Example #1
0
        public new bool Equals(object obj)
        {
            bool             result   = false;
            SteamAppProperty property = obj as SteamAppProperty;

            if (property != null)
            {
                result = (Name == property.Name && _propType == property._propType && _value.Equals(property.Value));
            }
            return(result);
        }
Example #2
0
        public object GetPropertyAsObject(string name)
        {
            object           result   = null;
            SteamAppProperty property = this[name];

            if (property != null && property.Value != null)
            {
                result = property.Value;
            }
            return(result);
        }
Example #3
0
 public SteamAppProperty(SteamAppProperty other)
 {
     Name      = other.Name;
     _propType = other._propType;
     if (_propType == SteamAppPropertyType.Table)
     {
         _value = (SteamAppPropertyTable)other._value;
         return;
     }
     _value = other._value;
 }
Example #4
0
        public object ExtractProperty(string name)
        {
            SteamAppProperty      property      = this[name];
            SteamAppPropertyTable propertyTable = new();

            propertyTable.SetPropertyValue(property.Name, property.PropertyType, property.Value);
            MemoryStream memoryStream = new();

            new BinaryWriter(memoryStream).Write(propertyTable);
            return(memoryStream);
        }
Example #5
0
        public SteamAppPropertyType GetPropertyType(string name)
        {
            SteamAppPropertyType result   = SteamAppPropertyType._Invalid_;
            SteamAppProperty     property = this[name];

            if (property != null)
            {
                result = property.PropertyType;
            }
            return(result);
        }
Example #6
0
        public bool TryGetPropertyValue <T>(string name, out T result)
        {
            bool result2 = false;

            result = default;
            SteamAppProperty property = this[name];

            if (property != null)
            {
                result2 = property.TryGetValue <T>(out result);
            }
            return(result2);
        }
        public bool SetPropertyValue(string name, SteamAppPropertyType type, object?value)
        {
            var property = this[name];

            if (property == null)
            {
                property = new SteamAppProperty(name);
                _properties.Add(property);
            }
            bool result = property.PropertyType != type || !property.Value !.Equals(value);

            property.PropertyType = type;
            property.Value        = value;
            return(result);
        }
Example #8
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));
        }