本文整理汇总了C#中DeploymentResult.AddGood方法的典型用法代码示例。如果您正苦于以下问题:C# DeploymentResult.AddGood方法的具体用法?C# DeploymentResult.AddGood怎么用?C# DeploymentResult.AddGood使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeploymentResult
的用法示例。
在下文中一共展示了DeploymentResult.AddGood方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckForSiteAndVDirExistance
public void CheckForSiteAndVDirExistance(Func<bool> website, Func<bool> vdir, DeploymentResult result)
{
if (website())
{
result.AddGood("Found Website '{0}'", WebsiteName);
if (vdir())
{
result.AddGood("Found VDir '{0}'", VdirPath);
}
else
{
result.AddAlert("Couldn't find VDir '{0}'", VdirPath);
if (ShouldCreate)
result.AddAlert("The VDir '{0}' will be created", VdirPath);
}
}
else
{
result.AddAlert("Couldn't find Website '{0}'", WebsiteName);
if (ShouldCreate)
result.AddAlert("Website '{0}' and VDir '{1}' will be created", WebsiteName, VdirPath);
}
}
示例2: ProcessLocalQueue
void ProcessLocalQueue(DeploymentResult result)
{
Logging.Coarse("[msmq] Setting default permissions for on local queue '{0}'", _address.ActualUri);
try
{
var q = new MessageQueue(_address.LocalName);
q.SetPermissions(WellKnownSecurityRoles.Administrators, MessageQueueAccessRights.FullControl, AccessControlEntryType.Allow);
result.AddGood("Successfully set permissions for '{0}' on queue '{1}'".FormatWith(WellKnownSecurityRoles.Administrators, _address.LocalName));
q.SetPermissions(WellKnownSecurityRoles.CurrentUser, MessageQueueAccessRights.FullControl, AccessControlEntryType.Revoke);
result.AddGood("Successfully set permissions for '{0}' on queue '{1}'".FormatWith(WellKnownSecurityRoles.Administrators, _address.LocalName));
q.SetPermissions(WellKnownSecurityRoles.Everyone, MessageQueueAccessRights.FullControl, AccessControlEntryType.Revoke);
result.AddGood("Successfully set permissions for '{0}' on queue '{1}'".FormatWith(WellKnownSecurityRoles.Administrators, _address.LocalName));
q.SetPermissions(WellKnownSecurityRoles.Anonymous, MessageQueueAccessRights.FullControl, AccessControlEntryType.Revoke);
result.AddGood("Successfully set permissions for '{0}' on queue '{1}'".FormatWith(WellKnownSecurityRoles.Administrators, _address.LocalName));
}
catch (MessageQueueException ex)
{
if (ex.Message.Contains("does not exist")) throw new DeploymentException("The queue '{0}' doesn't exist.", ex);
throw;
}
}
示例3: Execute
public DeploymentResult Execute()
{
var result = new DeploymentResult();
var to = _path.GetFullPath(_to);
if (Directory.Exists(to))
result.AddGood("'{0}' already exists.".FormatWith(to));
else
{
result.AddGood(Name);
Directory.CreateDirectory(to);
}
return result;
}
示例4: VerifyCanRun
public DeploymentResult VerifyCanRun()
{
var result = new DeploymentResult();
if (File.Exists(System.IO.Path.GetFileName(_fileName)))
{
result.AddGood(string.Format("{0} exists and will be deleted.", _fileName));
}
else
{
result.AddGood(string.Format("{0} does not exist, so cannot be deleted.", _fileName));
}
return result;
}
示例5: Execute
public DeploymentResult Execute()
{
var result = new DeploymentResult();
if (File.Exists(_fileName))
{
File.Delete(_fileName);
result.AddGood(string.Format("{0} exists and was deleted.", _fileName));
}
else
{
result.AddGood(string.Format("{0} does not exist, so cannot be deleted.", _fileName));
}
return result;
}
示例6: VerifyCanRun
public DeploymentResult VerifyCanRun()
{
var result = new DeploymentResult();
try
{
File.GetAttributes(_target);
result.AddGood(string.Format("{0} exists and will be deleted.", _target));
}
catch (Exception ex)
{
result.AddGood(string.Format("{0} does not exist, deletion skipped.", _target));
}
return result;
}
示例7: Execute
public DeploymentResult Execute()
{
var result = new DeploymentResult();
ValidatePath(result, _to);
ValidatePath(result, _from);
_from = Path.GetFullPath(_from);
_to = Path.GetFullPath(_to);
//todo: verify that from exists
if (!Directory.Exists(_to))
{
Directory.CreateDirectory(_to);
}
if (Directory.Exists(_from))
{
foreach (string file in Directory.GetFiles(_from))
{
//need to support recursion
string fileName = Path.GetFileName(file);
File.Copy(file, Path.Combine(_to, fileName));
//log file was copied / event?
}
//what do you want to do if the directory DOESN'T exist?
}
result.AddGood("Copied stuff");
return result;
}
示例8: VerifyCanRun
public override DeploymentResult VerifyCanRun()
{
var result = new DeploymentResult();
//can I connect to the server?
IDbConnection conn = null;
try
{
conn = GetConnection();
conn.Open();
result.AddGood("I can talk to the database");
}
catch (Exception)
{
result.AddAlert("I cannot open the connection");
throw;
}
finally
{
if (conn != null)
{
conn.Close();
conn.Dispose();
}
}
//can I connect to the database?
if (OutputSql != null)
result.AddAlert(string.Format("I will run the sql '{0}'", OutputSql));
return result;
}
示例9: Execute
public override DeploymentResult Execute()
{
var result = new DeploymentResult();
var iisManager = ServerManager.OpenRemote(ServerName);
BuildApplicationPool(iisManager, result);
if (!DoesSiteExist(result)) CreateWebSite(iisManager, WebsiteName, result);
Site site = GetSite(iisManager, WebsiteName);
BuildVirtualDirectory(site, iisManager, result);
try
{
iisManager.CommitChanges();
result.AddGood("'{0}' was created/updated successfully.", VirtualDirectoryPath);
}
catch (COMException ex)
{
if (ProcessModelIdentityType == ProcessModelIdentityType.SpecificUser) throw new DeploymentException("An exception occurred trying to apply deployment changes. If you are attempting to set the IIS " +
"Process Model's identity to a specific user then ensure that you are running DropKick with elevated privileges, or UAC is disabled.", ex);
throw;
}
LogCoarseGrain("[iis7] {0}", Name);
return result;
}
示例10: Execute
public DeploymentResult Execute()
{
Thread.Sleep(_waitTime);
var result = new DeploymentResult();
result.AddGood("Waited for '{0}' seconds", _waitTime.TotalSeconds.ToString());
return result;
}
示例11: VerifyCanRun
public override DeploymentResult VerifyCanRun()
{
var result = new DeploymentResult();
ValidateIsFile(result, _filePath);
result.AddGood(Name);
return result;
}
示例12: Execute
public override DeploymentResult Execute()
{
var result = new DeploymentResult();
if (ServiceExists())
{
using (var c = new ServiceController(ServiceName, MachineName))
{
Logging.Coarse("[svc] Stopping service '{0}'", ServiceName);
if (c.CanStop)
{
int pid = GetProcessId(ServiceName);
c.Stop();
c.WaitForStatus(ServiceControllerStatus.Stopped, 30.Seconds());
//WaitForProcessToDie(pid);
}
}
result.AddGood("Stopped Service '{0}'", ServiceName);
Logging.Coarse("[svc] Stopped service '{0}'", ServiceName);
}
else
{
result.AddAlert("Service '{0}' does not exist and could not be stopped", ServiceName);
Logging.Coarse("[svc] Service '{0}' does not exist.", ServiceName);
}
return result;
}
示例13: Execute
public override DeploymentResult Execute()
{
var result = new DeploymentResult();
if (!MessageQueue.Exists(Address.LocalName))
{
result.AddAlert("'{0}' does not exist and will be created.".FormatWith(Address.FormatName));
MessageQueue.Create(Address.LocalName, _transactional);
result.AddGood("Created queue '{0}'".FormatWith(Address.FormatName));
}
else
{
result.AddGood("'{0}' already exists.".FormatWith(Address.FormatName));
}
return result;
}
示例14: VerifyCanRun
public DeploymentResult VerifyCanRun()
{
var result = new DeploymentResult();
var to = _path.GetFullPath(_to);
//TODO figure out a good verify step...
result.AddGood(Directory.Exists(to) ? "'{0}' already exists.".FormatWith(to) : Name);
return result;
}
示例15: DeleteDestinationFirst
protected static void DeleteDestinationFirst(DirectoryInfo directory, DeploymentResult result)
{
if (directory.Exists)
{
directory.Delete(true);
result.AddGood("'{0}' was successfully deleted".FormatWith(directory.FullName));
//TODO: a delete list?
}
}