예제 #1
0
        public override void ExtractingProperty(Item item, ContentProperty propertyData)
        {
            if (propertyData.Value != null)
            {
                var links = JsonConvert.DeserializeObject <JArray>(propertyData.Value.ToString());
                if (links != null)
                {
                    foreach (var link in links)
                    {
                        var isMedia = link["isMedia"] != null || link["udi"] != null && link["udi"].ToString().StartsWith("umb://media");

                        if (link["id"] == null)
                        {
                            continue;
                        }

                        var nodeObjectType = isMedia
                            ? UmbracoNodeObjectTypeIds.Media
                            : UmbracoNodeObjectTypeIds.Document;

                        Guid nodeGuid;
                        if (Guid.TryParse(link["id"].ToString(), out nodeGuid))
                        {
                            link["id"] = ExecutionContext.DatabasePersistence.GetNodeId(nodeGuid, nodeObjectType);
                        }
                    }

                    propertyData.Value = links;
                }
            }
        }
예제 #2
0
        public int Save(ContentBinding Model)
        {
            using (var _c = db)
            {
                var _Model = new ContentProperty();
                if (Model.ContentPropertyID == 0)
                {
                    var _IQParent = _c.ContentProperties.Where(m => m.SiteID == Model.SiteID && m.ContentPropertyParentID == Model.ContentPropertyParentID);
                    _Model.ContentPropertyParentID = Model.ContentPropertyParentID;
                    _Model.SiteID   = Model.SiteID;
                    _Model.Priority = _IQParent.Any() ? _IQParent.Select(m => m.Priority).Max() + 1 : 0;
                    _Model.Lock     = Model.Lock;
                    _Model.Enabled  = true;
                    _c.ContentProperties.Add(_Model);
                }
                else
                {
                    _Model          = _c.ContentProperties.Where(m => m.ContentPropertyID == Model.ContentPropertyID).SingleOrDefault();
                    _Model.Priority = Model.Priority;
                }
                _Model.ContentPropertyAlias = Model.ContentPropertyAlias;
                _Model.ContentPropertyType  = Model.ContentPropertyType;
                _c.SaveChanges();

                //SAVE ROOT
                AddRoot(_Model.ContentPropertyID, _Model.ContentPropertyParentID);

                return(_Model.ContentPropertyID);
            }
        }
예제 #3
0
파일: Tags.cs 프로젝트: jayvin/Courier
 public override void PackagingProperty(Item item, ContentProperty propertyData)
 {
     if (item != null)
     {
         item.Dependencies.Add(item.ItemId.Id, ProviderIDCollection.tagRelationsProviderGuid);
     }
 }
예제 #4
0
 static CustomContentControl()
 {
     ContentProperty.OverrideMetadata(
         typeof(CustomContentControl),
         new FrameworkPropertyMetadata(new PropertyChangedCallback(OnContentChanged))
         );
 }
예제 #5
0
 static LayoutFloatingWindowControl()
 {
     AllowsTransparencyProperty.OverrideMetadata(typeof(LayoutFloatingWindowControl), new FrameworkPropertyMetadata(false));
     ContentProperty.OverrideMetadata(typeof(LayoutFloatingWindowControl), new FrameworkPropertyMetadata(null, null, CoerceContentValue));
     ShowInTaskbarProperty.OverrideMetadata(typeof(LayoutFloatingWindowControl), new FrameworkPropertyMetadata(false));
     WindowStyleProperty.OverrideMetadata(typeof(LayoutFloatingWindowControl), new FrameworkPropertyMetadata(WindowStyle.None));
 }
예제 #6
0
        public static ContentPropertyResponse CreateContentlessDocumentLinkToFolder(string repo, string folderId)
        {
            DocumentumServiceUtils.ConfigureApiClient(repo);
            ContentProperty contentProperty = new ContentProperty();

            contentProperty.properties = new PropertiesType();
            contentProperty.properties.r_object_type  = "dwr_gen_doc";
            contentProperty.properties.object_name    = "readme6";
            contentProperty.properties.author_creator = "Pedro Barroso";
            contentProperty.properties.author_date    = "2017-09-26";
            contentProperty.properties.topic_subject  = "The subject";

            IDocumentumApi          documentumApi = new DocumentumApi();
            ContentPropertyResponse response      = null;

            try
            {
                response = documentumApi.CreateContentlessDocument(repo, folderId, contentProperty);
            }
            catch (ApiException ex)
            {
                Log.Error(ex);
            }
            return(response);
        }
예제 #7
0
 static RangeBase3D()
 {
     ContentProperty.OverrideMetadata(
         typeof(RangeBase3D),
         new UIPropertyMetadata(
             ContentPropertyChanged));
 }
예제 #8
0
            public void SetsOrderFieldAndAscendingDirection(ContentProperty field)
            {
                var sut = new ContentCriteria().OrderBy(field);

                Assert.AreEqual(EkEnumeration.OrderByDirection.Ascending, sut.OrderByDirection);
                Assert.AreEqual(field, sut.OrderByField);
            }
예제 #9
0
        void Attach()
        {
            _verticalScrollBarVisibilityProperty.Attach(OnScrollBarVisibilityChanged);
            _horizontalScrollBarVisibilityProperty.Attach(OnScrollBarVisibilityChanged);

            ContentProperty.Attach(OnContentChanged);
        }
        /// <summary>
        /// Get the dependency property tests.
        /// </summary>
        /// <returns>The dependency property tests.</returns>
        public override IEnumerable <DependencyPropertyTestMethod> GetDependencyPropertyTests()
        {
            // Get the base Control dependency property tests
            IList <DependencyPropertyTestMethod> tests = TagInherited(base.GetDependencyPropertyTests());

            // ContentProperty tests
            tests.Add(ContentProperty.CheckDefaultValueTest);
            tests.Add(ContentProperty.ChangeClrSetterTest);
            tests.Add(ContentProperty.ChangeSetValueTest);
            tests.Add(ContentProperty.SetNullTest);
            tests.Add(ContentProperty.ClearValueResetsDefaultTest);
            tests.Add(ContentProperty.CanBeStyledTest);
            tests.Add(ContentProperty.TemplateBindTest);
            tests.Add(ContentProperty.DoesNotChangeVisualStateTest(null, "Test"));
            tests.Add(ContentProperty.SetXamlAttributeTest);
            tests.Add(ContentProperty.SetXamlElementTest);
            tests.Add(ContentProperty.SetXamlContentTest);
            tests.Add(ContentProperty.IsContentPropertyTest);
            tests.Add(ContentProperty.DataTemplateWithIntTest);
            tests.Add(ContentProperty.DataTemplateWithStringTest);
            tests.Add(ContentProperty.DataTemplateWithStringAndPropertyTest);
            tests.Add(ContentProperty.DataTemplateWithUIElementFailsTest);
            tests.Add(ContentProperty.DataTemplateWithBusinessObjectTest);

            // ContentTemplateProperty tests
            tests.Add(ContentTemplateProperty.CheckDefaultValueTest);
            tests.Add(ContentTemplateProperty.ChangeClrSetterTest);
            tests.Add(ContentTemplateProperty.ChangeSetValueTest);
            tests.Add(ContentTemplateProperty.SetNullTest);
            tests.Add(ContentTemplateProperty.ClearValueResetsDefaultTest);
            tests.Add(ContentTemplateProperty.CanBeStyledTest);
            tests.Add(ContentTemplateProperty.TemplateBindTest);

            return(tests);
        }
예제 #11
0
 static StyleDialog()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(StyleDialog), new FrameworkPropertyMetadata(typeof(StyleDialog)));
     ContentProperty.OverrideMetadata(typeof(StyleDialog), new FrameworkPropertyMetadata(new PropertyChangedCallback(Changed)));
     WidthProperty.OverrideMetadata(typeof(StyleDialog), new FrameworkPropertyMetadata(new PropertyChangedCallback(Changed)));
     HeightProperty.OverrideMetadata(typeof(StyleDialog), new FrameworkPropertyMetadata(new PropertyChangedCallback(Changed)));
 }
예제 #12
0
 public override void PackagingProperty(Item item, ContentProperty propertyData)
 {
     if (item != null)
     {
         item.Dependencies.Add(item.ItemId.Id, ProviderIDCollection.tagRelationsProviderGuid);
     }
 }
        /// <summary>
        /// Get the dependency property tests.
        /// </summary>
        /// <returns>The dependency property tests.</returns>
        public override IEnumerable <DependencyPropertyTestMethod> GetDependencyPropertyTests()
        {
            List <DependencyPropertyTestMethod> tests = new List <DependencyPropertyTestMethod>(base.GetDependencyPropertyTests());

            tests.RemoveTests(ContentProperty.DoesNotChangeVisualStateTest(null, "Test"));
            return(tests);
        }
예제 #14
0
 public override void ExtractingProperty(Core.Item item, ContentProperty propertyData)
 {
     propertyData.Value = XmlDependencies.ReplaceIds(
         propertyData.Value.ToString(),
         dataXpath,
         IdentifierReplaceDirection.FromGuidToNodeId);
 }
예제 #15
0
        public int Save(ContentBindingList Model)
        {
            using (var _c = db)
            {
                var _CP = new ContentProperty
                {
                    ContentPropertyParentID = Model.ContentPropertyParentID,
                    SiteID = Model.SiteID,
                    ContentPropertyType  = Model.ContentPropertyType,
                    ContentPropertyAlias = Model.ContentPropertyAlias,
                    Priority             = Model.Priority,
                    Lock          = Model.Lock,
                    ShowInContent = Model.ShowInContent,
                    Enabled       = true
                };
                _c.ContentProperties.Add(_CP);
                _c.SaveChanges();
                //SAVE ROOT
                AddRoot(_CP.ContentPropertyID, _CP.ContentPropertyParentID);

                var _NumCultureSite = _c.Cultures.Where(m => m.SiteID == Model.SiteID).Count();
                if (_NumCultureSite < Model.ContentCultures.Count())
                {
                    throw new RuleException(ContentRuleExceptionCode.MORECULTURES.ToString(), "Content Alias:" + Model.ContentPropertyAlias + " with " + Model.ContentCultures.Count() + " and Site have " + _NumCultureSite + " Cultures");
                }
                foreach (var item in Model.ContentCultures)
                {
                    item.ContentPropertyID = _CP.ContentPropertyID;
                    SaveCulture(item, Model.SiteID);
                }
                return(_CP.ContentPropertyID);
            }
        }
예제 #16
0
        /// <summary>
        /// Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes.
        /// </summary>
        /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.</param>
        /// <param name="value">An <see cref="T:System.Object" /> that specifies the type of array for which to get properties.</param>
        /// <param name="attributes">An array of type <see cref="T:System.Attribute" /> that is used as a filter.</param>
        /// <returns>
        /// A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the properties that are exposed for this data type, or null if there are no properties.
        /// </returns>
        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
        {
            var typeDesc = (ContentTypeDescriptor)context.Instance;
            var content  = typeDesc.Content;
            PropertyDescriptorCollection result = TypeDescriptor.GetProperties(value, attributes);
            var properties = new List <ContentPropertyDescriptor>();

            // Build the property descriptors for the blending type.
            foreach (PropertyDescriptor descriptor in result.Cast <PropertyDescriptor>().Where(item => !_depthProps.Contains(item.Name)))
            {
                var contentProp = new ContentProperty(descriptor, value, content.TypeDescriptor["Stencil"])
                {
                    HasDefaultValue   = true,
                    RefreshProperties = RefreshProperties.All,
                    IsReadOnly        = false
                };

                if (string.Equals(descriptor.Name, "FrontFace", StringComparison.OrdinalIgnoreCase))
                {
                    contentProp.IsReadOnly  = true;
                    contentProp.Converter   = typeof(StencilStateTypeConverter).AssemblyQualifiedName;
                    contentProp.DisplayName = APIResources.PROP_STENCIL_FRONT_NAME;
                    contentProp.Description = APIResources.PROP_STENCIL_FRONT_DESC;
                }

                if (string.Equals(descriptor.Name, "BackFace", StringComparison.OrdinalIgnoreCase))
                {
                    contentProp.IsReadOnly  = true;
                    contentProp.Converter   = typeof(StencilStateTypeConverter).AssemblyQualifiedName;
                    contentProp.DisplayName = APIResources.PROP_STENCIL_BACK_NAME;
                    contentProp.Description = APIResources.PROP_STENCIL_BACK_DESC;
                }

                if (string.Equals(descriptor.Name, "StencilReference", StringComparison.OrdinalIgnoreCase))
                {
                    contentProp.DisplayName  = APIResources.PROP_STENCIL_REFERENCE_NAME;
                    contentProp.Description  = APIResources.PROP_STENCIL_REFERENCE_DESC;
                    contentProp.DefaultValue = 0;
                }

                if (string.Equals(descriptor.Name, "StencilReadMask", StringComparison.OrdinalIgnoreCase))
                {
                    contentProp.DisplayName  = APIResources.PROP_STENCIL_READ_MASK_NAME;
                    contentProp.Description  = APIResources.PROP_STENCIL_READ_MASK_DESC;
                    contentProp.DefaultValue = 255;
                }

                if (string.Equals(descriptor.Name, "StencilWriteMask", StringComparison.OrdinalIgnoreCase))
                {
                    contentProp.DisplayName  = APIResources.PROP_STENCIL_WRITE_MASK_NAME;
                    contentProp.Description  = APIResources.PROP_STENCIL_WRITE_MASK_DESC;
                    contentProp.DefaultValue = 255;
                }

                properties.Add(new ContentPropertyDescriptor(contentProp));
            }

            return(new PropertyDescriptorCollection(properties.Cast <PropertyDescriptor>().OrderBy(item => item.DisplayName ?? item.Name).ToArray()));
        }
