private int ApplyAppSettingsFromIni(IniFile ini, IniFile.Section options, out string[] masterServers)
        {
            masterServers = (options.GetString("ApplyAppSettingsFromXml") ?? "").Split(',');
              this.miShowOptions.Down = options.GetBool("ShowOptions");
              this.miShowServerQuery.Down = options.GetBool("ShowServerQuery");

              this.rbAddressHidden.Checked = options.GetInt("ShowAddressMode") == 0;
              this.rbAddressQueryPort.Checked = options.GetInt("ShowAddressMode") == 1;
              this.rbAddressGamePort.Checked = options.GetInt("ShowAddressMode") == 2;
              this.cbRefreshSelectedServer.Checked = options.GetBool("RefreshSelected", true);
              this.spinRefreshInterval.EditValue = options.GetDecimal("RefreshInterval");
              this.rbUpdateListAndStatus.Checked = options.GetBool("AutoUpdateList", true);
              this.rbUpdateStatusOnly.Checked = options.GetBool("AutoUpdateInfo");
              this.cbFavServersOnTop.Checked = options.GetBool("KeepFavServersOnTop", true);
              this.cbHideUnresponsiveServers.Checked = options.GetBool("HideUnresponsiveServers", true);
              this.cbRememberColumnLayout.Checked = options.GetBool("ColumnLayoutPerTab");

              // load favorite servers
              var favs = ini.GetSection("FavoriteServers");
              if (favs != null)
              {
            foreach (var server in favs.Keys)
            {
              if (server == "") continue;
              var parts = server.Split(':');
              this.favServers.Add(new IPEndPoint(IPAddress.Parse(parts[0]), int.Parse(parts[1])), favs.GetString(server));
            }
              }
              return options.GetInt("TabIndex");
        }
Ejemplo n.º 2
0
        public void LoadFromIni(IniFile iniFile, IniFile.Section ini, GameExtensionPool pool)
        {
            this.Source = (SourceType) ini.GetInt("Type");
              this.MasterServer = ini.GetString("MasterServer") ?? "hl2master.steampowered.com:27011";
              this.InitialGameID = ini.GetInt("InitialGameID");
              this.FilterMod = ini.GetString("FilterMod");
              this.FilterMap = ini.GetString("FilterMap");
              this.TagsInclude = ini.GetString("TagsInclude");
              this.TagsExclude = ini.GetString("TagsExclude");
              this.GetEmptyServers = ini.GetBool("GetEmptyServers", true);
              this.GetFullServers = ini.GetBool("GetFullServers", true);
              this.MasterServerQueryLimit = ini.GetInt("MasterServerQueryLimit", 500);
              this.GridFilter = ini.GetString("GridFilter");

              var layout = ini.GetString("GridLayout");
              if (!string.IsNullOrEmpty(layout))
            this.ServerGridLayout = new MemoryStream(Convert.FromBase64String(layout));

              this.gameExtension = pool.Get((Game) this.InitialGameID);

              if (this.Source == SourceType.CustomList)
              {
            this.servers = new List<ServerRow>();

            // new config format
            var sec = iniFile.GetSection(ini.Name + "_Servers");
            if (sec != null)
            {
              foreach (var key in sec.Keys)
              {
            var row = new ServerRow(Ip4Utils.ParseEndpoint(key), this.gameExtension);
            row.CachedName = sec.GetString(key);
            this.servers.Add(row);
              }
            }
            else
            {
              // old config format
              var oldSetting = ini.GetString("Servers") ?? "";
              foreach (var server in oldSetting.Split('\n', ' '))
              {
            var s = server.Trim();
            if (s == "") continue;
            this.servers.Add(new ServerRow(Ip4Utils.ParseEndpoint(s), this.gameExtension));
              }
            }
              }
        }
Ejemplo n.º 3
0
        private void ReadConfigurationFromIniFile()
        {
            string iniFile = this.GetType().Assembly.Location.ToLower().Replace(".dll", ".ini");
              IniFile ini = new IniFile(iniFile);
              this.svlMapping = new DataMapping(ini.GetSection("SVL_Record"));
              this.svlMapping.DefaultEncoding = Encoding.UTF8;
              this.tslMapping = new DataMapping(ini.GetSection("TSL_Record"));
              this.tslMapping.DefaultEncoding = Encoding.UTF8;
              this.dvbMapping = new DataMapping(ini.GetSection("DVB_Data"));
              this.dvbMapping.DefaultEncoding = Encoding.UTF8;

              var sec = ini.GetSection("Columns");
              var fields = sec.GetString("DVB_T");
              if (fields != null)
            dvbtChannels.VisibleColumnFieldNames = fields.Trim().Split(',');
              fields = sec.GetString("DVB_C");
              if (fields != null)
            dvbcChannels.VisibleColumnFieldNames = fields.Trim().Split(',');
              fields = sec.GetString("DVB_S");
              if (fields != null)
            dvbsChannels.VisibleColumnFieldNames = fields.Trim().Split(',');
        }