private BodyFragmentInfo GetDisclaimerBodyPart(BodyFragmentInfo parentBodyFragment)
		{
			int endLineIndex = parentBodyFragment.EndLineIndex;
			int endLineIndex2 = base.EndLineIndex;
			FragmentInfo.TrimBoundary(base.BodyScanner, ref endLineIndex, ref endLineIndex2);
			return new BodyFragmentInfo(base.BodyScanner, endLineIndex, endLineIndex2);
		}
Exemple #2
0
        private void InitializeUniquePart(int lastUniqueWordIndex, bool fullParentMatched)
        {
            this.lastUniqueWord = ((lastUniqueWordIndex < this.childBodyFragment.EndWordIndex) ? lastUniqueWordIndex : (this.childBodyFragment.EndWordIndex - 1));
            int lastNormalFragmentIndex = BodyDiffer.GetLastNormalFragmentIndex(this.childBodyFragment, lastUniqueWordIndex);
            int num = (this.ChildScanner.Fragments.Count > lastNormalFragmentIndex + 1) ? ((int)this.ChildScanner.Fragments[lastNormalFragmentIndex + 1].FirstLine) : this.childBodyFragment.EndLineIndex;

            num = ((num >= this.childBodyFragment.EndLineIndex) ? this.childBodyFragment.EndLineIndex : num);
            int startLineIndex = this.childBodyFragment.StartLineIndex;

            FragmentInfo.TrimBoundary(this.ChildScanner, ref startLineIndex, ref num);
            if (fullParentMatched)
            {
                for (int i = this.childBodyFragment.StartLineIndex; i < num; i++)
                {
                    if ((ulong)this.ChildScanner.Lines[i].FirstWordIndex > (ulong)((long)this.lastUniqueWord))
                    {
                        num = i;
                        FragmentInfo.TrimBoundary(this.ChildScanner, ref startLineIndex, ref num);
                        if (num > 0 && this.ChildScanner.Lines[num - 1].Category == ConversationBodyScanner.Scanner.LineCategory.PotentialNonMsHeader)
                        {
                            num--;
                        }
                    }
                }
            }
            this.uniqueBodyPart = new FragmentInfo(this.ChildScanner, startLineIndex, num);
        }
		private BodyFragmentInfo GetUniqueBodyPart(BodyFragmentInfo parentBodyFragment)
		{
			int startLineIndex = base.StartLineIndex;
			int num = parentBodyFragment.StartLineIndex;
			FragmentInfo.TrimBoundary(base.BodyScanner, ref startLineIndex, ref num);
			int i = 1;
			bool flag = false;
			while (i < base.BodyScanner.Fragments.Count)
			{
				if ((int)base.BodyScanner.Fragments[i].FirstLine == num)
				{
					if (base.BodyScanner.Fragments[i - 1].Category == ConversationBodyScanner.Scanner.FragmentCategory.MsHeader || base.BodyScanner.Fragments[i - 1].Category == ConversationBodyScanner.Scanner.FragmentCategory.NonMsHeader)
					{
						num = (int)base.BodyScanner.Fragments[i - 1].FirstLine;
						FragmentInfo.TrimBoundary(base.BodyScanner, ref startLineIndex, ref num);
						flag = true;
						break;
					}
				}
				else if ((int)base.BodyScanner.Fragments[i].FirstLine > num)
				{
					break;
				}
				i++;
			}
			if (!flag && num > 0 && base.BodyScanner.Lines[num - 1].Category == ConversationBodyScanner.Scanner.LineCategory.PotentialNonMsHeader)
			{
				num--;
			}
			return new BodyFragmentInfo(base.BodyScanner, startLineIndex, num);
		}
Exemple #4
0
        public FragmentInfo Trim()
        {
            int num  = this.StartLineIndex;
            int num2 = this.EndLineIndex;

            FragmentInfo.TrimBoundary(this.bodyScanner, ref num, ref num2);
            if (num != this.StartLineIndex || num2 != this.EndLineIndex)
            {
                return(new FragmentInfo(this.BodyScanner, num, num2));
            }
            return(this);
        }
