Esempio n. 1
0
        static void Main()
        {
            //IOManager.TraverseDirectory(@"C:\Users\Bogdan Alov\Documents\Visual Studio 2017");

            StudentsRepository.InitializeData();
            StudentsRepository.GetAllStudentsFromCourse("Unity");
            //StudentsRepository.GetStudentScoresFromCourse("Unity", "Ivan");
        }
Esempio n. 2
0
        private static void TryReadDatabaseFromFile(string input, string[] data)
        {
            if (!IsCommandValidLenght(data, 2))
            {
                return;
            }

            var fileName = data[1];

            StudentsRepository.InitializeData(fileName);
        }
Esempio n. 3
0
 private static void TryReadDatabaseFromFile(string input, string[] data)
 {
     if (data.Length == 2)
     {
         string fileName = data[1];
         StudentsRepository.InitializeData(fileName);
     }
     else
     {
         DisplayInvalidCommandMessage(input);
     }
 }
Esempio n. 4
0
        private static void ReadDatabaseFromFile(List <string> commandParameters)
        {
            string fileName = commandParameters[0];

            StudentsRepository.InitializeData(fileName);
        }
Esempio n. 5
0
        public static void InterpredCommand(string input)
        {
            string[] data              = input.Split(' ');
            string   command           = data[0];
            int      indexOfFirstSpace = input.IndexOf(' ');
            string   inputAfterCommand = input.Substring(indexOfFirstSpace + 1);

            switch (command)
            {
            case "mkdir":
                if (data.Length == 2)
                {
                    IOManager.CreateDirectoryInCurrentFolder(data[1]);
                }
                else
                {
                    OutputWriter.DisplayException(ExceptionMessages.InvalidCommandParams);
                }
                break;

            case "ls":
                if (data.Length == 1)
                {
                    IOManager.ShowDirectory();
                }
                else
                {
                    OutputWriter.DisplayException(command + ExceptionMessages.UnNeededParameters);
                }
                break;

            case "clear":
                if (data.Length == 1)
                {
                    Console.Clear();
                }
                else
                {
                    OutputWriter.DisplayException(command + ExceptionMessages.UnNeededParameters);
                }
                break;

            case "cd":
                if (data.Length >= 2)
                {
                    IOManager.ChangeCurrentDirectoryRelative(inputAfterCommand);
                }
                else
                {
                    OutputWriter.DisplayException(command + ExceptionMessages.InvalidCommandParams);
                }
                break;

            case "readDb":
                StudentsRepository.InitializeData(inputAfterCommand);
                break;

            case "filter":
                if (data.Length == 2)
                {
                    StudentsRepository.GetAllStudentsFromCourse(data[1]);
                }
                break;

            case "download":
                if (data.Length > 1)
                {
                    IOManager.DownloadFile(inputAfterCommand);
                }
                else
                {
                    OutputWriter.DisplayException(ExceptionMessages.MissingURL);
                }
                break;

            case "open":
                if (data.Length == 2)
                {
                    IOManager.OpenFile(data[1]);
                }
                else
                {
                    OutputWriter.DisplayException(ExceptionMessages.MissingURL);
                }
                break;

            case "help":
                if (data.Length == 1)
                {
                    IOManager.Help();
                }
                else
                {
                    OutputWriter.DisplayException(command + ExceptionMessages.UnNeededParameters);
                }
                break;

            case "s":
                if (data.Length == 2)
                {
                    PremiumMobileRepository.SummarizeEmails(data[1]);
                }
                break;

            default:
                OutputWriter.DisplayException(ExceptionMessages.InvalidCommand);
                break;
            }
        }
        private static void TryReadDatabaseFromFile(string input, string[] data)
        {
            string fileName = data[1];

            StudentsRepository.InitializeData(fileName);
        }