Exemplo n.º 1
0
 static bool IsSavedConf(string device)
 {
     if (Setup.FileSystem() == "true")
     {
         Utils.Settings settings = new Utils.Settings(@"0:\System\" + device + ".conf");
         if ((settings.GetValue("ipaddress") != "0.0.0.0") || (settings.GetValue("subnet") != "0.0.0.0") || (settings.GetValue("gateway") != "0.0.0.0"))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 2
0
 public static void Enable()
 {
     if (RTL8168NIC != null)
     {
         Utils.Settings settings = new Utils.Settings(@"0:\System\" + RTL8168NIC.Name + ".conf");
         if (!IsSavedConf(RTL8168NIC.Name))
         {
             Kernel.LocalNetworkConfig = new Network.IPV4.Config(new Network.IPV4.Address(0, 0, 0, 0), new Network.IPV4.Address(0, 0, 0, 0), new Network.IPV4.Address(0, 0, 0, 0));
             Network.NetworkStack.ConfigIP(RTL8168NIC, Kernel.LocalNetworkConfig);
         }
         else
         {
             Kernel.LocalNetworkConfig = new Network.IPV4.Config(Network.IPV4.Address.Parse(settings.GetValue("ipaddress")), Network.IPV4.Address.Parse(settings.GetValue("subnet")), Network.IPV4.Address.Parse(settings.GetValue("gateway")));
             Network.NetworkStack.ConfigIP(RTL8168NIC, Kernel.LocalNetworkConfig);
         }
     }
     if (AMDPCNetIINIC != null)
     {
         Utils.Settings settings = new Utils.Settings(@"0:\System\" + AMDPCNetIINIC.Name + ".conf");
         if (!IsSavedConf(AMDPCNetIINIC.Name))
         {
             Kernel.LocalNetworkConfig = new Network.IPV4.Config(new Network.IPV4.Address(0, 0, 0, 0), new Network.IPV4.Address(0, 0, 0, 0), new Network.IPV4.Address(0, 0, 0, 0));
             Network.NetworkStack.ConfigIP(AMDPCNetIINIC, Kernel.LocalNetworkConfig);
         }
         else
         {
             Kernel.LocalNetworkConfig = new Network.IPV4.Config(Network.IPV4.Address.Parse(settings.GetValue("ipaddress")), Network.IPV4.Address.Parse(settings.GetValue("subnet")), Network.IPV4.Address.Parse(settings.GetValue("gateway")));
             Network.NetworkStack.ConfigIP(AMDPCNetIINIC, Kernel.LocalNetworkConfig);
         }
     }
 }