protected virtual void DispatchAdminShutDownRequest(FrostbiteLayerConnection sender, Packet cpRecievedPacket)
 {
     if (this.RequestPacketAdminShutdown != null)
     {
         FrostbiteConnection.RaiseEvent(this.RequestPacketAdminShutdown.GetInvocationList(), this, cpRecievedPacket);
     }
 }
 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 DispatchAlterReservedSlotsListRequest(FrostbiteLayerConnection sender, Packet cpRecievedPacket)
 {
     if (this.RequestPacketAlterReservedSlotsListRecieved != null)
     {
         FrostbiteConnection.RaiseEvent(this.RequestPacketAlterReservedSlotsListRecieved.GetInvocationList(), this, cpRecievedPacket);
     }
 }
 protected virtual void DispatchUnsecureSafeListedRequest(FrostbiteLayerConnection sender, Packet cpRecievedPacket)
 {
     if (this.RequestPacketUnsecureSafeListedRecieved != null)
     {
         FrostbiteConnection.RaiseEvent(this.RequestPacketUnsecureSafeListedRecieved.GetInvocationList(), this, cpRecievedPacket);
     }
 }
Exemple #6
0
 private void item_TagsEdited(MapZoneDrawing sender)
 {
     if (this.MapZoneChanged != null)
     {
         FrostbiteConnection.RaiseEvent(this.MapZoneChanged.GetInvocationList(), sender);
     }
 }
Exemple #7
0
 private void Tags_TagsEdited(ZoneTagList sender)
 {
     if (this.TagsEdited != null)
     {
         FrostbiteConnection.RaiseEvent(this.TagsEdited.GetInvocationList(), this);
     }
 }
Exemple #8
0
        void m_prcClient_PacketRecieved(FrostbiteConnection sender, bool isHandled, Packet packetBeforeDispatch)
        {
            Packet cpRequestPacket = this.m_prcClient.Game.Connection.GetRequestPacket(packetBeforeDispatch);

            if (packetBeforeDispatch.OriginatedFromServer == false && packetBeforeDispatch.IsResponse == true)
            {
                if (this.LogDebugDetails == true && cpRequestPacket != null)
                {
                    if (cpRequestPacket.OriginatedFromServer == false)
                    {
                        this.Write(this.GetDebugPacket("^6Client", "^4", packetBeforeDispatch, cpRequestPacket));
                        //this.Write("^b^6{0,18}^0 {1}\tS:{2}\t^4{3}\t^0(RE: ^2{4}^0)", "Command:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().TrimEnd('\r', '\n').Replace("{", "{{").Replace("}", "}}"), cpRequestPacket.ToString().Replace("{", "{{").Replace("}", "}}"));
                    }
                    else
                    {
                        if (this.LogEventsConnection == true)
                        {
                            this.Write(this.GetDebugPacket("^8Server", "^4", packetBeforeDispatch, cpRequestPacket));
                            //this.Write("^b^8{0,18}^0 {1}\tS:{2}\t^4{3}\t^0(RE: ^2{4}^0)", "Event:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().TrimEnd('\r', '\n').Replace("{", "{{").Replace("}", "}}"), cpRequestPacket.ToString().Replace("{", "{{").Replace("}", "}}"));
                        }
                    }
                }
                else
                {
                    if ((cpRequestPacket != null && cpRequestPacket.OriginatedFromServer == false) || this.LogEventsConnection == true)
                    {
                        this.Write("^b^4{0}", packetBeforeDispatch.ToString().TrimEnd('\r', '\n').Replace("{", "{{").Replace("}", "}}"));
                    }
                }
            }
            // ELSE IF it's an event initiated by the server (OnJoin, OnLeave, OnChat etc)
            else if (packetBeforeDispatch.OriginatedFromServer == true && packetBeforeDispatch.IsResponse == false)
            {
                if (this.LogDebugDetails == true)
                {
                    if (cpRequestPacket != null && cpRequestPacket.OriginatedFromServer == false)
                    {
                        this.Write(this.GetDebugPacket("^6Client", "^4", packetBeforeDispatch, null));
                        //this.Write("^b^6{0,18}^0 {1}\tS:{2}\t^4{3}", "Command:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().Replace("{", "{{").Replace("}", "}}"));
                    }
                    else
                    {
                        if (this.LogEventsConnection == true)
                        {
                            this.Write(this.GetDebugPacket("^8Server", "^4", packetBeforeDispatch, null));
                            //this.Write("^b^8{0,18}^0 {1}\tS:{2}\t^4{3}", "Event:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().Replace("{", "{{").Replace("}", "}}"));
                        }
                    }
                }
                else
                {
                    if ((cpRequestPacket != null && cpRequestPacket.OriginatedFromServer == false) || this.LogEventsConnection == true)
                    {
                        this.Write("^b^4{0}", packetBeforeDispatch.ToString().TrimEnd('\r', '\n').Replace("{", "{{").Replace("}", "}}"));
                    }
                }
            }

            this.BytesRecieved += packetBeforeDispatch.PacketSize;
        }
