예제 #1
0
        protected static DeploymentParameter MakeDeploymentParameterFromDecalredParameter(DeploymentParameterWPI d)
        {
            DeploymentParameter r = new DeploymentParameter();

            r.Name         = d.Name;
            r.FriendlyName = d.FriendlyName;
            r.DefaultValue = d.DefaultValue;
            r.Description  = d.Description;

            r.SetWellKnownTagsFromRawString(d.RawTags);
            if (!string.IsNullOrEmpty(d.ValidationString))
            {
                // synchronized with Microsoft.Web.Deployment.DeploymentSyncParameterValidationKind
                if (d.HasValidation((int)DeploymentParameterValidationKind.AllowEmpty))
                {
                    r.ValidationKind |= DeploymentParameterValidationKind.AllowEmpty;
                }
                if (d.HasValidation((int)DeploymentParameterValidationKind.RegularExpression))
                {
                    r.ValidationKind |= DeploymentParameterValidationKind.RegularExpression;
                }
                if (d.HasValidation((int)DeploymentParameterValidationKind.Enumeration))
                {
                    r.ValidationKind |= DeploymentParameterValidationKind.Enumeration;
                }
                if (d.HasValidation((int)DeploymentParameterValidationKind.Boolean))
                {
                    r.ValidationKind |= DeploymentParameterValidationKind.Boolean;
                }

                r.ValidationString = d.ValidationString;
            }
            else
            {
                r.ValidationKind = DeploymentParameterValidationKind.None;
            }

            return(r);
        }
        public void BindParameter(DeploymentParameter param)
        {
            // store parameter details
            this.Name = param.Name;
            this.FriendlyName = param.FriendlyName;
            this.Description = param.Description;
            this.DefaultValue = param.DefaultValue;
            this.wellKnownTags = param.WellKnownTags;
            this.validationKind = param.ValidationKind;
            this.validationString = param.ValidationString;

            // toggle controls
            BindControls();
        }
 public DeploymentParameter GetParameter()
 {
     DeploymentParameter parameter = new DeploymentParameter();
     parameter.Name = this.Name;
     parameter.FriendlyName = this.FriendlyName;
     parameter.Description = this.Description;
     parameter.Value = GetParameterValue();
     parameter.DefaultValue = this.DefaultValue;
     parameter.WellKnownTags = this.WellKnownTags;
     parameter.ValidationKind = this.ValidationKind;
     parameter.ValidationString = this.ValidationString;
     return parameter;
 }
예제 #4
0
 /// <remarks/>
 public void InstallGalleryApplicationAsync(string id, DeploymentParameter[] updatedValues, object userState) {
     if ((this.InstallGalleryApplicationOperationCompleted == null)) {
         this.InstallGalleryApplicationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnInstallGalleryApplicationOperationCompleted);
     }
     this.InvokeAsync("InstallGalleryApplication", new object[] {
                 id,
                 updatedValues}, this.InstallGalleryApplicationOperationCompleted, userState);
 }
예제 #5
0
 /// <remarks/>
 public void InstallGalleryApplicationAsync(string id, DeploymentParameter[] updatedValues) {
     this.InstallGalleryApplicationAsync(id, updatedValues, null);
 }
예제 #6
0
 /// <remarks/>
 public System.IAsyncResult BeginInstallGalleryApplication(string id, DeploymentParameter[] updatedValues, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("InstallGalleryApplication", new object[] {
                 id,
                 updatedValues}, callback, asyncState);
 }
예제 #7
0
 public StringResultObject InstallGalleryApplication(string id, DeploymentParameter[] updatedValues) {
     object[] results = this.Invoke("InstallGalleryApplication", new object[] {
                 id,
                 updatedValues});
     return ((StringResultObject)(results[0]));
 }
		public List<DeploymentParameter> GetApplicationParameters(string productId)
		{
			string packageFile = GetApplicationPackagePath(productId);
			//
			if (String.IsNullOrEmpty(packageFile))
				return null;
			//
			List<DeploymentParameter> appParams = new List<DeploymentParameter>();
			//
			DeploymentObject iisApplication = null;
			//
			try
			{
				iisApplication = DeploymentManager.CreateObject(DeploymentWellKnownProvider.Package, packageFile);
				//
				foreach (DeploymentSyncParameter parameter in iisApplication.SyncParameters)
				{
                    DeploymentParameter p = new DeploymentParameter
					{
						Name = parameter.Name,
						FriendlyName = !String.IsNullOrEmpty(parameter.FriendlyName) ? parameter.FriendlyName : parameter.Name,
						Value = parameter.Value,
						DefaultValue = parameter.DefaultValue,
						Description = parameter.Description,
                        ValidationKind = (DeploymentParameterValidationKind)parameter.Validation.Kind,
                        ValidationString = parameter.Validation.ValidationString,
                        WellKnownTags = (DeploymentParameterWellKnownTag)parameter.WellKnownTags
					};

                    // add to the list
                    appParams.Add(p);

                    // fix tags for parameters with hard-coded names
                    if(wellKnownParameters.ContainsKey(p.Name))
                        p.WellKnownTags |= wellKnownParameters[p.Name];
				}
			}
			catch (Exception ex)
			{
				// Log an error
				Log.WriteError(
					String.Format("Could not read deployment parameters from '{0}' package.", packageFile), ex);
				//
				throw;
			}
			finally
			{
				if (iisApplication != null)
					iisApplication.Dispose();
			}
			//
			return appParams;
		}
예제 #9
0
 public StringResultObject InstallGalleryApplication(int UserId, string id, DeploymentParameter[] updatedValues, string languageId)
 {
     object[] results = this.Invoke("InstallGalleryApplication", new object[] {
                 UserId,
                 id,
                 updatedValues,
                 languageId});
     return ((StringResultObject)(results[0]));
 }
예제 #10
0
 /// <remarks/>
 public void InstallGalleryApplicationAsync(int UserId, string id, DeploymentParameter[] updatedValues, string languageId)
 {
     this.InstallGalleryApplicationAsync(UserId, id, updatedValues, languageId, null);
 }
 /// <remarks/>
 public void InstallAsync(int packageId, string webAppId, string siteName, string virtualDir, DeploymentParameter[] parameters, object userState) {
     if ((this.InstallOperationCompleted == null)) {
         this.InstallOperationCompleted = new System.Threading.SendOrPostCallback(this.OnInstallOperationCompleted);
     }
     this.InvokeAsync("Install", new object[] {
                 packageId,
                 webAppId,
                 siteName,
                 virtualDir,
                 parameters}, this.InstallOperationCompleted, userState);
 }
 /// <remarks/>
 public void InstallAsync(int packageId, string webAppId, string siteName, string virtualDir, DeploymentParameter[] parameters) {
     this.InstallAsync(packageId, webAppId, siteName, virtualDir, parameters, null);
 }
 /// <remarks/>
 public System.IAsyncResult BeginInstall(int packageId, string webAppId, string siteName, string virtualDir, DeploymentParameter[] parameters, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("Install", new object[] {
                 packageId,
                 webAppId,
                 siteName,
                 virtualDir,
                 parameters}, callback, asyncState);
 }
 public StringResultObject Install(int packageId, string webAppId, string siteName, string virtualDir, DeploymentParameter[] parameters) {
     object[] results = this.Invoke("Install", new object[] {
                 packageId,
                 webAppId,
                 siteName,
                 virtualDir,
                 parameters});
     return ((StringResultObject)(results[0]));
 }
 private bool ApplyPrefixSuffixPolicy(DeploymentParameter parameter, string policyValue)
 {
     if (null != policyValue)
     {
         string prefix, suffix;
         ParsePolicyPrefixSuffix(policyValue, out prefix, out suffix);
         if (!string.IsNullOrEmpty(prefix))
             parameter.ValuePrefix = prefix;
         if (!string.IsNullOrEmpty(suffix))
             parameter.ValueSuffix = suffix;
         return true;
     }
     return false;
 }