示例#1
0
 /// <summary>
 /// Netch 自带程序添加防火墙
 /// </summary>
 public static void AddNetchFwRules()
 {
     try
     {
         if (GetFwRulePath(Netch).StartsWith(Global.NetchDir) && GetFwRulesNumber(Netch) >= ProgramPath.Length)
         {
             return;
         }
         RemoveNetchFwRules();
         foreach (var p in ProgramPath)
         {
             var path = Path.GetFullPath(p);
             if (File.Exists(path))
             {
                 AddFwRule("Netch", path);
             }
         }
     }
     catch (Exception e)
     {
         Logging.Warning("添加防火墙规则错误(如已关闭防火墙则可无视此错误)\n" + e);
     }
 }
示例#2
0
        public static void LoggingAdapters(string id)
        {
            var adapter = NetworkInterface.GetAllNetworkInterfaces().First(adapter => adapter.Id == id);

            Logging.Warning($"检索此网卡信息出错: {adapter.Name} {adapter.Id} {adapter.Description}");
        }