public static void edit(string id, int line, string content) { //Create target to edit file string fileed = Path.Combine(localAD, id); //Verify input if (File.Exists(fileed) == true && ErrHandle.isNonNull(content) == false && ErrHandle.isNonNull(line.ToString()) == false && ErrHandle.isNonNull(id) == false) { string[] data = File.ReadAllLines(fileed); data[line] = content; File.WriteAllText(fileed, content); } else { ErrHandle.message(); } }
//-File management //Save content to file public static void save(string id, List <string> content) { //Create target to make file string filemake = Path.Combine(localAD, id); //Validate input if (File.Exists(filemake) == false && ErrHandle.isNonNull(content[0]) == false && ErrHandle.isNonNull(id) == false) { //Make and write to file File.Create(filemake).Dispose(); File.WriteAllLines(filemake, content); } else { //Catch error and display message ErrHandle.message(); } }