private void HandleEvent(BinaryReader br) { // 마지막으로 접수된 패킷의 시간. _dtPing = DateTime.Now; NotifyType notifyType = (NotifyType)DecodeInteger(br); // Temp //SetError(ErrorType.Fail_ReceiveSocket, notifyType.ToString()); BaseInfo baseInfo = BaseInfo.CreateInstance(br); baseInfo._dtReceiveTime = System.DateTime.Now; // 2013-12-27: GreenRose switch (notifyType) { case NotifyType.Reply_RoomDetail: { Console.WriteLine("Reply_roomDetail"); RoomDetailInfo roomDetailInfo = (RoomDetailInfo)baseInfo; } break; case NotifyType.Reply_EnterMeeting: { Console.WriteLine("Reply_EnterMeeting"); } break; case NotifyType.Reply_ClassInfo: { Console.WriteLine("Reply_ClassInfo"); } break; } ResultInfo resultInfo = new ResultInfo(); if (notifyType == NotifyType.Notify_Ping) { _dtPing = DateTime.Now; if (_ClientConneted == null || !_ClientConneted.IsAlive) { _ClientConneted = new Thread(OnClientConnected); _ClientConneted.Start(); } Send(NotifyType.Notify_Ping, resultInfo); } else if (notifyType == NotifyType.Reply_VoiceChat) { _NotifyHandler(notifyType, null, baseInfo); } else { _NotifyTypes.Add(notifyType); _ReceiveInfos.Add(baseInfo); } _CompleteBuffer = null; if (_InvokeMethod != null) { _InvokeMethod(); } }
public static BaseInfo CreateInstance(BinaryReader br) { BaseInfo baseInfo = null; InfoType infoType = (InfoType)DecodeInteger(br); switch (infoType) { case InfoType.Result: baseInfo = new ResultInfo(); break; case InfoType.Header: baseInfo = new HeaderInfo(); break; case InfoType.Home: baseInfo = new HomeInfo(); break; case InfoType.User: baseInfo = new UserInfo(); break; case InfoType.UserDetail: baseInfo = new UserDetailInfo(); break; case InfoType.Room: baseInfo = new RoomInfo(); break; case InfoType.RoomList: baseInfo = new RoomListInfo(); break; case InfoType.RoomDetail: baseInfo = new RoomDetailInfo(); break; case InfoType.String: baseInfo = new StringInfo(); break; case InfoType.Voice: baseInfo = new VoiceInfo(); break; case InfoType.Video: baseInfo = new VideoInfo(); break; case InfoType.Present: baseInfo = new IconInfo(); break; case InfoType.Give: baseInfo = new GiveInfo(); break; case InfoType.Game: baseInfo = new GameInfo(); break; case InfoType.GameList: baseInfo = new GameListInfo(); break; case InfoType.GameDetail: baseInfo = new GameDetailInfo(); break; case InfoType.ChatHistory: baseInfo = new ChatHistoryInfo(); break; case InfoType.PointHistory: baseInfo = new PointHistoryInfo(); break; case InfoType.ChargeHistory: baseInfo = new ChargeHistoryInfo(); break; case InfoType.EvalHistory: baseInfo = new EvalHistoryInfo(); break; case InfoType.PresentHistory: baseInfo = new PresentHistoryInfo(); break; case InfoType.GameHistory: baseInfo = new GameHistoryInfo(); break; case InfoType.UserList: baseInfo = new UserListInfo(); break; case InfoType.AskChat: baseInfo = new AskChatInfo(); break; case InfoType.Board: baseInfo = new BoardInfo(); break; case InfoType.Betting: baseInfo = new BettingInfo(); break; case InfoType.Table: baseInfo = new TableInfo(); break; case InfoType.Sicbo: baseInfo = new SicboInfo(); break; case InfoType.Dice: baseInfo = new DiceInfo(); break; case InfoType.DzCard: baseInfo = new DzCardInfo(); break; case InfoType.Horse: baseInfo = new HorseInfo(); break; case InfoType.BumperCar: baseInfo = new BumperCarInfo(); break; case InfoType.Fish: baseInfo = new FishInfo(); break; case InfoType.FishSend: baseInfo = new FishSendInfo(); break; case InfoType.AddScore: baseInfo = new AddScoreInfo(); break; case InfoType.SendCard: baseInfo = new SendCardInfo(); break; case InfoType.Musice: baseInfo = new MusiceInfo(); break; case InfoType.MusiceState: baseInfo = new MusiceStateInfo(); break; case InfoType.ClassInfo: baseInfo = new ClassInfo(); break; case InfoType.ClassList: baseInfo = new ClassListInfo(); break; case InfoType.ClassTypeInfo: baseInfo = new ClassTypeInfo(); break; case InfoType.ClassTypeList: baseInfo = new ClassTypeListInfo(); break; case InfoType.ClassPictureDetail: baseInfo = new ClassPictureDetailInfo(); break; case InfoType.RoomValue: baseInfo = new RoomPrice(); break; case InfoType.Payment: baseInfo = new PaymentInfo(); break; case InfoType.DWGameFile: baseInfo = new DWGameFileInfo(); break; case InfoType.UserState: baseInfo = new UserState(); break; case InfoType.Server: baseInfo = new ServerInfo(); break; case InfoType.AVMsg: baseInfo = new AVMsg(); break; } if (baseInfo != null) { baseInfo.FromBytes(br); } return(baseInfo); }