public static SWData_Codes Load(string swFolder) { string folder = CodeFolder(swFolder); SWData_Codes codes = new SWData_Codes(); DirectoryInfo d = new DirectoryInfo(folder); foreach (var item in d.GetFiles()) { if (item.FullName.EndsWith(".swcode")) { SWDataCode code = LoadSub(item.FullName); codes.codes.Add(code); } } return(codes); }
public static void Save(string swFolder, SWData_Codes data) { //Delete all .swcode files string folder = CodeFolder(swFolder); DirectoryInfo d = new DirectoryInfo(folder); foreach (var item in d.GetFiles()) { if (item.FullName.EndsWith(".swcode")) { File.Delete(item.FullName); } } //Create all .swcode files foreach (var item in data.codes) { string path = folder + item.name + ".swcode"; SaveSub(path, item); } }