Ejemplo n.º 1
0
        protected override void BeforeRun()
        {
            debugger = mDebugger;
            Console.Clear();
            Console.WriteLine("Welcome to verySmallOS\n");
            SetKeyboardScanMap(EnvironmentUtils.QueryUserForKeymap());

            /*
             * var fsFactory = new Sys.FileSystem.FatFileSystemFactory();
             * var blockDevice = BlockDevice.Devices.First();
             * var partition = new Partition(blockDevice, 254, 50000);
             * fileSystem = fsFactory.Create(partition, "0:", 47000);
             */

            fileSystem = new Sys.FileSystem.CosmosVFS();
            Sys.FileSystem.VFS.VFSManager.RegisterVFS(fileSystem);
            Console.WriteLine("\n(Use \"startx\" to enter the rudimentary graphical mode :))\n\n\n\n\n\n");
        }
Ejemplo n.º 2
0
        public void RunCommand(string[] cmd)
        {
            FileSystemUtils.CheckForFileinsertOperator(cmd, out bool containsWriteOp);

            if (containsWriteOp)
            {
                return;
            }

            switch (cmd[0])
            {
            case "ls":
            case "dir":
                FileSystemUtils.Dir(currentPath, cmd);
                break;

            case "cat":
                FileSystemUtils.Cat(cmd[1]);
                break;

            case "touch":
                FileSystemUtils.Touch(cmd[1]);
                break;

            case "mkdir":
                FileSystemUtils.Mkdir(cmd[1]);
                break;

            case "help":
                for (int i = 0; i < supportedCommands.Length; i++)
                {
                    Console.Write($"{supportedCommands[i]}\t");
                }
                Console.Write('\n');
                break;

            case "exit":
                EnvironmentUtils.Exit();
                break;

            case "startx":
                Console.WriteLine("Are you sure you want to change to graphical mode? (Y/N)");
                string isSure = Console.ReadLine();
                if (isSure.ToUpper() != "Y")
                {
                    return;
                }
                Console.WriteLine("For cursor mode press 1, for shape mode press 2");
                string choice = Console.ReadLine();
                switch (choice)
                {
                case "1":
                    GraphicsSubsystemUtil.StartGraphicalMode(System.Drawing.Color.Wheat);
                    GraphicsSubsystemUtil.EnableCursor();
                    break;

                case "2":
                    GraphicsSubsystemUtil.StartGraphicalMode(System.Drawing.Color.Wheat);
                    break;

                default:
                    Console.WriteLine("Invalid choice. :/\nBack to console mode. ");
                    break;
                }
                break;

            default:
                if (cmd[0] != "")
                {
                    Console.WriteLine("Command not recognized");
                }
                break;
            }
        }