aboutsummaryrefslogtreecommitdiffstats
path: root/Software
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-11-25 16:38:54 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-11-25 16:38:54 +0200
commitca18248f6203d7567a2276ec76360aedd4cfda0b (patch)
treee2bd460350caf6056fc579fd96736028e3ab68ff /Software
parentfcf154eb2ae88dcf1003ea6bd14c91cab1a616e9 (diff)
downloadTango-ca18248f6203d7567a2276ec76360aedd4cfda0b.tar.gz
Tango-ca18248f6203d7567a2276ec76360aedd4cfda0b.zip
Working on Backup/Restore...
Diffstat (limited to 'Software')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupFile.cs64
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupMode.cs23
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupRestoreProgressEventArgs.cs36
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupRestoreStage.cs47
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupSettings.cs19
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/IBackupManager.cs34
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/BackupRestore/BackupMode.cs12
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/BackupRestore/BackupRestoreProgressEventArgs.cs16
8 files changed, 251 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupFile.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupFile.cs
new file mode 100644
index 000000000..4425aad9e
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupFile.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Web;
+
+namespace Tango.PPC.Common.BackupRestore
+{
+ /// <summary>
+ /// Represents a backup file record.
+ /// </summary>
+ public class BackupFile
+ {
+ /// <summary>
+ /// Gets or sets the backup name.
+ /// </summary>
+ public String Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the creation date.
+ /// </summary>
+ public DateTime Date { get; set; }
+
+ /// <summary>
+ /// Gets or sets the machine serial number.
+ /// </summary>
+ public String MachineSerialNumber { get; set; }
+
+ /// <summary>
+ /// Gets or sets the application version.
+ /// </summary>
+ public String ApplicationVersion { get; set; }
+
+ /// <summary>
+ /// Gets or sets the firmware version.
+ /// </summary>
+ public String FirmwareVersion { get; set; }
+
+ /// <summary>
+ /// Gets or sets the settings file.
+ /// </summary>
+ public String SettingsFile { get; set; }
+
+ /// <summary>
+ /// Gets or sets the job files.
+ /// </summary>
+ public List<String> JobFiles { get; set; }
+
+ /// <summary>
+ /// Gets or sets the backup settings.
+ /// </summary>
+ public BackupSettings Settings { get; set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="BackupFile"/> class.
+ /// </summary>
+ public BackupFile()
+ {
+ Settings = new BackupSettings();
+ JobFiles = new List<string>();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupMode.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupMode.cs
new file mode 100644
index 000000000..8533ce22a
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupMode.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Common.BackupRestore
+{
+ /// <summary>
+ /// Represents a backup mode.
+ /// </summary>
+ public enum BackupMode
+ {
+ /// <summary>
+ /// Jobs only backup.
+ /// </summary>
+ Jobs,
+ /// <summary>
+ /// Complete backup of data, app binaries, firmware and settings file.
+ /// </summary>
+ Full,
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupRestoreProgressEventArgs.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupRestoreProgressEventArgs.cs
new file mode 100644
index 000000000..d12db7b56
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupRestoreProgressEventArgs.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Common.BackupRestore
+{
+ /// <summary>
+ /// Represents a backup restore procedure progress.
+ /// </summary>
+ /// <seealso cref="System.EventArgs" />
+ public class BackupRestoreProgressEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Gets or sets a value indicating whether the progress is intermediate.
+ /// </summary>
+ public bool IsIntermediate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the progress value.
+ /// </summary>
+ public double Progress { get; set; }
+
+
+ /// <summary>
+ /// Gets or sets the maximum progress.
+ /// </summary>
+ public double MaxProgress { get; set; }
+
+ /// <summary>
+ /// Gets or sets the progress stage.
+ /// </summary>
+ public BackupRestoreStage Stage { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupRestoreStage.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupRestoreStage.cs
new file mode 100644
index 000000000..efef2d4d0
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupRestoreStage.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Common.BackupRestore
+{
+ /// <summary>
+ /// Represents a backup restore procedure stage.
+ /// </summary>
+ public enum BackupRestoreStage
+ {
+ [Description("Initializing")]
+ Initializing,
+
+ //Backup
+ [Description("Backing up data...")]
+ BackingupDatabase,
+ [Description("Backing up application...")]
+ BackingupApplication,
+ [Description("Backing up settings...")]
+ BackingupSettings,
+ [Description("Writing settings...")]
+ WritingSettings,
+ [Description("Compressing files...")]
+ CompressingFiles,
+ [Description("Finalizing backup...")]
+ FinalizingBackup,
+
+ //Restore
+ [Description("Validating backup...")]
+ ValidatingBackup,
+ [Description("Extracting content...")]
+ ExtractingContent,
+ [Description("Restoring data...")]
+ RestoringDatabase,
+
+
+ [Description("Done")]
+ Done,
+
+ [Description("Error")]
+ Error,
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupSettings.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupSettings.cs
new file mode 100644
index 000000000..b2021ba39
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/BackupSettings.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Common.BackupRestore
+{
+ /// <summary>
+ /// Represents a backup settings.
+ /// </summary>
+ public class BackupSettings
+ {
+ /// <summary>
+ /// Gets or sets the backup mode.
+ /// </summary>
+ public BackupMode Mode { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/IBackupManager.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/IBackupManager.cs
new file mode 100644
index 000000000..a50f0ab60
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.BackupRestore/BackupRestore/IBackupManager.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Common.BackupRestore
+{
+ /// <summary>
+ /// Represents a backup/restore manager.
+ /// </summary>
+ public interface IBackupManager
+ {
+ /// <summary>
+ /// Occurs when the backup/restore procedure makes progress.
+ /// </summary>
+ event EventHandler<BackupRestoreProgressEventArgs> Progress;
+
+ /// <summary>
+ /// Creates a backup file containing database, application and firmware versions.
+ /// </summary>
+ /// <param name="filePath">The file path.</param>
+ /// <param name="settings">Backup configuration.</param>
+ /// <returns></returns>
+ Task CreateBackup(String filePath, BackupSettings settings);
+
+ /// <summary>
+ /// Restores a backup located in the specified file path.
+ /// </summary>
+ /// <param name="filePath">The file path.</param>
+ /// <returns></returns>
+ Task Restore(String filePath);
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/BackupRestore/BackupMode.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/BackupRestore/BackupMode.cs
new file mode 100644
index 000000000..5e2f6d168
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/BackupRestore/BackupMode.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Common.BackupRestore
+{
+ class BackupMode
+ {
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/BackupRestore/BackupRestoreProgressEventArgs.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/BackupRestore/BackupRestoreProgressEventArgs.cs
new file mode 100644
index 000000000..402db821a
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/BackupRestore/BackupRestoreProgressEventArgs.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Common.BackupRestore
+{
+ public class BackupRestoreEventArgs : EventArgs
+ {
+ public bool IsIntermediate { get; set; }
+ public double Progress { get; set; }
+ public double MaxProgress { get; set; }
+ public BackupRestoreStage Stage { get; set; }
+ }
+}