2024-08-16 18:02:59 +08:00

48 lines
1.8 KiB
C#
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.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(" 苏州道安自动化技术有限公司成立于2009年7月公司在苏州新加坡工业园区注册成立是一家专业从事于装配和测试的民营企业。");
//TODO 打印 ip
// 获取所有网络接口 (NetworkInterface)
var networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (var networkInterface in networkInterfaces)
{
if (networkInterface.OperationalStatus != OperationalStatus.Up)
continue; // 跳过未激活的接口
//Console.WriteLine($"Interface: {networkInterface.Name}");
// 获取接口的 IP 地址
foreach (var unicastAddress in networkInterface.GetIPProperties().UnicastAddresses)
{
if (unicastAddress.Address.AddressFamily == AddressFamily.InterNetwork)
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($" IP Address: {unicastAddress.Address}");
}
}
Console.WriteLine();
}
}
}
}