示例#1
0
        static void Main(string[] args)
        {
            //need add Log For out information.
            //need shange void to list methods
            string path = $"{Environment.CurrentDirectory}\\Data\\Customers.xml";

            LinqWorkerForCustumers linqWorker = new LinqWorkerForCustumers(path);

            int i           = 10;
            int CountOfTask = 7;

            while (i != 0)
            {
                i = ConsoleWorker.getIntegerValue("We have 7 tasks. Press number 1-7 for show some task. If you whant see all task press 8. 0 - exit\n");
                if (i == CountOfTask + 1)
                {
                    for (int y = 1; y < CountOfTask + 1; y++)
                    {
                        Console.WriteLine($"====================== Task {y} ======================");
                        ShowResult.Show(y, path);
                    }
                }
                else
                {
                    ShowResult.Show(i, path);
                }
            }


            Console.Read();
        }
        public void DoTaskWithRectangles()
        {
            int figureWidth;
            int figureLength;
            int rectanglWidth;
            int rectangLength;

            string mainMessage          = "Give me ";
            string figureWidthMessage   = mainMessage + "figure width: ";
            string figureLengthMessage  = mainMessage + "figure length: ";
            string rectanglWidthMessage = mainMessage + "rectang width: ";
            string rectangLengthMessage = mainMessage + "rectang length: ";


            figureWidth   = ConsoleWorker.getIntegerValue(figureWidthMessage);
            figureLength  = ConsoleWorker.getIntegerValue(figureLengthMessage);
            rectanglWidth = ConsoleWorker.getIntegerValue(rectanglWidthMessage);
            rectangLength = ConsoleWorker.getIntegerValue(rectangLengthMessage);


            FigureWorker a       = new FigureWorker();
            int          rectang = a.FindAllRectangle(figureWidth, figureLength, rectanglWidth, rectangLength);

            Console.WriteLine(helpOutPutInfo(rectang.ToString()));
            Console.Read();
        }
示例#3
0
        public IConsoleWorker AddWorker(ConsoleWorker newWorker)
        {
            WorkerManager manager = new WorkerManager(Writer, newWorker);

            Workers.Add(manager);
            return(manager);
        }
示例#4
0
        public static void Show(int num, string path)
        {
            LinqWorkerForCustumers linqWorker = new LinqWorkerForCustumers(path);

            switch (num)
            {
            case 1:
                decimal prise;
                ShowTask1(linqWorker.Task1(out prise));
                Console.WriteLine("\nPrise: " + prise);
                break;

            case 2: ShowTask2(linqWorker.Task2()); break;

            case 3: ShowTask3(linqWorker.Task3(ConsoleWorker.getIntegerValue("give me Prise "))); break;

            case 4: ShowTask4(linqWorker.Task4()); break;

            case 5: ShowTask5(linqWorker.Task5()); break;

            case 6: ShowTask6(linqWorker.Task6()); break;

            case 7: ShowTask7(linqWorker.Task7()); break;
            }
            Console.WriteLine();
        }
示例#5
0
        private Grid(ConsoleWorker console)
        {
            this.reader = console;
            this.writer = console;

            this.InitializeGrid();
        }
示例#6
0
 public WorkerManager(ConsoleWriter consoleWriter, ConsoleWorker newWorker)
 {
     UniqueID = Guid.NewGuid();
     State    = WorkerStateEnum.Stopped;
     console  = consoleWriter;
     worker   = newWorker;
     watch    = new Stopwatch();
 }
示例#7
0
        private void CheckErrorsMenu_Click(object sender, RoutedEventArgs e)
        {
            StringWriter writer = new StringWriter();

            ArxmlTester tester = new ArxmlTester(autosarApp, writer);

            tester.Test();
            ConsoleWorker.GetInstance().Clear();
            ConsoleWorker.GetInstance().AddText(writer.ToString());
            ConsoleWorker.GetInstance().Show();
        }
示例#8
0
        static void Main(string[] args)
        {
            string mesForFactorial = "Hello. I show to you Factorial. Give me number: ";
            string mesForFibonacci = "Now we see Fibonachi numbers. What number from Fibonacci bumbers do you whant:";

            int numForFactorial = ConsoleWorker.getIntegerValue(mesForFactorial);

            Console.WriteLine($"Factorial {numForFactorial}=" + MathClassForTask.Factorial(numForFactorial));

            int numForFibonachi = ConsoleWorker.getIntegerValue(mesForFibonacci);

            Console.WriteLine($"{numForFibonachi} number in fibonacci sequence=" + MathClassForTask.Fibonacci(numForFibonachi));

            Console.Read();
        }
