예제 #1
0
파일: Verbs.cs 프로젝트: ozyx/PowerWalk
            public static void LoadTranscript(string line)
            {
                bool loadedFile;

                string command = null, complement = null;

                SplitImperative(line, ref command, ref complement);

                try
                {
                    switch (command)
                    {
                    case "dir":
                    {
                        SplitImperative(complement, ref command, ref complement);

                        loadedFile = command.Equals(Operators.Verbs.Commands.current) ?

                                     LoadFromDirectoryToTranscript(Preferences.default_directory) :
                                     LoadFromDirectoryToTranscript(complement.Trim());

                        break;
                    }

                    case "file": loadedFile = LoadFileIntoTranscript(complement.Trim());
                        break;

                    case "files": loadedFile = LoadFilesIntoTranscript(complement);
                        break;

                    default:
                    {
                        loadedFile = String.IsNullOrWhiteSpace(complement) ?

                                     LoadFromDirectoryToTranscript(Preferences.default_directory) :
                                     LoadFilesIntoTranscript(complement);

                        break;
                    }
                    }
                }
                catch (Exception e)
                {
                    CommandLineInterface.ShowError(Preferences.FIRST_INDENTATION + "Error :  " + e.Message);

                    loadedFile = false;
                }

                if (!loadedFile)
                {
                    Console.WriteLine("\nNone of the pages specified were loaded successfully.");
                }
            }