public override void Deserialize(EndianReader reader) { Configuration = new ConsoleConfiguration(); ((ISerializable)Configuration).Deserialize(reader); ActiveTitles = reader.ReadUInt16BEPrefixedArray <ActiveTitle>(); }
static void Main(string[] args) { var configuration = new ConsoleConfiguration().Get(); var cardPaymentRequestWorkerPopulator = new PaymentWorkerCollection(); var workers = cardPaymentRequestWorkerPopulator.Populate(); using (var bus = RabbitHutch.CreateBus(configuration[RabbitMqServer.ConStr])) { bus.RespondAsync <CardPaymentRequest, CardPaymentResponse>(request => { return(Task.Factory.StartNew(() => { var worker = workers.Take(); try { return worker.Execute(request); } finally { workers.Add(worker); } })); }); Console.WriteLine("Listening for messages. Hit <return> to quit."); Console.ReadLine(); } }
public void Should_resolve_console() { ConsoleConfiguration.Configure(); var console = ConsoleConfiguration.Locate <IConsoleApplication>(); Assert.IsNotNull(console); }
private static void Launching(string args) { string filePath = args; if (!File.Exists(filePath)) { Console.WriteLine("File does not exist."); Exit(); } var fileType = filePath.Substring(filePath.LastIndexOf(".") + 1); if (fileType != "json" && fileType != "xml") { Console.WriteLine("Sorry, Virtual Libary does not support given file type."); Exit(); } IConfiguration configuration = new ConsoleConfiguration() { FilePath = filePath, }; if (fileType == "json") { _bookRepository = new JsonBookRepository(configuration); } else { _bookRepository = new XmlBookRepository(configuration); } _libraryService = new LibraryService(_bookRepository); _libraryPresenter = new ConsoleLibraryPresenter(); }
public override void Deserialize(BEReader reader) { Configuration = new ConsoleConfiguration(); ((ISerializable)Configuration).Deserialize(reader); ActiveTitles = reader.ReadArray <ActiveTitle>(); }
static void Main(string[] args) { var consoleConfiguration = new ConsoleConfiguration().Get(); using (var bus = RabbitHutch.CreateBus(consoleConfiguration[RabbitMqServer.ConStr])) { bus.SubscribeAsync <OrderNotification>(RabbitMqServer.Notification.NotificationQueue, message => Task.Factory.StartNew(() => { Console.WriteLine("Notification! = <" + message.Address + ", " + message.AuthCode + ", " + message.DeliveryDate + ", " + message.Name + ", " + message.Email + ">", Color.Yellow); Console.WriteLine("Notification mail has been sent!", Color.Yellow); }).ContinueWith(task => { if (task.IsCompleted && !task.IsFaulted) { Console.WriteLine("Finished processing all messages", Color.Gray); } else { throw new EasyNetQException("Message processing exception - look in the default error queue (broker)"); } })); Console.WriteLine("Listening for messages. Hit <return> to quit."); Console.ReadLine(); } }
public Shell(IValueConverter valueConverter, IWriteableHistory history, IFileSystem fileSystem, ICommandFinder commandFinder, IEnvironment environment, ICommandExecutor commandExecutor, ILsfRunner lsfRunner = null, ConsoleConfiguration config = null) { this.ValueConverter = valueConverter; this.History = history; this.FileSystem = fileSystem; this.CommandFinder = commandFinder; this._Environment = environment; this.CommandExecutor = commandExecutor; this.LsfRunner = lsfRunner ?? new LsfRunner(environment, commandFinder, fileSystem, commandExecutor); this.Config = config ?? new ConsoleConfiguration(); }
public static ConfigurationPropertyHolder set_up_configuration_and_build_the_container(string[] args) { ConfigurationPropertyHolder configuration = new ConsoleConfiguration(); parse_arguments_and_set_up_configuration(configuration, args); if (configuration.Debug) { change_log_to_debug_level(); } ApplicationConfiguraton.set_defaults_if_properties_are_not_set(configuration); ApplicationConfiguraton.build_the_container(configuration); return configuration; }
public static void Main(string[] args) { var consoleConfiguration = new ConsoleConfiguration().Get(); using (var bus = RabbitHutch.CreateBus(consoleConfiguration[RabbitMqServer.ConStr])) { bus.SubscribeAsync <RegisterOrder>(RabbitMqServer.Registration.OrderQueue, message => Task.Factory.StartNew(() => { Console.WriteLine("Payment = <" + message.CardNumber + ", " + message.CardHolderName + ", " + message.ExpiryDate + ", " + message.Amount + ">", Color.Lime); var cardPaymentRequest = new CardPaymentRequest() { Amount = message.Amount, CardHolderName = message.CardHolderName, CardNumber = message.CardNumber, ExpiryDate = message.ExpiryDate }; var paymentResponse = bus.Request <CardPaymentRequest, CardPaymentResponse>(cardPaymentRequest); var orderNotification = new OrderNotification() { Address = message.Address, AuthCode = paymentResponse.AuthCode, DeliveryDate = DateTime.Now.AddDays(14), Email = message.Email, Name = message.Name }; bus.Publish(orderNotification, cfg => cfg.WithQueueName(RabbitMqServer.Notification.NotificationQueue)); }).ContinueWith(task => { if (task.IsCompleted && !task.IsFaulted) { Console.WriteLine("Finished processing all messages", Color.Gray); } else { throw new EasyNetQException("Message processing exception - look in the default error queue (broker)"); } })); Console.WriteLine("Listening for messages. Hit <return> to quit."); Console.ReadLine(); } }
public static ConfigurationPropertyHolder set_up_configuration_and_build_the_container(string[] args) { ConfigurationPropertyHolder configuration = new ConsoleConfiguration(); parse_arguments_and_set_up_configuration(configuration, args); if (configuration.Debug) { change_log_to_debug_level(); } ApplicationConfiguraton.set_defaults_if_properties_are_not_set(configuration); ApplicationConfiguraton.build_the_container(configuration); return(configuration); }
private static void Main(string[] args) { var config = new ConsoleConfiguration { SplashScreen = "Best Bank ever" }; using (var console = new ClientConsole(config)) { var rootCommand = new RootCommand(console); rootCommand.RegisterCommand(Container.GetInstance <Kontener.InterfejsBanku>()); var commandEngine = new CommandEngine(rootCommand); commandEngine.Start(args); } }
public void WriteInConsoleTest() { var consoleConfig = new ConsoleConfiguration(); var _logger = new ConsoleLogger( Verbosity.VerbosityTypes.high, consoleConfig ); var typeOfMessages = TypeOfMessage.error; foreach (var msg in _listOfMessages) { var toWrite = _logger.BuildMessage(msg, typeOfMessages); var resultOperation = _logger.LogMessage(toWrite); Assert.Equal(0, resultOperation); } }
public static ILoggingBuilder AddSerilogConsole(this ILoggingBuilder loggingBuilder, ConsoleConfiguration config) { if (loggingBuilder == null) { throw new ArgumentNullException(nameof(loggingBuilder)); } if (config == null) { throw new ArgumentNullException(nameof(config)); } var serilog = Utility.CreateConsoleLogger(config); return(loggingBuilder.AddSerilog(serilog)); }
public static ILoggerFactory AddSerilogConsole(this ILoggerFactory loggerFactory, ConsoleConfiguration config) { if (loggerFactory == null) { throw new ArgumentNullException(nameof(loggerFactory)); } if (config == null) { throw new ArgumentNullException(nameof(config)); } var serilog = Utility.CreateConsoleLogger(config); return(loggerFactory.AddSerilog(serilog)); }
public void Deconstruct( out ConsoleConfiguration console, out FileConfiguration file, out ElasticSearchConfiguration elasticSearch, out TracingConfiguration tracing) => (console, file, elasticSearch, tracing) = ( this.Console ?? new ConsoleConfiguration(),
/// <summary> /// Add a console window logger using custom settings /// </summary> /// <param name="config">custom configuration settings</param> /// <returns>Target configuration</returns> public FluentTargetConfiguration ConsoleLogger(ConsoleConfiguration config) { Add(new ConsoleTarget(config)); return(_configuration); }