예제 #17
0
        protected void AttendButton_Click(object sender, EventArgs e)
        {
            IParticipant participant;

            if (!string.IsNullOrEmpty(HiddenEmail.Value))
            {
                participant = AttendRegistrationEngine.GetParticipant(HiddenEmail.Value, HiddenCode.Value);
                if (participant != null)
                {
                    participant = (participant as ParticipantBlock).CreateWritableClone() as ParticipantBlock;
                }
            }

            else
            {
                string participantEmail = "";
                foreach (var fragment in DetailsXFormControl.ExtractXFormControls())
                {
                    if (fragment.ID == "epost" || fragment.ID == "email")
                    {
                        participantEmail = fragment.Value;
                    }
                }


                if (string.IsNullOrEmpty(participantEmail) || Business.Email.Validation.IsEmail(participantEmail) == false)
                {
                    return;
                }

                participant = AttendRegistrationEngine.GenerateParticipation(CurrentData.ContentLink, participantEmail, true, DetailsXFormControl.Data.Data.OuterXml, "Participant submitted form");
            }
            if (participant != null)
            {
                participant.XForm    = DetailsXFormControl.Data.Data.OuterXml;
                participant.Sessions = new ContentArea();
                foreach (ContentReference item in GetChosenSessions())
                {
                    participant.Sessions.Items.Add(new ContentAreaItem()
                    {
                        ContentLink = item
                    });
                }
                Locate.ContentRepository().Save(participant as IContent, EPiServer.DataAccess.SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess);
                string propertyName = "";
                if (participant.AttendStatus == AttendStatus.Confirmed.ToString())
                {
                    propertyName = "CompleteContent";
                }
                if (participant.AttendStatus == AttendStatus.Submitted.ToString())
                {
                    propertyName = "SubmittedContent";
                }
                ContentProperty.PropertyName = propertyName;
                ContentProperty.DataBind();
                DetailsXFormControl.Visible = false;
                AttendButton.Visible        = false;
            }
        }
예제 #18
0
 static MediaPlayer()
 {
     DefaultStyleKeyProperty.OverrideMetadata(typeof(MediaPlayer), new FrameworkPropertyMetadata(typeof(MediaPlayer)));
     BackgroundProperty.OverrideMetadata(typeof(MediaPlayer), new FrameworkPropertyMetadata(Brushes.Black));
     HorizontalAlignmentProperty.OverrideMetadata(typeof(MediaPlayer), new FrameworkPropertyMetadata(HorizontalAlignment.Stretch));
     VerticalAlignmentProperty.OverrideMetadata(typeof(MediaPlayer), new FrameworkPropertyMetadata(VerticalAlignment.Stretch));
     ContentProperty.OverrideMetadata(typeof(MediaPlayer), new FrameworkPropertyMetadata(ContentChanged, CoerceContent));
 }
예제 #19
0
        static MyLabel()
        {
            ContentProperty.OverrideMetadata(typeof(MyLabel),

                                             new FrameworkPropertyMetadata(

                                                 new PropertyChangedCallback(OnContentChanged)));
        }
예제 #20
0
        static TransitionControl()
        {
            DefaultStyleKeyProperty.OverrideMetadata(
                typeof(TransitionControl), new FrameworkPropertyMetadata(typeof(TransitionControl)));

            ContentProperty.OverrideMetadata(
                typeof(TransitionControl), new FrameworkPropertyMetadata(OnContentPropertyChanged));
        }
        public override void PackagingProperty(Item item, ContentProperty propertyData)
        {
            Guid g;

            if (propertyData.Value != null && Guid.TryParse(propertyData.Value.ToString(), out g))
            {
                item.Dependencies.Add(g.ToString(), Constants.ProviderId);
            }
        }
예제 #22
0
 /// <summary>
 /// Initializes static members of the <see cref="MathBlock" /> class.
 /// </summary>
 static MathBlock()
 {
     DefaultStyleKeyProperty.OverrideMetadata(
         typeof(MathBlock),
         new FrameworkPropertyMetadata(typeof(MathBlock)));
     ContentProperty.OverrideMetadata(
         typeof(MathBlock),
         new FrameworkPropertyMetadata(typeof(MathBlock), (s, e) => ((MathBlock)s).ContentChanged()));
 }
예제 #23
0
 public static ContentPropertyDto ToDto(this ContentProperty property)
 {
     return(new ContentPropertyDto
     {
         IsRequired = property.IsRequired,
         Key = property.Key,
         Value = property.Value.ToDto()
     });
 }
예제 #24
0
        /// <summary>
        /// Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes.
        /// </summary>
        /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.</param>
        /// <param name="value">An <see cref="T:System.Object" /> that specifies the type of array for which to get properties.</param>
        /// <param name="attributes">An array of type <see cref="T:System.Attribute" /> that is used as a filter.</param>
        /// <returns>
        /// A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the properties that are exposed for this data type, or null if there are no properties.
        /// </returns>
        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
        {
            var typeDesc = (ContentTypeDescriptor)context.Instance;
            PropertyDescriptorCollection result = TypeDescriptor.GetProperties(value, attributes);
            var properties = new List <ContentPropertyDescriptor>();

            // Build the property descriptors for the blending type.
            foreach (PropertyDescriptor descriptor in result)
            {
                var contentProp = new ContentProperty(descriptor, value, typeDesc["TextureSampler"])
                {
                    HasDefaultValue   = true,
                    RefreshProperties = RefreshProperties.All,
                    IsReadOnly        = typeDesc["TextureSampler"].IsReadOnly
                };

                if (string.Equals(descriptor.Name, "TextureFilter", StringComparison.OrdinalIgnoreCase))
                {
                    contentProp.DefaultValue = TextureFilter.Point;
                    contentProp.Converter    = typeof(TextureFilterTypeConverter).AssemblyQualifiedName;
                    contentProp.DisplayName  = APIResources.PROP_SAMPLE_FILTER_NAME;
                    contentProp.Description  = APIResources.PROP_SAMPLE_FILTER_DESC;
                }

                if (string.Equals(descriptor.Name, "HorizontalWrapping", StringComparison.OrdinalIgnoreCase))
                {
                    contentProp.RefreshProperties = RefreshProperties.All;
                    contentProp.DefaultValue      = TextureAddressing.Clamp;
                    contentProp.Converter         = typeof(TextureAddressingTypeConverter).AssemblyQualifiedName;
                    contentProp.DisplayName       = APIResources.PROP_SAMPLE_HORZADDR_NAME;
                    contentProp.Description       = APIResources.PROP_SAMPLE_HORZADDR_DESC;
                }

                if (string.Equals(descriptor.Name, "VerticalWrapping", StringComparison.OrdinalIgnoreCase))
                {
                    contentProp.RefreshProperties = RefreshProperties.All;
                    contentProp.DefaultValue      = TextureAddressing.Clamp;
                    contentProp.Converter         = typeof(TextureAddressingTypeConverter).AssemblyQualifiedName;
                    contentProp.DisplayName       = APIResources.PROP_SAMPLE_VERTADDR_NAME;
                    contentProp.Description       = APIResources.PROP_SAMPLE_VERTADDR_DESC;
                }

                if (string.Equals(descriptor.Name, "BorderColor", StringComparison.OrdinalIgnoreCase))
                {
                    contentProp.DefaultValue = GorgonColor.Transparent;
                    contentProp.Converter    = typeof(RGBATypeConverter).AssemblyQualifiedName;
                    contentProp.SetTypeEditor(typeof(RGBAEditor), typeof(UITypeEditor));
                    contentProp.DisplayName = APIResources.PROP_SAMPLE_BORDER_NAME;
                    contentProp.Description = APIResources.PROP_SAMPLE_BORDER_DESC;
                }

                properties.Add(new ContentPropertyDescriptor(contentProp));
            }

            return(new PropertyDescriptorCollection(properties.Cast <PropertyDescriptor>().OrderBy(item => item.DisplayName ?? item.Name).ToArray()));
        }
예제 #25
0
        static FormattedTextBlock()
        {
            DefaultStyleKeyProperty.OverrideMetadata(
                typeof(FormattedTextBlock),
                new FrameworkPropertyMetadata(typeof(FormattedTextBlock)));

            ContentProperty.OverrideMetadata(
                typeof(FormattedTextBlock),
                new PropertyMetadata(defaultValue: null,
                                     ContentPropertyChangedHandler));
        }
        static DocumentFloatingWindow()
        {
            //This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
            //This style is defined in themes\generic.xaml
            DefaultStyleKeyProperty.OverrideMetadata(typeof(DocumentFloatingWindow), new FrameworkPropertyMetadata(typeof(DocumentFloatingWindow)));

            ContentProperty.OverrideMetadata(typeof(DocumentFloatingWindow),
                                             new FrameworkPropertyMetadata(
                                                 new PropertyChangedCallback(OnContentPropertyChanged),
                                                 new CoerceValueCallback(OnCoerceValueContentProperty)));
        }
예제 #27
0
        /// <summary>
        ///   Initializes static members of the RibbonGalleryItem class.
        /// </summary>
        static RibbonGalleryItem()
        {
            Type ownerType = typeof(RibbonGalleryItem);

            DefaultStyleKeyProperty.OverrideMetadata(ownerType, new FrameworkPropertyMetadata(ownerType));
            ContentProperty.OverrideMetadata(ownerType, new FrameworkPropertyMetadata(null, new PropertyChangedCallback(OnContentChanged), new CoerceValueCallback(CoerceContent)));
            ToolTipProperty.OverrideMetadata(ownerType, new FrameworkPropertyMetadata(null, new CoerceValueCallback(RibbonHelper.CoerceRibbonToolTip)));
            ToolTipService.ShowOnDisabledProperty.OverrideMetadata(ownerType, new FrameworkPropertyMetadata(true));
            EventManager.RegisterClassHandler(ownerType, KeyTipService.ActivatingKeyTipEvent, new ActivatingKeyTipEventHandler(OnActivatingKeyTipThunk));
            EventManager.RegisterClassHandler(ownerType, KeyTipService.KeyTipAccessedEvent, new KeyTipAccessedEventHandler(OnKeyTipAccessedThunk));
        }
