本文整理汇总了C#中BitReader.ReadInt32方法的典型用法代码示例。如果您正苦于以下问题:C# BitReader.ReadInt32方法的具体用法?C# BitReader.ReadInt32怎么用?C# BitReader.ReadInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitReader
的用法示例。
在下文中一共展示了BitReader.ReadInt32方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Deserialize
public static WeldedInfo Deserialize(BitReader br)
{
var wi = new WeldedInfo();
wi.Active = br.ReadBit();
wi.ActorId = br.ReadInt32();
wi.Offset = Vector3D.Deserialize(br);
wi.Mass = br.ReadFloat();
wi.Rotation = Rotator.Deserialize(br);
return wi;
}
示例2: Read
public void Read(BitReader reader)
{
var alm = InfoManager.AssetLibraryManager;
this.Type = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.WeaponTypes);
this.Balance = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.BalanceDefs);
this.Manufacturer = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.Manufacturers);
this.ManufacturerGradeIndex = reader.ReadInt32(7);
this.GameStage = reader.ReadInt32(7);
this.BodyPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.WeaponParts);
this.GripPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.WeaponParts);
this.BarrelPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.WeaponParts);
this.SightPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.WeaponParts);
this.StockPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.WeaponParts);
this.ElementalPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.WeaponParts);
this.Accessory1Part = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.WeaponParts);
this.Accessory2Part = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.WeaponParts);
this.MaterialPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.WeaponParts);
this.PrefixPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.WeaponParts);
this.TitlePart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.WeaponParts);
}
示例3: Read
public void Read(BitReader reader)
{
var alm = InfoManager.AssetLibraryManager;
this.Type = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.ItemTypes);
this.Balance = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.BalanceDefs);
this.Manufacturer = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.Manufacturers);
this.ManufacturerGradeIndex = reader.ReadInt32(7);
this.GameStage = reader.ReadInt32(7);
this.AlphaPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.ItemParts);
this.BetaPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.ItemParts);
this.GammaPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.ItemParts);
this.DeltaPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.ItemParts);
this.EpsilonPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.ItemParts);
this.ZetaPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.ItemParts);
this.EtaPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.ItemParts);
this.ThetaPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.ItemParts);
this.MaterialPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.ItemParts);
this.PrefixPart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.ItemParts);
this.TitlePart = alm.Decode(reader, this.AssetLibrarySetId, AssetGroup.ItemParts);
}
示例4: DoDeserializeFromByteArray
/// <summary>
/// This method is used to deserialize the StreamObjectHeaderEnd16bit basic object from the specified byte array and start index.
/// </summary>
/// <param name="byteArray">Specify the byte array.</param>
/// <param name="startIndex">Specify the start index from the byte array.</param>
/// <returns>Return the length in byte of the StreamObjectHeaderEnd16bit basic object.</returns>
protected override int DoDeserializeFromByteArray(byte[] byteArray, int startIndex)
{
using (BitReader reader = new BitReader(byteArray, startIndex))
{
int headerType = reader.ReadInt32(2);
if (headerType != 0x3)
{
throw new InvalidOperationException(string.Format("Failed to get the StreamObjectHeaderEnd16bit header type value, expect value {0}, but actual value is {1}", 0x3, headerType));
}
uint typeValue = reader.ReadUInt32(14);
if (!Enum.IsDefined(typeof(StreamObjectTypeHeaderEnd), (int)typeValue))
{
throw new InvalidOperationException(string.Format("Failed to get the StreamObjectHeaderEnd16bit type value, the value {0} is not defined", typeValue));
}
this.Type = (StreamObjectTypeHeaderEnd)typeValue;
return 2;
}
}
示例5: UpdateItemStats
// Methods
public UpdateItemStats(byte[] data)
: base(data)
{
this.stats = new List<StatBase>();
this.unknown61b = -1;
this.unknown78b = -1;
BitReader reader = new BitReader(data, 1);
this.unknown8b = reader.ReadInt32(10);
this.uid = reader.ReadUInt32();
while (reader.ReadBoolean(1))
{
BaseStat stat = BaseStat.Get(reader.ReadInt32(9));
this.unknown60b = reader.ReadInt32(1);
if (stat.Type == StatType.ChargedSkill)
{
this.unknown61b = reader.ReadInt32(1);
int charges = reader.ReadInt32(8);
int maxCharges = reader.ReadInt32(8);
this.unknown78b = reader.ReadInt32(1);
int level = reader.ReadInt32(6);
int skill = reader.ReadInt32(10);
this.stats.Add(new ChargedSkillStat(stat, level, skill, charges, maxCharges));
}
else
{
if (stat.Signed)
{
this.stats.Add(new SignedStat(stat, reader.ReadInt32(stat.SendBits)));
continue;
}
this.stats.Add(new UnsignedStat(stat, reader.ReadUInt32(stat.SendBits)));
}
}
this.offset = reader.Position;
this.unknownEnd = reader.ReadByteArray();
}
示例6: WalkVerify
// Methods
public WalkVerify(byte[] data)
: base(data)
{
BitReader reader = new BitReader(data, 1);
this.stamina = reader.ReadInt32(15);
this.x = reader.ReadInt32(0x10);
this.y = reader.ReadInt32(0x10);
this.state = reader.ReadInt32(0x11);
}
示例7: SetState
// Methods
public SetState(byte[] data)
: base(data)
{
int num;
this.unitType = (UnitType) data[1];
this.uid = BitConverter.ToUInt32(data, 2);
this.state = BaseState.Get(data[7]);
this.stats = new List<StatBase>();
BitReader reader = new BitReader(data, 8);
Label_003E:
num = reader.ReadInt32(9);
if (num != 0x1ff)
{
BaseStat stat = BaseStat.Get(num);
int val = reader.ReadInt32(stat.SendBits);
if (stat.SendParamBits > 0)
{
int param = reader.ReadInt32(stat.SendParamBits);
if (stat.Signed)
{
this.stats.Add(new SignedStatParam(stat, val, param));
}
else
{
this.stats.Add(new UnsignedStatParam(stat, (uint) val, (uint) param));
}
}
else if (stat.Signed)
{
this.stats.Add(new SignedStat(stat, val));
}
else
{
this.stats.Add(new UnsignedStat(stat, (uint) val));
}
goto Label_003E;
}
this.unknownEnd = reader.ReadByteArray();
}
示例8: PlayerLifeManaChange
// Methods
public PlayerLifeManaChange(byte[] data)
: base(data)
{
BitReader reader = new BitReader(data, 1);
this.life = reader.ReadInt32(15);
this.mana = reader.ReadInt32(15);
this.stamina = reader.ReadInt32(15);
this.x = reader.ReadInt32(0x10);
this.y = reader.ReadInt32(0x10);
this.unknown85b = reader.ReadByteArray();
}
示例9: ReadStat
private static StatBase ReadStat(BitReader br)
{
int index = br.ReadInt32(9);
if (index == 0x1ff)
{
return null;
}
BaseStat stat = BaseStat.Get(index);
if (stat.SaveParamBits == -1)
{
if (stat.OpBase == StatType.Level)
{
return new PerLevelStat(stat, br.ReadInt32(stat.SaveBits));
}
switch (stat.Type)
{
case StatType.MaxDamagePercent:
case StatType.MinDamagePercent:
return new DamageRangeStat(stat, br.ReadInt32(stat.SaveBits), br.ReadInt32(stat.SaveBits));
case StatType.FireMinDamage:
case StatType.LightMinDamage:
case StatType.MagicMinDamage:
return new DamageRangeStat(stat, br.ReadInt32(stat.SaveBits), br.ReadInt32(BaseStat.Get((int) (stat.Index + 1)).SaveBits));
case StatType.FireMaxDamage:
case StatType.LightMaxDamage:
case StatType.MagicMaxDamage:
goto Label_0350;
case StatType.ColdMinDamage:
return new ColdDamageStat(stat, br.ReadInt32(stat.SaveBits), br.ReadInt32(BaseStat.Get(StatType.ColdMaxDamage).SaveBits), br.ReadInt32(BaseStat.Get(StatType.ColdLength).SaveBits));
case StatType.ReplenishDurability:
case StatType.ReplenishQuantity:
return new ReplenishStat(stat, br.ReadInt32(stat.SaveBits));
case StatType.PoisonMinDamage:
return new PoisonDamageStat(stat, br.ReadInt32(stat.SaveBits), br.ReadInt32(BaseStat.Get(StatType.PoisonMaxDamage).SaveBits), br.ReadInt32(BaseStat.Get(StatType.PoisonLength).SaveBits));
}
}
else
{
switch (stat.Type)
{
case StatType.SingleSkill:
case StatType.NonClassSkill:
return new SkillBonusStat(stat, br.ReadInt32(stat.SaveParamBits), br.ReadInt32(stat.SaveBits));
case StatType.ElementalSkillBonus:
return new ElementalSkillsBonusStat(stat, br.ReadInt32(stat.SaveParamBits), br.ReadInt32(stat.SaveBits));
case StatType.ClassSkillsBonus:
return new ClassSkillsBonusStat(stat, br.ReadInt32(stat.SaveParamBits), br.ReadInt32(stat.SaveBits));
case StatType.Aura:
return new AuraStat(stat, br.ReadInt32(stat.SaveParamBits), br.ReadInt32(stat.SaveBits));
case StatType.Reanimate:
return new ReanimateStat(stat, br.ReadUInt32(stat.SaveParamBits), br.ReadUInt32(stat.SaveBits));
case StatType.SkillOnAttack:
case StatType.SkillOnKill:
case StatType.SkillOnDeath:
case StatType.SkillOnStriking:
case StatType.SkillOnLevelUp:
case StatType.SkillOnGetHit:
return new SkillOnEventStat(stat, br.ReadInt32(6), br.ReadInt32(10), br.ReadInt32(stat.SaveBits));
case StatType.ChargedSkill:
return new ChargedSkillStat(stat, br.ReadInt32(6), br.ReadInt32(10), br.ReadInt32(8), br.ReadInt32(8));
case StatType.SkillTabBonus:
return new SkillTabBonusStat(stat, br.ReadInt32(3), br.ReadInt32(3), br.ReadInt32(10), br.ReadInt32(stat.SaveBits));
}
throw new Exception("Invalid stat: " + stat.Index.ToString());
}
Label_0350:
if (stat.Signed)
{
int num2 = br.ReadInt32(stat.SaveBits);
if (stat.SaveAdd > 0)
{
num2 -= stat.SaveAdd;
}
return new SignedStat(stat, num2);
}
uint val = br.ReadUInt32(stat.SaveBits);
if (stat.SaveAdd > 0)
{
val -= (uint) stat.SaveAdd;
}
return new UnsignedStat(stat, val);
}
示例10: AddUnit
// Methods
public AddUnit(byte[] data)
: base(data)
{
int num;
int num2;
this.unitType = (UnitType) data[1];
this.uid = BitConverter.ToUInt32(data, 2);
this.states = new List<NPCState>();
BitReader reader = new BitReader(data, 7);
Label_0030:
num = reader.ReadInt32(8);
if (num == 0xff)
{
this.offset = reader.Position;
this.unknownEnd = reader.ReadByteArray();
return;
}
if (!reader.ReadBoolean(1))
{
this.states.Add(new NPCState(BaseState.Get(num)));
goto Label_0030;
}
List<StatBase> stats = new List<StatBase>();
Label_0056:
num2 = reader.ReadInt32(9);
if (num2 != 0x1ff)
{
BaseStat stat = BaseStat.Get(num2);
int val = reader.ReadInt32(stat.SendBits);
if (stat.SendParamBits > 0)
{
int param = reader.ReadInt32(stat.SendParamBits);
if (stat.Signed)
{
stats.Add(new SignedStatParam(stat, val, param));
}
else
{
stats.Add(new UnsignedStatParam(stat, (uint) val, (uint) param));
}
}
else if (stat.Signed)
{
stats.Add(new SignedStat(stat, val));
}
else
{
stats.Add(new UnsignedStat(stat, (uint) val));
}
goto Label_0056;
}
this.states.Add(new NPCState(BaseState.Get(num), stats));
goto Label_0030;
}
示例11: ItemAction
// Methods
public ItemAction(byte[] data)
: base(data)
{
this.superiorType = SuperiorItemType.NotApplicable;
this.charClass = CharacterClass.NotApplicable;
this.level = -1;
this.usedSockets = -1;
this.use = -1;
this.graphic = -1;
this.color = -1;
this.stats = new List<StatBase>();
this.unknown1 = -1;
this.runewordID = -1;
this.runewordParam = -1;
BitReader br = new BitReader(data, 1);
this.action = (ItemActionType) br.ReadByte();
br.SkipBytes(1);
this.category = (ItemCategory) br.ReadByte();
this.uid = br.ReadUInt32();
if (data[0] == 0x9d)
{
br.SkipBytes(5);
}
this.flags = (ItemFlags) br.ReadUInt32();
this.version = (ItemVersion) br.ReadByte();
this.unknown1 = br.ReadByte(2);
this.destination = (ItemDestination) br.ReadByte(3);
if (this.destination == ItemDestination.Ground)
{
this.x = br.ReadUInt16();
this.y = br.ReadUInt16();
}
else
{
this.location = (EquipmentLocation) br.ReadByte(4);
this.x = br.ReadByte(4);
this.y = br.ReadByte(3);
this.container = (ItemContainer) br.ReadByte(4);
}
if ((this.action == ItemActionType.AddToShop) || (this.action == ItemActionType.RemoveFromShop))
{
int num = ((int) this.container) | 0x80;
if ((num & 1) == 1)
{
num--;
this.y += 8;
}
this.container = (ItemContainer) num;
}
else if (this.container == ItemContainer.Unspecified)
{
if (this.location == EquipmentLocation.NotApplicable)
{
if ((this.Flags & ItemFlags.InSocket) == ItemFlags.InSocket)
{
this.container = ItemContainer.Item;
this.y = -1;
}
else if ((this.action == ItemActionType.PutInBelt) || (this.action == ItemActionType.RemoveFromBelt))
{
this.container = ItemContainer.Belt;
this.y = this.x / 4;
this.x = this.x % 4;
}
}
else
{
this.x = -1;
this.y = -1;
}
}
if ((this.flags & ItemFlags.Ear) == ItemFlags.Ear)
{
this.charClass = (CharacterClass) br.ReadByte(3);
this.level = br.ReadByte(7);
this.name = br.ReadString(7, '\0', 0x10);
this.baseItem = BaseItem.Get(ItemType.Ear);
}
else
{
this.baseItem = BaseItem.GetByID(this.category, br.ReadUInt32());
if (this.baseItem.Type == ItemType.Gold)
{
this.stats.Add(new SignedStat(BaseStat.Get(StatType.Quantity), br.ReadInt32(br.ReadBoolean(1) ? 0x20 : 12)));
}
else
{
this.usedSockets = br.ReadByte(3);
if ((this.flags & (ItemFlags.Compact | ItemFlags.Gamble)) == ItemFlags.None)
{
BaseStat stat;
int num2;
this.level = br.ReadByte(7);
this.quality = (ItemQuality) br.ReadByte(4);
if (br.ReadBoolean(1))
{
this.graphic = br.ReadByte(3);
}
if (br.ReadBoolean(1))
//.........这里部分代码省略.........