public ValueTask ExecuteAsync(IConsole console) { this.HandleParameters(); Console.WriteLine("Loggin is " + (this.Logging ? "enabled" : "disabled")); ISequentialReader reader = new EDSMSequentialReader(this.Filepath); ParsedSystemCSVWriter xmlWriter = new ParsedSystemCSVWriter(Path.Combine(this.OutputDir, DateTimeOffset.UtcNow.ToUnixTimeSeconds() + ".csv")); ParserPool pool = new ParserPool(reader, Parsers.StarSystemParser.ParseStarSystem, xmlWriter.HandleSystem, this.Logging, DateTimeOffset.UtcNow.ToUnixTimeSeconds() + ".log"); pool.Start(); reader.Start(); ICollection <IFinishable> actionsToFinish = new List <IFinishable>() { pool, reader }; while (!actionsToFinish.All(x => x.Finished)) { Thread.Sleep(1000); Console.Clear(); ConsoleHelper.PrintProgress(reader.Progress, this.stopwatch.Elapsed); } xmlWriter.Commit(); ConsoleHelper.PrintElapsedTime(this.stopwatch.Elapsed); return(default);
private void ConnectSocketButton_Click(object sender, RoutedEventArgs e) { // 1. create a platform dependent socket var socket = new TelegramSocket(); // 2. create socket connector/sender/receiver var socketConnector = new TelegramSocketConnector(socket); var socketSender = new TelegramSocketSender(socket); var socketReceiver = new TelegramSocketReceiver(socket); // 3. setup connector setting(adding hosts) socketConnector.HostProvider.Hosts.Add(new TelegramExchangerHost("127.0.0.1", "1234")); socketConnector.ConnectionStateChanged += socketConnector_ConnectionStateChanged; // 4. start _telegramExchangeDispatcher.Start(socketConnector, socketSender, socketReceiver); _parserPool.Start(); }