コード例 #1
0
        public DeploymentResult Execute()
        {
            var result = new DeploymentResult();
            var to     = new DotNetPath().GetFullPath(_to);

            var toParent = GetRootShare(to);

            try
            {
                using (var context = FileShareAuthenticator.BeginFileShareAuthentication(toParent, _userName, _password))
                {
                    result.AddGood("'{0}' authenticated with {1}.".FormatWith(to, _userName));
                }
            }
            catch (Exception err)
            {
                result.AddError("Failed to access '{0}' as user '{1}'".FormatWith(toParent, _userName), err);
            }
            return(result);
        }
コード例 #2
0
        public DeploymentResult VerifyCanRun()
        {
            var    result   = new DeploymentResult();
            var    to       = new DotNetPath().GetFullPath(_to);
            string toParent = GetRootShare(to);

            try
            {
                using (var context = FileShareAuthenticator.BeginFileShareAuthentication(toParent, _userName, _password))
                {
                    result.AddGood(System.IO.Directory.Exists(to) ? "'{0}' already exists.".FormatWith(to) : Name);
                }
            }
            catch (Exception err)
            {
                result.AddError("Failed to access '{0}' as user '{1}'".FormatWith(toParent, _userName), err);
            }
            //TODO figure out a good verify step...
            return(result);
        }