Implement NLog for ASF logging, closes #274, #279

This commit is contained in:
JustArchi
2016-07-04 19:22:46 +02:00
parent f8ab06871f
commit 6ada40fc2f
14 changed files with 78 additions and 81 deletions

View File

@@ -60,6 +60,7 @@ namespace ConfigGenerator {
string botName = Path.GetFileNameWithoutExtension(configFile);
switch (botName) {
case Program.ASF:
case "Main":
case "example":
case "minimal":
continue;
@@ -155,6 +156,20 @@ namespace ConfigGenerator {
// Get rid of any potential whitespaces in bot name
input = Regex.Replace(input, @"\s+", "");
if (string.IsNullOrEmpty(input)) {
Logging.LogGenericErrorWithoutStacktrace("Your bot name is empty!");
return;
}
switch (input) {
case Program.ASF:
case "Main":
case "example":
case "minimal":
Logging.LogGenericErrorWithoutStacktrace("This name is reserved!");
return;
}
if (ASFConfig.ASFConfigs.Select(config => Path.GetFileNameWithoutExtension(config.FilePath)).Any(fileNameWithoutExtension => (fileNameWithoutExtension == null) || fileNameWithoutExtension.Equals(input))) {
Logging.LogGenericErrorWithoutStacktrace("Bot with such name exists already!");
return;