// Token: 0x06001659 RID: 5721 RVA: 0x00054610 File Offset: 0x00052810
        public static bool TryConvertOutputObjectKeyProperties(ConvertOutputPropertyEventArgs args, out object convertedValue)
        {
            convertedValue = null;
            ConfigurableObject configurableObject = args.ConfigurableObject;
            PropertyDefinition property           = args.Property;
            string             propertyInStr      = args.PropertyInStr;
            object             value = args.Value;

            if (value == null)
            {
                return(false);
            }
            if (!PswsKeyProperties.IsKeyProperty(configurableObject, property, propertyInStr))
            {
                return(false);
            }
            if (value is string)
            {
                convertedValue = UrlTokenConverter.UrlTokenEncode((string)value);
                return(true);
            }
            if (value is ObjectId)
            {
                convertedValue = new UrlTokenEncodedObjectId(value.ToString());
                return(true);
            }
            if (value is IUrlTokenEncode)
            {
                ((IUrlTokenEncode)value).ReturnUrlTokenEncodedString = true;
                convertedValue = value;
                return(true);
            }
            throw new NotSupportedException(string.Format("Value with type {0} is not supported.", value.GetType()));
        }
        // Token: 0x06001647 RID: 5703 RVA: 0x0005411C File Offset: 0x0005231C
        private object GetParameterValueToProxy(string parameter)
        {
            object result = this.context.InvocationInfo.UserSpecifiedParameters[parameter];

            if (Constants.IsPowerShellWebService)
            {
                string        commandName = this.context.InvocationInfo.CommandName;
                List <string> propertiesNeedUrlTokenInputDecode = PswsKeyProperties.GetPropertiesNeedUrlTokenInputDecode(commandName);
                if (propertiesNeedUrlTokenInputDecode != null && propertiesNeedUrlTokenInputDecode.Contains(parameter) && this.context.InvocationInfo.Fields.Contains(parameter))
                {
                    result = this.context.InvocationInfo.Fields[parameter];
                }
            }
            return(result);
        }
        // Token: 0x06001658 RID: 5720 RVA: 0x00054594 File Offset: 0x00052794
        public static void DecodeKeyProperties(string cmdletName, PropertyBag inputFields)
        {
            List <string> propertiesNeedUrlTokenInputDecode = PswsKeyProperties.GetPropertiesNeedUrlTokenInputDecode(cmdletName);

            foreach (string key in propertiesNeedUrlTokenInputDecode)
            {
                if (inputFields.IsModified(key))
                {
                    object             obj = inputFields[key];
                    IIdentityParameter value;
                    if (obj != null && PswsPropertyConverterModule.TryDecodeIIdentityParameter((IIdentityParameter)obj, out value))
                    {
                        inputFields[key] = value;
                    }
                }
            }
        }
Example #4
0
        // Token: 0x0600123F RID: 4671 RVA: 0x00039550 File Offset: 0x00037750
        internal bool TryConvertKeyToNonOrgHierarchy(ConvertOutputPropertyEventArgs args, out object convertedValue)
        {
            convertedValue = null;
            ConfigurableObject configurableObject = args.ConfigurableObject;
            PropertyDefinition property           = args.Property;
            string             propertyInStr      = args.PropertyInStr;
            object             value = args.Value;

            if (value == null)
            {
                return(false);
            }
            if (!PswsKeyProperties.IsKeyProperty(configurableObject, property, propertyInStr))
            {
                return(false);
            }
            if (value is INonOrgHierarchy)
            {
                ((INonOrgHierarchy)value).OrgHierarchyToIgnore = this.orgHierarchyToIgnore;
                convertedValue = value;
                return(true);
            }
            return(false);
        }