示例#9
0
        static void Main(string[] args)
        {
            IWorker worker = new ConsoleWorker();

            try
            {
                var app = new Application();
                app.Execute(args, worker);
                worker.WriteLine("Command successfully executed.");
            }
            catch (Exception e)
            {
                worker.WriteLine(e.Message);
            }
        }
示例#10
0
        static void Main(string[] args)
        {

            //message to console
            string helloMessage = "Hello. Input 1 If you want to see all buttons on StartPage.\nInput 2 to click on all buttons";
            bool flagToExit = false;

            
            //page to work
            StartPage st = new StartPage();
            Console.WriteLine(helloMessage);

            //logic for console
            while (!flagToExit)
            {
                int inputtedNumber = ConsoleWorker.getIntegerValue("Input your number ");
                switch (inputtedNumber)
                {
                    case 1:
                        st.ShowAllButtonInConsole();
                        break;
                    case 2:
                        try
                        {
                            string resOfClick;
                            st.ClickAllButtons( out resOfClick);
                            Console.WriteLine(resOfClick);
                        } catch (FormatException ex)
                        {
                            Console.WriteLine(ex.Message);
                        }
                        break;
                    default:
                        Console.WriteLine("You must input 1 or 2");
                        break;
                }

                //can create new method for this choice
                Console.WriteLine("Input n, if you whant exit.\nInput other symbol for return to programm ? (any line(y))/n");
                if (Console.ReadLine().ToUpper().Equals("N"))
                {
                    flagToExit = true;
                }
                
            }
           Console.WriteLine("Good by");
           Console.ReadLine();
        }
示例#11
0
        private async Task <bool> TryLoginByConsole()
        {
            ConsoleWorker.WriteLine($"Войдите на {config.SiteUrl}");
            var login    = ConsoleWorker.GetLogin();
            var password = new NetworkCredential(string.Empty, ConsoleWorker.GetPassword()).Password;

            var jwtToken = await ulearnApiClient.Login(login, password);

            if (jwtToken != null)
            {
                config.JwtToken = jwtToken;
                jwtToken        = await ulearnApiClient.RenewToken();          // Чтобы получить токен на больший срок
            }

            return(TrySetJwtTokenInConfig(jwtToken));
        }
示例#12
0
        static void Main(string[] args)
        {
            string messForPerson = "Number is prime: Input 1 and 1 parameters\n" +
                                   "Distanse between Points: Input 2 and 4 parameters Point1(x1,y1) Point2(x2,y2)\n" +
                                   "Count number in Numeral: Input 3 and 1 parameters\n" +
                                   "Exit: Input 0";


            Dictionary <int, MathCommandAbstract> dicWithCommand = new Dictionary <int, MathCommandAbstract>();

            dicWithCommand.Add(1, new NumberInfo());
            dicWithCommand.Add(2, new PointsWorker());
            dicWithCommand.Add(3, new CounterNumberInNumeral());



            bool flagToExit = false;

            while (!flagToExit)
            {
                Console.WriteLine(messForPerson);
                int numberFlag = ConsoleWorker.getIntegerValue();

                if (numberFlag == 0)
                {
                    flagToExit = true; continue;
                }
                else
                {
                    MathCommandAbstract command = dicWithCommand[numberFlag];

                    List <int> parametersList = new List <int>();
                    //command.GetType().GetFields().Length <<== count of fields in class
                    for (int i = 0; i < command.GetType().GetFields().Length; i++)
                    {
                        int param = ConsoleWorker.getIntegerValue("Input Parameter: ");
                        parametersList.Add(param);
                    }


                    command.SetParams(parametersList.ToArray());
                    command.Execute();
                    Console.WriteLine();
                }
            }
            Console.ReadLine();
        }
示例#13
0
        public async Task SendFullCourse()
        {
            ConsoleWorker.WriteLineWithTime("Загружаем курс на ulearn");

            var errors = await ulearnApiClient.SendFullCourse(config.Path, config.CourseId, config.ExcludeCriterias);

            if (errors.ErrorType != ErrorType.NoErrors)
            {
                ConsoleWorker.WriteErrorWithTime("Ошибка загрузки курса. " + errors.Message);
                config.PreviousSendHasError = true;
            }
            else
            {
                ConsoleWorker.WriteLineWithTime("Курс загружен без ошибок");
                config.PreviousSendHasError = false;
            }
        }