Exemple #9
0
        private void m_prcClient_PacketSent(FrostbiteConnection sender, bool isHandled, Packet packetBeforeDispatch)
        {
            if (this.LogDebugDetails == true)
            {
                if (packetBeforeDispatch.OriginatedFromServer == false)
                {
                    this.Write(this.GetDebugPacket("^6Client", "^2", packetBeforeDispatch, null));

                    //this.Write("^b^6{0,18}^0 {1}\tS:{2}\t^2{3}", "Command:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().TrimEnd('\r', '\n'));
                }
                else
                {
                    if (this.LogEventsConnection == true)
                    {
                        this.Write(this.GetDebugPacket("^8Server", "^2", packetBeforeDispatch, null));

                        //this.Write("^b^8{0,18}^0 {1}\tS:{2}\t^2{3}", "Event:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().TrimEnd('\r', '\n'));
                    }
                }
            }
            else
            {
                if (packetBeforeDispatch.OriginatedFromServer == false || this.LogEventsConnection == true)
                {
                    this.Write("^b^2{0}", packetBeforeDispatch.ToString().TrimEnd('\r', '\n'));
                }
            }

            this.BytesSent += packetBeforeDispatch.PacketSize;
        }
Exemple #10
0
        // 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) {
            }
        }
Exemple #11
0
        // 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);
                }
            }
        }
Exemple #12
0
        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();
        }
 private void m_connection_ConnectionClosed(FrostbiteLayerConnection sender)
 {
     if (this.ConnectionClosed != null)
     {
         FrostbiteConnection.RaiseEvent(this.ConnectionClosed.GetInvocationList(), this);
     }
 }
Exemple #14
0
        private void m_prcClient_PlayerKilled(PRoConClient sender, Kill kKillerVictimDetails)
        {
            float flTrespassArea = 0.0F;

            foreach (MapZoneDrawing zone in new List <MapZoneDrawing>(this.MapZones))
            {
                if (String.Compare(this.m_currentMapFileName, zone.LevelFileName, true) == 0)
                {
                    if ((flTrespassArea = zone.TrespassArea(kKillerVictimDetails.KillerLocation, 14.14F)) > 0.0F)
                    {
                        if (this.MapZoneTrespassed != null)
                        {
                            FrostbiteConnection.RaiseEvent(this.MapZoneTrespassed.GetInvocationList(), kKillerVictimDetails.Killer, ZoneAction.Kill, new MapZone(zone.UID, zone.LevelFileName, zone.Tags.ToString(), zone.ZonePolygon, true), kKillerVictimDetails.KillerLocation, flTrespassArea, kKillerVictimDetails);
                        }
                    }

                    if ((flTrespassArea = zone.TrespassArea(kKillerVictimDetails.VictimLocation, 14.14F)) > 0.0F)
                    {
                        if (this.MapZoneTrespassed != null)
                        {
                            FrostbiteConnection.RaiseEvent(this.MapZoneTrespassed.GetInvocationList(), kKillerVictimDetails.Victim, ZoneAction.Death, new MapZone(zone.UID, zone.LevelFileName, zone.Tags.ToString(), zone.ZonePolygon, true), kKillerVictimDetails.VictimLocation, flTrespassArea, kKillerVictimDetails);
                        }
                    }
                }
            }
        }
