// Token: 0x060020AD RID: 8365 RVA: 0x00099ACC File Offset: 0x00097CCC private void SubmitSettingInternal(string newValue) { if (this.originalValue == null) { this.originalValue = this.GetCurrentValue(); } if (this.originalValue == newValue) { this.originalValue = null; } BaseSettingsControl.SettingSource settingSource = this.settingSource; if (settingSource != BaseSettingsControl.SettingSource.ConVar) { if (settingSource == BaseSettingsControl.SettingSource.UserProfilePref) { UserProfile currentUserProfile = this.GetCurrentUserProfile(); if (currentUserProfile != null) { currentUserProfile.SetSaveFieldString(this.settingName, newValue); } UserProfile currentUserProfile2 = this.GetCurrentUserProfile(); if (currentUserProfile2 != null) { currentUserProfile2.RequestSave(false); } } } else { BaseConVar conVar = this.GetConVar(); if (conVar != null) { conVar.SetString(newValue); } } RoR2Application.onNextUpdate += this.UpdateControls; }
// Token: 0x06000DE6 RID: 3558 RVA: 0x0004440C File Offset: 0x0004260C private void InitConVars() { this.allConVars = new Dictionary <string, BaseConVar>(); this.archiveConVars = new List <BaseConVar>(); foreach (Type type in typeof(BaseConVar).Assembly.GetTypes()) { foreach (FieldInfo fieldInfo in type.GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)) { if (fieldInfo.FieldType.IsSubclassOf(typeof(BaseConVar))) { if (fieldInfo.IsStatic) { BaseConVar conVar = (BaseConVar)fieldInfo.GetValue(null); this.RegisterConVarInternal(conVar); } else if (type.GetCustomAttribute <CompilerGeneratedAttribute>() == null) { Debug.LogErrorFormat("ConVar defined as {0}.{1} could not be registered. ConVars must be static fields.", new object[] { type.Name, fieldInfo.Name }); } } } foreach (MethodInfo methodInfo in type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)) { if (methodInfo.GetCustomAttribute <ConVarProviderAttribute>() != null) { if (methodInfo.ReturnType != typeof(IEnumerable <BaseConVar>) || methodInfo.GetParameters().Length != 0) { Debug.LogErrorFormat("ConVar provider {0}.{1} does not match the signature \"static IEnumerable<ConVar.BaseConVar>()\".", new object[] { type.Name, methodInfo.Name }); } else if (!methodInfo.IsStatic) { Debug.LogErrorFormat("ConVar provider {0}.{1} could not be invoked. Methods marked with the ConVarProvider attribute must be static.", new object[] { type.Name, methodInfo.Name }); } else { foreach (BaseConVar conVar2 in ((IEnumerable <BaseConVar>)methodInfo.Invoke(null, Array.Empty <object>()))) { this.RegisterConVarInternal(conVar2); } } } } } foreach (KeyValuePair <string, BaseConVar> keyValuePair in this.allConVars) { BaseConVar value = keyValuePair.Value; if ((value.flags & ConVarFlags.Engine) != ConVarFlags.None) { value.defaultValue = value.GetString(); } else if (value.defaultValue != null) { value.SetString(value.defaultValue); } } }
// Token: 0x06000DEB RID: 3563 RVA: 0x00044880 File Offset: 0x00042A80 private void RunCmd(NetworkUser sender, string concommandName, List <string> userArgs) { bool active = NetworkServer.active; Console.ConCommand conCommand; if (this.concommandCatalog.TryGetValue(concommandName, out conCommand)) { if (!active && (conCommand.flags & ConVarFlags.ExecuteOnServer) > ConVarFlags.None) { this.ForwardCmdToServer(new ConCommandArgs { sender = sender, commandName = concommandName, userArgs = userArgs }); return; } if (NetworkServer.active && sender && !sender.isLocalPlayer && (conCommand.flags & ConVarFlags.SenderMustBeServer) != ConVarFlags.None) { return; } if ((conCommand.flags & ConVarFlags.Cheat) != ConVarFlags.None && !RoR2Application.cvCheats.boolValue) { Debug.LogFormat("Command \"{0}\" cannot be used while cheats are disabled.", new object[] { concommandName }); return; } try { conCommand.action(new ConCommandArgs { sender = sender, commandName = concommandName, userArgs = userArgs }); } catch (ConCommandException ex) { Debug.LogFormat("Command \"{0}\" failed: {1}", new object[] { concommandName, ex.Message }); } return; } else { BaseConVar baseConVar = this.FindConVar(concommandName); if (baseConVar == null) { Debug.LogFormat("\"{0}\" is not a recognized ConCommand or ConVar.", new object[] { concommandName }); return; } if (!active && (baseConVar.flags & ConVarFlags.ExecuteOnServer) > ConVarFlags.None) { this.ForwardCmdToServer(new ConCommandArgs { sender = sender, commandName = concommandName, userArgs = userArgs }); return; } if (NetworkServer.active && sender && !sender.isLocalPlayer && (baseConVar.flags & ConVarFlags.SenderMustBeServer) != ConVarFlags.None) { return; } if (userArgs.Count <= 0) { Debug.LogFormat("\"{0}\" = \"{1}\"\n{2}", new object[] { concommandName, baseConVar.GetString(), baseConVar.helpText }); return; } if ((baseConVar.flags & ConVarFlags.Cheat) != ConVarFlags.None && !RoR2Application.cvCheats.boolValue) { Debug.LogFormat("Command \"{0}\" cannot be changed while cheats are disabled.", new object[] { concommandName }); return; } baseConVar.SetString(userArgs[0]); return; } }