当前位置: 首页>>代码示例>>C#>>正文


C# DeploymentResult类代码示例

本文整理汇总了C#中DeploymentResult的典型用法代码示例。如果您正苦于以下问题:C# DeploymentResult类的具体用法?C# DeploymentResult怎么用?C# DeploymentResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DeploymentResult类属于命名空间,在下文中一共展示了DeploymentResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CopyFile

 protected void CopyFile(DeploymentResult result, string newFileName, string from, string to)
 {
     if (ExtensionsToString.IsNotEmpty(newFileName))
         CopyFileToFile(result, new FileInfo(from), new FileInfo(_path.Combine(to,newFileName)));
     else
         CopyFileToDirectory(result, new FileInfo(from), new DirectoryInfo(to));
 }
开发者ID:oriacle,项目名称:dropkick,代码行数:7,代码来源:BaseIoTask.cs

示例2: Execute

        public DeploymentResult Execute()
        {
            var deploymentResult = new DeploymentResult();
            bool abort = false;
            Ex(d =>
            {
               if(!abort) {
                  var o = d.Verify();
                  deploymentResult.MergedWith(o);
                  if(deploymentResult.ShouldAbort) { abort = true; }
                  if(o.ContainsError()) {
                     //display errors!
                     DisplayResults(o);
                     //stop. report verify error.
                     return;
                  }

                  var result = d.Execute();
                  DisplayResults(result);
                  deploymentResult.MergedWith(result);
                  if(deploymentResult.ShouldAbort) { abort = true; }
               } else {
                  Logging.Coarse(LogLevel.Error, "[Skip ] {0}", d.Name);
               }
            });

            return deploymentResult;
        }
开发者ID:GorelH,项目名称:dropkick,代码行数:28,代码来源:DeploymentPlan.cs

示例3: Execute

 public DeploymentResult Execute()
 {
     Thread.Sleep(_waitTime);
     var result = new DeploymentResult();
     result.AddGood("Waited for '{0}' seconds", _waitTime.TotalSeconds.ToString());
     return result;
 }
开发者ID:GorelH,项目名称:dropkick,代码行数:7,代码来源:WaitTask.cs

示例4: PerformReplacements

		private void PerformReplacements(DeploymentResult result)
		{
			var contents = File.ReadAllText(_filePath, _encoding);
			foreach (var replacement in _replacements)
				contents = replacement.Replace(contents, result);
			File.WriteAllText(_filePath, contents, _encoding);
		}
开发者ID:GorelH,项目名称:dropkick,代码行数:7,代码来源:FilePokeTask.cs

示例5: VerifyCanRun

		public override DeploymentResult VerifyCanRun()
		{
			var result = new DeploymentResult();
			ValidateIsFile(result, _filePath);
			result.AddGood(Name);
			return result;
		}
开发者ID:GorelH,项目名称:dropkick,代码行数:7,代码来源:FilePokeTask.cs

示例6: VerifyCanRun

        public DeploymentResult VerifyCanRun()
        {
            var result = new DeploymentResult();

            VerifyInAdministratorRole(result);

            if (Environment.MachineName.Equals(_serverName))
            {
                //if(MessageQueue.Exists(path))
                //{
                //    result.AddGood("'{0}' does exist");
                //}
                //else
                //{
                //    result.AddAlert(string.Format("'{0}' doesn't exist and will be created", _queueName));
                //}
                result.AddAlert("I can't check queue exstance yet");
            }
            else
            {
                result.AddAlert(string.Format("Cannot check for queue '{0}' on server '{1}' while on server '{2}'",
                                              _queueName, _serverName, Environment.MachineName));
            }

            return result;
        }
开发者ID:fchen,项目名称:dropkick,代码行数:26,代码来源:MsmqTask.cs

示例7: Execute

        public override DeploymentResult Execute()
        {
            //http://weblogs.asp.net/avnerk/archive/2007/05/10/granting-user-rights-in-c.aspx
            var result = new DeploymentResult();

            try
            {
                var serverName = _server.Name;
                if (!_server.IsLocal) serverName = "\\\\{0}".FormatWith(_server.Name);
                LsaUtility.SetRight(serverName, _userAccount, "SeServiceLogonRight");

                //using (var lsa = new LsaWrapper())
                //{
                //    lsa.AddPrivileges(_userAccount, "SeServiceLogonRight");
                //}
                LogSecurity("[security][lpo] Grant '{0}' LogOnAsService on '{1}'", _userAccount, _server.Name);
            }
            catch (Win32Exception ex)
            {
                var sb = new StringBuilder();
                sb.AppendFormat("Error while attempting to grant '{0}' the right '{1}'", _userAccount, "SeServiceLogonRight");
                result.AddError(sb.ToString(), ex);
            }


            return result;
        }
开发者ID:GorelH,项目名称:dropkick,代码行数:27,代码来源:LogOnAsAServiceTask.cs

