static void Main(string[] args) { DisableConsoleQuickEdit.Go(); Console.WriteLine("Plex-Automation-Client starting..."); PlexAutomationBroker plexAutomation = InitializePlexListener(PlexColor); plexAutomation.Start(); //IPAutomationBroker tvIpAutomation = InitializeTVIpListener(TvColor); //tvIpAutomation.Start(); //IPAutomationBroker xboxIpAutomation = InitializeXboxIpListener(XboxColor); //xboxIpAutomation.Start(); HueAutomationBroker hueAutomation = InitializeHueListner(HueColor); hueAutomation.Start(); DenonAutomationBroker denonAutomation = InitializeDenonListener(DenonColor); denonAutomation.Start(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Press <ENTER> to stop the Plex-Automation-Client"); Console.ReadKey(); }
public static void Main(string[] args) { #if DEBUG DisableConsoleQuickEdit.Go(); Config.DevMode = true; #endif Config.SetConfig(); CreateHostBuilder(args).Build().Run(); }
public static void Initialize(int screenWidth, int screenHeight, int headerHeight, int marginWidth) { DisableConsoleQuickEdit.Go(screenWidth, screenHeight); Grid.Initialize(screenWidth - MARGIN_BUFFER - marginWidth, screenHeight - MARGIN_BUFFER - headerHeight); Grid.marginWidth = marginWidth; //Grid.Initialize(117, 27); HUD.Initialize(headerHeight); }
static void Main(string[] args) { devicePool = new DevicePool(); tagQueue = new TagQueue(); configList = new ConfigList(); devicePool.OnRead += (object sender, Device.ReadEventArgs e) => { var device = (Device)sender; foreach (var tag in e.Tags) { tagQueue.Add(tag); } logger.Info("DeviceId: {0}, TagCount: {1}, Antennas: {2}", device.Id, e.Tags.Count, e.Tags.Count > 0 ? e.Tags[0].antennas : ""); }; devicePool.OnError += (object sender, Device.ErrorEventArgs e) => { var device = (Device)sender; logger.Error(e.Exception, $"{e.Exception.Message}, DeviceId: {device.Id}, ErrorTimes: {e.ErrorTimes}"); }; DisableConsoleQuickEdit.Go(); try { logger.Info("Init config..."); while (!configList.RefreshAsync().Result) { Thread.Sleep(1000); } logger.Info("Init devices..."); while (!devicePool.RefreshAsync().Result) { Thread.Sleep(1000); } } catch (Exception ex) { logger.Fatal(ex); return; } try { logger.Info("Starting new thread..."); while (true) { Task.Run(new Action(WorkThread)).Wait(); } } catch (Exception ex) { logger.Fatal(ex, "Main thread exception"); } }
static void Main(string[] args) { DisableConsoleQuickEdit.SetQuickEdit(true); SetTimer(); Repeater(); Console.WriteLine("Nejak som sa sem dostal"); timerForKillingUpdates.Stop(); timerForKillingUpdates.Dispose(); Console.ReadLine(); }
/// <summary> /// the main class: Application startup /// </summary> static void Main(string[] args) { try { //For some reason, console is editable, it shoudn't be DisableConsoleQuickEdit.Go(); //Extract the variables from specified xml file XmlDocument doc = new XmlDocument(); doc.Load("ConfigFiles/DataPull.xml"); string GSPPSSourceFolder = doc.GetElementsByTagName("GSPPSSourceFolder")[0].InnerText.Trim().ToUpper(); string CSVFolder = doc.GetElementsByTagName("CSVFolder")[0].InnerText.Trim().ToUpper(); string sourceFile = (args.Length > 0 && args[0].Trim().ToUpper() == "INCREMENT") ? doc.GetElementsByTagName("sourceFileINCREMENT")[0].InnerText : doc.GetElementsByTagName("sourceFileFULL")[0].InnerText; //Remove the csvs for a fresh install //DeleteDirectoryContents(SpecsFolder, false); //Establish connection with IQMS Oracle Database TryConnectionToIQMSDatabase(); //Connection is successful if this is reached. Stopwatch watch = Stopwatch.StartNew(); //Read the spec file, and create CSVs //1) Get temporary table ready for data arinvtTable = new ARINVT(CSVFolder, true); ParseSpecFile(GSPPSSourceFolder, sourceFile, CSVFolder); watch.Stop(); TimeSpan t = TimeSpan.FromMilliseconds(watch.ElapsedMilliseconds); string timeSpanDisplay = string.Format(" {0:D2}h:{1:D2}m:{2:D2}s:{3:D3}ms", t.Hours, t.Minutes, t.Seconds, t.Milliseconds); Console.WriteLine(timeSpanDisplay); Console.WriteLine(" Sleep for " + sleeptime + " seconds."); Thread.Sleep(sleeptime * 1000); } catch (Exception ex) { Logger.log(ex.Message + "\n" + ex.StackTrace); Console.WriteLine(" ERROR: " + ex.Message); Thread.Sleep(14000); } }
static void Main(string[] args) { m_SocketListener = new SocketListener(11000); m_MessageHandler = new MessageHandler(); if (DisableConsoleQuickEdit.Go()) { Console.WriteLine("Quick-Edit Mode Disabled.."); } InitializeModules(); Task.Run(() => m_SocketListener.Start()); Task.Run(() => ClientManager.CycleClientHeartbeats()); LoopReadInput(); }
static void Main() { _Bot.StartupTime = DateTime.Now; DisableConsoleQuickEdit.Go(); Console.Title = "Discore Selfbot"; #region CreateFolders if (!Directory.Exists(_Bot.Path)) { Directory.CreateDirectory(_Bot.Path); } if (!Directory.Exists(_Bot.PathTags)) { Directory.CreateDirectory(_Bot.PathTags); } if (!Directory.Exists(_Bot.PathCustom)) { Directory.CreateDirectory(_Bot.PathCustom); } #endregion JsonSerializer serializer = new JsonSerializer(); TrayIconBuster.TrayIconBuster.RemovePhantomIcons(); Console.ForegroundColor = ConsoleColor.White; Notif(); foreach (var Files in Directory.GetFiles(_Bot.PathTags)) { if (Files.ToString().EndsWith(".json")) { using (StreamReader reader = new StreamReader(Files)) { TagList.Add((_TagClass)serializer.Deserialize(reader, typeof(_TagClass))); } } } #region LoadToken if (File.Exists(_Bot.Path + "Token.txt")) { _Bot.Token = File.ReadAllText(_Bot.Path + "Token.txt"); if (_Bot.Token == "") { Console.Title = "Discore Selfbot"; _Log.Custom("Token not found please enter your user token in this file and restart the bot"); Process.Start(_Bot.Path); } } else { Console.Title = "Discore Selfbot"; File.CreateText(_Bot.Path + "Token.txt").Close(); _Log.Custom("Insert your User Token into the file Token.txt and restart the bot"); _Log.Custom("And no i dont steal tokens you can view the code on github"); Process.Start(_Bot.Path); } if (!File.Exists(_Bot.Path + "How-To-Get-User-Token.txt")) { using (StreamWriter sw = File.CreateText(_Bot.Path + "How-To-Get-User-Token.txt")) { sw.WriteLine("Open this in your web browser"); sw.WriteLine(""); sw.WriteLine("https://github.com/ArchboxDev/Discore-Selfbot/blob/master/UserToken.md"); } } while (_Bot.Token == "") { } #endregion if (File.Exists(_Bot.Path + "Settings.json")) { using (StreamReader reader = new StreamReader(_Bot.Path + "Settings.json")) { Settings = (_SettingsClass)serializer.Deserialize(reader, typeof(_SettingsClass)); } } else { using (StreamWriter file = File.CreateText(_Bot.PathTags + "Settings.json")) { serializer.Serialize(file, Settings); } } if (File.Exists(_Bot.Path + "Stats.json")) { using (StreamReader reader = new StreamReader(_Bot.Path + "Stats.json")) { Stats = (_StatsClass)serializer.Deserialize(reader, typeof(_StatsClass)); } } else { Stats.TotalRuns++; using (StreamWriter file = File.CreateText(_Bot.Path + "Stats.json")) { serializer.Serialize(file, Stats); } } _Log.Selfbot("Token found loading bot"); if (Settings.Startup == "Hide All") { NotifyIcon.ShowBalloonTip(30, "Loading!", "Selfbot is now loading", ToolTipIcon.Info); var handle = GetConsoleWindow(); ShowWindow(handle, SW_HIDE); } new Program().RunBot().GetAwaiter().GetResult(); }
static void Main(string[] args) { //Title of the console window Console.Title = "Simple Twitch Chat Bot " + version; // Turn off Quick Edit Mode DisableConsoleQuickEdit.SetQuickEdit(true); // SecurityProtocol SSL/TSL ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; //Load in information from external Config.txt source. LoadLocalization(); try { if (data[0]["Host"] == string.Empty || data[0]["BotName"] == string.Empty || data[0]["BotName"] == string.Empty || data[0]["oAuthPassword"] == string.Empty || data[0]["ChannelName"] == string.Empty || data[0]["OnlineMode"] == string.Empty || data[0]["OnlineURL"] == string.Empty || data[0]["DEBUG"] == string.Empty) { Console.WriteLine("Config.txt is not configured correctly. Message: Empty config entry found."); Thread.Sleep(8000); Environment.Exit(0); } if (data[0]["DEBUG"].ToUpper() == "TRUE") { debug = true; } else { debug = false; } // We create the chatbot object twitchChatBot = new TwitchChatBot(data[0]["Host"], Int32.Parse(data[0]["Port"]), data[0]["BotName"], data[0]["oAuthPassword"], data[0]["ChannelName"], data[0]["OnlineMode"], data[0]["OnlineURL"], true); Console.WriteLine("Client commands? Write \"help\" or \"commands\""); } catch (KeyNotFoundException e) { //This is the result of the external data being wrong. Console.WriteLine("Config.txt is not configured correctly. Message: " + e); Thread.Sleep(8000); Environment.Exit(0); } // This will keep the console window open and also be used as a command prompt. while (true) { switch (Console.ReadLine().ToLower()) // Catch input and convert to lowercase. { case "help": case "commands": Console.Clear(); Console.WriteLine("\"help\", \"commands\" will show this console window."); Console.WriteLine("\"reset\" will reset the counter and clear memory."); Console.WriteLine("\"reconnect\" will reconnect the bot but keep data."); Console.WriteLine("\"stats\", \"status\", \"count\" will print out data from the current session."); Console.WriteLine("\"clear\" will clear the console."); Console.WriteLine("\"upload\" will upload the statistics data to the server.(If online-mode is set \"TRUE\")"); Console.WriteLine("\"quit\", \"exit\" will shutdown the bot."); break; case "reconnect": // Reconnect and save data Data bot_data = ObjectClone <Data>(twitchChatBot.data); twitchChatBot.KillThreads(); twitchChatBot = new TwitchChatBot(data[0]["Host"], Int32.Parse(data[0]["Port"]), data[0]["BotName"], data[0]["oAuthPassword"], data[0]["ChannelName"], data[0]["OnlineMode"], data[0]["OnlineURL"], true); twitchChatBot.data = bot_data; break; case "reset": twitchChatBot.data = new Data(); Console.Clear(); Console.WriteLine("Program reset! Online stats are refreshed upon next !hungry command."); break; case "stats": case "status": case "count": Console.Clear(); Console.WriteLine("The word \"hungry\" has been said " + twitchChatBot.data.hungry.timesHungry.ToString() + " time(s). Total count of !hungry is " + twitchChatBot.data.hungry.timesHungryTotal.ToString() + ". This session: " + twitchChatBot.data.hungry.session_timesHungry.ToString() + " time(s) - Total: " + twitchChatBot.data.hungry.session_timesHungryTotal.ToString()); Console.WriteLine("Death has been registered " + twitchChatBot.data.hungry.timesHungry.ToString() + " time(s). Total count of death (command) is " + twitchChatBot.data.hungry.timesHungryTotal.ToString() + ". This session: " + twitchChatBot.data.deaths.session_deaths.ToString() + " time(s) - Total: " + twitchChatBot.data.deaths.session_deathsTotal.ToString()); break; case "clear": Console.Clear(); break; case "upload": Console.Clear(); if (twitchChatBot.connectionData.onlineMode) { twitchChatBot.SendData(); } break; case "quit": case "exit": Environment.Exit(0); break; } } }