Пример #1
0
 private static void DrawScreen()
 {
     AConsole.Fill(ConsoleColor.Blue);
     Console.CursorTop = 0;
     AConsole.WriteLineEx(" Cocoapad Viewer ", ConsoleColor.White, ConsoleColor.Gray, true, false);
     Console.BackgroundColor = ConsoleColor.Blue;
     Console.CursorTop       = 3;
 }
Пример #2
0
 /// <summary>
 /// Draws the screen.
 /// </summary>
 private static void DrawScreen()
 {
     AConsole.Fill(ConsoleColor.Blue);
     Console.CursorTop       = 0;
     Console.BackgroundColor = ConsoleColor.Gray;
     Console.WriteLine(" Medli Application IDE ");
     Console.BackgroundColor = ConsoleColor.Blue;
     Console.CursorTop       = 3;
 }
Пример #3
0
 private static void DrawScreen()
 {
     AConsole.Fill(ConsoleColor.Blue);
     Console.CursorTop       = 0;
     Console.BackgroundColor = ConsoleColor.Gray;
     Console.WriteLine(" Cocoapad Viewer ");
     Console.BackgroundColor = ConsoleColor.Blue;
     Console.CursorTop       = 3;
 }
Пример #4
0
        /// <summary>
        /// Main method for the Cocoapad edit
        /// Originally from Chocolate OS (pre-Medli) but won't rename this application
        /// </summary>
        /// <param name="file"></param>
        public static void Run(string file)
        {
            DrawScreen();
            Console.WriteLine("Cocoapad is a multi line text editor you can use to create many files.");
            Console.WriteLine("Once you have finished you can type '$SAVE' to save your file or '$END'");
            Console.WriteLine("to close without saving. '$RESET' can be used to start the file again from\nfresh, but use with caution!");
            Console.WriteLine("\nFilenames can currently only have 3 letter extensions but this will be fixed in the future.");
            //MEnvironment.PressAnyKey("Press any key to begin!");
            Console.WriteLine("Press any key to begin!");
            Console.ReadKey(true);
            DrawScreen();
            text = "";
            string line;
            var    num = 1;

            while (running == true)
            {
                Console.Write(num + ": ");
                num  = num + 1;
                line = Console.ReadLine();
                if (line == "$END")
                {
                    Console.WriteLine("Would you like to save first?");
                    string notsaved = Console.ReadLine();
                    if (notsaved == "y")
                    {
                        File.Create(Paths.CurrentDirectory + @"\" + file);
                        File.WriteAllText(Paths.CurrentDirectory + @"\" + file, text);
                        running = false;
                    }
                    else if (notsaved == "n")
                    {
                        running = false;
                    }
                }
                if (line == "$RESET")
                {
                    text = "";
                    DrawScreen();
                }
                if (line == "$SAVE")
                {
                    File.Create(Paths.CurrentDirectory + @"\" + file);
                    File.WriteAllText(Paths.CurrentDirectory + @"\" + file, text);
                    running = false;
                }
                text = text + (Environment.NewLine + line);
                if (Console.CursorTop == 24)
                {
                    DrawScreen();
                }
            }
            AConsole.Fill(ConsoleColor.Black);
        }
Пример #5
0
        /// <summary>
        /// Main method for the Cocoapad Development Environment
        /// Originally from Chocolate OS (proto-Medli)
        /// </summary>
        /// <param name="file"></param>
        public static void Run(string file)
        {
            DrawScreen();
            Console.WriteLine("The Medli Application IDE is an Integrated Development Environment");
            Console.WriteLine("users can use to develop applications for Medli.");
            Console.WriteLine("The same basic commands are used as Cocoapad Editor, but with a few");
            Console.WriteLine("extra commands to allow for the creation and running of apps.\n");
            Console.WriteLine("IDE commands:");
            Console.WriteLine("$END - Exits the IDE without saving");
            Console.WriteLine("$SAVE - Saves the current file");
            Console.WriteLine("$RESET - Resets the IDE and file to start again from fresh");
            Console.WriteLine("$RUN - Saves the file and executes it in the Medli Application Launcher");
            Extensions.PressAnyKey("Press any key to begin!");
            DrawScreen();
            text = "";
            AppInfo();
            string line;
            var    num = 4;

            while (running == true)
            {
                Console.Write(num + ": ");
                num  = num + 1;
                line = Console.ReadLine();
                if (line == "$END")
                {
                    if (text != File.ReadAllText(file))
                    {
                        Console.WriteLine("Would you like to save first?");
                        string notsaved = Console.ReadLine();
                        if (notsaved == "y")
                        {
                            File.Create(Paths.CurrentDirectory + @"\" + file);
                            File.WriteAllText(Paths.CurrentDirectory + @"\" + file, text);
                            running = false;
                        }
                        else if (notsaved == "n")
                        {
                            running = false;
                        }
                    }
                }
                if (line == "$RESET")
                {
                    text = "";
                    AppInfo();
                }
                if (line == "$SAVE")
                {
                    if (!text.EndsWith("EOF"))
                    {
                        text += "EOF";
                    }
                    File.WriteAllText(Paths.CurrentDirectory + @"\" + file, text);
                    running = false;
                    Extensions.PressAnyKey();
                }
                if (line == "$RUN")
                {
                    if (!text.EndsWith("EOF"))
                    {
                        text += "EOF";
                    }
                    File.WriteAllText(Paths.CurrentDirectory + @"\" + file, text);
                    running = false;
                    Console.Clear();
                    AppLauncher.PreExecute(file);
                    Extensions.PressAnyKey();
                }
                text += (Environment.NewLine + line);
                if (Console.CursorTop == 24)
                {
                    DrawScreen();
                }
            }
            AConsole.Fill(ConsoleColor.Black);
        }
Пример #6
0
 /// <summary>
 /// Initializes the installer service and allows the user to choose a machine name
 /// Sets the machine name as a variable and writes it to the disk
 /// </summary>
 /// <returns></returns>
 public static bool Init()
 {
     if (FSService.Active == false)
     {
         Kernel.username = "******";
         Kernel.pcname   = "testing";
         mDebugger.Send("Installer - Skipping Installer due to live filesystem.");
         return(false);
     }
     else if (Kernel.IsLive == true)
     {
         Kernel.username = "******";
         Kernel.pcname   = "testing";
         mDebugger.Send("Installer - Skipping Installer due to live filesystem.");
         return(false);
     }
     else if (FSService.Active == true && Kernel.IsLive == false)
     {
         if (File.Exists(Kernel.pcinfo))
         {
             try
             {
                 string[] pcnames = File.ReadAllLines(Kernel.pcinfo);
                 Kernel.pcname = pcnames[0];
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.Message);
             }
         }
         Console.WriteLine("Does usrinfo exist?");
         Console.WriteLine(File.Exists(Kernel.usrinfo));
         KernelExtensions.PressAnyKey();
         if (File.Exists(Kernel.usrinfo))
         {
             Console.Clear();
             try
             {
                 Accounts.UserLogin();
                 AConsole.Fill(ConsoleColor.Blue);
                 Console.ForegroundColor = ConsoleColor.White;
                 Console.WriteLine("Welcome back, " + Kernel.username + @"!");
                 KernelExtensions.PressAnyKey();
             }
             catch (Exception ex)
             {
                 AConsole.Error.WriteLine("Medli encountered an exception during the pre-initialization stage.\nError: " + ex.Message);
                 KernelExtensions.PressAnyKey();
             }
         }
         else
         {
             Console.Clear();
             Installer.ScreenSetup();
             Installer.WriteLine("Medli was unable to find any info regarding your PC.");
             Installer.WriteLine("The Medli installer will now run.");
             ServiceLogger = new LoggingService(Paths.SystemLogs + @"\ins.log");
             ServiceLogger.Record("Installer Service logger initialized.");
             ServiceLogger.Record("Installer Service running on " + Paths.Root);
             mDebugger.Send("Running setup...");
             Installer.PressAnyKey();
             Console.Clear();
             Active = true;
             Installer.Main();
         }
         Active = false;
         return(true);
     }
     else
     {
         return(false);
     }
 }