public static void CopyAll(DirectoryInfo source, DirectoryInfo target) { if (source.FullName.ToLower() == target.FullName.ToLower() || !source.Exists) { return; } if (!target.Exists) { target.Create(); } foreach (FileInfo file in source.GetFiles()) { FileInfo fileInfo = new FileInfo(Path.Combine(target.FullName, file.Name)); file.CopyTo(fileInfo.FullName, true); fileInfo.CreationTime = file.CreationTime; fileInfo.LastAccessTime = file.LastAccessTime; fileInfo.LastWriteTime = file.LastWriteTime; } foreach (DirectoryInfo directory in source.GetDirectories()) { DirectoryInfo subdirectory = target.CreateSubdirectory(directory.Name); DirectoryEx.CopyAll(directory, subdirectory); subdirectory.CreationTime = directory.CreationTime; subdirectory.LastAccessTime = directory.LastAccessTime; subdirectory.LastWriteTime = directory.LastWriteTime; } }
void BackupCreate(bool manual = false) { DirectoryEx.Backup(BackupFolders()); DirectoryEx.CopyAll(ConVar.Server.rootFolder, backupFolders[0]); if (!manual) { Puts(lang.GetMessage("backupfinish", this)); } }
IEnumerator BackupCreateI(bool manual = false) { DirectoryEx.Backup(BackupFolders()); yield return(new WaitForEndOfFrame()); DirectoryEx.CopyAll(ConVar.Server.rootFolder, backupFolders[0]); yield return(new WaitForEndOfFrame()); if (includeOxideInBackups) { DirectoryEx.CopyAll("oxide", backupFoldersOxide[0]); } if (!manual) { Puts(lang.GetMessage("backupfinish", this)); } yield return(null); }
public static void CopyAll(DirectoryInfo source, DirectoryInfo target) { int i; if (source.FullName.ToLower() == target.FullName.ToLower()) { return; } if (!source.Exists) { return; } if (!target.Exists) { target.Create(); } FileInfo[] files = source.GetFiles(); for (i = 0; i < (int)files.Length; i++) { FileInfo fileInfo = files[i]; FileInfo creationTime = new FileInfo(Path.Combine(target.FullName, fileInfo.Name)); fileInfo.CopyTo(creationTime.FullName, true); creationTime.CreationTime = fileInfo.CreationTime; creationTime.LastAccessTime = fileInfo.LastAccessTime; creationTime.LastWriteTime = fileInfo.LastWriteTime; } DirectoryInfo[] directories = source.GetDirectories(); for (i = 0; i < (int)directories.Length; i++) { DirectoryInfo directoryInfo = directories[i]; DirectoryInfo lastAccessTime = target.CreateSubdirectory(directoryInfo.Name); DirectoryEx.CopyAll(directoryInfo, lastAccessTime); lastAccessTime.CreationTime = directoryInfo.CreationTime; lastAccessTime.LastAccessTime = directoryInfo.LastAccessTime; lastAccessTime.LastWriteTime = directoryInfo.LastWriteTime; } }
public static void CopyAll(string sourceDirectory, string targetDirectory) { DirectoryEx.CopyAll(new DirectoryInfo(sourceDirectory), new DirectoryInfo(targetDirectory)); }
public static void backup() { DirectoryEx.Backup(backupFolder, backupFolder1, backupFolder2, backupFolder3); DirectoryEx.CopyAll(rootFolder, backupFolder); }
public static void backup() { DirectoryEx.Backup(new string[] { ConVar.Server.backupFolder, ConVar.Server.backupFolder1, ConVar.Server.backupFolder2, ConVar.Server.backupFolder3 }); DirectoryEx.CopyAll(ConVar.Server.rootFolder, ConVar.Server.backupFolder); }