示例8: CopyDirectory

        protected void CopyDirectory(DeploymentResult result, DirectoryInfo source, DirectoryInfo destination, IEnumerable<Regex> ignoredPatterns)
        {
            if (!destination.Exists)
            {
                destination.Create();
            }
            else
            {
                RemoveReadOnlyAttributes(destination, result);
            }

            // Copy all files.
            FileInfo[] files = source.GetFiles();
            foreach (FileInfo file in files.Where(f => !IsIgnored(ignoredPatterns, f)))
            {
                string fileDestination = _path.Combine(destination.FullName, file.Name);
                CopyFileToFile(result, file, new FileInfo(fileDestination));
            }

            // Process subdirectories.
            DirectoryInfo[] dirs = source.GetDirectories();
            foreach (var dir in dirs)
            {
                // Get destination directory.
                string destinationDir = _path.Combine(destination.FullName, dir.Name);

                // Call CopyDirectory() recursively.
                CopyDirectory(result, dir, new DirectoryInfo(destinationDir), ignoredPatterns);
            }
        }
开发者ID:GorelH,项目名称:dropkick,代码行数:30,代码来源:BaseIoTask.cs

示例9: 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;
        }
开发者ID:oriacle,项目名称:dropkick,代码行数:30,代码来源:WinServiceStopTask.cs

示例10: 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);
            }
        }
开发者ID:fchen,项目名称:dropkick,代码行数:26,代码来源:BaseIisTask.cs

示例11: FindCertificateBy

        public static X509Certificate2 FindCertificateBy(string thumbprint, StoreName storeName, StoreLocation storeLocation, PhysicalServer server, DeploymentResult result)
        {
            if (string.IsNullOrEmpty(thumbprint)) return null;

            var certstore = new X509Store(storeName, storeLocation);

            try
            {
                certstore.Open(OpenFlags.ReadOnly);

                thumbprint = thumbprint.Trim();
                thumbprint = thumbprint.Replace(" ", "");

                foreach (var cert in certstore.Certificates)
                {
                    if (string.Equals(cert.Thumbprint, thumbprint, StringComparison.OrdinalIgnoreCase) || string.Equals(cert.Thumbprint, thumbprint, StringComparison.InvariantCultureIgnoreCase))
                    {
                        return cert;
                    }
                }

                result.AddError("Could not find a certificate with thumbprint '{0}' on '{1}'".FormatWith(thumbprint, server.Name));
                return null;
            }
            finally
            {
                certstore.Close();
            }
        }
开发者ID:Allon-Guralnek,项目名称:dropkick,代码行数:29,代码来源:BaseSecurityCertificatePermissionsTask.cs

示例12: Execute

        public DeploymentResult Execute()
        {
            var results = new DeploymentResult();
            var log = new DeploymentLogger(results);
            var scriptsPath = Path.GetFullPath(_scriptsLocation);
            var useSimpleRecovery = _recoveryMode == DatabaseRecoveryMode.Simple ? true : false;

            try
            {
                switch (_roundhouseMode)
                {
                    case RoundhousEMode.Drop:
                        RoundhousEClientApi.Run(log, _connectionString, scriptsPath, _environmentName, true, useSimpleRecovery,_repositoryPath,_versionFile,_versionXPath);
                        break;
                    case RoundhousEMode.Restore:
                        RoundhousEClientApi.Run(log, _connectionString, scriptsPath, _environmentName, false, useSimpleRecovery, _repositoryPath, _versionFile, _versionXPath, true, _restorePath);
                        break;
                    case RoundhousEMode.DropCreate:
                        RoundhousEClientApi.Run(log, _connectionString, @".\", _environmentName, true, useSimpleRecovery, _repositoryPath, _versionFile, _versionXPath);
                        goto case RoundhousEMode.Normal;
                    case RoundhousEMode.Normal:
                        RoundhousEClientApi.Run(log, _connectionString, scriptsPath, _environmentName, false, useSimpleRecovery, _repositoryPath, _versionFile, _versionXPath);
                        break;
                    default:
                        goto case RoundhousEMode.Normal;
                }

            }
            catch (Exception ex)
            {
                results.AddError("An error occured during RoundhousE execution.", ex);
            }

            return results;
        }
开发者ID:drusellers,项目名称:dropkick,代码行数:35,代码来源:RoundhousETask.cs

示例13: 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;
        }
开发者ID:GorelH,项目名称:dropkick,代码行数:26,代码来源:Iis7Task.cs

示例14: 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;
        }
开发者ID:GorelH,项目名称:dropkick,代码行数:34,代码来源:OutputSqlTask.cs

示例15: CopyDirectory

        protected void CopyDirectory(DeploymentResult result, DirectoryInfo source, DirectoryInfo destination)
        {
            if (!destination.Exists)
            {
                destination.Create();
            }

            // Copy all files.
            FileInfo[] files = source.GetFiles();
            foreach (var file in files)
            {
                string fileDestination = _path.Combine(destination.FullName,
                                                       file.Name);

                CopyFileToFile(result, file, new FileInfo(fileDestination));
            }

            // Process subdirectories.
            DirectoryInfo[] dirs = source.GetDirectories();
            foreach (var dir in dirs)
            {
                // Get destination directory.
                string destinationDir = _path.Combine(destination.FullName, dir.Name);

                // Call CopyDirectory() recursively.
                CopyDirectory(result, dir, new DirectoryInfo(destinationDir));
            }
        }
开发者ID:oriacle,项目名称:dropkick,代码行数:28,代码来源:BaseIoTask.cs


注:本文中的DeploymentResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。