Ejemplo n.º 1
0
        public void RemoveProperty(params string[] propertyPath)
        {
            SteamAppPropertyTable propertyTable = this;

            foreach (string text in propertyPath.Take(propertyPath.Length - 1))
            {
                if (propertyTable.HasProperty(new string[]
                {
                    text
                }))
                {
                    propertyTable = propertyTable.GetPropertyValue <SteamAppPropertyTable>(text, null);
                }
                else
                {
                    SteamAppPropertyTable propertyTable2 = new();
                    propertyTable.SetPropertyValue(text, SteamAppPropertyType.Table, propertyTable2);
                    propertyTable = propertyTable2;
                }
                if (propertyTable == null)
                {
                    return;
                }
            }
            RemoveProperty(propertyPath.Last <string>());
        }
Ejemplo n.º 2
0
        public bool SetPropertyValue(SteamAppPropertyType type, object value, params string[] propertyPath)
        {
            SteamAppPropertyTable propertyTable = this;

            foreach (string text in propertyPath.Take(propertyPath.Length - 1))
            {
                if (propertyTable.HasProperty(new string[]
                {
                    text
                }))
                {
                    propertyTable = propertyTable.GetPropertyValue <SteamAppPropertyTable>(text, null);
                }
                else
                {
                    SteamAppPropertyTable propertyTable2 = new();
                    propertyTable.SetPropertyValue(text, SteamAppPropertyType.Table, propertyTable2);
                    propertyTable = propertyTable2;
                }
                if (propertyTable == null)
                {
                    return(false);
                }
            }
            return(propertyTable.SetPropertyValue(propertyPath.Last <string>(), type, value));
        }
Ejemplo n.º 3
0
        public bool HasProperty(params string[] PropertyPath)
        {
            SteamAppPropertyTable propertyTable = this;

            foreach (string name in PropertyPath)
            {
                if (propertyTable == null || propertyTable[name] == null)
                {
                    return(false);
                }
                propertyTable = propertyTable.GetPropertyValue <SteamAppPropertyTable>(name, null);
            }
            return(true);
        }
Ejemplo n.º 4
0
        public T GetPropertyValue <T>(T DefaultValue, params string[] PropertyPath)
        {
            SteamAppPropertyTable propertyTable = this;

            foreach (string name in PropertyPath.Take(PropertyPath.Length - 1))
            {
                SteamAppProperty property = propertyTable[name];
                if (property != null)
                {
                    propertyTable = property.GetValue <SteamAppPropertyTable>();
                }
                if (property == null || propertyTable == null)
                {
                    return(DefaultValue);
                }
            }
            return(propertyTable.GetPropertyValue <T>(PropertyPath.Last <string>(), DefaultValue));
        }
 public bool Equals(SteamAppPropertyTable other)
 {
     return(other != null && Count == other.Count && _properties.All((SteamAppProperty prop) => other._properties.Any((SteamAppProperty otherProp) => prop.Equals(otherProp))));
 }
 public SteamAppPropertyTable(SteamAppPropertyTable other)
 {
     _properties.AddRange(from prop in other._properties
                          select new SteamAppProperty(prop));
 }