Пример #1
0
        public void Run()
        {
            FileMaster fileMaster = new FileMaster();
            var        connector  = new Connector(fileMaster);

            try
            {
                while (true)
                {
                    var userInformation = FindNeedData(fileMaster);
                    connector.Run(userInformation);
                    Console.WriteLine("If you want connect again, click Enter");
                    var key = Console.ReadKey(true);
                    if (key.Key != ConsoleKey.Enter)
                    {
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                Console.ReadKey();
            }
        }
Пример #2
0
        private void ReadShowData(FileMaster fileMaster, string path, string firstMessage)
        {
            Console.WriteLine(firstMessage);
            var data = (List <object>)fileMaster.ReadData(path);

            if (data != null)
            {
                foreach (var oneData in data)
                {
                    Console.WriteLine(oneData);
                }
            }
        }
Пример #3
0
 private string[] FindNeedData(FileMaster fileMaster)
 {
     ReadShowData(fileMaster, @"D:\temp\User\IPs.json", "IPs:");
     ReadShowData(fileMaster, @"D:\temp\User\ports.json", "Ports:");
     return(EnterData());
 }
Пример #4
0
 public Connector(FileMaster fileMaster)
 {
     this.fileMaster = fileMaster;
 }