static void SaveDatabase(ZipWriter writer, bool compress) { Logger.Log(LogType.SystemActivity, "Compressing Database..."); using (Stream src = File.OpenRead(sqlPath)) { writer.WriteEntry(src, sqlPath, compress); } Logger.Log(LogType.SystemActivity, "Database compressed"); }
static void SaveFiles(ZipWriter writer, List <string> paths, bool compress) { Logger.Log(LogType.SystemActivity, "Compressing {0} files...", paths.Count); for (int i = 0; i < paths.Count; i++) { string path = paths[i]; bool compressThis = compress && !path.CaselessContains(".lvl"); try { using (Stream src = File.OpenRead(path)) { writer.WriteEntry(src, path, compressThis); } } catch (Exception ex) { Logger.LogError("Failed to backup file: " + path, ex); } if (i == 0 || (i % 100) != 0) { continue; } Logger.Log(LogType.SystemActivity, "Backed up {0}/{1} files", i, paths.Count); } }