示例#14
0
        static void Main(string[] args)
        {
            string messForPerson = "Number is prime: Input 1\n" +
                                   "Distanse between Points: Input 2\n" +
                                   "Count number in Numeral: Input 3\n" +
                                   "Exit: Input 0";


            bool flagToExit = false;

            while (!flagToExit)
            {
                Console.WriteLine(messForPerson);
                int numberFlag = ConsoleWorker.getIntegerValue();
                MathCommandAbstract command = null;
                IBaseRecirver       recirver;
                if (numberFlag == 0)
                {
                    flagToExit = true; continue;
                }
                switch (numberFlag)
                {
                case 1:
                    recirver = new NumberInfoRecirver(ConsoleWorker.getIntegerValue("Input number "));
                    command  = new NumberInfo((NumberInfoRecirver)recirver);
                    break;

                case 2:
                    recirver = new PointRecirver(ConsoleWorker.getIntegerValue("Input x1 "),
                                                 ConsoleWorker.getIntegerValue("Input y1 "),
                                                 ConsoleWorker.getIntegerValue("Input x2 "),
                                                 ConsoleWorker.getIntegerValue("Input y2 "));
                    command = new PointsWorker((PointRecirver)recirver);
                    break;

                case 3:
                    recirver = new CounterNumberInNumeralRecirver(ConsoleWorker.getIntegerValue("Input number "));
                    command  = new CounterNumberInNumeral((CounterNumberInNumeralRecirver)recirver);
                    break;
                }
                command.Execute();
                Console.WriteLine();
            }

            Console.ReadLine();
        }
示例#15
0
        public async Task SendCourseUpdates()
        {
            ConsoleWorker.WriteLineWithTime("Загружаем изменения на ulearn");

            var errors = await ulearnApiClient.SendCourseUpdates(config.Path, courseUpdateQuery.GetAllCourseUpdate(),
                                                                 courseUpdateQuery.GetAllDeletedFiles(), config.CourseId, config.ExcludeCriterias);

            if (errors.ErrorType != ErrorType.NoErrors)
            {
                ConsoleWorker.WriteErrorWithTime("Ошибка загрузки изменений. " + errors.Message);
                config.PreviousSendHasError = true;
            }
            else
            {
                ConsoleWorker.WriteLineWithTime("Изменения загружены без ошибок");
                config.PreviousSendHasError = false;
            }

            courseUpdateQuery.Clear();
        }
示例#16
0
        static void Main(string[] args)
        {
            try
            {
                var textParser = new TextParser();
                var text       = textParser.ParseTextFile(ConfigurationManager.AppSettings["pathToSourceText"]);
                var taskFirst  = new TaskFirst(text);

                ConsoleWorker.Start(taskFirst, textParser);
                new Concordance(text).WriteConcordanceToFile(ConfigurationManager.AppSettings["pathToConcordance"]);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                Console.WriteLine("Program has finished");
                Console.ReadKey();
            }
        }
示例#17
0
        public Apple()
        {
            _severInfo = new ServerInformation
            {
                ServerStarted = DateTime.Now,
                ServerVersion = new Version("2.0.0"),
                Author        = "Josh Hallow",
                Title         = "Apple Server",
                Developers    = new List <string> {
                    "Josh Hallow"
                }
            };

            _log = LogManager.GetLogger(typeof(Apple));
            _log.Info("Apple server is loading.");

            _appleConfig = new AppleConfig("config.ini");

            SocketSettings socketSettings = new SocketSettings
            {
                EndPoint      = new IPEndPoint(IPAddress.Any, int.Parse(_appleConfig.GetConfigElement("game.socket.port"))),
                SocketBacklog = ushort.Parse(_appleConfig.GetConfigElement("game.socket.backlog")),
                _log          = LogManager.GetLogger(typeof(SocketManager))
            };

            _socketManager = new SocketManager(socketSettings);
            _appleEncoding = new AppleEncoding();
            _packetManager = new PacketManager();
            _gameManager   = new GameManager();

            string interval = _appleConfig.GetConfigElement("console.timer.interval");

            _consoleWorker = new ConsoleWorker(ushort.Parse(interval));
            _consoleWorker.UpdateConsoleTitle();

            _log.Info(_severInfo.Title + " is ready.");
        }
示例#18
0
 public void Run(ConfigApp appSettings, string args)
 {
     ConsoleWorker.WriteHelp(appSettings.CommandList);
 }
示例#19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GetBranchesCommand" /> class.
 /// </summary>
 /// <param name="consoleHelper">The ConsoleHelper instance.</param>
 /// <param name="gitHubClient">The GitHubClient instance.</param>
 public GetBranchesCommand(ConsoleWorker consoleHelper) : base(consoleHelper)
 {
 }
