Beispiel #1
0
 public override void Execute()
 {
     TextLogger.GetLogger().Log($"Method {this.GetType().ToString()}.Execute() has been invoked", this.Path);
     Console.ForegroundColor = ConsoleColor.Red;
     ConsoleLogger.GetLogger().Log("Invalid command", null);
     Console.ResetColor();
 }
Beispiel #2
0
        public void Start()
        {
            bool flag = true;

            System.Console.Clear();
            while (flag)
            {
                System.Console.WriteLine("Enter 'exit' to exit");
                System.Console.WriteLine("Enter 'help' to see all commands");
                string command = RichInput("Enter the command : ");
                this.Manager.SetCommand(Builder.GetCommand(this.Path, command));
                try
                {
                    this.Manager.ExecuteCommand();
                }
                catch (InterruptException e)
                {
                    TextLogger.GetLogger().Log(e.Message, this.Path);
                    flag = false;
                }
                catch (Exception e)
                {
                    TextLogger.GetLogger().Log(e.Message, this.Path);
                }
            }
        }
Beispiel #3
0
 public override void Execute()
 {
     TextLogger.GetLogger().Log($"Method {this.GetType().ToString()}.Execute() has been invoked", this.Path);
     System.Console.Write("Commands : ");
     foreach (var command in this.Commands)
     {
         System.Console.Write(command + ", ");
     }
     System.Console.WriteLine("\n");
 }
Beispiel #4
0
        public override void Execute()
        {
            TextLogger.GetLogger().Log($"Method {this.GetType().ToString()}.Execute() has been invoked", this.Path);
            string fullPath = this.Path + "\\test.txt";

            if (File.Exists(fullPath))
            {
                File.Delete(fullPath);
            }
            else
            {
                throw new FileNotFoundException("File does not exist!");
            }
        }
Beispiel #5
0
        public override void Execute()
        {
            TextLogger.GetLogger().Log($"Method {this.GetType().ToString()}.Execute() has been invoked", this.Path);
            List <string> strs = Directory.GetFiles(Path, "*", SearchOption.AllDirectories).ToList();

            foreach (string str in strs)
            {
                if (str.Substring(str.LastIndexOf(".") + 1) == "cs")
                {
                    System.Console.WriteLine(str);
                }
            }
            System.Console.WriteLine("\n");
        }
Beispiel #6
0
 public override void Execute()
 {
     TextLogger.GetLogger().Log($"Method {this.GetType().ToString()}.Execute() has been invoked", this.Path);
     throw new InterruptException();
 }
Beispiel #7
0
 public override void Execute()
 {
     TextLogger.GetLogger().Log($"Method {this.GetType().ToString()}.Execute() has been invoked", this.Path);
     Directory.GetFiles(Path, "*", SearchOption.AllDirectories).ToList().ForEach(n => Console.WriteLine(n));
     System.Console.WriteLine("\n");
 }