예제 #28
0
        /// <summary>
        /// Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes.
        /// </summary>
        /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.</param>
        /// <param name="value">An <see cref="T:System.Object" /> that specifies the type of array for which to get properties.</param>
        /// <param name="attributes">An array of type <see cref="T:System.Attribute" /> that is used as a filter.</param>
        /// <returns>
        /// A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the properties that are exposed for this data type, or null if there are no properties.
        /// </returns>
        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
        {
            PropertyDescriptorCollection result = TypeDescriptor.GetProperties(value, attributes);
            var properties = new List <ContentPropertyDescriptor>();

            Debug.Assert(context.PropertyDescriptor != null, "Property descriptor is NULL");

            // Build the property descriptors for the blending type.
            foreach (PropertyDescriptor descriptor in result)
            {
                var contentProp = new ContentProperty(descriptor, value, ((ContentPropertyDescriptor)context.PropertyDescriptor).ContentProperty)
                {
                    HasDefaultValue   = true,
                    RefreshProperties = RefreshProperties.All,
                    IsReadOnly        = false
                };

                if (string.Equals(descriptor.Name, "ComparisonOperator", StringComparison.OrdinalIgnoreCase))
                {
                    contentProp.Converter    = typeof(ComparisonTypeConverter).AssemblyQualifiedName;
                    contentProp.DefaultValue = ComparisonOperator.Always;
                    contentProp.DisplayName  = APIResources.PROP_STENCIL_OP_COMPARE_NAME;
                    contentProp.Description  = APIResources.PROP_STENCIL_OP_COMPARE_DESC;
                }

                if (string.Equals(descriptor.Name, "PassOperation", StringComparison.OrdinalIgnoreCase))
                {
                    contentProp.Converter    = typeof(StencilOperationsTypeConverter).AssemblyQualifiedName;
                    contentProp.DefaultValue = StencilOperation.Keep;
                    contentProp.DisplayName  = APIResources.PROP_STENCIL_OP_PASS_NAME;
                    contentProp.Description  = APIResources.PROP_STENCIL_OP_PASS_DESC;
                }

                if (string.Equals(descriptor.Name, "FailOperation", StringComparison.OrdinalIgnoreCase))
                {
                    contentProp.Converter    = typeof(StencilOperationsTypeConverter).AssemblyQualifiedName;
                    contentProp.DefaultValue = StencilOperation.Keep;
                    contentProp.DisplayName  = APIResources.PROP_STENCIL_OP_FAIL_NAME;
                    contentProp.Description  = APIResources.PROP_STENCIL_OP_FAIL_DESC;
                }

                if (string.Equals(descriptor.Name, "DepthFailOperation", StringComparison.OrdinalIgnoreCase))
                {
                    contentProp.Converter    = typeof(StencilOperationsTypeConverter).AssemblyQualifiedName;
                    contentProp.DefaultValue = StencilOperation.Keep;
                    contentProp.DisplayName  = APIResources.PROP_STENCIL_OP_DEPTH_FAIL_NAME;
                    contentProp.Description  = APIResources.PROP_STENCIL_OP_DEPTH_FAIL_DESC;
                }

                properties.Add(new ContentPropertyDescriptor(contentProp));
            }

            return(new PropertyDescriptorCollection(properties.Cast <PropertyDescriptor>().OrderBy(item => item.DisplayName ?? item.Name).ToArray()));
        }
예제 #29
0
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
        #region Constructors
        /// <summary>
        /// Constructs a window object
        /// </summary>
        static NavigationWindow()
        {
            _dType = DependencyObjectType.FromSystemTypeInternal(typeof(NavigationWindow));

            DefaultStyleKeyProperty.OverrideMetadata(
                typeof(NavigationWindow),
                new FrameworkPropertyMetadata(typeof(NavigationWindow)));

            ContentProperty.OverrideMetadata(
                typeof(NavigationWindow),
                new FrameworkPropertyMetadata(
                    null,
                    new CoerceValueCallback(CoerceContent)));

            SandboxExternalContentProperty.OverrideMetadata(
                typeof(NavigationWindow),
                new FrameworkPropertyMetadata(new PropertyChangedCallback(OnSandboxExternalContentPropertyChanged),
                                              new CoerceValueCallback(CoerceSandBoxExternalContentValue)));


            CommandManager.RegisterClassCommandBinding(
                typeof(NavigationWindow),
                new CommandBinding(
                    NavigationCommands.BrowseBack,
                    new ExecutedRoutedEventHandler(OnGoBack),
                    new CanExecuteRoutedEventHandler(OnQueryGoBack)));

            CommandManager.RegisterClassCommandBinding(
                typeof(NavigationWindow),
                new CommandBinding(
                    NavigationCommands.BrowseForward,
                    new ExecutedRoutedEventHandler(OnGoForward),
                    new CanExecuteRoutedEventHandler(OnQueryGoForward)));

            CommandManager.RegisterClassCommandBinding(
                typeof(NavigationWindow),
                new CommandBinding(NavigationCommands.NavigateJournal, new ExecutedRoutedEventHandler(OnNavigateJournal)));

            CommandManager.RegisterClassCommandBinding(
                typeof(NavigationWindow),
                new CommandBinding(
                    NavigationCommands.Refresh,
                    new ExecutedRoutedEventHandler(OnRefresh),
                    new CanExecuteRoutedEventHandler(OnQueryRefresh)));

            CommandManager.RegisterClassCommandBinding(
                typeof(NavigationWindow),
                new CommandBinding(
                    NavigationCommands.BrowseStop,
                    new ExecutedRoutedEventHandler(OnBrowseStop),
                    new CanExecuteRoutedEventHandler(OnQueryBrowseStop)));
        }
예제 #30
0
        static DataGridRowHeader()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(DataGridRowHeader), new FrameworkPropertyMetadata(typeof(DataGridRowHeader)));

            ContentProperty.OverrideMetadata(typeof(DataGridRowHeader), new FrameworkPropertyMetadata(OnNotifyPropertyChanged, OnCoerceContent));
            ContentTemplateProperty.OverrideMetadata(typeof(DataGridRowHeader), new FrameworkPropertyMetadata(OnNotifyPropertyChanged, OnCoerceContentTemplate));
            ContentTemplateSelectorProperty.OverrideMetadata(typeof(DataGridRowHeader), new FrameworkPropertyMetadata(OnNotifyPropertyChanged, OnCoerceContentTemplateSelector));
            StyleProperty.OverrideMetadata(typeof(DataGridRowHeader), new FrameworkPropertyMetadata(OnNotifyPropertyChanged, OnCoerceStyle));
            WidthProperty.OverrideMetadata(typeof(DataGridRowHeader), new FrameworkPropertyMetadata(OnNotifyPropertyChanged, OnCoerceWidth));

            ClickModeProperty.OverrideMetadata(typeof(DataGridRowHeader), new FrameworkPropertyMetadata(ClickMode.Press));
            FocusableProperty.OverrideMetadata(typeof(DataGridRowHeader), new FrameworkPropertyMetadata(false));
        }
예제 #31
0
        /// <summary>
        /// Initializes static members of the <see cref="MediaElement"/> class.
        /// </summary>
        static MediaElement()
        {
            // Content property cannot be changed.
            ContentProperty.OverrideMetadata(typeof(MediaElement), new FrameworkPropertyMetadata(null, OnCoerceContentValue));

            var style = new Style(typeof(MediaElement), null);

            style.Setters.Add(new Setter(FlowDirectionProperty, FlowDirection.LeftToRight));
            style.Seal();
            StyleProperty.OverrideMetadata(typeof(MediaElement), new FrameworkPropertyMetadata(style));

            // Initialize the core
            MediaEngine.Initialize(WindowsPlatform.Instance);
        }
