Exemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="config"></param>
 /// <param name="jobID"></param>
 /// <param name="target"></param>
 /// <returns></returns>
 public string Execute(string config, int jobID, IBackupTarget target)
 {
     using (BackupRunner br = new BackupRunner(FileBackupConfig.Load(config), jobID, target)) {
         int count = br.Run();
         return("{0} files was backed up".FillBlanks(count));
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <b>BackupRunner</b> class.
 /// </summary>
 /// <param name="config"></param>
 /// <param name="jobID"></param>
 /// <param name="target"></param>
 public BackupRunner(FileBackupConfig config, int jobID, IBackupTarget target)
 {
     this.config   = config;
     dbFile        = new FileInfo("{0}\\FileBackupDatabases\\{1}.s3db".FillBlanks(Configuration.DataDirectory.FullName, jobID));
     backupDirPath = new DirectoryInfo(config.Directory).FullName + "\\";
     this.target   = target;
 }
Exemplo n.º 3
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="configuration"></param>
            /// <returns></returns>
            public static FileBackupConfig Load(string configuration)
            {
                if (string.IsNullOrEmpty(configuration))
                {
                    return(new FileBackupConfig());
                }
                MemoryStream     ms = null;
                FileBackupConfig ps = null;

                try {
                    ms = new MemoryStream(configuration.ToByteArray());
                    ms.Seek(0, SeekOrigin.Begin);
                    ps = (FileBackupConfig)Serializer.Deserialize(ms);
                } catch {
                } finally {
                    if (ms != null)
                    {
                        ms.Close();
                        ms.Dispose();
                    }
                }
                return(ps ?? new FileBackupConfig());
            }
Exemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="container"></param>
 /// <param name="config"></param>
 public void InitiateConfiguration(Control container, string config)
 {
     gui = new FileBackupConfigGUI(FileBackupConfig.Load(config));
     container.Controls.Add(gui);
 }