private ConnAppProc CreateConnApp(eServerType server_type) { ConnAppProc app_server = null; switch (server_type) { case eServerType.WORLD: app_server = new WorldMsgProc(); break; case eServerType.GATE: app_server = new GateMsgProc(); break; case eServerType.FIGHT: app_server = new FightMsgProc(); break; case eServerType.GLOBAL: app_server = new GlobalMsgProc(); break; default: Log.Warning("错误的服务器类型:" + server_type); return(null); } app_server.Setup(); return(app_server); }
public bool TryBroadcastToAuthServer(Packet p) { eServerType type = eServerType.Auth; lock (m_lockObject) { if (false == m_dicOtherServers.ContainsKey(type)) { return(false); } foreach (var node in m_dicOtherServers[type]) { if (null == node.m_session) { continue; } node.m_session.RelayPacket(p); } } return(true); }
void OnLogOffEvent(string userName, eServerType serverType) { this.Invoke((MethodInvoker) delegate() { switch (serverType) { case eServerType.Ibet: lblIbetStatus.Text = IbetEngine.AccountStatus.ToString(); lblIbetRealDomain.Text = IbetEngine.UrlHost; lblIbetCreadit.Text = string.Empty; lblIbetCashBalance.Text = string.Empty; //if (DataContainer.FirstAccounts.Contains(userName)) //{ // DataContainer.FirstAccounts.Remove(userName); //} break; case eServerType.Sbo: lblSboStatus.Text = SboEngine.AccountStatus.ToString(); lblSboRealDomain.Text = SboEngine.UrlHost; lblSboCreadit.Text = string.Empty; lblSboCashBalance.Text = string.Empty; //if (DataContainer.SecondAccounts.Contains(userName)) //{ // DataContainer.SecondAccounts.Remove(userName); //} break; } //SetDefaultStyle(); }); }
void OnExceptionEvent(ExceptionMessage logMsg, eServerType serverType, object obj) { if (serverType == eServerType.Ibet) { Thread thread = new Thread(() => { ReStartIbet(obj); }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); } else { Thread thread = new Thread(() => { ReStartSbo(obj); }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); } //if (serverType == eServerType.Ibet) //{ // Thread thread = new Thread(ReStartFromIbet); // thread.SetApartmentState(ApartmentState.STA); // thread.Start(); //} //else //{ // Thread thread = new Thread(ReStartFromSbo); // thread.SetApartmentState(ApartmentState.STA); // thread.Start(); //} }
public fmOtherServer Find(eServerType type, int seq) { lock (m_lockObject) { if (false == m_dicOtherServers.ContainsKey(type)) { return(null); } foreach (var node in m_dicOtherServers[type]) { if (null == node.m_desc) { continue; } if (node.m_desc.m_nSequence == seq) { return(node); } } return(null); } }
public void OnServerRegist(eServerType svrType, int sessionID) { if (m_svrRegistDeal != null) { m_svrRegistDeal(svrType, sessionID); } }
////public void OnLogBetEvent(Common.Objects.LogBetMessage logMsg) ////{ //// var odd = logMsg.HomeOdd + " | " + logMsg.AwayOdd; //// string[] row1 = //// { //// logMsg.Time, logMsg.ServerType.ToString(), logMsg.HomeTeamName, logMsg.AwayTeamName, odd, //// logMsg.BetType.ToString(), logMsg.BetStake.ToString(), logMsg.Status.ToString() //// }; //// this.Invoke((MethodInvoker)delegate() //// { //// dgvBetLog.Rows.Insert(0, row1); //// //switch (logMsg.ServerType) //// //{ //// // case eServerType.Ibet: //// // this.lblFirstAvaiableCredit.Text = _accountConfig.IbetEngine.AvailabeCredit.ToString(); //// // break; //// // case eServerType.Sbo: //// // this.lblSecondAvaiableCredit.Text = _accountConfig.SboEngine.AvailabeCredit.ToString(); //// // break; //// //} //// }); ////} public void OnProcessorExceptionEvent(Common.Objects.ExceptionMessage exMsg, eServerType serverType) { string msg = string.Empty; switch (exMsg.ExceptionType) { case eExceptionType.LoginFail: msg = "Tài khoản của bạn hiện đang đăng nhâp tai một địa chỉ khác. Hệ thống đã tự động dừng quét. Vui lòng chọn STOP và cấu hình lại."; break; default: msg = "Lỗi hệ thống quét. Vui lòng chọn STOP và cấu hình lại."; break; } this.Invoke((MethodInvoker) delegate() { TabControl tabMain = _accountConfig._bcWin.Controls.Find("tabMain", true).FirstOrDefault() as TabControl; TabPage currentTab = tabMain.TabPages[_accountConfig.ID.ToString()]; string tabText = currentTab.Text; //currentTab.Name = processGuid.ToString(); currentTab.Text = "LỖI"; SetFourceStopClickStyle(); lbExMsg.Text = msg; MessageBox.Show(this, string.Format("Lỗi cặp {0}" + Environment.NewLine + "Vui lòng kiểm tra lại !", tabText)); }); //this.Invoke(new Action(() => { MessageBox.Show(this, "text"); })); }
private void UpdateBetPool(eServerType serverType, string matchId, Dictionary <string, int> betPool, int stake) { if (!betPool.ContainsKey(matchId)) { betPool.Add(matchId, 0); } betPool[matchId] += stake; if (serverType == eServerType.Ibet) { IbetEngine.UpdateAvailabeCredit(); } else { SboEngine.UpdateAvailabeCredit(); } //if (OnLogBetEvent != null) //{ // var msg = new LogBetMessage() // { // HomeTeamName = match.HomeTeamName, // AwayTeamName = match.AwayTeamName, // OddType = match.OddType, // ServerType = match.ServerType, // HomeOdd = match.HomeOdd, // AwayOdd = match.AwayOdd, // BetStake = stake, // BetType = betType // }; // OnLogBetEvent(msg); //} }
public override void Read(ByteArray by) { base.Read(by); account_idx = by.ReadLong(); s_type = (eServerType)by.ReadByte(); fs_uid = by.ReadUShort(); }
public void Read(ByteArray by) { srv_uid = by.ReadUShort(); srv_type = (eServerType)by.ReadUInt(); srv_ip = by.ReadUInt(); srv_port = by.ReadUShort(); }
public void Read(ByteArray by) { srv_type = (eServerType)by.ReadUInt(); srv_realm_idx = by.ReadUShort(); srv_uid = by.ReadUShort(); srv_endpoint.Read(by); }
private void OnPingNet(PacketBase packet) { eServerType server_type = eServerType.NONE; uint packet_id = 0; //发送包id long tick = 0; //发送时间,记录延迟 long offset_time = 0; uint flags = 0; if (packet is gs2c.PingNet) { gs2c.PingNet msg = packet as gs2c.PingNet; server_type = eServerType.GATE; packet_id = msg.packet_id; tick = msg.tick; offset_time = Time.time - tick; flags = msg.flags; Log.Debug("收到gs包:" + msg.packet_id + " 时间:" + Time.time + " 延迟:" + (Time.time - msg.tick)); } else if (packet is ss2c.PingNet) { ss2c.PingNet msg = packet as ss2c.PingNet; packet_id = msg.packet_id; tick = msg.tick; offset_time = Time.time - tick; flags = msg.flags; if (Utils.HasFlag(msg.flags, (uint)eServerType.GLOBAL)) { server_type = eServerType.GLOBAL; } else { server_type = eServerType.SERVER; } Log.Debug("收到ss包:" + msg.packet_id + " 时间:" + Time.time + " 延迟:" + (Time.time - msg.tick)); } else if (packet is fs2c.PingNet) { fs2c.PingNet msg = packet as fs2c.PingNet; server_type = eServerType.FIGHT; packet_id = msg.packet_id; tick = msg.tick; offset_time = Time.time - tick; flags = msg.flags; Log.Debug("收到fs包:" + msg.packet_id + " 时间:" + Time.time + " 延迟:" + (Time.time - msg.tick)); } else if (packet is ws2c.PingNet) { ws2c.PingNet msg = packet as ws2c.PingNet; server_type = eServerType.WORLD; packet_id = msg.packet_id; tick = msg.tick; offset_time = Time.time - tick; flags = msg.flags; Log.Debug("收到ws包:" + msg.packet_id + " 时间:" + Time.time + " 延迟:" + (Time.time - msg.tick)); } if (server_type != eServerType.NONE) { EventController.TriggerEvent(ClientEventID.SERVER_PING, server_type, packet_id, tick, offset_time, flags); } }
public override void Deserialize(Packet p) { base.Deserialize(p); m_eServerType = (eServerType)p.ReadInt(); m_nSequence = p.ReadInt(); m_strIP = p.ReadString(); m_nPort = p.ReadInt(); }
public override void Deserialize(Packet p) { base.Deserialize(p); m_eServerType = (eServerType)p.ReadInt(); m_nSequence = p.ReadInt(); m_nPlayerCount = p.ReadInt(); //m_eWorldState = (eWorldState)p.ReadInt(); }
private void OnExceptionEvent(ExceptionMessage logMsg, eServerType serverType, object obj) { if (serverType == eServerType.Isn) { Thread thread = new Thread(ReStartFromIsn); thread.SetApartmentState(ApartmentState.STA); thread.Start(); } }
void sboScan_OnExceptionEvent(ExceptionMessage logMsg, eServerType serverType, object obj) { Thread thread = new Thread(() => { ReStartSbo(obj); }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); }
/// <summary> /// 广播消息 /// </summary> public void BroadcastMsg(PacketBase packet, eServerType type) { foreach (var obj in m_app_servers) { if (obj.Value.srv_info.srv_type == type) { obj.Value.Send(packet); } } }
public void GetConnAppList(List <ConnAppProc> list, eServerType type) { foreach (var obj in m_app_servers) { if (obj.Value.srv_info.srv_type == type) { list.Add(obj.Value); } } }
public void Read(ref Packet p) { m_eServerType = (eServerType)p.ReadInt(); m_eState = (eState)p.ReadInt(); m_nSequence = p.ReadInt(); m_strIP = p.ReadString(); m_nPort = p.ReadInt(); //m_eWorldState = (eWorldState)p.ReadInt(); m_nPlayerCount = p.ReadInt(); }
private void SboBetOnOnExceptionEvent(ExceptionMessage logMsg, eServerType serverType, object o) { Thread thread = new Thread(() => { ReStartSboBet(o); }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); }
public List <fmOtherServer> Find(eServerType type) { lock (m_lockObject) { if (false == m_dicOtherServers.ContainsKey(type)) { return(null); } return(m_dicOtherServers[type]); } }
public ScanInfoDTO ClientScanAccountBuyServerType(string username, eServerType serverType) { try { int accType; string linkType; switch (serverType) { case eServerType.Sbo: accType = 2; linkType = "SBO_SCAN_LINK"; break; case eServerType.Ibet: accType = 1; linkType = "IBET_SCAN_LINK"; break; default: accType = 0; linkType = ""; break; } using (var context = new WinDbEntities()) { var i = context.Users.FirstOrDefault(u => u.Username == username); if (i == null) { throw new Exception("INVALID USERNAME"); } var scanaccDto = new ScanInfoDTO(); scanaccDto.ScanServers = context.SystemConfigs.Where(a => a.KeyConfig == linkType) .Select(a => a.ValueConfig).ToList(); scanaccDto.Accounts = i.AccScanInUses.Where(a => a.ScanAccount.ServerType == accType).Select( ac => new ScanAccountInfoDTO { Username = ac.ScanAccount.Username, Password = ac.ScanAccount.Password } ).ToList(); return(scanaccDto); } } catch (Exception ex) { Logger.Error(ex); return(new ScanInfoDTO()); } }
//public MatchOddDTO(string id, string matchID, eServerType serverType, string leagueID, string leagueName, string homeTeamName, // string awayTeamName, eTimeMatchType timeType, int minutes) //{ // this.ID = id; // this.MatchID = matchID; // this.ServerType = serverType; // this.LeagueID = leagueID; // this.LeagueName = leagueName; // this.HomeTeamName = homeTeamName; // this.AwayTeamName = awayTeamName; // this.TimeType = timeType; // this.Minutes = minutes; //} public MatchOddDTO(string matchID, eServerType serverType, string leagueID, string leagueName, string homeTeamName, string awayTeamName, eTimeMatchType timeType, int minutes) { this.MatchID = matchID; this.ServerType = serverType; this.LeagueID = leagueID; this.LeagueName = leagueName; this.HomeTeamName = homeTeamName; this.AwayTeamName = awayTeamName; this.TimeType = timeType; this.Minutes = minutes; //OddChecks = new List<float>(); }
public void Connect2Server(string ip, ushort port, eServerType type, ushort srv_uid) { Log.Info("连接服务器 ip:" + ip + " port:" + port + " type:" + type + " uid:" + srv_uid); long conn_idx = NetConnectManager.Instance.ConnectTo(ip, port, OnConnected, OnMessageReveived, OnConnectClose); ConnAppProc app_server = CreateConnApp(type); app_server.conn_idx = conn_idx; app_server.srv_info.srv_type = type; app_server.srv_info.srv_uid = srv_uid; app_server.srv_info.srv_realm_idx = m_srv_realm_idx; app_server.srv_info.srv_status = eConnAppStatus.CONNECTING; m_app_servers.Add(conn_idx, app_server); }
private void OnExceptionEvent(ExceptionMessage logMsg, eServerType serverType) { if (serverType == eServerType.Ibet) { Thread thread = new Thread(ReStartFromIbet); thread.SetApartmentState(ApartmentState.STA); thread.Start(); } else { Thread thread = new Thread(ReStartFromSbo); thread.SetApartmentState(ApartmentState.STA); thread.Start(); } }
private void OnRecvPing(GameEvent evt) { eServerType server_type = evt.Get <eServerType>(0); uint packet_id = evt.Get <uint>(1); long tick = evt.Get <long>(2); long offset_time = evt.Get <long>(3); uint flags = evt.Get <uint>(4); string str = string.Format("{0} ID:{1}, 时间:{2}, 延迟:{3}, 标记:{4}", server_type, packet_id, tick, offset_time, flags); m_list_ping.Items.Add(str); if (m_list_ping.Items.Count > 8) { m_list_ping.Items.RemoveAt(0); } }
private void UpdateBetPool(eServerType serverType, string matchId, Dictionary <string, int> betPool, int stake) { if (!betPool.ContainsKey(matchId)) { betPool.Add(matchId, 0); } betPool[matchId] += stake; if (serverType == eServerType.Pina) { PiEngine.UpdateAvailabeCredit(); } else { IsnEngine.UpdateAvailabeCredit(); } }
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~连接列表~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ private ConnAppProc CreateConnApp(eServerType server_type) { ConnAppProc app_server = null; switch (server_type) { case eServerType.WORLD: app_server = new WorldMsgProc(); break; default: Log.Warning("错误的服务器类型:" + server_type); return(null); } app_server.Setup(); return(app_server); }
public void RequestRegistServer(eServerType eFromServerType) { ServerSession ss = m_session as ServerSession; descOtherServer desc = new descOtherServer(); desc.m_eServerType = m_eToServerType; ss.m_descServer = desc; using (PT_Server_RegisterAtCenter_RQ fmp = new PT_Server_RegisterAtCenter_RQ()) { fmp.m_eServerType = eFromServerType; fmp.m_nSequence = m_nSequence; fmp.m_strIP = m_fromConfig.m_strPublicIP; fmp.m_nPort = m_fromConfig.m_nPort; SendPacket(fmp); } }
private void IbetScan_OnExceptionEvent(ExceptionMessage logMsg, eServerType serverType, object obj) { IbetSubBrokerEngine engine = obj as IbetSubBrokerEngine; engine.OnExceptionEvent -= IbetScan_OnExceptionEvent; engine.LogOff(); while (engine.AccountStatus == eAccountStatus.Offline) { if (engine.ReLogin()) { engine.StartScanEngine(eScanType.Live); engine.OnExceptionEvent += IbetScan_OnExceptionEvent; break; } Thread.Sleep(15000); } }