예제 #32
0
        /// <summary>
        /// Replaces the property data Ids.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="propertyData">The property data.</param>
        /// <param name="direction">The direction.</param>
        private void ReplacePropertyDataIds(Item item, ContentProperty propertyData, Direction direction)
        {
            if (propertyData != null && propertyData.Value != null)
            {
                var dataType = ExecutionContext.DatabasePersistence.RetrieveItem<DataType>(new ItemIdentifier(propertyData.DataType.ToString(),
                    ItemProviderIds.dataTypeItemProviderGuid));

                //Deserialize the value of the current Property to an ArchetypeModel and set additional properties before converting values
                var sourceJson = propertyData.Value.ToString();
                var canvas = JsonConvert.DeserializeObject<CanvasModel>(sourceJson);

                // serialize the Archetype back to a string
                propertyData.Value = JsonConvert.SerializeObject(canvas, Formatting.None);
                
            }
        }
 public override void ExtractingProperty(Item item, ContentProperty propertyData)
 {
     if (propertyData.Value != null)
     {
         var links = JsonConvert.DeserializeObject<JArray>(propertyData.Value.ToString());
         if (links != null)
         {
             foreach (dynamic link in links)
             {
                 if (link.id != null)
                 {
                     link.id = ExecutionContext.DatabasePersistence.GetNodeId(
                         (Guid)link.id,
                         link.isMedia != null ? UmbracoNodeObjectTypeIds.Media : UmbracoNodeObjectTypeIds.Document);
                 }
             }
             propertyData.Value = links;
         }
     }
 }
 public override void PackagingProperty(Item item, ContentProperty propertyData)
 {
     if (propertyData.Value != null)
     {
         var links = JsonConvert.DeserializeObject<JArray>(propertyData.Value.ToString());
         if (links != null)
         {
             foreach (dynamic link in links)
             {
                 if (link.id != null)
                 {
                     link.id = ExecutionContext.DatabasePersistence.GetUniqueId(
                         (int)link.id,
                         link.isMedia != null ? NodeObjectTypes.Media : NodeObjectTypes.Document);
                 }
             }
             propertyData.Value = links.ToString();
         }
     }
 }
 public override void ExtractingProperty(Item item, ContentProperty propertyData)
 {
     if (propertyData.Value != null)
     {
         var links = JsonConvert.DeserializeObject<JArray>(propertyData.Value.ToString());
         if (links != null)
         {
             foreach (dynamic link in links)
             {
                 if (link.id != null)
                 {
                     link.id = PersistenceManager.Default.GetNodeId(
                         (Guid)link.id,
                         link.isMedia != null ? NodeObjectTypes.Media : NodeObjectTypes.Document);
                 }
             }
             propertyData.Value = links.ToString();
         }
     }
 }
        public override void PackagingProperty(Item item, ContentProperty propertyData)
        {
            if (propertyData.Value != null)
            {
                var links = JsonConvert.DeserializeObject<JArray>(propertyData.Value.ToString());
                if (links != null)
                {
                    foreach (dynamic link in links)
                    {
                        if (link.id != null)
                        {
                            var objectTypeId = link.isMedia != null
                                ? UmbracoNodeObjectTypeIds.Media
                                : UmbracoNodeObjectTypeIds.Document;
                            var itemProviderId = link.isMedia != null
                                ? ItemProviderIds.mediaItemProviderGuid
                                : ItemProviderIds.documentItemProviderGuid;

                            link.id = ExecutionContext.DatabasePersistence.GetUniqueId((int)link.id, objectTypeId);
                            item.Dependencies.Add(link.id.ToString(), itemProviderId);
                        }
                        else if (link.isMedia != null)
                        {
                            try
                            {
                                var mediaId = ExecutionContext.DatabasePersistence.GetUniqueIdFromMediaFile(link.url);
                                item.Dependencies.Add(mediaId.ToString(), ItemProviderIds.mediaItemProviderGuid);
                            }
                            catch (Exception e)
                            {
                                CourierLogHelper.Error<MultiUrlPickerDataResolverProvider>(string.Format("Error setting media-item dependency, name={0}, url={1}", link.name, link.url), e);
                            }
                        }
                    }
                    propertyData.Value = links.ToString();
                }
            }
        }
 public override void ExtractingCell(Item item, ContentProperty propertyData, dynamic cell)
 {
     ProcessCell(item, propertyData, cell, Direction.Extracting);
 }
		private void ResolvePropertyData(Item item, ContentProperty propertyData, Direction direction)
		{
			if (propertyData == null || propertyData.Value == null)
				return;

			// create a fake `PublishedPropertyType`
			var dataTypeId = ExecutionContext.DatabasePersistence.GetNodeId(propertyData.DataType, UmbracoNodeObjectTypeIds.DataType);

			// deserialize the current Property's value into a 'MortarValue'
			var mortarValue = JsonConvert.DeserializeObject<MortarValue>(propertyData.Value.ToString());

			// get the `PropertyItemProvider` from the collection.
			var propertyItemProvider = ItemProviderCollection.Instance.GetProvider(ItemProviderIds.propertyDataItemProviderGuid, this.ExecutionContext);

			if (mortarValue != null)
			{
				foreach (var mortarBlock in mortarValue)
				{
					foreach (var mortarRow in mortarBlock.Value)
					{
						var rowOptionsDocTypeAlias = MortarHelper.GetRowOptionsDocType(dataTypeId, mortarBlock.Key);
						if (!string.IsNullOrWhiteSpace(rowOptionsDocTypeAlias))
						{
							mortarRow.RawOptions = ResolveMultiplePropertyItemData(item, propertyItemProvider,
								mortarRow.RawOptions, rowOptionsDocTypeAlias, direction);
						}

						foreach (var mortarItem in mortarRow.Items)
						{
							if (mortarItem == null)
							{
								CourierLogHelper.Warn<MortarDataResolver>("MortarItem appears to be null, (from '{0}' block)", () => mortarBlock.Key);
								continue;
							}

							if (mortarItem.Type == null)
							{
								CourierLogHelper.Warn<MortarDataResolver>("MortarItem did not contain a value for Type, (from '{0}' block)", () => mortarBlock.Key);
								continue;
							}

							switch (mortarItem.Type.ToUpperInvariant())
							{
								case "DOCTYPE":
									// resolve the doctype alias/guid
									string docTypeAlias = string.Empty;

									if (mortarItem.AdditionalInfo.ContainsKey("docType"))
									{
										docTypeAlias = mortarItem.AdditionalInfo["docType"];
										DocumentType docType;
										Guid docTypeGuid;

										if (Guid.TryParse(docTypeAlias, out docTypeGuid))
										{
											docType = ExecutionContext.DatabasePersistence.RetrieveItem<DocumentType>(
												new ItemIdentifier(docTypeGuid.ToString(),
													ItemProviderIds.documentTypeItemProviderGuid));
											docTypeAlias = docType.Alias;
										}
										else
										{
											docType = ExecutionContext.DatabasePersistence.RetrieveItem<DocumentType>(
												new ItemIdentifier(docTypeAlias,
													ItemProviderIds.documentTypeItemProviderGuid));
											docTypeGuid = docType.UniqueId;
										}

										if (direction == Direction.Packaging)
										{
											mortarItem.AdditionalInfo["docType"] = docTypeAlias;

											// add dependency for the DocType
											var name = string.Concat("Document type: ", docTypeAlias);
											var dependency = new Dependency(name, docTypeAlias, ItemProviderIds.documentTypeItemProviderGuid);

											item.Dependencies.Add(dependency);
										}
										else if (direction == Direction.Extracting)
										{
											// NOTE: [LK] In v0.4.0 we swapped the usage from the DocType's GUID back to the alias.
											mortarItem.AdditionalInfo["docType"] = docTypeAlias; // docTypeGuid.ToString();
										}
									}

									// resolve the value's properties
									mortarItem.RawValue = ResolveMultiplePropertyItemData(item, propertyItemProvider, mortarItem.RawValue, docTypeAlias, direction);

									break;

								case "EMBED":
									// we don't need Courier to process the embed code - it's pure HTML
									break;

								case "LINK":
									mortarItem.RawValue = ConvertIdentifier(mortarItem.RawValue, item, direction, ItemProviderIds.documentItemProviderGuid, "Document");
									break;

								case "MEDIA":
									mortarItem.RawValue = ConvertIdentifier(mortarItem.RawValue, item, direction, ItemProviderIds.mediaItemProviderGuid, "Media");
									break;

								case "RICHTEXT":
									// From the 'MortarValueConverter' it appears that the DocumentTypeAlias,
									// PropertyEditorAlias and PropertyTypeAlias are all constants, so we reuse them here.
									mortarItem.RawValue = ResolvePropertyItemData(
										item,
										propertyItemProvider,
										mortarItem.RawValue,
										Constants.PropertyEditors.TinyMCEAlias,
										"bodyText",
										Guid.Empty,
										direction);
									break;

								default:
									break;
							}
						}
					}
				}

				propertyData.Value = JsonConvert.SerializeObject(mortarValue);
			}
		}
        private void ProcessProperty(Item item, ContentProperty propertyData, Direction direction)
        {
            var propertyItemProvider = ItemProviderCollection.Instance.GetProvider(ItemProviderIds.propertyDataItemProviderGuid, ExecutionContext);

            if (direction == Direction.Packaging)
                item.Dependencies.Add(propertyData.DataType.ToString(), ItemProviderIds.dataTypeItemProviderGuid);

            var array = JsonConvert.DeserializeObject<JArray>(propertyData.Value.ToString());
            foreach (var ncObj in array)
            {
                var doctypeAlias = ncObj["ncContentTypeAlias"].ToString();
                var doctype =
                    ExecutionContext.DatabasePersistence.RetrieveItem<DocumentType>(new ItemIdentifier(doctypeAlias,
                        ItemProviderIds.documentTypeItemProviderGuid));
                if (doctype == null)
                    continue;

                foreach (var propertyType in doctype.Properties)
                {
                    object o;
                    if ((o = ncObj[propertyType.Alias]) != null)
                    {
                        //make fake item
                        var value = o.ToString();
                        var datatype =
                            ExecutionContext.DatabasePersistence.RetrieveItem<DataType>(
                                new ItemIdentifier(propertyType.DataTypeDefinitionId.ToString(),
                                    ItemProviderIds.dataTypeItemProviderGuid));

                        var fakeItem = new ContentPropertyData
                        {
                            ItemId = item.ItemId,
                            Name = string.Format("{0} [{1}: Nested {2} ({3})]", item.Name, EditorAlias, datatype.PropertyEditorAlias, propertyType.Alias),
                            Data = new List<ContentProperty>
                            {
                                new ContentProperty
                                {
                                    Alias = propertyType.Alias,
                                    DataType = datatype.UniqueID,
                                    PropertyEditorAlias = datatype.PropertyEditorAlias,
                                    Value = value
                                }
                            }
                        };

                        if (direction == Direction.Packaging)
                        {
                            try
                            {
                                // run the 'fake' item through Courier's data resolvers
                                ResolutionManager.Instance.PackagingItem(fakeItem, propertyItemProvider);
                            }
                            catch (Exception ex)
                            {
                                CourierLogHelper.Error<NestedContentDataResolverProvider>(
                                    string.Concat("Error packaging data value: ", fakeItem.Name), ex);
                            }
                        }
                        else if (direction == Direction.Extracting)
                        {
                            try
                            {
                                // run the 'fake' item through Courier's data resolvers
                                ResolutionManager.Instance.ExtractingItem(fakeItem, propertyItemProvider);
                            }
                            catch (Exception ex)
                            {
                                CourierLogHelper.Error<NestedContentDataResolverProvider>(
                                    string.Concat("Error extracting data value: ", fakeItem.Name), ex);
                            }
                        }

                        // pass up the dependencies and resources
                        item.Dependencies.AddRange(fakeItem.Dependencies);
                        item.Resources.AddRange(fakeItem.Resources);

                        if (fakeItem.Data != null && fakeItem.Data.Any())
                        {
                            var firstDataType = fakeItem.Data.FirstOrDefault();
                            if (firstDataType != null)
                            {
                                // set the resolved property data value
                                string serializedValue = firstDataType.Value as string ??
                                                         JsonConvert.SerializeObject(firstDataType.Value);


                                ncObj[propertyType.Alias] = new JValue(serializedValue);

                                // (if packaging) add a dependency for the property's data-type
                                if (direction == Direction.Packaging)
                                    item.Dependencies.Add(firstDataType.DataType.ToString(), ItemProviderIds.dataTypeItemProviderGuid);
                            }
                        }
                    }
                }
            }

            propertyData.Value = JsonConvert.SerializeObject(array);
        }
 public override void PackagingProperty(Item item, ContentProperty propertyData)
 {
     ProcessProperty(item, propertyData, Direction.Packaging);
 }
예제 #41
0
		private void ReplacePropertyDataIds(Item item, ContentProperty propertyData, Direction direction)
		{
			if (propertyData != null && propertyData.Value != null)
			{
				var dataTypeId = ExecutionContext.DatabasePersistence.GetNodeId(propertyData.DataType, NodeObjectTypes.DataType);
				var fakePropertyType = this.CreateDummyPropertyType(dataTypeId, this.EditorAlias);

				var converter = new ArchetypeValueConverter();
				var archetype = (ArchetypeModel)converter.ConvertDataToSource(fakePropertyType, propertyData.Value, false);

				if (archetype != null)
				{
					// get the `PropertyItemProvider` from the collection.
					var propertyItemProvider = ItemProviderCollection.Instance.GetProvider(ProviderIDCollection.propertyDataItemProviderGuid, this.ExecutionContext);

					foreach (var property in archetype.Fieldsets.SelectMany(x => x.Properties))
					{
						if (property == null || string.IsNullOrWhiteSpace(property.PropertyEditorAlias))
							continue;

						// create a 'fake' item for Courier to process
						var fakeItem = new ContentPropertyData()
						{
							ItemId = item.ItemId,
							Name = string.Format("{0} [{1}: Nested {2} ({3})]", new[] { item.Name, this.EditorAlias, property.PropertyEditorAlias, property.Alias }),
							Data = new List<ContentProperty>
							{
								new ContentProperty
								{
									Alias = property.Alias,
									DataType = ExecutionContext.DatabasePersistence.GetUniqueId(property.DataTypeId, NodeObjectTypes.DataType),
									PropertyEditorAlias = property.PropertyEditorAlias,
									Value = property.Value
								}
							}
						};

						if (direction == Direction.Packaging)
						{
							try
							{
								// run the 'fake' item through Courier's data resolvers
								ResolutionManager.Instance.PackagingItem(fakeItem, propertyItemProvider);
							}
							catch (Exception ex)
							{
								LogHelper.Error<ArchetypeDataResolver>(string.Concat("Error packaging data value: ", fakeItem.Name), ex);
							}

							// pass up the dependencies and resources
							item.Dependencies.AddRange(fakeItem.Dependencies);
							item.Resources.AddRange(fakeItem.Resources);
						}
						else if (direction == Direction.Extracting)
						{
							try
							{
								// run the 'fake' item through Courier's data resolvers
								ResolutionManager.Instance.ExtractingItem(fakeItem, propertyItemProvider);
							}
							catch (Exception ex)
							{
								LogHelper.Error<ArchetypeDataResolver>(string.Concat("Error extracting data value: ", fakeItem.Name), ex);
							}
						}

						if (fakeItem.Data != null && fakeItem.Data.Any())
						{
							var firstDataType = fakeItem.Data.FirstOrDefault();
							if (firstDataType != null)
							{
								// set the resolved property data value
								property.Value = firstDataType.Value;

								// (if packaging) add a dependency for the property's data-type
								if (direction == Direction.Packaging)
									item.Dependencies.Add(firstDataType.DataType.ToString(), ProviderIDCollection.dataTypeItemProviderGuid);
							}
						}
					}

					// serialize the Archetype back to a string
					propertyData.Value = archetype.SerializeForPersistence();
				}
			}
		}
