我是新手开发者! 我现在学习C#, 我想更改Mac地址只使用C#(带注册表)(不是bat OR cmd) 我能怎么做? 此代码为Make Random 12随机字符串,包含英文和数字 我想将mac地址更改为随机字符串.. 谢谢!
using System;
using System.Timers;
using System;
using System.Net;
using System.IO;
using System.Diagnostics;
using System.Linq;
using Microsoft.Win32;
namespace auto_mac_address_changer
{
class MainClass
{
public static string GetRandomPassword(int _totLen)
{
Random rand = new Random(); string input = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; var chars = Enumerable.Range(0, _totLen).Select(x => input[rand.Next(0, input.Length)]); return new string(chars.ToArray());
}
public static void Main(string[] args)
{
bool networkUp = System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();
reg = reg.OpenSubKey("Software\\Your Program Name", true);
while (true)
{
if (networkUp == false)
{
string a = GetRandomPassword(12);
//here need to be change registry relative Mac Address
}
}
}
}
}