コード例 #1
0
 public ServerRow(IPEndPoint ep, GameExtension extension, ServerInfo info = null)
 {
     this.EndPoint      = ep;
     this.GameExtension = extension;
     this.ServerInfo    = info;
     this.PlayerCount   = new PlayerCountInfo(this);
 }
コード例 #2
0
        public void AssignFrom(TabViewModel opt)
        {
            this.MasterServer           = opt.MasterServer;
            this.InitialGameID          = opt.InitialGameID;
            this.FilterMod              = opt.FilterMod;
            this.FilterMap              = opt.FilterMap;
            this.TagsIncludeServer      = opt.TagsIncludeServer;
            this.TagsExcludeServer      = opt.TagsExcludeServer;
            this.GetEmptyServers        = opt.GetEmptyServers;
            this.GetFullServers         = opt.GetFullServers;
            this.MasterServerQueryLimit = opt.MasterServerQueryLimit;

            this.Source             = opt.Source;
            this.serverSource       = opt.serverSource;
            this.Servers            = new List <ServerRow>(opt.Servers);
            this.gameExtension      = opt.gameExtension;
            this.GridFilter         = opt.GridFilter;
            this.MinPlayers         = opt.MinPlayers;
            this.MinPlayersInclBots = opt.MinPlayersInclBots;
            this.MaxPing            = opt.MaxPing;
            this.TagsIncludeClient  = opt.TagsIncludeClient;
            this.TagsExcludeClient  = opt.TagsExcludeClient;
            this.ServerGridLayout   = opt.ServerGridLayout;
            this.VersionMatch       = opt.VersionMatch;
            this.CustomDetailColumns.AddRange(opt.CustomDetailColumns);
            this.CustomRuleColumns.AddRange(opt.CustomRuleColumns);
            this.HideColumns.AddRange(opt.HideColumns);
        }
コード例 #3
0
 public object GetExtenderCellValue(GameExtension extension, string field)
 {
     if (this.ServerInfo == null)
     return null;
       object value;
       if (!this.extenderFieldCache.TryGetValue(field, out value))
     this.extenderFieldCache[field] = value = extension.GetServerCellValue(this, field);
       return value;
 }
コード例 #4
0
 public UpdateRequest(Game appId, int maxResults, int timeout, GameExtension gameExtension, bool callGetInfo)
 {
     this.Timestamp     = DateTime.Now.Ticks;
     this.AppId         = appId;
     this.MaxResults    = maxResults;
     this.Timeout       = timeout;
     this.GameExtension = gameExtension;
     this.CallGetInfo   = callGetInfo;
 }
コード例 #5
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));
              }
            }
              }
        }
コード例 #6
0
        public void AssignFrom(IViewModel opt)
        {
            this.MasterServer = opt.MasterServer;
              this.InitialGameID = opt.InitialGameID;
              this.FilterMod = opt.FilterMod;
              this.FilterMap = opt.FilterMap;
              this.TagsInclude = opt.TagsInclude;
              this.TagsExclude = opt.TagsExclude;
              this.GetEmptyServers = opt.GetEmptyServers;
              this.GetFullServers = opt.GetFullServers;
              this.MasterServerQueryLimit = opt.MasterServerQueryLimit;

              var vm = opt as TabViewModel;
              if (vm == null)
            return;

              this.Source = vm.Source;
              this.serverSource = vm.serverSource;
              this.servers = vm.servers;
              this.gameExtension = vm.gameExtension;
              this.GridFilter = vm.GridFilter;
              this.ServerGridLayout = vm.ServerGridLayout;
        }
コード例 #7
0
        private void InitGameExtension()
        {
            this.gvServers.BeginUpdate();
              var cols = new List<GridColumn>(this.gvServers.Columns);
              foreach (var col in cols)
              {
            if (col.Tag != null)
              this.gvServers.Columns.Remove(col);
            else
              col.Visible = true;
              }

              if (!extenders.TryGetValue(this.SteamAppID, out this.gameExtension))
            this.gameExtension = new GameExtension();
              this.gameExtension.CustomizeServerGridColumns(gvServers);
              this.gameExtension.CustomizePlayerGridColumns(gvPlayers);
              this.gvServers.EndUpdate();

              this.miConnectSpectator.Visibility = this.gameExtension.SupportsConnectAsSpectator ? BarItemVisibility.Always : BarItemVisibility.Never;
        }
コード例 #8
0
            private int DataModified; // bool, but there is no Interlocked.Exchange(bool)

            #endregion Fields

            #region Constructors

            public UpdateRequest(Game appId, int maxResults, int timeout, GameExtension gameExtension)
            {
                this.Timestamp = DateTime.Now.Ticks;
                this.AppId = appId;
                this.MaxResults = maxResults;
                this.Timeout = timeout;
                this.GameExtension = gameExtension;
            }
コード例 #9
0
 public ServerRow(IPEndPoint ep, GameExtension extension)
 {
     this.EndPoint = ep;
       this.PlayerCount = new PlayerCountInfo(this);
       this.GameExtension = extension;
 }
コード例 #10
0
 public void SetGameExtension(GameExtension ext)
 {
     this.GameExtension = ext;
 }
コード例 #11
0
        public void LoadFromIni(IniFile iniFile, IniFile.Section ini, GameExtensionPool pool, bool ignoreMasterServer)
        {
            this.Source                 = (SourceType)ini.GetInt("Type");
            this.Caption                = ini.GetString("TabName");
            this.MasterServer           = (ignoreMasterServer ? null : ini.GetString("MasterServer")) ?? "";
            this.InitialGameID          = ini.GetInt("InitialGameID");
            this.FilterMod              = ini.GetString("FilterMod");
            this.FilterMap              = ini.GetString("FilterMap");
            this.TagsIncludeServer      = ini.GetString("TagsInclude");
            this.TagsExcludeServer      = ini.GetString("TagsExclude");
            this.VersionMatch           = ini.GetString("VersionMatch");
            this.GetEmptyServers        = ini.GetBool("GetEmptyServers", true);
            this.GetFullServers         = ini.GetBool("GetFullServers", true);
            this.MasterServerQueryLimit = ini.GetInt("MasterServerQueryLimit", this.MasterServerQueryLimit);
            this.GridFilter             = ini.GetString("GridFilter");
            this.MinPlayers             = ini.GetInt("MinPlayers");
            this.MinPlayersInclBots     = ini.GetBool("MinPlayersInclBots");
            this.MaxPing                = ini.GetInt("MaxPing");
            this.TagsIncludeClient      = ini.GetString("TagsIncludeClient");
            this.TagsExcludeClient      = ini.GetString("TagsExcludeClient");

            this.CustomDetailColumns.Clear();
            foreach (var detail in (ini.GetString("CustomDetailColumns") ?? "").Split(','))
            {
                if (detail != "")
                {
                    CustomRuleColumns.Add(detail);
                }
            }

            this.CustomRuleColumns.Clear();
            foreach (var rule in (ini.GetString("CustomRuleColumns") ?? "").Split(','))
            {
                if (rule != "")
                {
                    CustomRuleColumns.Add(rule);
                }
            }

            this.HideColumns.Clear();
            foreach (var col in (ini.GetString("HideColumns") ?? "").Split(','))
            {
                if (col != "")
                {
                    HideColumns.Add(col);
                }
            }

            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));
                    }
                }
            }
        }