예제 #42
0
        private void ReplacePropertyDataIds(Item item, ContentProperty propertyData, Direction direction)
        {
            if (propertyData != null && propertyData.Value != null)
            {
                // just look at the amount of dancing around we have to do in order to fake a `PublishedPropertyType`?!
                var dataTypeId = PersistenceManager.Default.GetNodeId(propertyData.DataType, NodeObjectTypes.DataType);
                var fakePropertyType = this.CreateDummyPropertyType(dataTypeId, this.EditorAlias);

                var converter = new ArchetypeValueConverter();
                var archetype = (ArchetypeModel)converter.ConvertDataToSource(fakePropertyType, propertyData.Value, false);

                if (archetype != null)
                {
                    // create a 'fake' provider, as ultimately only the 'Packaging' enum will be referenced.
                    var fakeItemProvider = new PropertyItemProvider();

                    foreach (var property in archetype.Fieldsets.SelectMany(x => x.Properties))
                    {
                        if (property == null || string.IsNullOrWhiteSpace(property.PropertyEditorAlias))
                            continue;

                        // create a 'fake' item for Courier to process
                        var fakeItem = new ContentPropertyData()
                        {
                            ItemId = item.ItemId,
                            Name = string.Format("{0} [{1}: Nested {2} ({3})]", new[] { item.Name, this.EditorAlias, property.PropertyEditorAlias, property.Alias }),
                            Data = new List<ContentProperty>
                            {
                                new ContentProperty
                                {
                                    Alias = property.Alias,
                                    DataType = PersistenceManager.Default.GetUniqueId(property.DataTypeId, NodeObjectTypes.DataType),
                                    PropertyEditorAlias = property.PropertyEditorAlias,
                                    Value = property.Value
                                }
                            }
                        };

                        if (direction == Direction.Packaging)
                        {
                            try
                            {
                                // run the 'fake' item through Courier's data resolvers
                                ResolutionManager.Instance.PackagingItem(fakeItem, fakeItemProvider);
                            }
                            catch (Exception ex)
                            {
                                LogHelper.Error<ArchetypeDataResolver>(string.Concat("Error packaging data value: ", fakeItem.Name), ex);
                            }

                            // pass up the dependencies and resources
                            item.Dependencies.AddRange(fakeItem.Dependencies);
                            item.Resources.AddRange(fakeItem.Resources);
                        }
                        else if (direction == Direction.Extracting)
                        {
                            try
                            {
                                // run the 'fake' item through Courier's data resolvers
                                ResolutionManager.Instance.ExtractingItem(fakeItem, fakeItemProvider);
                            }
                            catch (Exception ex)
                            {
                                LogHelper.Error<ArchetypeDataResolver>(string.Concat("Error extracting data value: ", fakeItem.Name), ex);
                            }
                        }

                        if (fakeItem.Data != null && fakeItem.Data.Any())
                        {
                            var firstDataType = fakeItem.Data.FirstOrDefault();
                            if (firstDataType != null)
                            {
                                // set the resolved property data value
                                property.Value = firstDataType.Value;

                                // (if packaging) add a dependency for the property's data-type
                                if (direction == Direction.Packaging)
                                    item.Dependencies.Add(firstDataType.DataType.ToString(), ProviderIDCollection.dataTypeItemProviderGuid);
                            }
                        }
                    }

                    if (item.Name.Contains(string.Concat(this.EditorAlias, ": Nested")))
                    {
                        // if the Archetype is nested, then we only want to return the object itself - not a serialized string
                        propertyData.Value = archetype;
                    }
                    else
                    {
                        // if the Archetype is the root/container, then we can serialize it to a string
                        propertyData.Value = archetype.SerializeForPersistence();
                    }
                }
            }
        }
예제 #43
0
 public virtual void PackagingProperty(Item item, ContentProperty propertyData)
 {
 }
