/// <summary> /// Setter method for assigning a value to a cvar. Regardless of its type. /// </summary> /// <param name="key">Cvar name</param> /// <param name="value">Value to set</param> /// <param name="mode">Cvar type (None, Archived)</param> /// <returns></returns> public void ForceSet(string key, string value, CvarMode mode = CvarMode.None) { if (!values.ContainsKey(key)) { values.Add(key, new Cvar { mode = mode, value = value }); } else { values[key].value = value; values[key].tempValue = null; } }
/// <summary> /// Setter method for assigning a value to a cvar. /// NOTE: Use ForceSet if you want to overwrite archived cvar. /// </summary> /// <param name="key">Cvar name</param> /// <param name="value">Value to set</param> /// <param name="mode">Cvar type (None, Archived)</param> /// <returns></returns> public bool Set(string key, string value, CvarMode mode = CvarMode.None) { if (!values.ContainsKey(key)) { values.Add(key, new Cvar { mode = mode, value = value }); return(true); } else if (values[key].mode != CvarMode.Archived) { values[key].value = value; return(true); } else { values[key].tempValue = value; } return(false); }