コード例 #1
0
ファイル: RestoreTask.cs プロジェクト: ChadBurggraf/sthreeql
 /// <summary>
 /// Initializes a new instance of the RestoreTask class.
 /// </summary>
 /// <param name="target">The restore target to execute.</param>
 public RestoreTask(DatabaseRestoreTargetConfigurationElement target)
     : base(SThreeQLConfiguration.Section.AwsTargets[target.AwsBucketName])
 {
     this.Target = target;
 }
コード例 #2
0
        private static void ExecuteRestore(DatabaseRestoreTargetConfigurationElement target)
        {
            try
            {
                RestoreTask task = new RestoreTask(target);
                task.DecompressComplete += new EventHandler<RestoreDatabaseTargetEventArgs>(RestoreDecompressComplete);
                task.DecompressStart += new EventHandler<RestoreDatabaseTargetEventArgs>(RestoreDecompressStart);
                task.RestoreComplete += new EventHandler<RestoreDatabaseTargetEventArgs>(RestoreComplete);
                task.RestoreStart += new EventHandler<RestoreDatabaseTargetEventArgs>(RestoreStart);
                task.TransferComplete += new EventHandler<RestoreDatabaseTargetEventArgs>(RestoreTransferComplete);
                task.TransferProgress += new EventHandler<RestoreDatabaseTargetEventArgs>(RestoreTransferProgress);
                task.TransferStart += new EventHandler<RestoreDatabaseTargetEventArgs>(RestoreTransferStart);

                var result = task.Execute();

                if (!result.Success)
                {
                    WriteError(result.Exception);
                }
            }
            catch (Exception ex)
            {
                WriteError(ex);
            }
        }