agfas 发表于 2025-5-28 03:08:58

求助一个Host.exe

Hello!
I need a Host.exe that will let me introduce the computer's Ethernet address to the post processor. I would be very happy if you could help me.

Merhaba!
Bilgisayarın Ethernet adresini post işlemciye tanıtmamı sağlayacak bir Host.exe dosyasına ihtiyacım var. Bana yardımcı olabilirseniz çok mutlu olurum.

张思颖 发表于 2025-5-28 18:45:56

翻译了一下;P

using System;
using System.Net;
using System.Net.NetworkInformation;

class EthernetAddressHost
{
    static void Main(string[] args)
    {
      try {
            // 获取第一个活跃的以太网适配器MAC地址
            string macAddress = GetActiveEthernetMAC();
            Console.WriteLine($"Ethernet MAC: {macAddress}");
            
            // 模拟传递给后处理器的逻辑
            PostProcessor.SendToProcessor(macAddress);
            Console.WriteLine("Address transferred to post processor successfully");
      }
      catch (Exception ex) {
            Console.WriteLine($"Error: {ex.Message}");
      }
    }

    static string GetActiveEthernetMAC()
    {
      foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
      {
            if (nic.NetworkInterfaceType == NetworkInterfaceType.Ethernet &&
                nic.OperationalStatus == OperationalStatus.Up)
            {
                return nic.GetPhysicalAddress().ToString();
            }
      }
      throw new Exception("No active Ethernet adapter found");
    }
}

// 后处理器模拟接口
class PostProcessor
{
    public static void SendToProcessor(string macAddress)
    {
      // 实际实现需根据后处理器API调整
      File.WriteAllText("mac_address.txt", macAddress);
    }
}

NX编程小学生 发表于 2025-5-28 11:44:31

Hoş geldiniz!
Affedersiniz!   I cannot speak Turkish!

licv21 发表于 2025-5-28 14:20:31

来秀英文的吗

放ジ荡〆 发表于 2025-5-28 20:47:01

你好!
我需要一个 Host.exe,以便将计算机的以太网地址引入后处理器。如果你能帮助我,我会很高兴。

agfas 发表于 2025-5-29 01:14:07

licv21 发表于 2025-5-28 14:20
来秀英文的吗

我只是想寻求帮助。
你在想什么?

agfas 发表于 2025-5-29 05:05:31

比较邮政计算机的 Mac ( ETHERNET ) 地址
如果帖子中没有定义MAC地址,则应取消该帖子。
感谢您的关注和支持。

Post should compare the computer's Mac (ETHERNET) Address If the Mac address is not defined in the post, the post should be cancelled
Thank you for your interest and support.

agfas 发表于 2025-5-29 05:15:24

张思颖 发表于 2025-5-28 18:45
翻译了一下

using System;


感谢您的支持。 我无法让它工作。
页: [1]
查看完整版本: 求助一个Host.exe