Exemple #1
0
 static void LoadAll(Assistant a)
 {
     a.LoadAll();
 }
Exemple #2
0
 static void SaveAll(Assistant a)
 {
     a.SaveAll();
 }
Exemple #3
0
        static void Main(string[] args)
        {
            Assistant helper  = new Assistant();
            string    command = "";

            Help();
            while (command != "exit")
            {
                Write("\nGMAssistant: ");
                command = ReadLine();
                string [] userInputs = command.Split();
                switch (userInputs[0].ToLower())
                {
                case "help":
                    if (userInputs.Length == 1)
                    {
                        Help();
                    }
                    else
                    {
                        Err();
                    }
                    break;

                case "list":
                    if (userInputs.Length == 1)
                    {
                        List(helper);
                    }
                    else
                    {
                        Err();
                    }
                    break;

                case "generate":
                    if (userInputs.Length == 1)
                    {
                        GenCharacter(helper);
                    }
                    else
                    {
                        Err();
                    }
                    break;

                case "build":
                    if (userInputs.Length == 1)
                    {
                        BuildCharacter(helper);
                    }
                    else
                    {
                        Err();
                    }
                    break;

                case "load":
                    if (userInputs.Length == 1)
                    {
                        Load(helper);
                    }
                    else if (userInputs.Length == 2)
                    {
                        Load(helper, userInputs[1]);
                    }
                    else
                    {
                        Err();
                    }
                    break;

                case "loadall":
                    if (userInputs.Length == 1)
                    {
                        WriteLine("Loading.....");
                        helper.LoadAll();
                        WriteLine("Finished!");
                    }
                    else
                    {
                        Err();
                    }
                    break;

                case "save":
                    if (userInputs.Length == 1)
                    {
                        SaveCharacter(helper);
                    }
                    else if (userInputs.Length == 2)
                    {
                        SaveCharacter(helper, userInputs[1]);
                    }
                    else
                    {
                        Err();
                    }
                    break;

                case "saveall":
                    if (userInputs.Length == 1)
                    {
                        WriteLine("Saving......");
                        helper.SaveAll();
                        WriteLine("Finished!");
                    }
                    else
                    {
                        Err();
                    }
                    break;

                case "csheet":
                    if (userInputs.Length == 1)
                    {
                        CSheet(helper);
                    }
                    else if (userInputs.Length == 2)
                    {
                        CSheet(helper, userInputs[1]);
                    }
                    else
                    {
                        Err();
                    }
                    break;

                case "exit":
                    break;

                default:
                    Err();
                    break;
                }
            }
        }