Exemple #15
0
 protected void m_prcClient_PacketQueued(FrostbiteConnection sender, Packet cpPacket, int iThreadId)
 {
     if (LogDebugDetails == true)
     {
         Write(GetDebugPacket("^7Queued", "^2", cpPacket, null));
     }
 }
Exemple #16
0
        private void DownloadRateUpdater(Object obj)
        {
            CDownloadFile cdfParent = ((CDownloadFile)obj);

            int iTickCount = 0;

            int[] a_iKiBytesPerTick      = new int[50];
            int   iPreviousTickReadBytes = 0;

            while (((CDownloadFile)obj).FileDownloading == true)
            {
                a_iKiBytesPerTick[iTickCount] = cdfParent.m_iReadBytes - iPreviousTickReadBytes;
                iTickCount = (++iTickCount % 50);

                cdfParent.m_dblKibPerSecond = 0.0;
                foreach (int iKiBytesTick in a_iKiBytesPerTick)
                {
                    cdfParent.m_dblKibPerSecond += iKiBytesTick;
                }

                cdfParent.m_dblKibPerSecond = cdfParent.m_dblKibPerSecond / 5120; // / 1024 / 5;

                iPreviousTickReadBytes = cdfParent.m_iReadBytes;

                if (cdfParent.DownloadProgressUpdate != null && iPreviousTickReadBytes > 0)
                {
                    //cdfParent.DownloadProgressUpdate(cdfParent);

                    FrostbiteConnection.RaiseEvent(cdfParent.DownloadProgressUpdate.GetInvocationList(), cdfParent);
                }

                Thread.Sleep(100);
            }
        }
Exemple #17
0
        // string strLocalizationFilePath,
        public CLocalization(string strLocalizationFilePath, string strLocalizationFileName)
        {
            this.m_strLocalizationFileName = strLocalizationFileName;
            this.m_strLocalizationFilePath = strLocalizationFilePath;
            this.m_dicLocalizedStrings     = new Dictionary <string, string>();

            try {
                string strFullLocalizationFile = Encoding.Unicode.GetString(File.ReadAllBytes(this.m_strLocalizationFilePath));

                MatchCollection mtcAllVariables = Regex.Matches(strFullLocalizationFile, "^(.*?)=(.*?)[\\r]?$", RegexOptions.Multiline);

                foreach (Match mtVariable in mtcAllVariables)
                {
                    if (this.m_dicLocalizedStrings.ContainsKey(mtVariable.Groups[1].Value) == false)
                    {
                        this.m_dicLocalizedStrings.Add(mtVariable.Groups[1].Value, mtVariable.Groups[2].Value);
                    }
                    else
                    {
                        this.m_dicLocalizedStrings[mtVariable.Groups[1].Value] = mtVariable.Groups[2].Value;
                    }
                }
            }
            catch (Exception e) {
                FrostbiteConnection.LogError("CLocalization", String.Empty, e);
                // TO DO: Nice error message for loading localization file error.
            }
        }
        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 focus_PackageBeginUnzip(Package sender)
 {
     if (this.PackageInstalling != null)
     {
         FrostbiteConnection.RaiseEvent(this.PackageInstalling.GetInvocationList(), this, sender);
     }
 }
Exemple #20
0
        // TO DO: Better error reporting on this method.
        public void Shutdown()
        {
            try
            {
                lock (ShutdownConnectionLock)
                {
                    if (NetworkStream != null)
                    {
                        NetworkStream.Close();
                        NetworkStream.Dispose();
                        NetworkStream = null;
                    }
                    if (Client != null)
                    {
                        Client.Close();
                        Client = null;
                    }

                    this.OnConnectionClosed();
                }
            }
            catch (SocketException)
            {
                // TO DO: Error reporting, possibly in a log file.
            }
            catch (Exception e)
            {
                FrostbiteConnection.LogError("FrostbiteLayerConnection.Shutdown", "catch (Exception e)", e);
            }
            finally
            {
                this.NullActions();
            }
        }
