/** * Constructs a Style record and Sets its fields appropriately. * @param in the RecordInputstream to Read the record from */ public StyleRecord(RecordInputStream in1) { fHighByte = BitFieldFactory.GetInstance(0x01); //have to init here, since we are being called //from base, and class level init hasnt been done. field_1_xf_index = in1.ReadShort(); if (Type == STYLE_BUILT_IN) { field_2_builtin_style = (byte)in1.ReadByte(); field_3_outline_style_level = (byte)in1.ReadByte(); } else if (Type == STYLE_USER_DEFINED) { field_2_name_length = in1.ReadShort(); // Some files from Crystal Reports lack // the remaining fields, which Is naughty if (in1.Remaining > 0) { field_3_string_options = (byte)in1.ReadByte(); byte[] str = in1.ReadRemainder(); if (fHighByte.IsSet(field_3_string_options)) { field_4_name = StringUtil.GetFromUnicodeBE(str, 0, field_2_name_length); } else { field_4_name = StringUtil.GetFromCompressedUnicode(str, 0, field_2_name_length); } } } // todo sanity Check exception to make sure we're one or the other }
/// <summary> /// Gets the instance. /// </summary> /// <param name="mask">The mask.</param> /// <returns></returns> public static BitField GetInstance(int mask) { BitField f = (BitField)instances[mask]; if (f == null) { f = new BitField(mask); instances[mask] = f; } return f; }
private void SetOptionFlag(bool flag, BitField field) { field_5_options = field.SetBoolean(field_5_options, flag); }
private bool GetOptionFlag(BitField field) { return field.IsSet(field_5_options); }
private void SetModified(bool modified, BitField field) { field_5_options = field.SetBoolean(field_5_options, !modified); }
private bool IsModified(BitField field) { return !field.IsSet(field_5_options); }
private void SetOptionFlag(bool modified, BitField field) { int value = modified ? 0 : 1; int optionFlags = GetInt(OFFSET_OPTION_FLAGS); optionFlags = field.SetValue(optionFlags, value); SetInt(OFFSET_OPTION_FLAGS, optionFlags); }
private bool GetOptionFlag(BitField field) { int optionFlags = GetInt(OFFSET_OPTION_FLAGS); int value = field.GetValue(optionFlags); return value == 0 ? true : false; }
private bool GetFontOption(BitField field) { int options = GetInt(OFFSET_FONT_OPTIONS); return field.IsSet(options); }
private void SetFontOption(bool option, BitField field) { int options = GetInt(OFFSET_FONT_OPTIONS); options = field.SetBoolean(options, option); SetInt(OFFSET_FONT_OPTIONS, options); }
internal SysIndexProcedure(int mask) { this.mask = new BitField(mask); }
public void TestSetLargeValues() { BitField bf1 = new BitField(0xF), bf2 = new BitField(0xF0000000); int a = 0; a = bf1.SetValue(a, 9); a = bf2.SetValue(a, 9); Assert.AreEqual(9, bf1.GetValue(a)); Assert.AreEqual(9, bf2.GetValue(a)); }