示例#1
0
        /// <summary>
        /// Main installer method, choose colour of installer, choose desired username and reports if a FAT error occurs
        /// </summary>
        public static void Main()
        {
            ScreenSetup();
            WriteLine("Welcome to the Medli installer.");
            PressAnyKey();

            try
            {
                Accounts.InitNewUser(); Done();

                WriteLine("Enter the root password: "******"Writing root password...");
                MEnvironment.WriteRootPass(); Done();
            }
            catch (Exception ex)
            {
                Bluescreen.Init(ex, true);
                Console.ReadKey(true);
            }

            WriteLine("Please enter a machine name:");
            Kernel.pcname = ReadLine();

            try
            {
                WritePrefix("Creating machineinfo file...    "); File.Create(Kernel.pcinfo).Dispose(); Done();
                WritePrefix("Writing machineinfo to file...  "); File.WriteAllText(Kernel.pcinfo, Kernel.pcname); Done();
            }
            catch
            {
                WriteLine("OOOPS!");
                PressAnyKey("Press any key to view the stop error: ");
                ErrorHandler.BlueScreen.Init(5, @"The Installer was unable to create the user directory and other files. 
This may be due to a failing hard drive or other internal error", "FAT Error");
            }

            WriteLine("Awesome - you're all set!");
            PressAnyKey("Press any key to start Medli!");
            Console.Clear();
        }
示例#2
0
 /// <summary>
 /// Removes the char at position [string[index]]
 /// </summary>
 /// <param name="str"></param>
 /// <param name="null_based_index"></param>
 /// <returns></returns>
 public static string _RemoveCharAt(this string str, int null_based_index)
 {
     if (null_based_index < str.Length)
     {
         string _str = "";
         for (int i = 0; i < null_based_index; i++)
         {
             _str += str[i];
         }
         for (int i = null_based_index + 1; i < str.Length; i++)
         {
             _str += str[i];
         }
         return(_str);
     }
     else
     {
         Bluescreen.Init("string._GetCharAt", "null_based_index must be >= 0 and <= the length of the string");
         return(str);
     }
 }