Exemple #21
0
        private Enum GenerateEnum(string enumName, string[] literals)
        {
            Enum returnEnum = null;

            try {
                if (this.m_dicGeneratedEnums.ContainsKey(enumName) == false)
                {
                    EnumBuilder enumBuilder = m_modBuilder.DefineEnum(enumName, TypeAttributes.Public, typeof(System.Int32));
                    //string[] al = { "en-US", "en-UK", "ar-SA", "da-DK", "French", "Cantonese" };
                    for (int i = 0; i < literals.Length; i++)
                    {
                        // here al is an array list with a list of string values
                        if (literals[i].ToString().Length > 0)
                        {
                            enumBuilder.DefineLiteral(literals[i].ToString(), i);
                        }
                    }

                    Type enumType = enumBuilder.CreateType();
                    returnEnum = (Enum)Activator.CreateInstance(enumType);

                    this.m_dicGeneratedEnums.Add(enumName, returnEnum);
                }
                else
                {
                    returnEnum = this.m_dicGeneratedEnums[enumName];
                }
            }
            catch (Exception e) {
                FrostbiteConnection.LogError("uscPluginPanel.GenerateEnum", enumName + " " + String.Join("|", literals), e);
            }

            return(returnEnum);
        }
Exemple #22
0
        protected void m_prcClient_PacketSent(FrostbiteConnection sender, bool isHandled, Packet packetBeforeDispatch)
        {
            if (LogDebugDetails == true)
            {
                if (packetBeforeDispatch.OriginatedFromServer == false)
                {
                    Write(GetDebugPacket("^6Client", "^2", packetBeforeDispatch, null));
                }
                else
                {
                    if (LogEventsConnection == true)
                    {
                        Write(GetDebugPacket("^8Server", "^2", packetBeforeDispatch, null));
                    }
                }
            }
            else
            {
                if (packetBeforeDispatch.OriginatedFromServer == false || LogEventsConnection == true)
                {
                    Write("^b^2{0}", packetBeforeDispatch.ToString().TrimEnd('\r', '\n'));
                }
            }

            BytesSent += packetBeforeDispatch.PacketSize;
        }
Exemple #23
0
        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);
            }
        }
Exemple #24
0
        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) {
                }
            }
        }
Exemple #25
0
 private void GameConfigInfo()
 {
     this.m_blGameConfigHint = true;
     if (this.GameConfigUpdated != null)
     {
         FrostbiteConnection.RaiseEvent(this.GameConfigUpdated.GetInvocationList());
     }
 }
Exemple #26
0
        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 SetItem(int index, PRoConLayerClient item)
        {
            if (this.LayerClientAltered != null)
            {
                FrostbiteConnection.RaiseEvent(this.LayerClientAltered.GetInvocationList(), item);
            }

            base.SetItem(index, item);
        }
        protected override void RemoveItem(int index)
        {
            if (this.LayerClientDisconnected != null)
            {
                FrostbiteConnection.RaiseEvent(this.LayerClientDisconnected.GetInvocationList(), this[index]);
            }

            base.RemoveItem(index);
        }
Exemple #29
0
        protected override void InsertItem(int index, PRoConClient item)
        {
            if (this.ConnectionAdded != null)
            {
                FrostbiteConnection.RaiseEvent(this.ConnectionAdded.GetInvocationList(), item);
            }

            base.InsertItem(index, item);
        }
Exemple #30
0
        protected override void SetItem(int index, Account item)
        {
            if (this.AccountChanged != null)
            {
                FrostbiteConnection.RaiseEvent(this.AccountChanged.GetInvocationList(), item);
            }

            base.SetItem(index, item);
        }
