how to allow more than one command without it hanging

Sep 30, 2011 at 10:22 PM

i am a novice and i have just cre when created a minimal os but when every i input anything weather it be a real command or not it hangs or shuts down

help pls thank you so ery very much

Coordinator
Oct 1, 2011 at 11:08 AM
maybe it helps if you describe what you're doing, maybe with some code snippets, etc..


On Fri, Sep 30, 2011 at 11:22 PM, joehop67 <notifications@codeplex.com> wrote:

From: joehop67

i am a novice and i have just cre when created a minimal os but when every i input anything weather it be a real command or not it hangs or shuts down

help pls thank you so ery very much

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Oct 2, 2011 at 2:55 AM
using System;
using Cosmos.Compiler.Builder;

namespace click_try_2
{
    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

        // Main entry point of the kernel
        public static void Init()
        {
            var xBoot = new Cosmos.Sys.Boot();
            xBoot.Execute();
            Console.WriteLine("welcome to click a dos-like operating system");
            Console.WriteLine("enter help for a list of commands");
            string userinput;
            string userinput2;
            string userinput3;
            string userinput4;
            string userinput5;
            userinput = Console.ReadLine();
            userinput2 = Console.ReadLine();
            userinput3 = Console.ReadLine();
            userinput4 = Console.ReadLine();
            userinput5 = Console.ReadLine();
            if (userinput == "shutdown")
            {
                Cosmos.Sys.Deboot.ShutDown();
            }


            if (userinput == "help")
                
            {
                Console.WriteLine("1. help- displays a list of commands");
                Console.WriteLine("2. shutdown- shuts down system");
                Console.WriteLine("3. reboot- reboots system");
                Console.WriteLine("4. joke- tells joke");
                Console.WriteLine("5. lol- same as joke");
                Console.WriteLine("6. funny- same as lol");
                Console.WriteLine("7. laugh- same as funny");
                Console.WriteLine("thats all for now");
            }

            
            if (userinput2 == "joke")
            {

                Console.WriteLine("a chicken crossed the road to meet james bond, the chicken says whats your name? bond replies bond james bond whats yours? the chicken replies, ken chic ken.");
            }
            
            if (userinput3 == "lol")
                
            {
                Console.WriteLine("why did the piece of gum cross the road?");
                Console.WriteLine("cause it was stuck to the chicken's foot!");
            }
            
            
            if (userinput4 == "funny")
                
            {
                Console.WriteLine("why did the man stand beside the vault");
                Console.WriteLine("cause he wanted to feel on the safe side");
            }
            
            if (userinput5 == "laugh")
                
            {
                Console.WriteLine("how do you cut the sea in half?");
                Console.WriteLine("you use a sea saw");
            }

        }
    }
}

 

 

i put in the entire code...

i also tryed to add more variables to see if that would work... it didnt

Coordinator
Oct 2, 2011 at 8:31 AM
you forgot to mention the version of cosmos you're using, but at least it's an ancient one.

the static void Init is only called once, so if you want to have it executed multiple times, put a loop around the body.. (generic programming thing though, not cosmos related)



On Sun, Oct 2, 2011 at 3:55 AM, joehop67 <notifications@codeplex.com> wrote:

From: joehop67

using System;
using Cosmos.Compiler.Builder;

namespace click_try_2
{
    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

        // Main entry point of the kernel
        public static void Init()
        {
            var xBoot = new Cosmos.Sys.Boot();
            xBoot.Execute();
            Console.WriteLine("welcome to click a dos-like operating system");
            Console.WriteLine("enter help for a list of commands");
            string userinput;
            string userinput2;
            string userinput3;
            string userinput4;
            string userinput5;
            userinput = Console.ReadLine();
            userinput2 = Console.ReadLine();
            userinput3 = Console.ReadLine();
            userinput4 = Console.ReadLine();
            userinput5 = Console.ReadLine();
            if (userinput == "shutdown")
            {
                Cosmos.Sys.Deboot.ShutDown();
            }


            if (userinput == "help")
                
            {
                Console.WriteLine("1. help- displays a list of commands");
                Console.WriteLine("2. shutdown- shuts down system");
                Console.WriteLine("3. reboot- reboots system");
                Console.WriteLine("4. joke- tells joke");
                Console.WriteLine("5. lol- same as joke");
                Console.WriteLine("6. funny- same as lol");
                Console.WriteLine("7. laugh- same as funny");
                Console.WriteLine("thats all for now");
            }

            
            if (userinput2 == "joke")
            {

                Console.WriteLine("a chicken crossed the road to meet james bond, the chicken says whats your name? bond replies bond james bond whats yours? the chicken replies, ken chic ken.");
            }
            
            if (userinput3 == "lol")
                
            {
                Console.WriteLine("why did the piece of gum cross the road?");
                Console.WriteLine("cause it was stuck to the chicken's foot!");
            }
            
            
            if (userinput4 == "funny")
                
            {
                Console.WriteLine("why did the man stand beside the vault");
                Console.WriteLine("cause he wanted to feel on the safe side");
            }
            
            if (userinput5 == "laugh")
                
            {
                Console.WriteLine("how do you cut the sea in half?");
                Console.WriteLine("you use a sea saw");
            }

        }
    }
}

i put in the entire code...

i also tryed to add more variables to see if that would work... it didnt

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Oct 2, 2011 at 10:21 PM

i tryed to implament a loop to be specific the while (true) ; and i get the unreachable code warning and my  operating system doesnt work properlly i cant type text

Coordinator
Oct 3, 2011 at 8:21 AM
My guess is you're using the while loop wrong. Please read up on this, use google etc...


On Sun, Oct 2, 2011 at 11:21 PM, joehop67 <notifications@codeplex.com> wrote:

From: joehop67

i tryed to implament a loop to be specific the while (true) ; and i get the unreachable code warning and my operating system doesnt work properlly i cant type text

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Oct 3, 2011 at 9:29 PM

I Have use DevKit when

using Cosmos.Compiler.Builder; not found
Coordinator
Oct 4, 2011 at 9:18 AM
See my other message to you: Please create a new kernel project, and port your old sources. We moved to an msbuild based builder structure, which means your old code wont work..

On Mon, Oct 3, 2011 at 10:29 PM, dreamersoft <notifications@codeplex.com> wrote:

From: dreamersoft

I Have use DevKit when

using Cosmos.Compiler.Builder; not found

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Coordinator
Oct 4, 2011 at 9:19 AM
Also, please don't hijack threads about different topics like this, especially when you already started your own thread..


On Tue, Oct 4, 2011 at 10:18 AM, Matthijs ter Woord <matthijsterwoord@gmail.com> wrote:
See my other message to you: Please create a new kernel project, and port your old sources. We moved to an msbuild based builder structure, which means your old code wont work..


On Mon, Oct 3, 2011 at 10:29 PM, dreamersoft <notifications@codeplex.com> wrote:

From: dreamersoft

I Have use DevKit when

using Cosmos.Compiler.Builder; not found

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com



Developer
Oct 4, 2011 at 11:40 PM

If you really can't figure out a simple while loop, then try this

while(true)
{
    Console.Write(">");
    string userInput = Console.ReadLine();
    //do stuff with user Input
}

Hope you can figure out a for loop dun dun dun