示例#1
0
        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();
                    }
        }