Exemple #31
0
        void m_prcClient_PacketRecieved(FrostbiteConnection sender, bool isHandled, Packet packetBeforeDispatch) {

            Packet cpRequestPacket = this.m_prcClient.Game.Connection.GetRequestPacket(packetBeforeDispatch);

            if (packetBeforeDispatch.OriginatedFromServer == false && packetBeforeDispatch.IsResponse == true) {

                if (this.LogDebugDetails == true && cpRequestPacket != null) {

                    if (cpRequestPacket.OriginatedFromServer == false) {
                        this.Write(this.GetDebugPacket("^6Client", "^4", packetBeforeDispatch, cpRequestPacket));
                        //this.Write("^b^6{0,18}^0 {1}\tS:{2}\t^4{3}\t^0(RE: ^2{4}^0)", "Command:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().TrimEnd('\r', '\n').Replace("{", "{{").Replace("}", "}}"), cpRequestPacket.ToString().Replace("{", "{{").Replace("}", "}}"));
                    }
                    else {
                        if (this.LogEventsConnection == true) {
                            this.Write(this.GetDebugPacket("^8Server", "^4", packetBeforeDispatch, cpRequestPacket));
                            //this.Write("^b^8{0,18}^0 {1}\tS:{2}\t^4{3}\t^0(RE: ^2{4}^0)", "Event:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().TrimEnd('\r', '\n').Replace("{", "{{").Replace("}", "}}"), cpRequestPacket.ToString().Replace("{", "{{").Replace("}", "}}"));
                        }
                    }
                }
                else {
                    if ((cpRequestPacket != null && cpRequestPacket.OriginatedFromServer == false) || this.LogEventsConnection == true) {
                        this.Write("^b^4{0}", packetBeforeDispatch.ToString().TrimEnd('\r', '\n').Replace("{", "{{").Replace("}", "}}"));
                    }
                }
            }
            // ELSE IF it's an event initiated by the server (OnJoin, OnLeave, OnChat etc)
            else if (packetBeforeDispatch.OriginatedFromServer == true && packetBeforeDispatch.IsResponse == false) {

                if (this.LogDebugDetails == true) {

                    if (cpRequestPacket != null && cpRequestPacket.OriginatedFromServer == false) {
                        this.Write(this.GetDebugPacket("^6Client", "^4", packetBeforeDispatch, null));
                        //this.Write("^b^6{0,18}^0 {1}\tS:{2}\t^4{3}", "Command:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().Replace("{", "{{").Replace("}", "}}"));
                    }
                    else {
                        if (this.LogEventsConnection == true) {
                            this.Write(this.GetDebugPacket("^8Server", "^4", packetBeforeDispatch, null));
                            //this.Write("^b^8{0,18}^0 {1}\tS:{2}\t^4{3}", "Event:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().Replace("{", "{{").Replace("}", "}}"));
                        }
                    }
                }
                else {
                    if ((cpRequestPacket != null && cpRequestPacket.OriginatedFromServer == false) || this.LogEventsConnection == true) {
                        this.Write("^b^4{0}", packetBeforeDispatch.ToString().TrimEnd('\r', '\n').Replace("{", "{{").Replace("}", "}}"));
                    }
                }

            }

            this.BytesRecieved += packetBeforeDispatch.PacketSize;
        }
Exemple #32
0
        private void m_prcClient_PacketSent(FrostbiteConnection sender, bool isHandled, Packet packetBeforeDispatch) {

            if (this.LogDebugDetails == true) {

                if (packetBeforeDispatch.OriginatedFromServer == false) {
                    this.Write(this.GetDebugPacket("^6Client", "^2", packetBeforeDispatch, null));

                    //this.Write("^b^6{0,18}^0 {1}\tS:{2}\t^2{3}", "Command:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().TrimEnd('\r', '\n'));
                }
                else {
                    if (this.LogEventsConnection == true) {
                        this.Write(this.GetDebugPacket("^8Server", "^2", packetBeforeDispatch, null));

                        //this.Write("^b^8{0,18}^0 {1}\tS:{2}\t^2{3}", "Event:", this.GetRequestResponseColour(packetBeforeDispatch), packetBeforeDispatch.SequenceNumber, packetBeforeDispatch.ToDebugString().TrimEnd('\r', '\n'));
                    }
                }

            }
            else {
                if (packetBeforeDispatch.OriginatedFromServer == false || this.LogEventsConnection == true) {
                    this.Write("^b^2{0}", packetBeforeDispatch.ToString().TrimEnd('\r', '\n'));
                }
            }

            this.BytesSent += packetBeforeDispatch.PacketSize;
        }
Exemple #33
0
        private void m_prcClient_PacketQueued(FrostbiteConnection sender, Packet cpPacket, int iThreadId) {
            if (this.LogDebugDetails == true) {

                this.Write(this.GetDebugPacket("^7Queued", "^2", cpPacket, null));

                //this.Write("^b^7Queued({0}):\t^0 {1}\tS:{2}\t^2{3}", iThreadId, this.GetRequestResponseColour(cpPacket), cpPacket.SequenceNumber, cpPacket.ToDebugString().TrimEnd('\r', '\n'));
            }
        }