Exemple #5
0
        private void InitializeDisclaimerPart(int disclaimerWordStart)
        {
            int num = this.childBodyFragment.EndLineIndex;

            while (num > this.UniqueBodyPart.EndLineIndex && (long)disclaimerWordStart <= (long)((ulong)this.ChildScanner.Lines[num - 1].FirstWordIndex))
            {
                num--;
            }
            int endLineIndex = this.childBodyFragment.EndLineIndex;

            FragmentInfo.TrimBoundary(this.ChildScanner, ref num, ref endLineIndex);
            this.disclaimerPart = new FragmentInfo(this.ChildScanner, num, endLineIndex);
        }
Exemple #6
0
 internal static void TrimBoundary(ConversationBodyScanner bodyScanner, ref int startLineIndex, ref int endLineIndex)
 {
     while (endLineIndex > startLineIndex)
     {
         if (!FragmentInfo.IsBlankLine(bodyScanner, startLineIndex))
         {
             break;
         }
         startLineIndex++;
     }
     while (endLineIndex > startLineIndex && FragmentInfo.IsBlankLine(bodyScanner, endLineIndex - 1))
     {
         endLineIndex--;
     }
 }
		public void ExtractNestedBodyParts(BodyTagInfo parentBodyTagInfo, out BodyFragmentInfo parentBodyPart, out FragmentInfo uniqueBodyPart, out FragmentInfo disclaimerPart)
		{
			BodyFragmentInfo bodyFragmentInfo;
			parentBodyPart = (bodyFragmentInfo = null);
			FragmentInfo fragmentInfo;
			disclaimerPart = (fragmentInfo = bodyFragmentInfo);
			uniqueBodyPart = fragmentInfo;
			parentBodyPart = this.GetParentBodyPart(parentBodyTagInfo);
			if (parentBodyPart != null)
			{
				uniqueBodyPart = this.GetUniqueBodyPart(parentBodyPart);
				disclaimerPart = this.GetDisclaimerBodyPart(parentBodyPart);
				if (uniqueBodyPart.IsEmpty && !disclaimerPart.IsEmpty)
				{
					uniqueBodyPart = disclaimerPart;
					disclaimerPart = FragmentInfo.Empty;
				}
			}
		}
		private BodyFragmentInfo GetParentBodyPart(BodyTagInfo parentBodyTagInfo)
		{
			if (parentBodyTagInfo.WordCount == 0 && parentBodyTagInfo.FormatCrc == 0)
			{
				return new BodyFragmentInfo(base.BodyScanner, base.EndLineIndex, base.EndLineIndex);
			}
			int i = base.EndLineIndex;
			int num = base.EndLineIndex;
			int num2 = base.GetFirstWordIndex(i);
			int num3 = num2;
			int num4 = 0;
			uint num5 = 0U;
			while (num3 >= base.StartWordIndex && i >= base.StartLineIndex)
			{
				if (num4 == parentBodyTagInfo.WordCount && num5 == (uint)parentBodyTagInfo.WordCrc)
				{
					while (i > 0)
					{
						int num6 = base.GetFirstWordIndex(i - 1);
						uint num7 = 0U;
						while (num6 < num2 && !BodyFragmentInfo.IsUsefulWord(base.BodyScanner.Words[num6], out num7))
						{
							num6++;
						}
						if (num6 != num2)
						{
							break;
						}
						i--;
						num2 = base.GetFirstWordIndex(i);
					}
					FragmentInfo.TrimBoundary(base.BodyScanner, ref i, ref num);
					return new BodyFragmentInfo(base.BodyScanner, i, num);
				}
				if (num4 <= parentBodyTagInfo.WordCount)
				{
					if (i == 0)
					{
						break;
					}
					int j = base.GetFirstWordIndex(--i);
					while (j < num2)
					{
						if (base.StartWordIndex >= num2)
						{
							break;
						}
						uint num8 = 0U;
						num2--;
						if (BodyFragmentInfo.IsUsefulWord(base.BodyScanner.Words[num2], out num8))
						{
							num4++;
							num5 = (num5 << 1) + (num5 >> 31);
							num5 ^= num8;
						}
					}
				}
				else if (num4 > parentBodyTagInfo.WordCount)
				{
					int k = base.GetFirstWordIndex(--num);
					while (k < num3)
					{
						num3--;
						uint num9;
						if (BodyFragmentInfo.IsUsefulWord(base.BodyScanner.Words[num3], out num9))
						{
							num4--;
							int num10 = num4 % 32;
							if (num10 == 0)
							{
								num5 ^= num9;
							}
							else
							{
								num5 ^= (num9 << num10) + (num9 >> 32 - num10);
							}
						}
					}
				}
			}
			return null;
		}