public IInstaller GetInstaller(IReadOnlyDictionary <string, object> initParams)
        {
            var inst = new IisInstaller();

            if (initParams == null)
            {
                initParams = new Dictionary <string, object>();
            }

            // Required params
            initParams.GetParameter(WEB_SITE_REF,
                                    (string x) => inst.WebSiteRef = x);

            // Optional params
            initParams.GetParameter(BINDING_ADDRESS,
                                    (string x) => inst.BindingAddress = x);
            initParams.GetParameter(BINDING_PORT,
                                    (int x) => inst.BindingPort = x);
            initParams.GetParameter(BINDING_HOST,
                                    (string x) => inst.BindingHost = x);
            initParams.GetParameter(BINDING_HOST_REQUIRED,
                                    (bool x) => inst.BindingHostRequired = x);
            initParams.GetParameter(FORCE,
                                    (bool x) => inst.Force = x);
            initParams.GetParameter(CERTIFICATE_FRIENDLY_NAME,
                                    (string x) => inst.CertificateFriendlyName = x);

            return(inst);
        }
예제 #2
0
        public IInstaller GetInstaller(IReadOnlyDictionary <string, object> initParams)
        {
            var inst = new IisInstaller();

            if (initParams == null)
            {
                initParams = new Dictionary <string, object>();
            }

            // Required params
            if (!initParams.ContainsKey(WEB_SITE_REF.Name))
            {
                throw new KeyNotFoundException($"missing required parameter [{WEB_SITE_REF.Name}]");
            }
            inst.WebSiteRef = (string)initParams[WEB_SITE_REF.Name];

            // Optional params
            if (initParams.ContainsKey(BINDING_ADDRESS.Name))
            {
                inst.BindingAddress = (string)initParams[BINDING_ADDRESS.Name];
            }
            if (initParams.ContainsKey(BINDING_PORT.Name))
            {
                inst.BindingPort = (int)((long)initParams[BINDING_PORT.Name]);
            }
            if (initParams.ContainsKey(BINDING_HOST.Name))
            {
                inst.BindingHost = (string)initParams[BINDING_HOST.Name];
            }
            if (initParams.ContainsKey(BINDING_HOST_REQUIRED.Name))
            {
                inst.BindingHostRequired = (bool)initParams[BINDING_HOST_REQUIRED.Name];
            }
            if (initParams.ContainsKey(FORCE.Name))
            {
                inst.Force = (bool)initParams[FORCE.Name];
            }

            return(inst);
        }