Пример #1
0
 public static void Backup(DirectoryInfo parent, params string[] names)
 {
     for (int index = 0; index < names.Length; ++index)
     {
         names[index] = Path.Combine(parent.FullName, names[index]);
     }
     DirectoryEx.Backup(names);
 }
Пример #2
0
 public static void Backup(DirectoryInfo parent, params string[] names)
 {
     for (int i = 0; i < (int)names.Length; i++)
     {
         names[i] = Path.Combine(parent.FullName, names[i]);
     }
     DirectoryEx.Backup(names);
 }
Пример #3
0
 void BackupCreate(bool manual = false)
 {
     DirectoryEx.Backup(BackupFolders());
     DirectoryEx.CopyAll(ConVar.Server.rootFolder, backupFolders[0]);
     if (!manual)
     {
         Puts(lang.GetMessage("backupfinish", this));
     }
 }
Пример #4
0
        IEnumerator SaveLoop()
        {
            if (!Initialized)
            {
                yield return(null);
            }
            WaitForFixedUpdate waitU = new WaitForFixedUpdate();

            BaseEntity.saveList.RemoveWhere(p => !p);
            BaseEntity.saveList.RemoveWhere(p => p == null);
            Diag.Stopwatch stopwatch = Diag.Stopwatch.StartNew();
            foreach (BaseEntity current in BaseEntity.saveList)
            {
                current.InvalidateNetworkCache();
            }
            Debug.Log("Invalidate Network Cache took " + stopwatch.Elapsed.TotalSeconds.ToString("0.00") + " seconds");
            if (Rounds < saveCustomAfter && saveCustomAfter > 0)
            {
                IEnumerator original = SaveRestore.Save(ConVar.Server.rootFolder + "/" + SaveRestore.SaveFileName, true);
                while (original.MoveNext())
                {
                }
                Debug.Log("Saving complete");
                if (!callOnServerSave)
                {
                    Interface.Oxide.DataFileSystem.WriteObject(this.Title, new List <object>(new object[] { ConVar.Server.rootFolder + "/" + SaveRestore.SaveFileName, "default" }));
                }
                Rounds++;
                CallOnServerSave();
            }
            else
            {
                string file = saveFolder + SaveRestore.SaveFileName;
                DirectoryEx.Backup(SaveFolders());
                yield return(waitU);

                ConVar.Server.GetServerFolder("saves/0/");
                yield return(waitU);

                try {
                    IEnumerator custom = SaveRestore.Save(file, true);
                    while (custom.MoveNext())
                    {
                    }
                    Debug.Log("Custom Saving complete");
                    if (!callOnServerSave)
                    {
                        Interface.Oxide.DataFileSystem.WriteObject(this.Title, new List <object>(new object[] { file, "custom" }));
                    }
                }
                catch { PrintWarning(lang.GetMessage("dirnotfound", this)); }
                CallOnServerSave();
                Rounds = 0;
            }
            yield return(null);
        }
Пример #5
0
 void OnPluginUnloaded(Plugin name)
 {
     if (Interface.Oxide.IsShuttingDown && !wasShutDown)
     {
         wasShutDown = true;
         try {
             DirectoryEx.Backup(BackupFoldersShutdown());
             if (includeOxideInBackups)
             {
                 DirectoryEx.Backup(BackupFoldersShutdownOxide());
             }
         } catch {}
     }
 }
Пример #6
0
        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);
        }
Пример #7
0
 void SaveBackupCreate()
 {
     DirectoryEx.Backup(SaveFolders());
     ConVar.Server.GetServerFolder("saves/0/");
 }
Пример #8
0
 public static void backup()
 {
     DirectoryEx.Backup(backupFolder, backupFolder1, backupFolder2, backupFolder3);
     DirectoryEx.CopyAll(rootFolder, backupFolder);
 }
Пример #9
0
 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);
 }