void LoadUserSettings() { //if (!File.Exists(UserSettingsFilePath)) // return; using (FileStream fs = File.OpenRead(UserSettingsFilePath)) using (var xs = new XorStream(fs)) using (var gzs = new GZipStream(xs, CompressionMode.Decompress)) { var reader = new RawDataReader(xs, Encoding.UTF8); byte[] sign = Encoding.UTF8.GetBytes(USER_SETTINGS_SIGNATURE); for (int i = 0; i < sign.Length; ++i) { if (sign[i] != reader.ReadByte()) { throw new CorruptedFileException(UserSettingsFilePath); } } IsMaximized = reader.ReadBoolean(); int x = reader.ReadInt(); int y = reader.ReadInt(); int w = reader.ReadInt(); int h = reader.ReadInt(); FrameRectangle = new Rectangle(x, y, w, h); UseCountryCode = reader.ReadBoolean(); int mruSize = reader.ReadInt(); int mruCount = reader.ReadInt(); MRUSubHeading = new MRUList <SubHeading>(mruSize); for (int i = 0; i < mruCount; ++i) { MRUSubHeading.Add(new SubHeading(reader.ReadULong())); } AutoDetectProxy = reader.ReadBoolean(); EnableProxy = reader.ReadBoolean(); ProxyHost = reader.ReadString(); ProxyPort = reader.ReadUShort(); } }
Message ProcessLogMessage(Message msg, uint clID) { Dbg.Assert(msg.MessageCode == Message_t.Log); var ms = new MemoryStream(msg.Data); var reader = new RawDataReader(ms, Encoding.UTF8); DateTime tm = reader.ReadTime(); bool isErr = reader.ReadBoolean(); string txt = reader.ReadString(); if (isErr) { AppContext.LogManager.LogSysActivity($"Réception log d'erreur du client {ClientStrID(clID)}"); AppContext.LogManager.LogClientError(clID, txt, tm); } else { AppContext.LogManager.LogSysActivity($"Réception d'un log d'activité du client {ClientStrID(clID)}"); AppContext.LogManager.LogClientActivity(clID, txt, tm); } return(null); }