Sunday, December 26, 2010

Backup BRE

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Build.Utilities;
using System.IO;
using Microsoft.Build.Framework;

namespace BizTalk.BuildGenerator.Tasks.BRE
{
///
/// Task to ackup the BRE
///

public class BackupBRE : BaseBRETask
{
private string _FolderPath;

///

/// Task execute method
///

///
public override bool Execute()
{
if (!Directory.Exists(this._FolderPath))
throw new ApplicationException("The folder does not exist");

string folder = Path.GetFullPath(this._FolderPath);
Console.WriteLine("Backup Folder: " + folder);
string filePath = folder + @"\" + Guid.NewGuid().ToString();
BREManager mgr = base.CreateManager();
mgr.ExportAll(filePath);
return true;
}
///
/// This is the folder where the backup will be created
///

[Required]
public string FolderPath
{
get { return _FolderPath; }
set { _FolderPath = value; }
}
}
}

No comments:

Post a Comment