示例#20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HelpCommand" /> class.
 /// </summary>
 /// <param name="consoleHelper">The ConsoleHelper instance.</param>
 /// <param name="gitHubClient">The GitHubClient instance.</param>
 public HelpCommand(ConsoleWorker consoleHelper) : base(consoleHelper)
 {
 }
示例#21
0
        static void Main(string[] args)
        {
            string pizzaMessage =
                "Input 1 Cheese Pizza\n" +
                "Input 2 Meat Pizza\n" +
                "Input 3 Pepperoni\n";
            string addIngMessage =
                "Do you whant adding some ingredient?\n" +
                "1 - Yes " +
                "2 - no";
            string ingMessage =
                "Input 1 Mushrooms\n" +
                "Input 2 Pepper\n" +
                "Input 3 Pepperoni\n";
            string readyPizzaMessage =
                "Input 1 to cook this pizza and create new Pizza\n" +
                "Input 2 to see Pizza\'s price\n" +
                "Input 3 to see all ingredients in your pizza\n" +
                "Input 4 for exit\n";
            int inputNum;


            BasePizza      pizza;
            BaseIngredient ing;

            //can do new method. generator.
            Dictionary <int, BasePizza>      pizzaDic = new Dictionary <int, BasePizza>();
            Dictionary <int, BaseIngredient> ingDic   = new Dictionary <int, BaseIngredient>();

            pizzaDic.Add(1, new CheesePizza());
            pizzaDic.Add(2, new MeatPizza());
            pizzaDic.Add(3, new VeganPizza());

            ingDic.Add(1, new Mushrooms());
            ingDic.Add(2, new Pepper());
            ingDic.Add(3, new Pepperoni());



PizzaQuestion:
            Console.WriteLine(pizzaMessage);
            inputNum = ConsoleWorker.getIntegerValue();
            pizza    = pizzaDic[inputNum];
            Console.WriteLine($"You input {inputNum}. You have {pizza.PizzaName}");

IngredientsQuestion:
            Console.WriteLine(addIngMessage);
            inputNum = ConsoleWorker.getIntegerValue();
            switch (inputNum)
            {
            case 1:
                Console.WriteLine(ingMessage);
                int ingNum = ConsoleWorker.getIntegerValue();
                ing   = ingDic[ingNum];
                pizza = ing.addIngred(pizza);
                goto IngredientsQuestion;

            case 2:
                goto ReadyPizzaQuestion;
            }

ReadyPizzaQuestion:
            Console.WriteLine(readyPizzaMessage);
            inputNum = ConsoleWorker.getIntegerValue();
            switch (inputNum)
            {
            case 1:
                goto PizzaQuestion;

            case 2:
                Console.WriteLine("Pizza price: " + pizza.PizzaPrice);
                goto ReadyPizzaQuestion;

            case 3:
                Console.WriteLine("Pizza ingridients: ");
                pizza.Additives.ForEach(el => Console.WriteLine(el));
                goto ReadyPizzaQuestion;

            case 4:
                break;
            }


            Console.Read();
        }
示例#22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AbstractCommand" /> class.
 /// </summary>
 /// <param name="consoleHelper">The ConsoleHelper instance.</param>
 /// <param name="gitHubClient">The GitHubClient instance.</param>
 public AbstractCommand(ConsoleWorker consoleHelper)
 {
     this.ConslWorker = consoleHelper;
 }
示例#23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BranchCommitsCommand" /> class.
 /// </summary>
 /// <param name="consoleHelper">The ConsoleHelper instance.</param>
 /// <param name="gitHubClient">The GitHubClient instance.</param>
 public BranchCommitsCommand(ConsoleWorker consoleHelper) : base(consoleHelper)
 {
 }
示例#24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateRepoCommand" /> class.
 /// </summary>
 /// <param name="consoleHelper">The ConsoleHelper instance.</param>
 /// <param name="gitHubClient">The GitHubClient instance.</param>
 public CreateRepoCommand(ConsoleWorker consoleHelper) : base(consoleHelper)
 {
 }
示例#25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserReposCommand" /> class.
 /// </summary>
 /// <param name="consoleHelper">The ConsoleHelper instance.</param>
 /// <param name="gitHubClient">The GitHubClient instance.</param>
 public UserReposCommand(ConsoleWorker consoleHelper) : base(consoleHelper)
 {
 }
示例#26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommitCountCommand" /> class.
 /// </summary>
 /// <param name="consoleHelper">The ConsoleHelper instance.</param>
 /// <param name="gitHubClient">The GitHubClient instance.</param>
 public CommitCountCommand(ConsoleWorker consoleHelper) : base(consoleHelper)
 {
 }