// 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()));
        }
Exemplo n.º 2
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);
        }