Exemple #1
0
 // Token: 0x06007C14 RID: 31764 RVA: 0x0022E694 File Offset: 0x0022C894
 private IList <ContentLocatorBase> Merge(ContentLocatorBase initialLocator, IList <ContentLocatorBase> additionalLocators)
 {
     if (additionalLocators == null || additionalLocators.Count == 0)
     {
         return(new List <ContentLocatorBase>(1)
         {
             initialLocator
         });
     }
     for (int i = 1; i < additionalLocators.Count; i++)
     {
         additionalLocators[i] = ((ContentLocatorBase)initialLocator.Clone()).Merge(additionalLocators[i]);
     }
     additionalLocators[0] = initialLocator.Merge(additionalLocators[0]);
     return(additionalLocators);
 }
Exemple #2
0
        // Token: 0x06007C06 RID: 31750 RVA: 0x0022DE04 File Offset: 0x0022C004
        public object ResolveLocator(ContentLocatorBase locator, int offset, DependencyObject startNode, out AttachmentLevel attachmentLevel)
        {
            base.VerifyAccess();
            if (locator == null)
            {
                throw new ArgumentNullException("locator");
            }
            if (startNode == null)
            {
                throw new ArgumentNullException("startNode");
            }
            ContentLocator contentLocator = locator as ContentLocator;

            if (contentLocator != null && (offset < 0 || offset >= contentLocator.Parts.Count))
            {
                throw new ArgumentOutOfRangeException("offset");
            }
            return(this.InternalResolveLocator(locator, offset, startNode, false, out attachmentLevel));
        }
Exemple #3
0
        // Token: 0x06007C0B RID: 31755 RVA: 0x0022DF94 File Offset: 0x0022C194
        private int FindMatchingPrefix(ContentLocator[] prefixes, ContentLocatorBase locator, out bool matched)
        {
            matched = true;
            int            result         = 0;
            ContentLocator contentLocator = locator as ContentLocator;

            if (contentLocator != null && prefixes != null && prefixes.Length != 0)
            {
                matched = false;
                foreach (ContentLocator contentLocator2 in prefixes)
                {
                    if (contentLocator.StartsWith(contentLocator2))
                    {
                        result  = contentLocator2.Parts.Count;
                        matched = true;
                        break;
                    }
                }
            }
            return(result);
        }
Exemple #4
0
        // Token: 0x06007C10 RID: 31760 RVA: 0x0022E31C File Offset: 0x0022C51C
        private object InternalResolveLocator(ContentLocatorBase locator, int offset, DependencyObject startNode, bool skipStartNode, out AttachmentLevel attachmentLevel)
        {
            attachmentLevel = AttachmentLevel.Full;
            object result = null;
            ContentLocatorGroup contentLocatorGroup = locator as ContentLocatorGroup;
            ContentLocator      contentLocator      = locator as ContentLocator;
            AttachmentLevel     attachmentLevel2    = AttachmentLevel.Unresolved;

            if (contentLocator != null && offset == contentLocator.Parts.Count - 1)
            {
                ContentLocatorPart locatorPart = contentLocator.Parts[offset];
                SelectionProcessor selectionProcessorForLocatorPart = this.GetSelectionProcessorForLocatorPart(locatorPart);
                if (selectionProcessorForLocatorPart != null)
                {
                    result          = selectionProcessorForLocatorPart.ResolveLocatorPart(locatorPart, startNode, out attachmentLevel2);
                    attachmentLevel = attachmentLevel2;
                    return(result);
                }
            }
            IList <ContentLocator> list;

            if (contentLocatorGroup == null)
            {
                list = new List <ContentLocator>(1);
                list.Add(contentLocator);
            }
            else
            {
                AnnotationService service = AnnotationService.GetService(startNode);
                if (service != null)
                {
                    startNode = service.Root;
                }
                list          = contentLocatorGroup.Locators;
                offset        = 0;
                skipStartNode = false;
            }
            bool flag = true;

            if (list.Count > 0)
            {
                LocatorManager.ResolvingLocatorState resolvingLocatorState = this.ResolveSingleLocator(ref result, ref attachmentLevel, AttachmentLevel.StartPortion, list[0], offset, startNode, skipStartNode);
                if (list.Count == 1)
                {
                    result          = resolvingLocatorState.AttachedAnchor;
                    attachmentLevel = resolvingLocatorState.AttachmentLevel;
                }
                else
                {
                    if (list.Count > 2)
                    {
                        AttachmentLevel attachmentLevel3 = AttachmentLevel.Unresolved;
                        AttachmentLevel attachmentLevel4 = attachmentLevel;
                        for (int i = 1; i < list.Count - 1; i++)
                        {
                            resolvingLocatorState = this.ResolveSingleLocator(ref result, ref attachmentLevel, AttachmentLevel.MiddlePortion, list[i], offset, startNode, skipStartNode);
                            if (attachmentLevel3 == AttachmentLevel.Unresolved || (attachmentLevel & AttachmentLevel.MiddlePortion) != AttachmentLevel.Unresolved)
                            {
                                attachmentLevel3 = attachmentLevel;
                            }
                            attachmentLevel = attachmentLevel4;
                        }
                        attachmentLevel = attachmentLevel3;
                    }
                    else
                    {
                        flag = false;
                    }
                    resolvingLocatorState = this.ResolveSingleLocator(ref result, ref attachmentLevel, AttachmentLevel.EndPortion, list[list.Count - 1], offset, startNode, skipStartNode);
                    if (!flag && attachmentLevel == AttachmentLevel.MiddlePortion)
                    {
                        attachmentLevel &= ~AttachmentLevel.MiddlePortion;
                    }
                    if (attachmentLevel == (AttachmentLevel.StartPortion | AttachmentLevel.EndPortion))
                    {
                        attachmentLevel = AttachmentLevel.Full;
                    }
                }
            }
            else
            {
                attachmentLevel = AttachmentLevel.Unresolved;
            }
            return(result);
        }
