internal string SaveSettings(string fileName, string settings) { try { string[] args = settings.Split('\n'); string fullPath = Methods.Instance.GetApplicationPath() + fileName; if (File.Exists(fullPath)) { File.Delete(fullPath); } using (var tw = new StreamWriter(fullPath)) { for (int i = 0; i < args.Length; i++) { tw.WriteLine(RijndaelSimple.Encrypt(args[i].Trim())); } } return("Settings saved"); } catch { return("Fail to save settings"); } }
internal List <String> LoadSettings(string fileName) { string fullPath = Methods.Instance.GetApplicationPath() + fileName; if (File.Exists(fullPath)) { string input; var args = new List <String>(); using (var tr = new StreamReader(fullPath)) { while ((input = tr.ReadLine()) != null) { if (input != null) { args.Add(RijndaelSimple.Decrypt(input)); } } } return(args); } return(null); }