예제 #44
0
 public virtual void ExtractingProperty(Item item, ContentProperty propertyData)
 {
 }
        private void DeserializeContents(WorkflowMarkupSerializationManager serializationManager, object obj, XmlReader reader)
        {
            if (serializationManager == null)
                throw new ArgumentNullException("serializationManager");
            if (obj == null)
                throw new ArgumentNullException("obj");
            if (reader == null)
                throw new ArgumentNullException("reader");

            if (reader.NodeType != XmlNodeType.Element)
                return;

            // get the serializer
            WorkflowMarkupSerializer serializer = serializationManager.GetSerializer(obj.GetType(), typeof(WorkflowMarkupSerializer)) as WorkflowMarkupSerializer;
            if (serializer == null)
            {
                serializationManager.ReportError(CreateSerializationError(SR.GetString(SR.Error_SerializerNotAvailable, obj.GetType().FullName), reader));
                return;
            }

            try
            {
                serializer.OnBeforeDeserialize(serializationManager, obj);
            }
            catch (Exception e)
            {
                serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerThrewException, obj.GetType().FullName, e.Message), e));
                return;
            }

            bool isEmptyElement = reader.IsEmptyElement;
            string elementNamespace = reader.NamespaceURI;

            List<PropertyInfo> props = new List<PropertyInfo>();
            List<EventInfo> events = new List<EventInfo>();
            // Add the extended properties for primitive types
            if (obj.GetType().IsPrimitive || obj.GetType() == typeof(string) || obj.GetType() == typeof(decimal) ||
                obj.GetType().IsEnum || obj.GetType() == typeof(DateTime) || obj.GetType() == typeof(TimeSpan) ||
                obj.GetType() == typeof(Guid))
            {
                props.AddRange(serializationManager.GetExtendedProperties(obj));
            }
            else
            {
                try
                {
                    props.AddRange(serializer.GetProperties(serializationManager, obj));
                    props.AddRange(serializationManager.GetExtendedProperties(obj));
                    events.AddRange(serializer.GetEvents(serializationManager, obj));
                }
                catch (Exception e)
                {
                    serializationManager.ReportError(CreateSerializationError(SR.GetString(SR.Error_SerializerThrewException, obj.GetType(), e.Message), e, reader));
                    return;
                }
            }
            //First we try to deserialize simple properties
            if (reader.HasAttributes)
            {
                while (reader.MoveToNextAttribute())
                {
                    // 
                    if (reader.LocalName.Equals("xmlns", StringComparison.Ordinal) || reader.Prefix.Equals("xmlns", StringComparison.Ordinal))
                        continue;

                    //
                    XmlQualifiedName xmlQualifiedName = new XmlQualifiedName(reader.LocalName, reader.LookupNamespace(reader.Prefix));
                    if (xmlQualifiedName.Namespace.Equals(StandardXomlKeys.Definitions_XmlNs, StringComparison.Ordinal) &&
                        !IsMarkupExtension(xmlQualifiedName) &&
                        !ExtendedPropertyInfo.IsExtendedProperty(serializationManager, props, xmlQualifiedName) &&
                        !ExtendedPropertyInfo.IsExtendedProperty(serializationManager, xmlQualifiedName))
                    {
                        serializationManager.FireFoundDefTag(new WorkflowMarkupElementEventArgs(reader));
                        continue;
                    }

                    //For simple properties we assume that if . indicates
                    string propName = XmlConvert.DecodeName(reader.LocalName);
                    string propVal = reader.Value;
                    DependencyProperty dependencyProperty = ResolveDependencyProperty(serializationManager, reader, obj, propName);
                    if (dependencyProperty != null)
                    {
                        serializationManager.Context.Push(dependencyProperty);
                        try
                        {
                            if (dependencyProperty.IsEvent)
                                DeserializeEvent(serializationManager, reader, obj, propVal);
                            else
                                DeserializeSimpleProperty(serializationManager, reader, obj, propVal);
                        }
                        finally
                        {
                            Debug.Assert(serializationManager.Context.Current == dependencyProperty, "Serializer did not remove an object it pushed into stack.");
                            serializationManager.Context.Pop();
                        }
                    }
                    else
                    {
                        PropertyInfo property = WorkflowMarkupSerializer.LookupProperty(props, propName);
                        if (property != null)
                        {
                            serializationManager.Context.Push(property);
                            try
                            {
                                DeserializeSimpleProperty(serializationManager, reader, obj, propVal);
                            }
                            finally
                            {
                                Debug.Assert((PropertyInfo)serializationManager.Context.Current == property, "Serializer did not remove an object it pushed into stack.");
                                serializationManager.Context.Pop();
                            }
                        }
                        else
                        {
                            EventInfo evt = WorkflowMarkupSerializer.LookupEvent(events, propName);
                            if (events != null && evt != null)
                            {
                                serializationManager.Context.Push(evt);
                                try
                                {
                                    DeserializeEvent(serializationManager, reader, obj, propVal);
                                }
                                finally
                                {
                                    Debug.Assert((EventInfo)serializationManager.Context.Current == evt, "Serializer did not remove an object it pushed into stack.");
                                    serializationManager.Context.Pop();
                                }
                            }
                            else
                                serializationManager.ReportError(CreateSerializationError(SR.GetString(SR.Error_SerializerNoMemberFound, new object[] { propName, obj.GetType().FullName }), reader));
                        }
                    }
                }
            }

            try
            {
                serializer.OnBeforeDeserializeContents(serializationManager, obj);
            }
            catch (Exception e)
            {
                serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerThrewException, obj.GetType().FullName, e.Message), e));
                return;
            }

            //Now deserialize compound properties
            try
            {
                serializer.ClearChildren(serializationManager, obj);
            }
            catch (Exception e)
            {
                serializationManager.ReportError(CreateSerializationError(SR.GetString(SR.Error_SerializerThrewException, obj.GetType(), e.Message), e, reader));
                return;
            }

            using (ContentProperty contentProperty = new ContentProperty(serializationManager, serializer, obj))
            {
                List<ContentInfo> contents = new List<ContentInfo>();
                if (!isEmptyElement)
                {
                    reader.MoveToElement();
                    int initialDepth = reader.Depth;
                    XmlQualifiedName extendedPropertyQualifiedName = new XmlQualifiedName(reader.LocalName, reader.LookupNamespace(reader.Prefix));
                    do
                    {
                        // Extended property should be deserialized, this is required for primitive types which have extended property as children
                        // We should  not ignore 
                        if (extendedPropertyQualifiedName != null && !ExtendedPropertyInfo.IsExtendedProperty(serializationManager, extendedPropertyQualifiedName))
                        {
                            extendedPropertyQualifiedName = null;
                            continue;
                        }
                        // this will make it to skip all the nodes
                        if ((initialDepth + 1) < reader.Depth)
                        {
                            bool unnecessaryXmlFound = false;
                            while (reader.Read() && ((initialDepth + 1) < reader.Depth))
                            {
                                // Ignore comments and whitespaces
                                if (reader.NodeType != XmlNodeType.Comment && reader.NodeType != XmlNodeType.Whitespace && !unnecessaryXmlFound)
                                {
                                    serializationManager.ReportError(CreateSerializationError(SR.GetString(SR.Error_InvalidDataFoundForType, obj.GetType().FullName), reader));
                                    unnecessaryXmlFound = true;
                                }
                            }
                        }

                        //Push all the PIs into stack so that they are available for type resolution
                        AdvanceReader(reader);
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            //We should only support A.B syntax for compound properties, all others are treated as content
                            XmlQualifiedName xmlQualifiedName = new XmlQualifiedName(reader.LocalName, reader.LookupNamespace(reader.Prefix));
                            int index = reader.LocalName.IndexOf('.');
                            if (index > 0 || ExtendedPropertyInfo.IsExtendedProperty(serializationManager, xmlQualifiedName))
                            {
                                string propertyName = reader.LocalName.Substring(reader.LocalName.IndexOf('.') + 1);
                                PropertyInfo property = WorkflowMarkupSerializer.LookupProperty(props, propertyName);
                                DependencyProperty dependencyProperty = ResolveDependencyProperty(serializationManager, reader, obj, reader.LocalName);
                                if (dependencyProperty == null && property == null)
                                    serializationManager.ReportError(CreateSerializationError(SR.GetString(SR.Error_InvalidElementFoundForType, reader.LocalName, obj.GetType().FullName), reader));
                                else if (dependencyProperty != null)
                                {
                                    PropertyInfo prop = WorkflowMarkupSerializer.LookupProperty(props, dependencyProperty.Name);
                                    //Deserialize the dynamic property
                                    serializationManager.Context.Push(dependencyProperty);
                                    try
                                    {
                                        DeserializeCompoundProperty(serializationManager, reader, obj);
                                    }
                                    finally
                                    {
                                        Debug.Assert(serializationManager.Context.Current == dependencyProperty, "Serializer did not remove an object it pushed into stack.");
                                        serializationManager.Context.Pop();
                                    }
                                }
                                else if (property != null)
                                {
                                    //Deserialize the compound property
                                    serializationManager.Context.Push(property);
                                    try
                                    {
                                        DeserializeCompoundProperty(serializationManager, reader, obj);
                                    }
                                    finally
                                    {
                                        Debug.Assert((PropertyInfo)serializationManager.Context.Current == property, "Serializer did not remove an object it pushed into stack.");
                                        serializationManager.Context.Pop();
                                    }
                                }
                            }
                            else
                            {
                                //Deserialize the children
                                int lineNumber = (reader is IXmlLineInfo) ? ((IXmlLineInfo)reader).LineNumber : 1;
                                int linePosition = (reader is IXmlLineInfo) ? ((IXmlLineInfo)reader).LinePosition : 1;
                                object obj2 = DeserializeObject(serializationManager, reader);
                                if (obj2 != null)
                                {
                                    obj2 = GetValueFromMarkupExtension(serializationManager, obj2);
                                    if (obj2 != null && obj2.GetType() == typeof(string) && ((string)obj2).StartsWith("{}", StringComparison.Ordinal))
                                        obj2 = ((string)obj2).Substring(2);
                                    contents.Add(new ContentInfo(obj2, lineNumber, linePosition));
                                }
                            }
                        }
                        else if (reader.NodeType == XmlNodeType.Text && contentProperty.Property != null)
                        {
                            //If we read the string then we should not advance the reader further instead break
                            int lineNumber = (reader is IXmlLineInfo) ? ((IXmlLineInfo)reader).LineNumber : 1;
                            int linePosition = (reader is IXmlLineInfo) ? ((IXmlLineInfo)reader).LinePosition : 1;
                            contents.Add(new ContentInfo(reader.ReadString(), lineNumber, linePosition));
                            if (initialDepth >= reader.Depth)
                                break;
                        }
                        else
                        {
                            if (reader.NodeType == XmlNodeType.Entity ||
                                reader.NodeType == XmlNodeType.Text ||
                                reader.NodeType == XmlNodeType.CDATA)
                                serializationManager.ReportError(CreateSerializationError(SR.GetString(SR.Error_InvalidDataFound, reader.Value.Trim(), obj.GetType().FullName), reader));
                        }
                    } while (reader.Read() && initialDepth < reader.Depth);
                }
                //Make sure that we set contents
                contentProperty.SetContents(contents);
            }
            try
            {
                serializer.OnAfterDeserialize(serializationManager, obj);
            }
            catch (Exception e)
            {
                serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerThrewException, obj.GetType().FullName, e.Message), e));
                return;
            }
        }
        /// <summary>
        /// Replaces the property data Ids.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="propertyData">The property data.</param>
        /// <param name="direction">The direction.</param>
		private void ReplacePropertyDataIds(Item item, ContentProperty propertyData, Direction direction)
		{
			if (propertyData != null && propertyData.Value != null)
			{
				var dataType = ExecutionContext.DatabasePersistence.RetrieveItem<DataType>(new ItemIdentifier(propertyData.DataType.ToString(),
					ItemProviderIds.dataTypeItemProviderGuid));

				//Fetch the Prevalues for the current Property's DataType (if its an 'Archetype config')
				var prevalue = dataType.Prevalues.FirstOrDefault(x => x.Alias.ToLowerInvariant().Equals("archetypeconfig"));
				var archetypePreValue = prevalue == null
					? null
					: JsonConvert.DeserializeObject<ArchetypePreValue>(prevalue.Value,
						ArchetypeHelper.Instance.JsonSerializerSettings);
				RetrieveAdditionalProperties(ref archetypePreValue);

				//Deserialize the value of the current Property to an ArchetypeModel and set additional properties before converting values
				var sourceJson = propertyData.Value.ToString();
				var archetype = JsonConvert.DeserializeObject<ArchetypeModel>(sourceJson, ArchetypeHelper.Instance.JsonSerializerSettings);
				RetrieveAdditionalProperties(ref archetype, archetypePreValue);

				if (archetype != null)
				{
					// get the `PropertyItemProvider` from the collection.
					var propertyItemProvider = ItemProviderCollection.Instance.GetProvider(ItemProviderIds.propertyDataItemProviderGuid, ExecutionContext);

					foreach (var property in archetype.Fieldsets.SelectMany(x => x.Properties))
					{
						if (property == null || string.IsNullOrWhiteSpace(property.PropertyEditorAlias))
							continue;

						// create a 'fake' item for Courier to process
						var fakeItem = new ContentPropertyData
						{
							ItemId = item.ItemId,
							Name = string.Format("{0} [{1}: Nested {2} ({3})]", new[] { item.Name, EditorAlias, property.PropertyEditorAlias, property.Alias }),
							Data = new List<ContentProperty>
							{
								new ContentProperty
								{
									Alias = property.Alias,
									DataType = ExecutionContext.DatabasePersistence.GetUniqueId(property.DataTypeId, UmbracoNodeObjectTypeIds.DataType),
									PropertyEditorAlias = property.PropertyEditorAlias,
									Value = property.Value
								}
							}
						};

						if (direction == Direction.Packaging)
						{
							try
							{
								// run the 'fake' item through Courier's data resolvers
								ResolutionManager.Instance.PackagingItem(fakeItem, propertyItemProvider);
							}
							catch (Exception ex)
							{
								CourierLogHelper.Error<ArchetypeDataResolver>(string.Concat("Error packaging data value: ", fakeItem.Name), ex);
							}

							// pass up the dependencies and resources
							item.Dependencies.AddRange(fakeItem.Dependencies);
							item.Resources.AddRange(fakeItem.Resources);
						}
						else if (direction == Direction.Extracting)
						{
							try
							{
								// run the 'fake' item through Courier's data resolvers
								ResolutionManager.Instance.ExtractingItem(fakeItem, propertyItemProvider);
							}
							catch (Exception ex)
							{
								CourierLogHelper.Error<ArchetypeDataResolver>(string.Concat("Error extracting data value: ", fakeItem.Name), ex);
							}
						}

						if (fakeItem.Data != null && fakeItem.Data.Any())
						{
							var firstDataType = fakeItem.Data.FirstOrDefault();
							if (firstDataType != null)
							{
								// set the resolved property data value
								property.Value = firstDataType.Value;

								// (if packaging) add a dependency for the property's data-type
								if (direction == Direction.Packaging)
									item.Dependencies.Add(firstDataType.DataType.ToString(), ItemProviderIds.dataTypeItemProviderGuid);
							}
						}
					}

					// serialize the Archetype back to a string
					propertyData.Value = archetype.SerializeForPersistence();
				}
			}
		}
        internal void SerializeContents(WorkflowMarkupSerializationManager serializationManager, object obj, XmlWriter writer, bool dictionaryKey)
        {
            if (serializationManager == null)
                throw new ArgumentNullException("serializationManager");
            if (obj == null)
                throw new ArgumentNullException("obj");
            if (writer == null)
                throw new ArgumentNullException("writer");

            WorkflowMarkupSerializer serializer = null;
            try
            {
                //Now get the serializer to persist the properties, if the serializer is not found then we dont serialize the properties
                serializer = serializationManager.GetSerializer(obj.GetType(), typeof(WorkflowMarkupSerializer)) as WorkflowMarkupSerializer;

            }
            catch (Exception e)
            {
                serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerThrewException, obj.GetType().FullName, e.Message), e));
                return;

            }

            if (serializer == null)
            {
                serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerNotAvailableForSerialize, obj.GetType().FullName)));
                return;
            }

            try
            {
                serializer.OnBeforeSerialize(serializationManager, obj);
            }
            catch (Exception e)
            {
                serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerThrewException, obj.GetType().FullName, e.Message), e));
                return;
            }

            Hashtable allProperties = new Hashtable();
            ArrayList complexProperties = new ArrayList();

            IDictionary<DependencyProperty, object> dependencyProperties = null;
            List<PropertyInfo> properties = new List<PropertyInfo>();
            List<EventInfo> events = new List<EventInfo>();
            Hashtable designTimeTypeNames = null;

            // Serialize the extended properties for primitive types also
            if (obj.GetType().IsPrimitive || obj.GetType() == typeof(string) || obj.GetType() == typeof(decimal) ||
                obj.GetType() == typeof(DateTime) || obj.GetType() == typeof(TimeSpan) || obj.GetType().IsEnum ||
                obj.GetType() == typeof(Guid))
            {
                if (obj.GetType() == typeof(char) || obj.GetType() == typeof(byte) ||
                    obj.GetType() == typeof(System.Int16) || obj.GetType() == typeof(decimal) ||
                    obj.GetType() == typeof(DateTime) || obj.GetType() == typeof(TimeSpan) ||
                    obj.GetType().IsEnum || obj.GetType() == typeof(Guid))
                {
                    //These non CLS-compliant are not supported in the XmlWriter 
                    if ((obj.GetType() != typeof(char)) || (char)obj != '\0')
                    {
                        //These non CLS-compliant are not supported in the XmlReader 
                        string stringValue = String.Empty;
                        if (obj.GetType() == typeof(DateTime))
                        {
                            stringValue = ((DateTime)obj).ToString("o", CultureInfo.InvariantCulture);
                        }
                        else
                        {
                            TypeConverter typeConverter = TypeDescriptor.GetConverter(obj.GetType());
                            if (typeConverter != null && typeConverter.CanConvertTo(typeof(string)))
                                stringValue = typeConverter.ConvertTo(null, CultureInfo.InvariantCulture, obj, typeof(string)) as string;
                            else
                                stringValue = Convert.ToString(obj, CultureInfo.InvariantCulture);
                        }

                        writer.WriteValue(stringValue);
                    }
                }
                else if (obj.GetType() == typeof(string))
                {
                    string attribValue = obj as string;
                    attribValue = attribValue.Replace('\0', ' ');
                    if (!(attribValue.StartsWith("{", StringComparison.Ordinal) && attribValue.EndsWith("}", StringComparison.Ordinal)))
                        writer.WriteValue(attribValue);
                    else
                        writer.WriteValue("{}" + attribValue);
                }
                else
                {
                    writer.WriteValue(obj);
                }
                // For Key properties, we don;t want to get the extended properties
                if (!dictionaryKey)
                    properties.AddRange(serializationManager.GetExtendedProperties(obj));
            }
            else
            {
                // Serialize properties
                //We first get all the properties, once we have them all, we start distinguishing between
                //simple and complex properties, the reason for that is XmlWriter needs to write attributes
                //first and elements later

                // Dependency events are treated as the same as dependency properties.


                try
                {
                    if (obj is DependencyObject && ((DependencyObject)obj).UserData.Contains(UserDataKeys.DesignTimeTypeNames))
                        designTimeTypeNames = ((DependencyObject)obj).UserData[UserDataKeys.DesignTimeTypeNames] as Hashtable;
                    dependencyProperties = serializer.GetDependencyProperties(serializationManager, obj);
                    properties.AddRange(serializer.GetProperties(serializationManager, obj));
                    // For Key properties, we don;t want to get the extended properties
                    if (!dictionaryKey)
                        properties.AddRange(serializationManager.GetExtendedProperties(obj));
                    events.AddRange(serializer.GetEvents(serializationManager, obj));
                }
                catch (Exception e)
                {
                    serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerThrewException, obj.GetType().FullName, e.Message), e));
                    return;
                }
            }
            if (dependencyProperties != null)
            {
                // For attached properties that does not have a corresponding real property on the object, if the value is a design time
                // type, it may not be set through dependency property SetValue, therefore will not be present in the dependencyProperties
                // collection, we'll have to get the dependency property object ourselves.
                if (designTimeTypeNames != null)
                {
                    foreach (object key in designTimeTypeNames.Keys)
                    {
                        DependencyProperty dependencyProperty = key as DependencyProperty;
                        if (dependencyProperty != null && !dependencyProperties.ContainsKey(dependencyProperty))
                            dependencyProperties.Add(dependencyProperty, designTimeTypeNames[dependencyProperty]);
                    }
                }

                // Add all dependency properties to the master collection.
                foreach (DependencyProperty dependencyProperty in dependencyProperties.Keys)
                {
                    string propertyName = String.Empty;
                    if (dependencyProperty.IsAttached)
                    {
                        string prefix = String.Empty;
                        XmlQualifiedName qualifiedName = serializationManager.GetXmlQualifiedName(dependencyProperty.OwnerType, out prefix);
                        propertyName = qualifiedName.Name + "." + dependencyProperty.Name;
                    }
                    else
                    {
                        propertyName = dependencyProperty.Name;
                    }

                    if (dependencyProperty.IsAttached || !dependencyProperty.DefaultMetadata.IsMetaProperty)
                        allProperties.Add(propertyName, dependencyProperty);
                }
            }

            if (properties != null)
            {
                foreach (PropertyInfo propInfo in properties)
                {
                    // Do not serialize properties that have corresponding dynamic properties.
                    if (propInfo != null && !allProperties.ContainsKey(propInfo.Name))
                        allProperties.Add(propInfo.Name, propInfo);
                }
            }

            if (events != null)
            {
                foreach (EventInfo eventInfo in events)
                {
                    // Do not serialize events that have corresponding dynamic properties.
                    if (eventInfo != null && !allProperties.ContainsKey(eventInfo.Name))
                        allProperties.Add(eventInfo.Name, eventInfo);
                }
            }

            using (ContentProperty contentProperty = new ContentProperty(serializationManager, serializer, obj))
            {
                foreach (object propertyObj in allProperties.Values)
                {
                    string propertyName = String.Empty;
                    object propertyValue = null;
                    Type propertyInfoType = null;

                    try
                    {
                        if (propertyObj is PropertyInfo)
                        {
                            PropertyInfo property = propertyObj as PropertyInfo;

                            // If the property has parameters we can not serialize it , we just move on.
                            ParameterInfo[] indexParameters = property.GetIndexParameters();
                            if (indexParameters != null && indexParameters.Length > 0)
                                continue;

                            propertyName = property.Name;
                            propertyValue = null;
                            if (property.CanRead)
                            {
                                propertyValue = property.GetValue(obj, null);
                                if (propertyValue == null && TypeProvider.IsAssignable(typeof(Type), property.PropertyType))
                                {
                                    // See if we have a design time value for the property
                                    DependencyProperty dependencyProperty = DependencyProperty.FromName(property.Name, property.ReflectedType);
                                    if (dependencyProperty != null)
                                        propertyValue = Helpers.GetDesignTimeTypeName(obj, dependencyProperty);

                                    if (propertyValue == null)
                                    {
                                        string key = property.ReflectedType.FullName + "." + property.Name;
                                        propertyValue = Helpers.GetDesignTimeTypeName(obj, key);
                                    }
                                    if (propertyValue != null)
                                        propertyValue = new TypeExtension((string)propertyValue);
                                }
                            }
                            propertyInfoType = property.PropertyType;
                        }
                        else if (propertyObj is EventInfo)
                        {
                            EventInfo evt = propertyObj as EventInfo;
                            propertyName = evt.Name;
                            propertyValue = WorkflowMarkupSerializationHelpers.GetEventHandlerName(obj, evt.Name);
                            if ((propertyValue == null || (propertyValue is string && string.IsNullOrEmpty((string)propertyValue)))
                                && obj is DependencyObject)
                            {
                                // The object is not created through deserialization, we should check to see if the delegate is 
                                // created and added to list.  We can only serialize the handler if its target type is the same
                                // as the activity type that's be designed.
                                DependencyProperty dependencyProperty = DependencyProperty.FromName(propertyName, obj.GetType());
                                if (dependencyProperty != null)
                                {
                                    Activity activity = serializationManager.Context[typeof(Activity)] as Activity;
                                    Delegate handler = ((DependencyObject)obj).GetHandler(dependencyProperty) as Delegate;
                                    if (handler != null && activity != null && TypeProvider.Equals(handler.Target.GetType(), Helpers.GetRootActivity(activity).GetType()))
                                        propertyValue = handler;
                                }
                            }
                            propertyInfoType = evt.EventHandlerType;
                        }
                        else if (propertyObj is DependencyProperty)
                        {
                            DependencyProperty dependencyProperty = propertyObj as DependencyProperty;
                            propertyName = dependencyProperty.Name;
                            propertyValue = dependencyProperties[dependencyProperty];
                            propertyInfoType = dependencyProperty.PropertyType;
                        }
                    }
                    catch (Exception e)
                    {
                        while (e is TargetInvocationException && e.InnerException != null)
                            e = e.InnerException;

                        serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerPropertyGetFailed, new object[] { propertyName, obj.GetType().FullName, e.Message })));
                        continue;
                    }

                    if (propertyObj is PropertyInfo && contentProperty.Property == (PropertyInfo)propertyObj)
                        continue;

                    Type propertyValueType = null;
                    if (propertyValue != null)
                    {
                        propertyValue = GetMarkupExtensionFromValue(propertyValue);
                        propertyValueType = propertyValue.GetType();
                    }
                    else if (propertyObj is PropertyInfo)
                    {
                        propertyValue = new NullExtension();
                        propertyValueType = propertyValue.GetType();
                        Attribute[] attributes = Attribute.GetCustomAttributes(propertyObj as PropertyInfo, typeof(DefaultValueAttribute), true);
                        if (attributes.Length > 0)
                        {
                            DefaultValueAttribute defaultValueAttr = attributes[0] as DefaultValueAttribute;
                            if (defaultValueAttr.Value == null)
                                propertyValue = null;
                        }
                    }
                    if (propertyValue != null)
                        propertyValueType = propertyValue.GetType();

                    //Now get the serializer to persist the properties, if the serializer is not found then we dont serialize the properties
                    serializationManager.Context.Push(propertyObj);
                    WorkflowMarkupSerializer propValueSerializer = null;
                    try
                    {
                        propValueSerializer = serializationManager.GetSerializer(propertyValueType, typeof(WorkflowMarkupSerializer)) as WorkflowMarkupSerializer;
                    }
                    catch (Exception e)
                    {
                        serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerThrewException, obj.GetType().FullName, e.Message), e));
                        serializationManager.Context.Pop();
                        continue;
                    }
                    if (propValueSerializer == null)
                    {
                        serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerNotAvailableForSerialize, propertyValueType.FullName)));
                        serializationManager.Context.Pop();
                        continue;
                    }

                    // ask serializer if we can serialize
                    try
                    {
                        if (propValueSerializer.ShouldSerializeValue(serializationManager, propertyValue))
                        {
                            //NOTE: THE FOLLOWING CONDITION ABOUT propertyInfoType != typeof(object) is VALID AS WE SHOULD NOT SERIALIZE A PROPERTY OF TYPE OBJECT TO STRING
                            //IF WE DO THAT THEN WE DO NOT KNOWN WHAT WAS THE TYPE OF ORIGINAL OBJECT AND SERIALIZER WONT BE ABLE TO GET THE STRING BACK INTO THE CORRECT TYPE,
                            //AS THE TYPE INFORMATION IS LOST
                            if (propValueSerializer.CanSerializeToString(serializationManager, propertyValue) && propertyInfoType != typeof(object))
                            {
                                using (new SafeXmlNodeWriter(serializationManager, obj, propertyObj, XmlNodeType.Attribute))
                                {
                                    //This is a work around to special case the markup extension serializer as it writes to the stream using writer
                                    if (propValueSerializer is MarkupExtensionSerializer)
                                    {
                                        propValueSerializer.SerializeToString(serializationManager, propertyValue);
                                    }
                                    else
                                    {
                                        string stringValue = propValueSerializer.SerializeToString(serializationManager, propertyValue);
                                        if (!string.IsNullOrEmpty(stringValue))
                                        {
                                            stringValue = stringValue.Replace('\0', ' ');
                                            if (propertyValue is MarkupExtension || !(stringValue.StartsWith("{", StringComparison.Ordinal) && stringValue.EndsWith("}", StringComparison.Ordinal)))
                                                writer.WriteString(stringValue);
                                            else
                                                writer.WriteString("{}" + stringValue);
                                        }
                                    }
                                }
                            }
                            else
                            {
                                complexProperties.Add(propertyObj);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerNoSerializeLogic, new object[] { propertyName, obj.GetType().FullName }), e));
                    }
                    finally
                    {
                        Debug.Assert(serializationManager.Context.Current == propertyObj, "Serializer did not remove an object it pushed into stack.");
                        serializationManager.Context.Pop();
                    }
                }

                try
                {
                    serializer.OnBeforeSerializeContents(serializationManager, obj);
                }
                catch (Exception e)
                {
                    serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerThrewException, obj.GetType().FullName, e.Message), e));
                    return;
                }

                // serialize compound properties as child elements of the current node.
                foreach (object propertyObj in complexProperties)
                {
                    // get value and check for null
                    string propertyName = String.Empty;
                    object propertyValue = null;
                    Type ownerType = null;
                    bool isReadOnly = false;

                    try
                    {
                        if (propertyObj is PropertyInfo)
                        {
                            PropertyInfo property = propertyObj as PropertyInfo;
                            propertyName = property.Name;
                            propertyValue = property.CanRead ? property.GetValue(obj, null) : null;
                            ownerType = obj.GetType();
                            isReadOnly = (!property.CanWrite);
                        }
                        else if (propertyObj is DependencyProperty)
                        {
                            DependencyProperty dependencyProperty = propertyObj as DependencyProperty;
                            propertyName = dependencyProperty.Name;
                            propertyValue = dependencyProperties[dependencyProperty];
                            ownerType = dependencyProperty.OwnerType;
                            isReadOnly = ((dependencyProperty.DefaultMetadata.Options & DependencyPropertyOptions.ReadOnly) == DependencyPropertyOptions.ReadOnly);
                        }
                    }
                    catch (Exception e)
                    {
                        while (e is TargetInvocationException && e.InnerException != null)
                            e = e.InnerException;

                        serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerPropertyGetFailed, propertyName, ownerType.FullName, e.Message)));
                        continue;
                    }

                    if (propertyObj is PropertyInfo && (PropertyInfo)propertyObj == contentProperty.Property)
                        continue;

                    if (propertyValue != null)
                    {
                        propertyValue = GetMarkupExtensionFromValue(propertyValue);

                        WorkflowMarkupSerializer propValueSerializer = serializationManager.GetSerializer(propertyValue.GetType(), typeof(WorkflowMarkupSerializer)) as WorkflowMarkupSerializer;
                        if (propValueSerializer != null)
                        {
                            using (new SafeXmlNodeWriter(serializationManager, obj, propertyObj, XmlNodeType.Element))
                            {
                                if (isReadOnly)
                                    propValueSerializer.SerializeContents(serializationManager, propertyValue, writer, false);
                                else
                                    propValueSerializer.SerializeObject(serializationManager, propertyValue, writer);
                            }
                        }
                        else
                        {
                            serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerNotAvailableForSerialize, propertyValue.GetType().FullName)));
                        }
                    }
                }

                // serialize the contents
                try
                {
                    object contents = contentProperty.GetContents();
                    if (contents != null)
                    {
                        contents = GetMarkupExtensionFromValue(contents);

                        WorkflowMarkupSerializer propValueSerializer = serializationManager.GetSerializer(contents.GetType(), typeof(WorkflowMarkupSerializer)) as WorkflowMarkupSerializer;
                        if (propValueSerializer == null)
                        {
                            serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerNotAvailableForSerialize, contents.GetType())));
                        }
                        else
                        {
                            //



                            //NOTE: THE FOLLOWING CONDITION ABOUT contentProperty.Property.PropertyType != typeof(object) is VALID AS WE SHOULD NOT SERIALIZE A PROPERTY OF TYPE OBJECT TO STRING
                            //IF WE DO THAT THEN WE DO NOT KNOWN WHAT WAS THE TYPE OF ORIGINAL OBJECT AND SERIALIZER WONT BE ABLE TO GET THE STRING BACK INTO THE CORRECT TYPE,
                            //AS THE TYPE INFORMATION IS LOST
                            if (propValueSerializer.CanSerializeToString(serializationManager, contents) &&
                                (contentProperty.Property == null || contentProperty.Property.PropertyType != typeof(object)))
                            {
                                string stringValue = propValueSerializer.SerializeToString(serializationManager, contents);
                                if (!string.IsNullOrEmpty(stringValue))
                                {
                                    stringValue = stringValue.Replace('\0', ' ');
                                    if (contents is MarkupExtension || !(stringValue.StartsWith("{", StringComparison.Ordinal) && stringValue.EndsWith("}", StringComparison.Ordinal)))
                                        writer.WriteString(stringValue);
                                    else
                                        writer.WriteString("{}" + stringValue);
                                }
                            }
                            else if (CollectionMarkupSerializer.IsValidCollectionType(contents.GetType()))
                            {
                                if (contentProperty.Property == null)
                                {
                                    IEnumerable enumerableContents = contents as IEnumerable;
                                    foreach (object childObj in enumerableContents)
                                    {
                                        if (childObj == null)
                                        {
                                            SerializeObject(serializationManager, new NullExtension(), writer);
                                        }
                                        else
                                        {
                                            object childObj2 = childObj;
                                            bool dictionaryEntry = (childObj2 is DictionaryEntry);
                                            try
                                            {
                                                if (dictionaryEntry)
                                                {
                                                    serializationManager.WorkflowMarkupStack.Push(childObj);
                                                    childObj2 = ((DictionaryEntry)childObj2).Value;
                                                }
                                                childObj2 = GetMarkupExtensionFromValue(childObj2);
                                                WorkflowMarkupSerializer childObjectSerializer = serializationManager.GetSerializer(childObj2.GetType(), typeof(WorkflowMarkupSerializer)) as WorkflowMarkupSerializer;
                                                if (childObjectSerializer != null)
                                                    childObjectSerializer.SerializeObject(serializationManager, childObj2, writer);
                                                else
                                                    serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerNotAvailableForSerialize, childObj2.GetType())));
                                            }
                                            finally
                                            {
                                                if (dictionaryEntry)
                                                    serializationManager.WorkflowMarkupStack.Pop();
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    propValueSerializer.SerializeContents(serializationManager, contents, writer, false);
                                }
                            }
                            else
                            {
                                propValueSerializer.SerializeObject(serializationManager, contents, writer);
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerThrewException, obj.GetType().FullName, e.Message), e));
                    return;
                }
            }

            try
            {
                serializer.OnAfterSerialize(serializationManager, obj);
            }
            catch (Exception e)
            {
                serializationManager.ReportError(new WorkflowMarkupSerializationException(SR.GetString(SR.Error_SerializerThrewException, obj.GetType().FullName, e.Message), e));
                return;
            }
        }
        /// <summary>
        /// Extractings the property.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="propertyData">The property data.</param>
		public override void ExtractingProperty(Item item, ContentProperty propertyData)
		{
			ReplacePropertyDataIds(item, propertyData, Direction.Extracting);
		}
 public override void ExtractingProperty(Item item, ContentProperty propertyData)
 {
     ProcessProperty(item, propertyData, Direction.Extracting);
 }
		public override void PackagingProperty(Item item, ContentProperty propertyData)
		{
			ResolvePropertyData(item, propertyData, Direction.Packaging);
		}
