internal static void ApplyConfigFile(ConfigPriority priority = ConfigPriority.RuntimeChanges) { SerializedConfig config = FileConfig; if (clientID != config.clientID || clientSecret != config.clientSecret || token != config.token) { LogHelper.Logln($"One of the core values (ID, Secret, or Token) have been changed in the file ({Path.GetFullPath(configFileName)}). The program might need a restart to apply those new values.", LogType.Warning); } if (SerializableField <string> .needsToReserialize) { LogHelper.Logln("There are runtime changes to configuration.", LogType.Warning); if (priority == ConfigPriority.RuntimeChanges) { LogHelper.Logln("Abort applying runtime configs from file configs.", LogType.Success); return; } else if (priority == ConfigPriority.FileChanges) { LogHelper.Logln("Discarding runtime changes to configs.", LogType.Warning); SerializableField <string> .Reset(); } } botName = new SerializableField <string>(config.botName); serverName = new SerializableField <string>(config.serverName); textChannel = new SerializableField <string>(config.textChannelName); voiceChannel = new SerializableField <string>(config.voiceChannelName); }
static ClientConfig() { #if DEBUG LogHelper.Logln("ClientConfig is being initialized.", LogType.Debug); #endif SerializedConfig config = FileConfig; clientID = config.clientID; #if MENTION_INVOKE_COMMAND ulong.TryParse(clientID, out clientIDNum); #endif clientSecret = config.clientSecret; token = config.token; _offlineDiskSpace = new SerializableField <ulong>(config.offlineDiskSpace); botName = new SerializableField <string>(config.botName); serverName = new SerializableField <string>(config.serverName); textChannel = new SerializableField <string>(config.textChannelName); voiceChannel = new SerializableField <string>(config.voiceChannelName); #if DEBUG #endif LogHelper.Logln("ClientConfig initialized.", LogType.Success); }