static void Main(string[] args) { Console.WriteLine(string.Join(" ", args)); var arguments = CommandLineArgumentParser.Parse(args); WeChat = new WeChatSdk(); WeChat.LogEvent += WeChat_LogEvent; WeChat.ReceiveContactEvent += WeChat_ReceiveContactEvent; WeChat.ReceiveOtherIMEvent += WeChat_ReceiveOtherIMEvent; WeChat.WeChatInitEvent += WeChat_WeChatInitEvent; WeChat.ConnetionCloseEvent += WeChat_ConnetionCloseEvent; int startCount = 0; if (arguments.Has("--count")) { int.TryParse(arguments.Get("--count").Next, out startCount); } OpenWeChat(startCount > 1 ? startCount : 1); if (arguments.Has("--server")) { WeChat.StartServer(); while (Console.ReadKey().Key.ToString().ToLower() != "c") { } } Console.ReadKey(); }
static void Main(string[] args) { WeChat = new WeChatSdk(); WeChat.LogEvent += WeChat_LogEvent; WeChat.ReceiveContactEvent += WeChat_ReceiveContactEvent; WeChat.ReceiveOtherIMEvent += WeChat_ReceiveOtherIMEvent; WeChat.WeChatInitEvent += WeChat_WeChatInitEvent; WeChat.ConnetionCloseEvent += WeChat_ConnetionCloseEvent; OpenWeChat(); if (args.Contains("--server")) { WeChat.StartServer(); while (Console.ReadKey().Key.ToString() != "C") { } } }