コード例 #1
0
		private static int GetFontFaceCrc(FormatStore formatStore, PropertyValue value)
		{
			if (value.Type == PropertyType.MultiValue)
			{
				return BodyFragmentInfo.GetFontFaceCrc(formatStore, formatStore.MultiValues.Plane(value.Value)[formatStore.MultiValues.Index(value.Value)].Values[0]);
			}
			int num = 0;
			string str = formatStore.Strings.Plane(value.StringHandle)[formatStore.Strings.Index(value.StringHandle)].Str;
			for (int i = 0; i < str.Length; i++)
			{
				char c = char.ToLowerInvariant(str[i]);
				if (i % 4 == 3)
				{
					num += (int)(c >> 8);
				}
				num += (int)((int)c << (8 * (i % 4) & 31));
			}
			return num;
		}
コード例 #2
0
		private static int GetPropertyCrc(FormatStore formatStore, PropertyId propertyId, IList<PropertyValue> propertyValues)
		{
			int num = 0;
			if (propertyId <= PropertyId.Language)
			{
				switch (propertyId)
				{
				case PropertyId.FontColor:
					if (propertyValues[0].Type == PropertyType.Color && propertyValues[0].Color.RGB != BodyFragmentInfo.defaultFontColor.RGB)
					{
						num = (int)propertyValues[0].Color.RGB;
						goto IL_1AA;
					}
					goto IL_1AA;
				case PropertyId.FontSize:
					break;
				case PropertyId.FontFace:
					num = BodyFragmentInfo.GetFontFaceCrc(formatStore, propertyValues[0]);
					goto IL_1AA;
				case PropertyId.TextAlignment:
					num = ((propertyValues[0].Enum == 3) ? 0 : propertyValues[0].Enum);
					goto IL_1AA;
				default:
					if (propertyId == PropertyId.Language)
					{
						num = propertyValues[0].Integer;
						goto IL_1AA;
					}
					break;
				}
			}
			else
			{
				switch (propertyId)
				{
				case PropertyId.RightMargin:
				case PropertyId.LeftMargin:
				{
					float num2 = 0f;
					foreach (PropertyValue propertyValue in propertyValues)
					{
						num2 += propertyValue.Millimeters;
						if (propertyValue.Type == PropertyType.AbsLength)
						{
							break;
						}
					}
					num = (int)num2;
					goto IL_1AA;
				}
				case PropertyId.BottomMargin:
					break;
				default:
					switch (propertyId)
					{
					case PropertyId.RightBorderWidth:
					case PropertyId.LeftBorderWidth:
					{
						float num3 = 0f;
						foreach (PropertyValue propertyValue2 in propertyValues)
						{
							num3 += propertyValue2.Millimeters;
						}
						num = (int)(num3 * 2f);
						goto IL_1AA;
					}
					}
					break;
				}
			}
			return 0;
			IL_1AA:
			if (num != 0)
			{
				int num4 = (int)(propertyId % PropertyId.LeftMargin);
				num = (num << num4) + (num >> 32 - num4);
			}
			return num;
		}