Esempio n. 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);
 }
 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);
 }
Esempio n. 3
0
 void BackupCreate(bool manual = false)
 {
     DirectoryEx.Backup(BackupFolders());
     DirectoryEx.CopyAll(ConVar.Server.rootFolder, backupFolders[0]);
     if (!manual)
     {
         Puts(lang.GetMessage("backupfinish", this));
     }
 }
Esempio n. 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);
        }
Esempio n. 5
0
 void OnPluginUnloaded(Plugin name)
 {
     if (Interface.Oxide.IsShuttingDown && !wasShutDown)
     {
         wasShutDown = true;
         try {
             DirectoryEx.Backup(BackupFoldersShutdown());
             if (includeOxideInBackups)
             {
                 DirectoryEx.Backup(BackupFoldersShutdownOxide());
             }
         } catch {}
     }
 }
Esempio n. 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);
        }
Esempio n. 7
0
 void SaveBackupCreate()
 {
     DirectoryEx.Backup(SaveFolders());
     ConVar.Server.GetServerFolder("saves/0/");
 }
Esempio n. 8
0
 public static void backup()
 {
     DirectoryEx.Backup(backupFolder, backupFolder1, backupFolder2, backupFolder3);
     DirectoryEx.CopyAll(rootFolder, backupFolder);
 }
Esempio n. 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);
 }