• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# DeploymentResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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(WellKnownRoles.Administrators, MessageQueueAccessRights.FullControl, AccessControlEntryType.Allow);
                result.AddGood("Successfully set permissions for '{0}' on queue '{1}'".FormatWith(WellKnownRoles.Administrators, _address.LocalName));

                q.SetPermissions(WellKnownRoles.CurrentUser, MessageQueueAccessRights.FullControl, AccessControlEntryType.Revoke);
                result.AddGood("Successfully set permissions for '{0}' on queue '{1}'".FormatWith(WellKnownRoles.Administrators, _address.LocalName));

                q.SetPermissions(WellKnownRoles.Everyone, MessageQueueAccessRights.FullControl, AccessControlEntryType.Revoke);
                result.AddGood("Successfully set permissions for '{0}' on queue '{1}'".FormatWith(WellKnownRoles.Administrators, _address.LocalName));

                q.SetPermissions(WellKnownRoles.Anonymous, MessageQueueAccessRights.FullControl, AccessControlEntryType.Revoke);
                result.AddGood("Successfully set permissions for '{0}' on queue '{1}'".FormatWith(WellKnownRoles.Administrators, _address.LocalName));
            }
            catch (MessageQueueException ex)
            {
                if (ex.Message.Contains("does not exist"))
                {
                    var msg = "The queue '{0}' doesn't exist.";
                    throw new DeploymentException(msg, ex);
                }
                throw;
            }
        }
开发者ID:oriacle,项目名称:dropkick,代码行数:30,代码来源:SetSensibleMsmqDefaults.cs


示例17: Ex

        DeploymentResult Ex(Func<DeploymentDetail, DeploymentResult> action)
        {
            Console.WriteLine(Name);
            var result = new DeploymentResult();

            foreach (var role in _roles)
            {
                Console.WriteLine("  {0}", role.Name);

                role.ForEachServer(s =>
                {
                    Console.WriteLine("    {0}", s.Name);
                    s.ForEachDetail(d =>
                    {
                        Console.WriteLine("      {0}", d.Name);
                        var r = action(d);
                        result.MergedWith(r);
                        foreach (var item in r.Results)
                        {
                            Console.WriteLine("      [{0}] {1}", item.Status, item.Message);
                        }
                    });
                });
            }

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


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


示例19: VerifyCanRun

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

            VerifyInAdministratorRole(result);

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


示例20: Execute

        public override DeploymentResult Execute()
        {
            var result = new DeploymentResult();

            ExecuteSqlWithNoReturn("CREATE ROLE [{0}]".FormatWith(_role));

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DeploymentSlot类代码示例发布时间:2022-05-24
下一篇:
C# DeploymentContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap