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(); }
public IConsoleWorker AddWorker(ConsoleWorker newWorker) { WorkerManager manager = new WorkerManager(Writer, newWorker); Workers.Add(manager); return(manager); }
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(); }
private Grid(ConsoleWorker console) { this.reader = console; this.writer = console; this.InitializeGrid(); }
public WorkerManager(ConsoleWriter consoleWriter, ConsoleWorker newWorker) { UniqueID = Guid.NewGuid(); State = WorkerStateEnum.Stopped; console = consoleWriter; worker = newWorker; watch = new Stopwatch(); }
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(); }
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(); }
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); } }
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(); }
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)); }
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(); }
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; } }
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(); }
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(); }
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(); } }
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."); }
public void Run(ConfigApp appSettings, string args) { ConsoleWorker.WriteHelp(appSettings.CommandList); }
/// <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) { }
/// <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) { }
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(); }
/// <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; }
/// <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) { }
/// <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) { }
/// <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) { }
/// <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) { }