private static void OnRenamed(object sender, RenamedEventArgs e) {
if ((sender == null) || (e == null)) {
ArchiLogger.LogNullError(nameof(sender) + " || " + nameof(e));
return;
}
string oldBotName = Path.GetFileNameWithoutExtension(e.OldName);
if (string.IsNullOrEmpty(oldBotName)) {
return;
}
if (oldBotName.Equals(SharedInfo.ASF)) {
ArchiLogger.LogGenericError("Global config file has been renamed, exiting...");
Program.Exit(1);
return;
}
Bot bot;
if (Bot.Bots.TryGetValue(oldBotName, out bot)) {
bot.OnNewConfigLoaded(new BotConfigEventArgs()).Forget();
}
string newBotName = Path.GetFileNameWithoutExtension(e.Name);
if (string.IsNullOrEmpty(newBotName)) {
return;
}
CreateBot(newBotName).Forget();
}