public static void EditConfig(string parameter, string value) { string fileType; switch (parameter) { case "birthdayColumnNumber": case "employeeNameColumnNumber": if (!Int32.TryParse(value, out _)) { value = ""; } break; case "serverPort": if (string.IsNullOrEmpty(value) || string.IsNullOrWhiteSpace(value)) { value = "25"; } else if (!Int32.TryParse(value, out _)) { value = ""; } break; case "htmlPath": fileType = value.Substring(value.LastIndexOf('.') + 1, value.Length - value.LastIndexOf('.') - 1); if (File.Exists(value) && fileType.ToLower().Equals("html")) { if (!File.ReadAllText(value).Contains("%LIST_OF_EMPLOYEES%")) { value = ""; } } else { value = ""; } break; case "xlsPath": fileType = value.Substring(value.LastIndexOf('.') + 1, value.Length - value.LastIndexOf('.') - 1); if (!File.Exists(value) || !fileType.ToLower().Equals("xls")) { value = ""; } break; case "senderPassword": value = EncryptString("b14ca5898a4e4133bbce2mbd02082020", value); break; case "fiveDaysMode": if (value.ToLower() == "yes" || value.ToLower() == "y") { value = "True"; } else { value = "False"; } break; default: break; } Configs.ChangeParameter(parameter, value); }