static void Main(string[] args) { args = args.Length > 0 ? args : new[] { "1017" }; const string title = "CozyBili"; int roomId; if (args.Length > 0 && int.TryParse(args[0], out roomId)) { var biliLive = new LiveDanMu(roomId); biliLive.OnlineNumChanged += x => Console.Title = string.Format("{0} - {1}号房间 - 当前在线人数{2}", title, roomId, x); biliLive.ReceiveDanMu += ShowDanMu; biliLive.Run(); } }
static void Main(string[] args) { string myRoomId = "21065"; var roomId = args.Length > 0 ? args[0] : myRoomId; var title = "CozyBili V1.0"; var danmu = new LiveDanMu(int.Parse(roomId)); danmu.OnlineNumChanged += x => Console.Title = string.Format("{0} - {1}号房间 - 当前在线人数{2}", title, roomId, x); danmu.ReceiveDanMu += ShowDanMu; var senMsg = new SendMessage(); danmu.Run(); string content = string.Empty; while ((content = Console.ReadLine()) != "stop") { senMsg.PostMessage(content, roomId); } }