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);
         }
     }
 }
 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);
     }
 }
Example #3
0
        /// <summary>
        /// Installation with progressbar.
        /// </summary>
        public void Installation()
        {
            Menu.DispInstallationDialog(0);

            Menu.DispInstallationDialog(5);

            InitDirs(); //create needed directories if they doesn't exist

            Menu.DispInstallationDialog(10);

            File.Create(@"0:\System\settings.conf");
            File.Create(@"0:\System\passwd");

            Menu.DispInstallationDialog(15);

            System.Users.Users.LoadUsers();

            Menu.DispInstallationDialog(20);

            System.Users.Users.PutUser("user:"******":admin");

            Menu.DispInstallationDialog(30);

            System.Users.Users.PutUser("user:root", Sha256.hash("root") + ":admin");

            Menu.DispInstallationDialog(40);

            string[] Users = { "root", FinalUsername };
            CreateUserDirectories(Users);

            Utils.Settings config = new Utils.Settings(@"0:\System\settings.conf");

            Menu.DispInstallationDialog(50);

            if ((FinalLang.Equals("en_US")) || FinalLang.Equals("en-US"))
            {
                config.PutValue("language", "en_US");
                Menu.DispInstallationDialog(60);
            }
            else if ((FinalLang.Equals("fr_FR")) || FinalLang.Equals("fr-FR"))
            {
                config.PutValue("language", "fr_FR");
                Menu.DispInstallationDialog(60);
            }
            else if ((FinalLang.Equals("nl_NL")) || FinalLang.Equals("nl-NL"))
            {
                config.PutValue("language", "nl_NL");
                Menu.DispInstallationDialog(60);
            }
            else if ((FinalLang.Equals("it_IT")) || FinalLang.Equals("it-IT"))
            {
                config.PutValue("language", "it_IT");
                Menu.DispInstallationDialog(60);
            }

            config.PutValue("hostname", FinalHostname);

            Menu.DispInstallationDialog(70);

            config.PutValue("setuptime", Time.MonthString() + "/" + Time.DayString() + "/" + Time.YearString() + ", " + Time.TimeString(true, true, true));

            config.PutValue("consolemode", "null");

            Menu.DispInstallationDialog(80);

            Kernel.SystemExists = true;

            config.PutValue("debugger", "off");

            foreach (HAL.Drivers.Network.NetworkDevice networkDevice in HAL.Drivers.Network.NetworkDevice.Devices)
            {
                File.Create(@"0:\System\" + networkDevice.Name + ".conf");
                Settings settings = new Settings(@"0:\System\" + networkDevice.Name + ".conf");
                settings.Add("ipaddress", "0.0.0.0");
                settings.Add("subnet", "0.0.0.0");
                settings.Add("gateway", "0.0.0.0");
                settings.Add("dns01", "0.0.0.0");
                settings.Push();
            }

            config.PushValues();

            Menu.DispInstallationDialog(90);

            System.Users.Users.PushUsers();

            Menu.DispInstallationDialog(100);

            Console.ForegroundColor = ConsoleColor.White;
            Console.BackgroundColor = ConsoleColor.Black;

            Run();
        }