예제 #51
0
        private HashSet<ContentProperty> GetNodeProperties(int id, HiveId selectedTemplateId)
        {

            var customProperties = new List<ContentProperty>();
            var tabIds = _docTypes.SelectMany(tabs => tabs.DefinedTabs).Select(x => x.Id).ToList();
            var currTab = 0;

            var node = XmlData.Root.Descendants()
                .Where(x => (string)x.Attribute("id") == id.ToString())
                .Single();

            var docTypeArray = _docTypes.ToArray();
            //get the corresponding doc type for this node
            var docType = docTypeArray
                .Where(x => x.Id == HiveId.ConvertIntToGuid(int.Parse((string)node.Attribute("nodeType"))))
                .Single();

            //add node name
            var nodeName = new ContentProperty((HiveId)Guid.NewGuid(),
                                               docType.Properties.Where(x => x.Alias == NodeNameAttributeDefinition.AliasValue).Single(),
                                               new Dictionary<string, object> { { "Name", (string)node.Attribute("nodeName") } })
                {
                    Name = NodeNameAttributeDefinition.AliasValue,
                    Alias = NodeNameAttributeDefinition.AliasValue,
                    TabId = docType.DefinedTabs.Where(x => x.Alias == _generalGroup.Alias).Single().Id
                    
                };
            customProperties.Add(nodeName);

            //add selected template (empty)
            var selectedTemplate = new ContentProperty((HiveId)Guid.NewGuid(),
                                                       docType.Properties.Where(x => x.Alias == SelectedTemplateAttributeDefinition.AliasValue).Single(),
                                                       selectedTemplateId.IsNullValueOrEmpty() ? new Dictionary<string, object>() : new Dictionary<string, object> { { "TemplateId", selectedTemplateId.ToString() } })
                {
                    Name = SelectedTemplateAttributeDefinition.AliasValue,
                    Alias = SelectedTemplateAttributeDefinition.AliasValue,
                    TabId = docType.DefinedTabs.Where(x => x.Alias == _generalGroup.Alias).Single().Id
                };
            customProperties.Add(selectedTemplate);

            customProperties.AddRange(
                node.Elements()
                    .Where(e => e.Attribute("isDoc") == null)
                    .Select(e =>
                    {

                        //Assigning the doc type properties is completely arbitrary here, all I'm doing is 
                        //aligning a DocumentTypeProperty that contains the DataType that I want to render

                        ContentProperty np;
                        DocumentTypeProperty dp;
                        switch (e.Name.LocalName)
                        {
                            case "bodyText":
                                //dp = new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[0]);
                                dp = docType.Properties.Where(x => x.Alias == "bodyText").Single();
                                np = new ContentProperty((HiveId)GetNodeProperty(e), dp, e.Value);
                                break;
                            case "colorSwatchPicker":
                                //dp = new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[2]);
                                dp = docType.Properties.Where(x => x.Alias == "colorSwatchPicker").Single();
                                np = new ContentProperty((HiveId)GetNodeProperty(e), dp, e.Value);
                                break;
                            case "tags":
                                //dp = new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[3]);
                                dp = docType.Properties.Where(x => x.Alias == "tags").Single();
                                np = new ContentProperty((HiveId)GetNodeProperty(e), dp, e.Value);
                                break;
                            case "textBox":
                                //dp = new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[4]) { OverriddenPreValues = overridenPreVals };
                                dp = docType.Properties.Where(x => x.Alias == "textBox").Single();
                                np = new ContentProperty((HiveId)GetNodeProperty(e), dp, e.Value);
                                break;
                            case "publisher":
                                //dp = new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[4]) { OverriddenPreValues = overridenPreVals };
                                dp = docType.Properties.Where(x => x.Alias == "publisher").Single();
                                np = new ContentProperty((HiveId)GetNodeProperty(e), dp, e.Value);
                                break;
                            case "numberOfPages":
                                //dp = new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[4]) { OverriddenPreValues = overridenPreVals };
                                dp = docType.Properties.Where(x => x.Alias == "numberOfPages").Single();
                                np = new ContentProperty((HiveId)GetNodeProperty(e), dp, e.Value);
                                break;
                            case "image":
                                //dp = new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[4]) { OverriddenPreValues = overridenPreVals };
                                dp = docType.Properties.Where(x => x.Alias == "image").Single();
                                var values = e.Value.Split(',');
                                np = new ContentProperty((HiveId)GetNodeProperty(e), dp, new Dictionary<string, object> { { "MediaId", values[0] }, { "Value", values[1] } });
                                break;
                            default:
                                //dp = new DocumentTypeProperty(new HiveId(Guid.NewGuid()), _dataTypes[1]);
                                dp = docType.Properties.Where(x => x.Alias == e.Name.LocalName).Single();
                                np = new ContentProperty((HiveId)GetNodeProperty(e), dp, e.Value);
                                break;
                        }

                        //need to set the data type model for this property

                        np.Alias = e.Name.LocalName;
                        np.Name = e.Name.LocalName;

                        //add to a random tab
                        currTab = 0; // currTab == 2 ? 0 : ++currTab;
                        np.TabId = tabIds[currTab];

                        return np;
                    }).ToList());

            return new HashSet<ContentProperty>(customProperties);
        }
        private void ProcessCell(Item item, ContentProperty propertyData, dynamic cell, Direction direction)
        {
            string docTypeId = cell?.value?.docType?.ToString();
            string cellValue = cell?.value?.value?.ToString();
            if (cellValue == null || docTypeId == null)
                return;

            var data = JsonConvert.DeserializeObject(cellValue);
            if (!(data is JObject))
                return;

            var propValues = ((JObject)data).ToObject<Dictionary<string, object>>();
            var docType = ExecutionContext.DatabasePersistence.RetrieveItem<DocumentType>(
                new ItemIdentifier(docTypeId, ItemProviderIds.documentTypeItemProviderGuid));

            if (direction == Direction.Packaging)
            {
                item.Dependencies.Add(docTypeId, ItemProviderIds.documentTypeItemProviderGuid);

                //package doctype from guid to alias
                cell.value.docType = new JValue(docType.Alias);
            }
            else if (direction == Direction.Extracting)
            {
                //extract doctype from alias to guid
                cell.value.docType = new JValue(docType.UniqueId.ToString());
            }

            var propertyItemProvider = ItemProviderCollection.Instance.GetProvider(ItemProviderIds.propertyDataItemProviderGuid, ExecutionContext);

            foreach (var prop in docType.Properties)
            {
                object value;
                if (!propValues.TryGetValue(prop.Alias, out value))
                    continue;

                var datatype =
                    ExecutionContext.DatabasePersistence.RetrieveItem<DataType>(
                        new ItemIdentifier(
                            prop.DataTypeDefinitionId.ToString(),
                            ItemProviderIds.dataTypeItemProviderGuid));

                var fakeItem = new ContentPropertyData
                {
                    ItemId = item.ItemId,
                    Name = string.Format("{0} [{1}: Nested {2} ({3})]", item.Name, EditorAlias, datatype.PropertyEditorAlias, prop.Alias),
                    Data = new List<ContentProperty>
                            {
                                new ContentProperty
                                {
                                    Alias = prop.Alias,
                                    DataType = datatype.UniqueID,
                                    PropertyEditorAlias = datatype.PropertyEditorAlias,
                                    Value = value.ToString()
                                }
                            }
                };

                if (direction == Direction.Packaging)
                {
                    try
                    {
                        // run the 'fake' item through Courier's data resolvers
                        ResolutionManager.Instance.PackagingItem(fakeItem, propertyItemProvider);
                    }
                    catch (Exception ex)
                    {
                        CourierLogHelper.Error<NestedContentDataResolverProvider>(
                            string.Concat("Error packaging data value: ", fakeItem.Name), ex);
                    }
                }
                else if (direction == Direction.Extracting)
                {
                    try
                    {
                        // run the 'fake' item through Courier's data resolvers
                        ResolutionManager.Instance.ExtractingItem(fakeItem, propertyItemProvider);
                    }
                    catch (Exception ex)
                    {
                        CourierLogHelper.Error<NestedContentDataResolverProvider>(
                            string.Concat("Error extracting data value: ", fakeItem.Name), ex);
                    }
                }

                // pass up the dependencies and resources
                item.Dependencies.AddRange(fakeItem.Dependencies);
                item.Resources.AddRange(fakeItem.Resources);

                if (fakeItem.Data != null && fakeItem.Data.Any())
                {
                    var firstDataType = fakeItem.Data.FirstOrDefault();
                    if (firstDataType != null)
                    {
                        // set the resolved property data value
                        string serializedValue = firstDataType.Value as string ??
                                                 JsonConvert.SerializeObject(firstDataType.Value);

                        object jsonValue;
                        try
                        {
                            jsonValue = JsonConvert.DeserializeObject(serializedValue);
                        }
                        catch
                        {
                            jsonValue = serializedValue;
                        }

                        propValues[prop.Alias] = jsonValue;

                        // (if packaging) add a dependency for the property's data-type
                        if (direction == Direction.Packaging)
                            item.Dependencies.Add(firstDataType.DataType.ToString(), ItemProviderIds.dataTypeItemProviderGuid);
                    }
                }
            }

            var serialized = JsonConvert.SerializeObject(propValues);
            cell.value.value = JsonConvert.DeserializeObject(serialized);
        }
예제 #53
0
 public override void ExtractingProperty(Item item, ContentProperty propertyData)
 {
     propertyData.Value = XmlDependencies.ReplaceIds(propertyData.Value.ToString(), "//* [@propertyid != '']", Core.Enums.IdentifierReplaceDirection.FromGuidToNodeId);
 }