46 lines
1.7 KiB
C#
Raw Normal View History

2026-01-10 13:47:54 +08:00
using Infrastructure.Helper;
using JinianNet.JNTemplate;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Net.Sockets;
namespace Infrastructure
{
public static class LogoExtension
{
public static void AddLogo(this IServiceCollection services)
{
Console.ForegroundColor = ConsoleColor.Blue;
var contentTpl = JnHelper.ReadTemplate("", "logo.txt");
var content = contentTpl?.Render();
var url = AppSettings.GetConfig("urls");
Console.WriteLine(content);
Console.ForegroundColor = ConsoleColor.Blue;
2026-01-15 16:37:45 +08:00
//Console.WriteLine("@版权所有 苏州锐至奥信息技术有限公司 ");
2026-01-10 13:47:54 +08:00
Console.WriteLine($"Swagger地址{url}/swagger/index.html");
Console.WriteLine($"初始化种子数据地址:{url}/common/InitSeedData");
// 获取所有 IPv4 地址
var ipv4Addresses = GetIPv4Addresses();
Console.WriteLine("IPv4 地址:");
foreach (string ip in ipv4Addresses)
{
Console.WriteLine($" {ip}");
}
}
static List<string> GetIPv4Addresses()
{
return NetworkInterface.GetAllNetworkInterfaces()
.Where(nic => nic.OperationalStatus == OperationalStatus.Up)
.SelectMany(nic => nic.GetIPProperties().UnicastAddresses)
.Where(addr => addr.Address.AddressFamily == AddressFamily.InterNetwork)
.Select(addr => addr.Address.ToString())
.Distinct()
.ToList();
}
}
}