// TO DO: Better error reporting on this method. public void Shutdown() { if (Client != null) { try { lock (ShutdownConnectionLock) { if (NetworkStream != null) { NetworkStream.Close(); NetworkStream.Dispose(); NetworkStream = null; } Client.Close(); Client = null; if (ConnectionClosed != null) { FrostbiteConnection.RaiseEvent(ConnectionClosed.GetInvocationList(), this); } } } catch (SocketException) { // TO DO: Error reporting, possibly in a log file. } catch (Exception e) { FrostbiteConnection.LogError("FrostbiteLayerConnection.Shutdown", "catch (Exception e)", e); } } }
public void ShutdownLayerListener() { if (this.m_tclLayerListener != null) { try { PRoConLayerClient[] cplcShutdownClients = new PRoConLayerClient[this.LayerClients.Count]; this.LayerClients.CopyTo(cplcShutdownClients, 0); foreach (PRoConLayerClient cplcShutdownClient in cplcShutdownClients) { cplcShutdownClient.OnShutdown(); cplcShutdownClient.Shutdown(); } //if (this.m_tclLayerListener != null) { this.m_tclLayerListener.Stop(); this.m_tclLayerListener = null; //} } catch (Exception) { } if (this.LayerOffline != null) { FrostbiteConnection.RaiseEvent(this.LayerOffline.GetInvocationList()); } } //this.OnLayerServerOffline(); }
// TO DO: Better error reporting on this method. public void Shutdown() { try { if (this.ConnectionClosed != null) { FrostbiteConnection.RaiseEvent(this.ConnectionClosed.GetInvocationList(), this); } if (this.m_tcpConnection != null) { lock (new object()) { if (this.m_tcpStream != null) { this.m_tcpStream.Close(); this.m_tcpStream.Dispose(); this.m_tcpStream = null; } if (this.m_tcpConnection != null) { this.m_tcpConnection.Close(); this.m_tcpConnection = null; } } } } catch (SocketException) { // TO DO: Error reporting, possibly in a log file. } catch (Exception) { } }
public void StartLayerListener() { try { IPAddress ipBinding = this.ResolveHostName(this.BindingAddress); this.m_tclLayerListener = new TcpListener(ipBinding, this.ListeningPort); this.m_tclLayerListener.Start(); if (this.LayerOnline != null) { FrostbiteConnection.RaiseEvent(this.LayerOnline.GetInvocationList()); } //this.OnLayerServerOnline(); this.m_tclLayerListener.BeginAcceptTcpClient(this.m_asyncAcceptCallback, this); } catch (SocketException skeError) { if (this.LayerSocketError != null) { FrostbiteConnection.RaiseEvent(this.LayerSocketError.GetInvocationList(), skeError); } this.ShutdownLayerListener(); //this.OnLayerServerSocketError(skeError); } }
protected virtual void DispatchSquadIsPrivateRequest(FrostbiteLayerConnection sender, Packet cpRecievedPacket) { if (this.RequestPacketSquadIsPrivateReceived != null) { FrostbiteConnection.RaiseEvent(this.RequestPacketSquadIsPrivateReceived.GetInvocationList(), this, cpRecievedPacket); } }
protected virtual void DispatchHelpRequest(FrostbiteLayerConnection sender, Packet cpRecievedPacket) { if (this.RequestHelp != null) { FrostbiteConnection.RaiseEvent(this.RequestHelp.GetInvocationList(), this, cpRecievedPacket); } }
protected virtual void DispatchAdminShutDownRequest(FrostbiteLayerConnection sender, Packet cpRecievedPacket) { if (this.RequestPacketAdminShutdown != null) { FrostbiteConnection.RaiseEvent(this.RequestPacketAdminShutdown.GetInvocationList(), this, cpRecievedPacket); } }
private void m_connection_ConnectionClosed(FrostbiteLayerConnection sender) { if (this.ConnectionClosed != null) { FrostbiteConnection.RaiseEvent(this.ConnectionClosed.GetInvocationList(), this); } }
public void DownloadInstallPackage(string uid, bool localInstall) { if (this.CanDownloadPackage(uid) == true) { if (this.PackageBeginningDownload != null) { FrostbiteConnection.RaiseEvent(this.PackageBeginningDownload.GetInvocationList(), this, this.RemotePackages[uid]); } this.RegisterEvents(this.RemotePackages[uid]); if (localInstall == true) { switch (this.RemotePackages[uid].PackageType) { case PackageType.Plugin: //this.RegisterEvents(this.RemotePackages[uid]); this.RemotePackages[uid].DownloadPackage(PackageManager.DIRECTORY_UPDATES); break; case PackageType.Mappack: this.RemotePackages[uid].DownloadPackage(""); break; } } else { // Extract to procon folder this.RemotePackages[uid].DownloadPackage(""); } } }
private void m_prcClient_PlayerKilled(PRoConClient sender, Kill kKillerVictimDetails) { float trespassArea = 0.0F; foreach (MapZoneDrawing zone in new List <MapZoneDrawing>(MapZones)) { if (System.String.Compare(CurrentMapFileName, zone.LevelFileName, System.StringComparison.OrdinalIgnoreCase) == 0) { if ((trespassArea = zone.TrespassArea(kKillerVictimDetails.KillerLocation, 14.14F)) > 0.0F) { if (MapZoneTrespassed != null) { FrostbiteConnection.RaiseEvent(MapZoneTrespassed.GetInvocationList(), kKillerVictimDetails.Killer, ZoneAction.Kill, new MapZone(zone.UID, zone.LevelFileName, zone.Tags.ToString(), zone.ZonePolygon, true), kKillerVictimDetails.KillerLocation, trespassArea, kKillerVictimDetails); } } if ((trespassArea = zone.TrespassArea(kKillerVictimDetails.VictimLocation, 14.14F)) > 0.0F) { if (MapZoneTrespassed != null) { FrostbiteConnection.RaiseEvent(MapZoneTrespassed.GetInvocationList(), kKillerVictimDetails.Victim, ZoneAction.Death, new MapZone(zone.UID, zone.LevelFileName, zone.Tags.ToString(), zone.ZonePolygon, true), kKillerVictimDetails.VictimLocation, trespassArea, kKillerVictimDetails); } } } } }
private static void ListenIncommingLayerConnections(IAsyncResult ar) { PRoConLayer plLayer = (PRoConLayer)ar.AsyncState; if (plLayer.m_tclLayerListener != null) { try { TcpClient tcpNewConnection = plLayer.m_tclLayerListener.EndAcceptTcpClient(ar); PRoConLayerClient cplcNewConnection = new PRoConLayerClient(new FrostbiteLayerConnection(tcpNewConnection), plLayer.m_praApplication, plLayer.m_prcClient); plLayer.LayerClients.Add(cplcNewConnection); if (plLayer.ClientConnected != null) { FrostbiteConnection.RaiseEvent(plLayer.ClientConnected.GetInvocationList(), cplcNewConnection); } plLayer.m_tclLayerListener.BeginAcceptTcpClient(plLayer.m_asyncAcceptCallback, plLayer); } catch (SocketException exception) { if (plLayer.LayerSocketError != null) { FrostbiteConnection.RaiseEvent(plLayer.LayerSocketError.GetInvocationList(), exception); } plLayer.ShutdownLayerListener(); //cbfAccountsPanel.OnLayerServerSocketError(skeError); } catch (Exception) { } } }
protected virtual void DispatchUnsecureSafeListedRequest(FrostbiteLayerConnection sender, Packet cpRecievedPacket) { if (this.RequestPacketUnsecureSafeListedRecieved != null) { FrostbiteConnection.RaiseEvent(this.RequestPacketUnsecureSafeListedRecieved.GetInvocationList(), this, cpRecievedPacket); } }
protected virtual void DispatchAlterReservedSlotsListRequest(FrostbiteLayerConnection sender, Packet cpRecievedPacket) { if (this.RequestPacketAlterReservedSlotsListRecieved != null) { FrostbiteConnection.RaiseEvent(this.RequestPacketAlterReservedSlotsListRecieved.GetInvocationList(), this, cpRecievedPacket); } }
private void Tags_TagsEdited(ZoneTagList sender) { if (this.TagsEdited != null) { FrostbiteConnection.RaiseEvent(this.TagsEdited.GetInvocationList(), this); } }
private void item_TagsEdited(MapZoneDrawing sender) { if (this.MapZoneChanged != null) { FrostbiteConnection.RaiseEvent(this.MapZoneChanged.GetInvocationList(), sender); } }
private void GameConfigInfo() { this.m_blGameConfigHint = true; if (this.GameConfigUpdated != null) { FrostbiteConnection.RaiseEvent(this.GameConfigUpdated.GetInvocationList()); } }
//private void focus_DownloadProgressUpdate(Package sender, CDownloadFile file) { // this.UnregisterEvents(sender); //} private void focus_DownloadComplete(Package sender, CDownloadFile file) { //this.UnregisterEvents(sender); if (this.PackageDownloaded != null) { FrostbiteConnection.RaiseEvent(this.PackageDownloaded.GetInvocationList(), this, sender); } }
private void focus_PackageEndUnzip(Package sender) { this.UnregisterEvents(sender); if (this.PackageAwaitingRestart != null) { FrostbiteConnection.RaiseEvent(this.PackageAwaitingRestart.GetInvocationList(), this, sender); } }
protected override void SetItem(int index, CPlayerInfo item) { if (this.PlayerRemoved != null) { FrostbiteConnection.RaiseEvent(this.PlayerRemoved.GetInvocationList(), item); } base.SetItem(index, item); }
private void Write(DateTime dtLoggedTime, string strText) { WriteLogLine(String.Format("[{0}] {1}", dtLoggedTime.ToString("HH:mm:ss"), strText.Replace("{", "{{").Replace("}", "}}"))); if (WriteConsole != null) { FrostbiteConnection.RaiseEvent(WriteConsole.GetInvocationList(), dtLoggedTime, strText); } }
protected override void InsertItem(int index, Account item) { base.InsertItem(index, item); if (this.AccountAdded != null) { FrostbiteConnection.RaiseEvent(this.AccountAdded.GetInvocationList(), item); } }
protected override void RemoveItem(int index) { if (this.LayerClientDisconnected != null) { FrostbiteConnection.RaiseEvent(this.LayerClientDisconnected.GetInvocationList(), this[index]); } base.RemoveItem(index); }
private void focus_DownloadError(Package sender, CDownloadFile file) { this.UnregisterEvents(sender); if (this.PackageDownloadFail != null) { FrostbiteConnection.RaiseEvent(this.PackageDownloadFail.GetInvocationList(), this, sender); } }
protected override void RemoveItem(int index) { if (AccountRemoved != null) { FrostbiteConnection.RaiseEvent(AccountRemoved.GetInvocationList(), this[index]); } base.RemoveItem(index); }
protected override void InsertItem(int index, PRoConClient item) { if (this.ConnectionAdded != null) { FrostbiteConnection.RaiseEvent(this.ConnectionAdded.GetInvocationList(), item); } base.InsertItem(index, item); }
/// <summary> /// This public method is used whenever the chat console has been written to via /// the procon.protected.chat.write command (basically plugin output) /// </summary> /// <param name="strText"></param> public void WriteViaCommand(string strText) { Write(DateTime.UtcNow.ToUniversalTime().AddHours(Client.Game.UtcOffset).ToLocalTime(), strText); if (WriteConsoleViaCommand != null) { FrostbiteConnection.RaiseEvent(WriteConsoleViaCommand.GetInvocationList(), DateTime.UtcNow.ToUniversalTime().AddHours(Client.Game.UtcOffset).ToLocalTime(), strText); } }
protected override void SetItem(int index, Account item) { if (this.AccountChanged != null) { FrostbiteConnection.RaiseEvent(this.AccountChanged.GetInvocationList(), item); } base.SetItem(index, item); }
public void SetPrivileges(CPrivileges cpUpdatedPrivileges) { Privileges = cpUpdatedPrivileges; if (AccountPrivilegesChanged != null) { FrostbiteConnection.RaiseEvent(AccountPrivilegesChanged.GetInvocationList(), this); } }
protected override void SetItem(int index, PRoConLayerClient item) { if (this.LayerClientAltered != null) { FrostbiteConnection.RaiseEvent(this.LayerClientAltered.GetInvocationList(), item); } base.SetItem(index, item); }
protected override void InsertItem(int index, CLocalization item) { base.InsertItem(index, item); if (this.LanguageAdded != null) { FrostbiteConnection.RaiseEvent(this.LanguageAdded.GetInvocationList(), item); } }