0

Hello guys I was recently trying to build my own OS using Cosmos , so I've finished enogh commands to fit the bill for standard user ,, my problem is the program can't work with more than one command , I want to make it like cmd and Here is sample of code `using System; using Cosmos.Compiler.Builder;

namespace CosmosBoot1

{

class Program
{
    #region Cosmos Builder logic
    // Most users wont touch this. This will call the Cosmos Build tool
    [STAThread]
    static void Main(string[] args)
    {
        BuildUI.Run();
    }
    #endregion
    public static string[] outputline = { "Welcome user" };

    // Main entry point of the kernel
    public static void Init()
    {
        var xBoot = new Cosmos.Sys.Boot();
        xBoot.Execute();
        Console.WriteLine("Welcome to Tammaa OS ");
        Console.WriteLine("Please insert a Command");
        Drawconsole();
        string uinput = "";
        uinput = Console.ReadLine();
        if (uinput == "shutdown")
        {
            Cosmos.Sys.Deboot.ShutDown();
        }
        else if (uinput == "help")
        {
            Console.WriteLine("shutdown \t Turn off the system");
            Console.WriteLine("restart \t Restarts the system");
        }
        else if (uinput == "calc")
        {
            Console.WriteLine("Please enter the the syntax");
            String operation = Console.ReadLine();
            uint usernum1, usernum2;
           Console.WriteLine("Please insert the 2 numbers");
           usernum1 = userint(0, 100, 101);
           usernum2 = userint(0, 100, 101);
           if (operation == "+")
           {
               Console.WriteLine((usernum1 + usernum2).ToString());
               Drawconsole();
           }
           else if (operation == "-")
           {
               Console.WriteLine((usernum1 - usernum2).ToString());
               Drawconsole();
           }
           else if (operation == "*")
           {
               Console.WriteLine((usernum1 * usernum2).ToString());
               Drawconsole();
           }
           else if (operation == "/")
           {
               Console.WriteLine((usernum1 / usernum2).ToString());
               Drawconsole();
           }
           else
           {
               Console.WriteLine("An unexcepected error  stoped the proccess please chack your data and try again");
               Drawconsole();
           }
        }
        else
        {
            Console.WriteLine("Unknown Command");
            Console.WriteLine("Type help to get vaild commands,Please");
            Drawconsole();
        }

        while (true)
            ;

    }
    public static uint userint(uint start, uint end, uint Default)
    {
        uint a;
        String userinput = Console.ReadLine();
        for (a = start; a <= end; a++)
        {
            if (a.ToString() == userinput)
            {
                return a;
            }
        }
        return Default;
    }
    public static void Drawconsole()
    {
        Console.Clear();
        Console.WriteLine("OS command here>");

    }
}

}`

  • 1
    Hi, can you please make an edit and post more of the code from your function? – Lebowski156 Jun 09 '16 at 23:00
  • What is addin, and what is textBox1? – Lebowski156 Jun 09 '16 at 23:08
  • Are you sure addin is your richtextbox? How is it retaining previous messages if it is explicitly setting the value every time to just contain "Name: MessageReceived". It would be very helpful to see more code. You should also debug to confirm that addin, textBox1, and recivedmessage contains the values that you are expecting. – Lebowski156 Jun 09 '16 at 23:32

0 Answers0