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