static void Main(string[] args) { #if Release // Initialize log system GRoggle.Use( new EventLogRoggle( eventSourceName: AidaApplicationSourceName, eventLogName: AidaLogName, acceptedLogLevels: RoggleLogLevel.Debug | RoggleLogLevel.Error | RoggleLogLevel.Info | RoggleLogLevel.Warning ) ); #endif // Start main application thread Aida = new AidaCore( voice: new FrenchFemaleVoice() ); Aida.Start(); // Set this thread idle, waiting for user input while (Aida.IsRunning) { var userInput = Console.ReadLine(); switch (userInput) { case "exit": Aida.Stop(); break; default: Aida.Write(userInput); break; } } }
static void Main(string[] args) { if (Environment.UserInteractive) { if (args.FirstOrDefault() == "-i") { Install(); } if (args.FirstOrDefault() == "-u") { Uninstall(); } if (args.FirstOrDefault() == "-d") { Debug(); } } else { GRoggle.Use( new EventLogRoggle( eventSourceName: AidaServiceSourceName, eventLogName: AidaLogName, acceptedLogLevels: RoggleLogLevel.Debug | RoggleLogLevel.Error | RoggleLogLevel.Info | RoggleLogLevel.Warning ) ); ServiceBase.Run(Services); } }
static void Install() { // Create Roggle log GRoggle.Use( new EventLogRoggle(eventSourceName: AidaServiceSourceName, eventLogName: AidaLogName), new EventLogRoggle(eventSourceName: AidaApplicationSourceName, eventLogName: AidaLogName) ); // Start installutil.exe to install services ManagedInstallerClass.InstallHelper(new string[] { Assembly.GetExecutingAssembly().Location }); // Start services if necessary foreach (var service in Services) { ServiceController serviceController = new ServiceController(service.ServiceName); serviceController.Start(); } }
static void TestSentryRoggle(string dsn) { Console.Clear(); Console.WriteLine("-------------"); Console.WriteLine("Test a Roggle"); Console.WriteLine("-------------"); Console.WriteLine(); try { GRoggle.Use(new SentryRoggle(dsn)); GRoggle.Write("Test debug", RoggleLogLevel.Debug); GRoggle.Write("Test error very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very", RoggleLogLevel.Error); GRoggle.Write("Test info", RoggleLogLevel.Info); GRoggle.Write("Test warning", RoggleLogLevel.Warning); } catch (Exception) { Console.WriteLine("ERR"); Console.WriteLine("Failed to test Sentry Roggle."); } }