Exemplo n.º 1
0
        public static void LoadGlobalOptions()
        {
            if (!File.Exists(Path.Combine(General.SavePath, "GlobalOptions.bin")))
            {
                return;
            }

            using (FileStream bin = new FileStream(Path.Combine(General.SavePath, "GlobalOptions.bin"), FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                GenericReader reader = new BinaryFileReader(new BinaryReader(bin));

                int version = reader.ReadInt();

                if (version >= 2)
                {
                    s_MultiPort = reader.ReadInt();
                }
                if (version >= 2)
                {
                    s_MultiServer = reader.ReadString();
                }

                int count = 0;
                if (version >= 1)
                {
                    count = reader.ReadInt();
                    Notification not = null;
                    for (int i = 0; i < count; ++i)
                    {
                        not = new Notification();
                        not.Load(reader);
                    }
                }

                count = reader.ReadInt();
                string txt = "";
                for (int i = 0; i < count; ++i)
                {
                    txt = reader.ReadString();
                    if (!s_Filters.Contains(txt))
                    {
                        s_Filters.Add(txt);
                    }
                }

                s_FilterPenalty = (FilterPenalty)reader.ReadInt();
                if (version >= 1)
                {
                    s_MacroPenalty = (MacroPenalty)reader.ReadInt();
                }
                s_MaxMsgs         = reader.ReadInt();
                s_ChatSpam        = reader.ReadInt();
                s_MsgSpam         = reader.ReadInt();
                s_RequestSpam     = reader.ReadInt();
                s_FilterBanLength = reader.ReadInt();
                s_FilterWarnings  = reader.ReadInt();
                if (version >= 1)
                {
                    s_AntiMacroDelay = reader.ReadInt();
                }
                s_IrcPort          = reader.ReadInt();
                s_IrcMaxAttempts   = reader.ReadInt();
                s_IrcEnabled       = reader.ReadBool();
                s_IrcAutoConnect   = reader.ReadBool();
                s_IrcAutoReconnect = reader.ReadBool();
                s_FilterSpeech     = reader.ReadBool();
                s_FilterMsg        = reader.ReadBool();
                s_Debug            = reader.ReadBool();
                s_LogChat          = reader.ReadBool();
                s_LogPms           = reader.ReadBool();
                s_IrcStaffColor    = (IrcColor)reader.ReadInt();
                s_IrcServer        = reader.ReadString();
                s_IrcRoom          = reader.ReadString();
                s_IrcNick          = reader.ReadString();
                s_TotalChats       = reader.ReadULong() - 1;
            }
        }