static void Main(string[] args) { if (!EnsureSingleLoad()) { Console.WriteLine("{0}: Another Instance Currently Running", DateTime.Now); return; } /* * var botClient = new BotClient(HandleBotManagerCommunication); * botClient.Start(); * * if (UsersCollection.PrimaryUser() == null) * { * Console.WriteLine("{0}: No Primary User Found", DateTime.Now); * Console.Write("{0}: Waiting For PrimaryUser to be Set by BotManager", DateTime.Now); * while (UsersCollection.PrimaryUser() == null) * { * Thread.Sleep(1000); * Console.Write("."); * } * Console.WriteLine(""); * Console.WriteLine("{0}: BotManager Set PrimaryUser to be {1}", DateTime.Now, UsersCollection.PrimaryUser().TwitterScreenName); * } */ var streamMonitors = new List <DualStreamMonitor>(); UsersCollection.PrimaryUsers().AsParallel().ForAll(u => { var streamMonitor = new DualStreamMonitor(u, Console.Out); streamMonitor.Start(); lock (streamMonitors) { streamMonitors.Add(streamMonitor); } }); while (Console.ReadLine() != "exit") { ; } //botClient.Stop(); streamMonitors.ForEach(s => s.Stop()); }
static void Main(string[] args) { if (!EnsureSingleLoad()) { Console.WriteLine("{0}: Another Instance Currently Runing", DateTime.Now); return; } var streamMonitor = new DualStreamMonitor(Console.Out); streamMonitor.Start(); while (Console.ReadLine() != "exit") { ; } streamMonitor.Stop(); }
static void Main(string[] args) { if (!EnsureSingleLoad()) { Console.WriteLine("{0}: Another Instance Currently Running", DateTime.Now); return; } var users = UsersCollection.PrimaryUsers() ?? new List <PostworthyUser>(); users.AsParallel().ForAll(u => { var streamMonitor = new DualStreamMonitor(u, Console.Out); streamMonitor.Start(); while (Console.ReadLine() != "exit") { ; } streamMonitor.Stop(); }); }