// Token: 0x06006332 RID: 25394 RVA: 0x001BE260 File Offset: 0x001BC460 private string GetOverlapQueryFragment(XmlNamespaceManager namespaceManager) { string text = namespaceManager.LookupPrefix("http://schemas.microsoft.com/windows/annotations/2003/11/core"); string text2 = namespaceManager.LookupPrefix(this.PartType.Namespace); string text3 = (text2 == null) ? "" : (text2 + ":"); text3 = string.Concat(new string[] { text3, TextSelectionProcessor.CharacterRangeElementName.Name, "/", text, ":Item" }); int num; int num2; TextSelectionProcessor.GetMaxMinLocatorPartValues(this, out num, out num2); string text4 = num.ToString(NumberFormatInfo.InvariantInfo); string text5 = num2.ToString(NumberFormatInfo.InvariantInfo); return(string.Concat(new string[] { text3, "[starts-with(@Name, \"Segment\") and ((substring-before(@Value,\",\") >= ", text4, " and substring-before(@Value,\",\") <= ", text5, ") or (substring-before(@Value,\",\") < ", text4, " and substring-after(@Value,\",\") >= ", text4, "))]" })); }
// Token: 0x0600632D RID: 25389 RVA: 0x001BE15C File Offset: 0x001BC35C internal bool Matches(ContentLocatorPart part) { bool flag = false; string value; this._nameValues.TryGetValue("IncludeOverlaps", out value); if (!bool.TryParse(value, out flag) || !flag) { return(this.Equals(part)); } if (part == this) { return(true); } if (!this._type.Equals(part.PartType)) { return(false); } int num; int num2; TextSelectionProcessor.GetMaxMinLocatorPartValues(this, out num, out num2); int num3; int num4; TextSelectionProcessor.GetMaxMinLocatorPartValues(part, out num3, out num4); return((num == num3 && num2 == num4) || (num != int.MinValue && ((num3 >= num && num3 <= num2) || (num3 < num && num4 >= num)))); }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods /// <summary> /// Determines if a locator part matches this locator part. Matches is /// different from equals because a locator part may be defined to match /// a range of locator parts, not just exact replicas. /// </summary> internal bool Matches(ContentLocatorPart part) { bool overlaps = false; string overlapsString; _nameValues.TryGetValue(TextSelectionProcessor.IncludeOverlaps, out overlapsString); // If IncludeOverlaps is true, a match is any locator part // whose range overlaps with ours if (Boolean.TryParse(overlapsString, out overlaps) && overlaps) { // We match ourselves if (part == this) { return(true); } // Have different type names if (!_type.Equals(part.PartType)) { return(false); } int desiredStartOffset; int desiredEndOffset; TextSelectionProcessor.GetMaxMinLocatorPartValues(this, out desiredStartOffset, out desiredEndOffset); int startOffset; int endOffset; TextSelectionProcessor.GetMaxMinLocatorPartValues(part, out startOffset, out endOffset); // Take care of an exact match to us (which may include offset==MinValue // which we don't want to handle with the formula below. if (desiredStartOffset == startOffset && desiredEndOffset == endOffset) { return(true); } // Take care of the special case of no content to match to if (desiredStartOffset == int.MinValue) { return(false); } if ((startOffset >= desiredStartOffset && startOffset <= desiredEndOffset) || (startOffset < desiredStartOffset && endOffset >= desiredStartOffset)) { return(true); } return(false); } return(this.Equals(part)); }
/// <summary> /// Produces an XPath fragment that selects for ContentLocatorParts with an anchor that /// intersects with the range specified by this ContentLocatorPart. /// </summary> /// <param name="namespaceManager">namespace manager used to look up prefixes</param> private string GetOverlapQueryFragment(XmlNamespaceManager namespaceManager) { string corePrefix = namespaceManager.LookupPrefix(AnnotationXmlConstants.Namespaces.CoreSchemaNamespace); string prefix = namespaceManager.LookupPrefix(this.PartType.Namespace); string res = prefix == null ? "" : (prefix + ":"); res += TextSelectionProcessor.CharacterRangeElementName.Name + "/" + corePrefix + ":" + AnnotationXmlConstants.Elements.Item; int startOffset; int endOffset; TextSelectionProcessor.GetMaxMinLocatorPartValues(this, out startOffset, out endOffset); string startStr = startOffset.ToString(NumberFormatInfo.InvariantInfo); string endStr = endOffset.ToString(NumberFormatInfo.InvariantInfo); // Note: this will never match if offsetStr == 0. Which makes sense - there // is no content to get anchors for. res += "[starts-with(@" + AnnotationXmlConstants.Attributes.ItemName + ", \"" + TextSelectionProcessor.SegmentAttribute + "\") and " + " ((substring-before(@" + AnnotationXmlConstants.Attributes.ItemValue + ",\",\") >= " + startStr + " and substring-before(@" + AnnotationXmlConstants.Attributes.ItemValue + ",\",\") <= " + endStr + ") or " + " (substring-before(@" + AnnotationXmlConstants.Attributes.ItemValue + ",\",\") < " + startStr + " and substring-after(@" + AnnotationXmlConstants.Attributes.ItemValue + ",\",\") >= " + startStr + "))]"; return(res); }