⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 impslogger.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 2 页
字号:
                            writer.WriteEndElement();
                            writer.WriteStartElement("ExtData");
                            if (!string.IsNullOrEmpty(ext))
                            {
                                Match match = this._ExtRegex.Match(ext);
                                if (match.Success)
                                {
                                    foreach (Match match2 in Regex.Matches(match.Groups[1].Value, @"(\S+?)\s*=\s*(\S+)", RegexOptions.Multiline))
                                    {
                                        writer.WriteAttributeString(match2.Groups[1].Value, this.TrimValue(match2.Groups[2].Value));
                                    }
                                    writer.WriteCData(match.Groups[2].Value);
                                }
                                else
                                {
                                    writer.WriteCData(ext);
                                }
                            }
                            writer.WriteEndElement();
                            writer.WriteEndElement();
                            writer.Flush();
                            byte[] bytes = Encoding.UTF8.GetBytes("\r\n");
                            w.Write(bytes, 0, bytes.Length);
                        }
                        lock (this._LogFile)
                        {
                            string text = Encoding.UTF8.GetString(w.ToArray());
                            if ((this.LogType | Imps.Client.Utils.LogType.GlobalFile) != Imps.Client.Utils.LogType.None)
                            {
                                File.AppendAllText(this._LogFile, text, Encoding.UTF8);
                            }
                            if ((this.LogType | Imps.Client.Utils.LogType.SingleFile) != Imps.Client.Utils.LogType.None)
                            {
                                File.AppendAllText(this.GetLogFileNameByCategory(category), text, Encoding.UTF8);
                            }
                        }
                    }
                }
                catch
                {
                }
            }
        }

        private static string CurrentProcessId
        {
            get
            {
                if (string.IsNullOrEmpty(_processId))
                {
                    _processId = Process.GetCurrentProcess().Id.ToString();
                }
                return _processId;
            }
        }

        public bool IsLogBiz
        {
            get
            {
                return this._IsLogBiz;
            }
            set
            {
                this._IsLogBiz = value;
            }
        }

        public bool IsLogConnection
        {
            get
            {
                return this._IsLogConnection;
            }
            set
            {
                this._IsLogConnection = value;
            }
        }

        public bool IsLogException
        {
            get
            {
                return this._IsLogException;
            }
            set
            {
                this._IsLogException = value;
            }
        }

        public bool IsLogGeneral
        {
            get
            {
                return this._IsLogGeneral;
            }
            set
            {
                this._IsLogGeneral = value;
            }
        }

        public bool IsLogInstall
        {
            get
            {
                return this._IsLogInstall;
            }
            set
            {
                this._IsLogInstall = value;
            }
        }

        public bool IsLogLiveUpdate
        {
            get
            {
                return this._IsLogLiveUpdate;
            }
            set
            {
                this._IsLogLiveUpdate = value;
            }
        }

        public bool IsLogLogin
        {
            get
            {
                return this._IsLogLogin;
            }
            set
            {
                this._IsLogLogin = value;
            }
        }

        public bool IsLogSipc
        {
            get
            {
                return this._IsLogSipc;
            }
            set
            {
                this._IsLogSipc = value;
            }
        }

        public string LogFolder
        {
            get
            {
                return this._LogFolder;
            }
            set
            {
                this._LogFolder = value;
            }
        }

        public Imps.Client.Logger.LogHeader LogHeader
        {
            get
            {
                return this._LogHeader;
            }
        }

        public Imps.Client.Utils.LogType LogType
        {
            get
            {
                return this._LogType;
            }
            set
            {
                this._LogType = value;
            }
        }

        public int MaxLogNo
        {
            get
            {
                return this._MaxLogNo;
            }
            set
            {
                if ((value <= 0) || (value > 100))
                {
                    throw new ArgumentException("最大文件号必须在1-100范围之内");
                }
                this._MaxLogNo = value;
            }
        }

        public string ServerUrl
        {
            get
            {
                return this._ServerUrl;
            }
            set
            {
                this._ServerUrl = value;
            }
        }

        public int ThresholdLevel
        {
            get
            {
                return this._ThresholdLevel;
            }
            set
            {
                this._ThresholdLevel = value;
            }
        }

        private class ImpsLoggerSender
        {
            private string _ServerUrl;
            private CookieContainer cookie = new CookieContainer();

            public ImpsLoggerSender(string serverUrl)
            {
                this._ServerUrl = serverUrl;
            }

            public void Post(byte[] buffer)
            {
                this.Post(buffer, 0, buffer.Length);
            }

            public void Post(byte[] buffer, int start, int length)
            {
                HttpWebRequest request = ConnectionFactory.CreateHttpWebRequest(this._ServerUrl, null, true, true);
                if (length != 0)
                {
                    GZipStream stream = new GZipStream(request.GetRequestStream(), 1, false);
                    stream.Write(buffer, start, length);
                    stream.Close();
                }
                ((HttpWebResponse) request.GetResponse()).Close();
            }

            public void PostEnd()
            {
                this.Post(new byte[0]);
            }
        }

        [StructLayout(LayoutKind.Sequential)]
        private struct MEMORY_INFO
        {
            public uint dwLength;
            public uint dwMemoryLoad;
            public uint dwTotalPhys;
            public uint dwAvailPhys;
            public uint dwTotalPageFile;
            public uint dwAvailPageFile;
            public uint dwTotalVirtual;
            public uint dwAvailVirtual;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -