Esempio n. 1
0
 public bool Remove(TT item)
 {
     if (LocalList.Contains(item))
     {
         _dataSource.RemoveFromList(Name, item);
         LocalList.Remove(item);
     }
     //ClearLocalList();
     return(true);
 }
Esempio n. 2
0
        /// <summary>
        /// Utility function to create DeploymentBaseOptions base on current vsMsDeployObject
        /// </summary>
        /// <param name="vSMSDeployObject"></param>
        /// <returns></returns>
        public static /*Deployment.DeploymentBaseOptions*/ dynamic CreateBaseOptions(VSMSDeployObject vSMSDeployObject)
        {
            // /*Deployment.DeploymentBaseOptions*/dynamic baseOptions = new Microsoft.Web.Deployment.DeploymentBaseOptions();
            /*Deployment.DeploymentBaseOptions*/
            dynamic baseOptions = MSWebDeploymentAssembly.DynamicAssembly.CreateObject("Microsoft.Web.Deployment.DeploymentBaseOptions");

            if (vSMSDeployObject.IsLocal)
            {
                // do nothing
            }
            else if (!vSMSDeployObject.UseSeparatedCredential)
            {
                baseOptions.ComputerName = vSMSDeployObject.ComputerName;
            }
            else
            {
                baseOptions.ComputerName = vSMSDeployObject.ComputerName;
                baseOptions.UserName     = vSMSDeployObject.UserName;
                baseOptions.Password     = vSMSDeployObject.Password;
            }

            baseOptions.PrefetchPayload = vSMSDeployObject.PrefetchPayload;
            baseOptions.IncludeAcls     = vSMSDeployObject.IncludeAcls;
            if (!string.IsNullOrEmpty(vSMSDeployObject.AuthenticationType))
            {
                baseOptions.AuthenticationType = vSMSDeployObject.AuthenticationType;
            }
            if (!string.IsNullOrEmpty(vSMSDeployObject.EncryptPassword))
            {
                baseOptions.EncryptPassword = vSMSDeployObject.EncryptPassword;
            }

            if (!string.IsNullOrEmpty(vSMSDeployObject.WebServerManifest))
            {
                baseOptions.WebServerConfiguration.WebServerManifest = System.IO.Path.GetFileName(vSMSDeployObject.WebServerManifest);
            }
            if (!string.IsNullOrEmpty(vSMSDeployObject.WebServerDirectory))
            {
                baseOptions.WebServerConfiguration.WebServerDirectory = vSMSDeployObject.WebServerDirectory;
            }

            if (!string.IsNullOrEmpty(vSMSDeployObject.WebServerAppHostConfigDirectory))
            {
                baseOptions.WebServerConfiguration.ConfigurationDirectory = vSMSDeployObject.WebServerAppHostConfigDirectory;
            }


            if (vSMSDeployObject.RetryInterval >= 0)
            {
                baseOptions.RetryInterval = vSMSDeployObject.RetryInterval;
            }
            if (vSMSDeployObject.RetryAttempts >= 0)
            {
                baseOptions.RetryAttempts = vSMSDeployObject.RetryAttempts;
            }

            if (!string.IsNullOrEmpty(vSMSDeployObject.UserAgent))
            {
                baseOptions.UserAgent = vSMSDeployObject.UserAgent;
            }

            //remove duplicate items appearing in both "EnableLinks" and "DisableLinks" caused by the default value set by publish target file
            Generic.List <string> enabledLinkList  = ConvertStringIntoList(vSMSDeployObject.EnableLinks);
            Generic.List <string> disabledLinkList = ConvertStringIntoList(vSMSDeployObject.DisableLinks);
            foreach (string link in disabledLinkList)
            {
                if (LinkContainedInTheCollection(link, enabledLinkList))
                {
                    enabledLinkList.Remove(link);
                }
            }

            ChangeLinkExtensionEnableStatue(baseOptions, disabledLinkList, false);
            ChangeLinkExtensionEnableStatue(baseOptions, enabledLinkList, true);

            return(baseOptions);
        }