Exemple #1
0
        protected override void ProcessRecord()
        {
            string storeName;

            try
            {
                base.ProcessRecord();
                CertificateSetting certificateSetting = new CertificateSetting();
                certificateSetting.StoreLocation = this.StoreLocation;
                CertificateSetting certificateSetting1 = certificateSetting;
                if (string.IsNullOrEmpty(this.StoreName))
                {
                    storeName = "My";
                }
                else
                {
                    storeName = this.StoreName;
                }
                certificateSetting1.StoreName = storeName;
                certificateSetting.Thumbprint = this.Thumbprint;
                base.WriteObject(certificateSetting, true);
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                base.WriteError(new ErrorRecord(exception, string.Empty, ErrorCategory.CloseError, null));
            }
        }
		protected override void ProcessRecord()
		{
			string storeName;
			try
			{
				base.ProcessRecord();
				CertificateSetting certificateSetting = new CertificateSetting();
				certificateSetting.StoreLocation = this.StoreLocation;
				CertificateSetting certificateSetting1 = certificateSetting;
				if (string.IsNullOrEmpty(this.StoreName))
				{
					storeName = "My";
				}
				else
				{
					storeName = this.StoreName;
				}
				certificateSetting1.StoreName = storeName;
				certificateSetting.Thumbprint = this.Thumbprint;
				base.WriteObject(certificateSetting, true);
			}
			catch (Exception exception1)
			{
				Exception exception = exception1;
				base.WriteError(new ErrorRecord(exception, string.Empty, ErrorCategory.CloseError, null));
			}
		}
        internal void ExecuteCommand()
        {
            CertificateSetting certSettings = new CertificateSetting
            {
                StoreLocation = StoreLocation,
                StoreName     = string.IsNullOrEmpty(StoreName) ? "My" : StoreName,
                Thumbprint    = Thumbprint
            };

            WriteObject(certSettings, true);
        }
        internal void ExecuteCommand()
        {
            CertificateSetting certSettings = new CertificateSetting
            {
                StoreLocation = StoreLocation,
                StoreName = string.IsNullOrEmpty(StoreName) ? "My" : StoreName,
                Thumbprint = Thumbprint
            };

            WriteObject(certSettings, true);
        }
Exemple #5
0
        public static ConfigSetting LoadSetting(XmlElement xmlElement)
        {
            var configSetting = new ConfigSetting();
            var type          = GetAttribute(xmlElement, "type", null);

            if (type == "enum")
            {
                var enumSetting          = new EnumSetting();
                var configOptionElements = xmlElement.SelectNodes("./ConfigOption").OfType <XmlElement>();
                foreach (var configOptionElement in configOptionElements)
                {
                    var enumOption = new EnumOption();
                    enumOption.Name  = GetAttribute(configOptionElement, "name", null);
                    enumOption.Title = GetAttribute(configOptionElement, "title", null);
                    enumOption.Desc  = GetAttribute(configOptionElement, "desc", null);
                    enumSetting.Options.Add(enumOption);
                }

                configSetting = enumSetting;
            }

            if (type == "int")
            {
                var intSetting = new IntSetting();
                intSetting.Min = GetAttribute(xmlElement, "min");
                intSetting.Max = GetAttribute(xmlElement, "max");
                configSetting  = intSetting;
            }

            if (type == "certificate")
            {
                var certificateSetting = new CertificateSetting();
                certificateSetting.IsSsl             = GetBoolAttribute(xmlElement, "isSsl") ?? false;
                certificateSetting.CanGenerate       = GetBoolAttribute(xmlElement, "canGenerate") ?? true;
                certificateSetting.CanExport         = GetBoolAttribute(xmlElement, "canExport") ?? true;
                certificateSetting.CanImport         = GetBoolAttribute(xmlElement, "canImport") ?? true;
                certificateSetting.CanSelect         = GetBoolAttribute(xmlElement, "canSelect") ?? false;
                certificateSetting.CanRemove         = GetBoolAttribute(xmlElement, "canRemove") ?? false;
                certificateSetting.RequirePrivateKey = GetBoolAttribute(xmlElement, "requirePrivateKey") ?? true;
                configSetting = certificateSetting;
            }

            configSetting.Name     = GetAttribute(xmlElement, "name", null);
            configSetting.Default  = GetAttribute(xmlElement, "default", null);
            configSetting.Enabled  = GetAttribute(xmlElement, "enabled", null);
            configSetting.Required = Convert.ToBoolean(GetAttribute(xmlElement, "required", "false"));
            configSetting.Title    = GetAttribute(xmlElement, "title", null);
            configSetting.Type     = GetAttribute(xmlElement, "type", null);
            configSetting.XPath    = GetAttribute(xmlElement, "xpath", null);
            return(configSetting);
        }