Exemple #5
0
        // Token: 0x06007C0C RID: 31756 RVA: 0x0022DFEC File Offset: 0x0022C1EC
        private IList <ContentLocatorBase> GenerateLocators(SubTreeProcessor processor, PathNode startNode, object selection)
        {
            List <ContentLocatorBase> list = new List <ContentLocatorBase>();
            bool           flag            = true;
            ContentLocator contentLocator  = processor.GenerateLocator(startNode, out flag);
            bool           flag2           = contentLocator != null;

            if (flag)
            {
                int count = startNode.Children.Count;
                if (count != 0)
                {
                    if (count != 1)
                    {
                        ContentLocatorBase contentLocatorBase = this.GenerateLocatorGroup(startNode, selection);
                        if (contentLocatorBase != null)
                        {
                            flag2 = false;
                        }
                        if (contentLocator != null)
                        {
                            list.Add(contentLocator.Merge(contentLocatorBase));
                        }
                        else if (contentLocatorBase != null)
                        {
                            list.Add(contentLocatorBase);
                        }
                    }
                    else
                    {
                        SubTreeProcessor           subTreeProcessor = this.GetSubTreeProcessor(startNode.Node);
                        IList <ContentLocatorBase> list2            = this.GenerateLocators(subTreeProcessor, (PathNode)startNode.Children[0], selection);
                        if (list2 != null && list2.Count > 0)
                        {
                            flag2 = false;
                        }
                        if (contentLocator != null)
                        {
                            list.AddRange(this.Merge(contentLocator, list2));
                        }
                        else
                        {
                            list.AddRange(list2);
                        }
                    }
                }
                else if (contentLocator != null)
                {
                    list.Add(contentLocator);
                }
            }
            else if (contentLocator != null)
            {
                list.Add(contentLocator);
            }
            if (flag2 && selection != null)
            {
                SelectionProcessor selectionProcessor = this.GetSelectionProcessor(selection.GetType());
                if (selectionProcessor != null)
                {
                    IList <ContentLocatorPart> list3 = selectionProcessor.GenerateLocatorParts(selection, startNode.Node);
                    if (list3 != null && list3.Count > 0)
                    {
                        List <ContentLocatorBase> list4 = new List <ContentLocatorBase>(list.Count * list3.Count);
                        foreach (ContentLocatorBase contentLocatorBase2 in list)
                        {
                            list4.AddRange(((ContentLocator)contentLocatorBase2).DotProduct(list3));
                        }
                        list = list4;
                    }
                }
            }
            return(list);
        }
Exemple #6
0
        // Token: 0x06007C0A RID: 31754 RVA: 0x0022DEF4 File Offset: 0x0022C0F4
        internal object FindAttachedAnchor(DependencyObject startNode, ContentLocator[] prefixes, ContentLocatorBase locator, out AttachmentLevel attachmentLevel)
        {
            if (startNode == null)
            {
                throw new ArgumentNullException("startNode");
            }
            if (locator == null)
            {
                throw new ArgumentNullException("locator");
            }
            attachmentLevel = AttachmentLevel.Unresolved;
            object result = null;
            bool   flag   = true;
            int    num    = this.FindMatchingPrefix(prefixes, locator, out flag);

            if (flag)
            {
                ContentLocator contentLocator = locator as ContentLocator;
                if (contentLocator == null || num < contentLocator.Parts.Count)
                {
                    result = this.InternalResolveLocator(locator, num, startNode, num != 0, out attachmentLevel);
                }
                if (attachmentLevel == AttachmentLevel.Unresolved && num > 0)
                {
                    if (num == 0)
                    {
                        attachmentLevel = AttachmentLevel.Unresolved;
                    }
                    else if (contentLocator != null && num < contentLocator.Parts.Count)
                    {
                        attachmentLevel = AttachmentLevel.Incomplete;
                        result          = startNode;
                    }
                    else
                    {
                        attachmentLevel = AttachmentLevel.Full;
                        result          = startNode;
                    }
                }
            }
            return(result);
        }