本文整理汇总了C#中IStream.WriteInt32方法的典型用法代码示例。如果您正苦于以下问题:C# IStream.WriteInt32方法的具体用法?C# IStream.WriteInt32怎么用?C# IStream.WriteInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IStream
的用法示例。
在下文中一共展示了IStream.WriteInt32方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveBitArray
private void SaveBitArray(BitArray bits, string countName, string addressName, MetaAllocator allocator, IStream stream, ReflexiveCache<int> cache, StructureValueCollection values)
{
if (bits.Length == 0)
{
values.SetInteger(countName, 0);
values.SetInteger(addressName, 0);
return;
}
var ints = new int[((bits.Length + 31) & ~31)/32];
bits.CopyTo(ints, 0);
// If the address isn't cached, then allocate space and write a new array
uint newAddress;
if (!cache.TryGetAddress(ints, out newAddress))
{
newAddress = allocator.Allocate(ints.Length*4, stream);
stream.SeekTo(_metaArea.PointerToOffset(newAddress));
foreach (int i in ints)
stream.WriteInt32(i);
cache.Add(newAddress, ints);
}
values.SetInteger(countName, (uint)ints.Length);
values.SetInteger(addressName, newAddress);
}
示例2: SaveOffsets
private void SaveOffsets(IStream stream)
{
int count = _strings.Count();
int start_offset = 0x8 + count * 4; // Start data offset of the first string
int currentOffset = start_offset;
foreach (string str in _strings)
{
if (str != null)
{
stream.WriteInt32(currentOffset);
currentOffset += str.Length + 1; // + 1 is for the null terminator
}
else
{
stream.WriteInt32(0);
}
}
}