static void Main(string[] args) { InitializeApplicationCommands(); if (args.Length >= 1 && commandContainer.ContainsCommand(args[0])) { try { commandContainer.GetCommand(args[0]).Initialize(args).Execute(); } catch (CryptographicException) { Console.WriteLine("Incorrect passphrase!"); Environment.Exit(1); } catch (DecryptionException) { Console.WriteLine("Decryption error!"); Environment.Exit(1); } catch (Exception) { Console.WriteLine("Incorrect usage!"); commandContainer.GetCommand("--help").Execute(); Environment.Exit(1); } } else { Console.WriteLine("Incorrect usage!"); commandContainer.GetCommand("--help").Execute(); Environment.Exit(1); } }
private void HandleSending() { try { string cmd = toSendCmdContainer.GetCommand(); if (!String.IsNullOrEmpty(cmd)) { sWriter.WriteLine(cmd); sWriter.Flush(); } Thread.Sleep(SendingTickRate); } catch (Exception exception) { this.receivingInfoPacket.Obj = false; this.receivingInfoPacket.Msg = exception.Message; } }