Exemple #1
0
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine($"TED Chat Relay v{VERSION} for EVE Online is starting...");
                _settings = RelaySetttings.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "settings.json"));

                if (!Directory.Exists(_settings.EveLogsFolder))
                {
                    Console.WriteLine("ERROR: EVE chatlogs folder not found!");
                    Console.ReadKey();
                    return;
                }


                Console.WriteLine("OK! Configured relays:");
                _settings.RelayChannels.ForEach(a => Console.WriteLine($"  * {a.EveChannelName}"));

                _timer = new Timer(Tick, new AutoResetEvent(true), 100, 1000);
                while (true)
                {
                    var command = Console.ReadLine();
                    switch (command?.Split(" ")[0])
                    {
                    case "quit":
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Console.ReadKey();
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            try
            {
                AppDomain.CurrentDomain.UnhandledException += (sender, eventArgs) =>
                {
                    Console.WriteLine(eventArgs.ExceptionObject.ToString());
                };

                Console.WriteLine($"TED Chat Relay v{VERSION} for EVE Online is starting...");
                try
                {
                    _settings = RelaySetttings.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "relaysettings.json"));
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error loading config file! Make sure it has correct syntax.");
                    Console.WriteLine(ex.ToString());
                    Console.WriteLine(ex.InnerException?.ToString());
                    Console.ReadKey();
                    return;
                }

                if (!Directory.Exists(_settings.EveLogsFolder))
                {
                    Console.WriteLine("ERROR: EVE chatlogs folder not found!");
                    Console.ReadKey();
                    return;
                }


                Console.WriteLine("OK! Configured relays:");
                if (!_settings.RelayChannels.Any())
                {
                    Console.WriteLine("ERROR: RelayChannels not set. Please add one!");
                    Console.ReadKey();
                    return;
                }
                _settings.RelayChannels.ForEach(a => Console.WriteLine($"  * {a.EveChannelName}"));

                _timer              = new Timer(1000);
                _timer.Elapsed     += Tick;
                _sendTimer          = new Timer(_settings.SendInterval);
                _sendTimer.Elapsed += SendTick;
                _timer.Start();
                _sendTimer.Start();
                while (true)
                {
                    var command = Console.ReadLine();
                    switch (command?.Split(" ")[0])
                    {
                    case "quit":
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Console.ReadKey();
            }
        }