//////////////// public static bool DumpToLocalFile(string data, out string fileName) { fileName = DataDumper.GetFileName((DataDumper.Dumps++) + ""); string relPath = DataDumper.GetRelativePath(); string fullFolder = Main.SavePath + Path.DirectorySeparatorChar + relPath; string fullPath = fullFolder + Path.DirectorySeparatorChar + fileName; DataDumper.PrepareDir(); return(FileHelpers.SaveTextFile(data, fullPath, false, false)); }
//////////////// private static void PrepareDir() { string fullDir = Main.SavePath + Path.DirectorySeparatorChar + DataDumper.GetRelativePath(); try { Directory.CreateDirectory(Main.SavePath); Directory.CreateDirectory(Main.SavePath + Path.DirectorySeparatorChar + "Logs"); Directory.CreateDirectory(fullDir); } catch (IOException e) { throw new IOException("Failed to prepare directory: " + fullDir, e); } }