Files
shgx_tz_mes_backend_sync/ZR.Admin.WebApi/Extensions/LogoExtension.cs

43 lines
1.6 KiB
C#
Raw Normal View History

2022-12-16 15:52:35 +08:00
using JinianNet.JNTemplate;
2024-03-17 14:53:16 +08:00
using System.Net.NetworkInformation;
2022-12-16 15:52:35 +08:00
namespace ZR.Admin.WebApi.Extensions
{
public static class LogoExtension
{
public static void AddLogo(this IServiceCollection services)
{
Console.ForegroundColor = ConsoleColor.Blue;
var contentTpl = JnHelper.ReadTemplate("", "logo.txt");
2022-12-20 16:06:59 +08:00
var content = contentTpl?.Render();
2024-06-07 11:04:26 +08:00
2022-12-16 15:52:35 +08:00
Console.WriteLine(content);
2022-12-20 16:06:59 +08:00
Console.ForegroundColor = ConsoleColor.Blue;
2023-08-02 13:36:44 +08:00
2024-03-17 14:53:16 +08:00
// 获取本地计算机的所有网络接口信息
NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface networkInterface in networkInterfaces)
{
// 过滤出活动的网络接口
if (networkInterface.OperationalStatus == OperationalStatus.Up)
{
// 获取网络接口的IP属性
IPInterfaceProperties ipProperties = networkInterface.GetIPProperties();
UnicastIPAddressInformationCollection ipAddresses = ipProperties.UnicastAddresses;
foreach (UnicastIPAddressInformation ipAddress in ipAddresses)
{
// 输出IPv4地址
if (ipAddress.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
{
2024-06-07 11:04:26 +08:00
Console.WriteLine("本机ip: " + ipAddress.Address.ToString());
2024-03-17 14:53:16 +08:00
}
}
}
}
2022-12-16 15:52:35 +08:00
}
}
}