2026-01-10 13:47:54 +08:00

46 lines
1.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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;
Console.WriteLine("@版权所有 苏州锐至奥信息技术有限公司 ");
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();
}
}
}