コード例 #1
0
        static void Main(string[] args)
        {
            var apiKey             = System.Configuration.ConfigurationManager.AppSettings["DotaApiKey"].ToString();
            var pastTarget         = long.Parse(System.Configuration.ConfigurationManager.AppSettings["PastTarget"].ToString());
            var defaultLogger      = new DefaultLogger();
            var cancellationSource = new CancellationTokenSource();

            Console.CancelKeyPress += (object sender, ConsoleCancelEventArgs e) => { cancellationSource.Cancel(); };

            StatCollectionHandler.Run(defaultLogger, apiKey, pastTarget, cancellationSource.Token);
        }
コード例 #2
0
 protected void ServiceMain()
 {
     try
     {
         var apiKey      = System.Configuration.ConfigurationManager.AppSettings["DotaApiKey"].ToString();
         var pastTarget  = long.Parse(System.Configuration.ConfigurationManager.AppSettings["PastTarget"].ToString());
         var eventLogger = new EventLogger(this.MainEvenLog);
         StatCollectionHandler.Run(eventLogger, apiKey, pastTarget, this.tokenSource.Token);
     }
     catch (OperationCanceledException)
     {
         MainEvenLog.WriteEntry($"Handler is canceled");
     }
     catch (Exception ex)
     {
         MainEvenLog.WriteEntry(ex.Message, EventLogEntryType.Error, 100);
     }
 }