static void Main(string[] args) { LogerHelper.SetConfig(); Thread t = new Thread(new ThreadStart(() => { var br = new IW2SBotRegHelper(); br.Register(BotType.WeChat); BotSearch.Instance.SetBusy += () => br.SentStatus(1); BotSearch.Instance.SetReady += () => br.SentStatus(0); BotSearch.Instance.Run(); // WeChartBot.Search.BosonNLP.Instance.Run(); })); t.Start(); Console.ReadLine(); }
static void Main(string[] args) { LogerHelper.SetConfig(); Thread computePanelIn6 = new Thread(new ThreadStart(() => { BotControlPanelIn6Hours.Instance.Run(); })); Thread computePanelByDay = new Thread(new ThreadStart(() => { BotControlPanelByDay.Instance.Run(); })); Thread computeChart = new Thread(new ThreadStart(() => { ComputeProjectChart.Instance.Run(); })); Thread baiduBot = new Thread(new ThreadStart(() => { var br = new IW2SBotRegHelper(); br.Register(BotType.Baidu); BaiduSearchMng.Instance.SetBusy += () => br.SentStatus(1); BaiduSearchMng.Instance.SetReady += () => br.SentStatus(0); BaiduSearchMng.Instance.Run(); })); Thread weixinBot = new Thread(new ThreadStart(() => { WeiXinSearchTools weixin = new WeiXinSearchTools(); while (true) { bool IsOK; Console.Write("输入开始日期(yyyy-MM-dd):"); string startStr = Console.ReadLine(); DateTime startDate = new DateTime(); IsOK = DateTime.TryParse(startStr, out startDate); if (!IsOK) { continue; } else { weixin.StartDate = startDate; } Console.Write("输入结束日期(yyyy-MM-dd):"); string endStr = Console.ReadLine(); DateTime endDate = new DateTime(); IsOK = DateTime.TryParse(endStr, out endDate); if (!IsOK) { continue; } else { weixin.EndDate = endDate; Console.WriteLine("日期为:{0}至{1}".FormatStr(startDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd"))); Console.Write("是否无误?(Y/N):"); string code = Console.ReadLine().ToUpper(); if (code == "Y") { break; } } } var br = new IW2SBotRegHelper(); br.Register(BotType.WeiXin); weixin.SetBusy += () => br.SentStatus(1); weixin.SetReady += () => br.SentStatus(0); weixin.SetError += () => br.SentStatus(3); weixin.Run(); })); Console.WriteLine("1、百度Bot\t2、百度图表预计算"); Console.WriteLine("3、控制台-分钟计算\t4、控制台-天计算"); Console.WriteLine("5、微信BOT"); Console.Write("输入命令:"); while (true) { string str = Console.ReadLine(); int num = Convert.ToInt32(str); if (num >= 1 && num <= 5) { switch (num) { case 1: //百度BOT baiduBot.Start(); break; case 2: //项目图表预计算 computeChart.Start(); break; case 3: //控制台最近6小时变化数计算 computePanelIn6.Start(); break; case 4: //控制台每天数据计算 computePanelByDay.Start(); break; case 5: weixinBot.Start(); break; } break; } } Console.Read(); }
static void Main(string[] args) { LogerHelper.SetConfig(); //Thread t11 = new Thread(new ThreadStart(() => //{ // var br = new IW2SBotRegHelper(); // br.Register(BotType.BaiduImg); // BaiduImgMng.Instance.SetBusy += () => br.SentStatus(1); // BaiduImgMng.Instance.SetReady += () => br.SentStatus(0); // BaiduImgMng.Instance.Run(); //})); //t11.Start(); //Thread t12 = new Thread(new ThreadStart(() => //{ // var br = new IW2SBotRegHelper(); // br.Register(BotType.Weibo); // BaiduWeiboMng.Instance.SetBusy += () => br.SentStatus(1); // BaiduWeiboMng.Instance.SetReady += () => br.SentStatus(0); // BaiduWeiboMng.Instance.Run(); //})); //t12.Start(); ////Utility.WL_IndustryMng.Instance.startWL_Industry(); //Thread t1 = new Thread(new ThreadStart(() => //{ // var br = new IW2SBotRegHelper(); // br.Register(BotType.Baidu); // BaiduKeywordMng.Instance.SetBusy += () => br.SentStatus(1); // BaiduKeywordMng.Instance.SetReady += () => br.SentStatus(0); // BaiduKeywordMng.Instance.Run(); //})); Thread t2 = new Thread(new ThreadStart(() => { var br = new IW2SBotRegHelper(); br.Register(BotType.Baidu); IW2SBotMng.Instance.SetBusy += () => br.SentStatus(1); IW2SBotMng.Instance.SetReady += () => br.SentStatus(0); IW2SBotMng.Instance.Run(); })); #region var botregTh = new Thread(() => { var botId = Utility.Utility.GenerateBotId().ToString().Replace("-", ""); var timer = new Timer { Interval = 60 * 1000, Enabled = true }; timer.Elapsed += (s, e) => { // 在mongodb中注册Bot Console.WriteLine("regist bot:{0}", botId); var col = MongoDBHelper.Instance.GetIW2S_BotRegister(); var builder = Builders <IW2S_BotRegister> .Filter; var ip = Utility.Utility.GetInternetIpAddress(); var host = Dns.GetHostName(); var pid = Process.GetCurrentProcess().Id; var bot = col.Find(builder.Eq(x => x.BotId, botId)).FirstOrDefault(); if (bot == null) { col.InsertOne(new IW2S_BotRegister { BotId = botId, RegTime = e.SignalTime.ToUniversalTime(), IpAddress = ip, HostName = host, ProcessId = pid.ToString(CultureInfo.InvariantCulture), Status = 0 }); } else { var updateBot = new UpdateDocument { { "$set", new QueryDocument { { "RegTime", e.SignalTime.ToUniversalTime() } } } }; col.UpdateOne(new QueryDocument { { "_id", bot._id } }, updateBot); } }; }); #endregion // t1.Start(); t2.Start(); //botregTh.Start(); //Thread t2 = new Thread(new ThreadStart(() => //{ // Utility.IW2SBotMng.Instance.Run(); //})); //t2.Start(); //Thread t3 = new Thread(new ThreadStart(() => // { // Utility.BotMng.Instance.Run(); // })); //t3.Start(); //Utility.HandleLinkData.Instance.Run(); //Thread t2 = new Thread(new ThreadStart(() => //{ // Utility.WhoisMng.Instance.start_whois(); //})); //t2.Start(); Console.Read(); }