Beispiel #1
0
 public byte[] ToByteArray()
 {
     byte[] array = new byte[12];
     BodyTagInfo.WriteInt(array, 0, this.wordCount);
     BodyTagInfo.WriteInt(array, 4, this.wordCrc);
     BodyTagInfo.WriteInt(array, 8, this.formatCrc);
     return(array);
 }
Beispiel #2
0
        public static BodyTagInfo FromByteArray(byte[] byteArray)
        {
            int num  = BodyTagInfo.ReadInt(byteArray, 0);
            int num2 = BodyTagInfo.ReadInt(byteArray, 4);
            int num3 = BodyTagInfo.ReadInt(byteArray, 8);

            return(new BodyTagInfo(num, num2, num3));
        }
		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;
		}
Beispiel #5
0
        public override bool Equals(object obj)
        {
            BodyTagInfo bodyTagInfo = obj as BodyTagInfo;

            return(bodyTagInfo != null && bodyTagInfo.WordCount == this.WordCount && bodyTagInfo.WordCrc == this.WordCrc && bodyTagInfo.FormatCrc == this.FormatCrc);
        }