ES3.RestoreBackup

public static bool RestoreBackup(string filePath, ES3Settings settings)

Description

Restores a backup of a file created using ES3.CreateBackup.

A backup is created by copying the file and giving it a .bak extension.

If a backup already exists it will be overwritten, so you will need to ensure that the old backup will not be required before calling this method.

Parameters

[table th=”0″]filePath,”[Optional] The relative or absolute path of the file we want to restore the backup of.”

settings,”[Optional] The settings we want to use to override the default settings.”[/table]

Returns

True if a backup was restored, or False if no backup could be found.

Examples

C#

 try
 {
     myInt = ES3.Load<int>("myInt", "myFile.es3");
 }
 catch
 {
     if(ES3.RestoreBackup("myFile.es3"))
         Debug.Log("Backup restored.");
     else
         Debug.Log("Backup could not be restored as no backup exists.");
 }

JS

 try
 {
     myInt = ES3.Load.<int>("myInt", "myFile.es3");
 }
 catch
 {
     if(ES3.RestoreBackup("myFile.es3"))
         Debug.Log("Backup restored.");
     else
         Debug.Log("Backup could not be restored as no backup exists.");
 }