本文整理汇总了C#中Blamite.Serialization.StructureValueCollection.HasInteger方法的典型用法代码示例。如果您正苦于以下问题:C# StructureValueCollection.HasInteger方法的具体用法?C# StructureValueCollection.HasInteger怎么用?C# StructureValueCollection.HasInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blamite.Serialization.StructureValueCollection
的用法示例。
在下文中一共展示了StructureValueCollection.HasInteger方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetObjectName
private string GetObjectName(StructureValueCollection values, StringIDSource stringIDs)
{
if (values.HasString("name"))
{
return values.GetString("name");
}
if (values.HasInteger("name stringid"))
{
var sid = new StringID(values.GetInteger("name stringid"));
return stringIDs.GetString(sid);
}
throw new InvalidOperationException("Unable to determine the name of objects in the \"" + _layoutName + "\" layout");
}
示例2: Load
private void Load(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea, StringIDSource stringIDs,
EngineDescription buildInfo)
{
Name = values.HasInteger("name index")
? stringIDs.GetString(new StringID(values.GetInteger("name index")))
: values.GetString("name");
ExecutionType = (short) values.GetInteger("execution type");
ReturnType = (short) values.GetInteger("return type");
RootExpressionIndex = new DatumIndex(values.GetInteger("first expression index"));
if (Name == null)
Name = "script_" + RootExpressionIndex.Value.ToString("X8");
Parameters = LoadParameters(reader, values, metaArea, buildInfo);
}
示例3: FreeBitArray
private static void FreeBitArray(StructureValueCollection values, string countName, string addressName, MetaAllocator allocator)
{
if (!values.HasInteger(countName) || !values.HasInteger(addressName))
return;
var oldCount = (int)values.GetInteger(countName);
uint oldAddress = values.GetInteger(addressName);
if (oldCount > 0 && oldAddress > 0)
allocator.Free(oldAddress, oldCount*4);
}
示例4: LoadBitArray
private BitArray LoadBitArray(StructureValueCollection values, string countName, string addressName, IReader reader)
{
if (!values.HasInteger(countName) || !values.HasInteger(addressName))
return new BitArray(0);
var count = (int) values.GetInteger(countName);
uint address = values.GetInteger(addressName);
if (count <= 0 || address == 0)
return new BitArray(0);
var ints = new int[count];
reader.SeekTo(_metaArea.PointerToOffset(address));
for (int i = 0; i < count; i++)
ints[i] = reader.ReadInt32();
return new BitArray(ints);
}
示例5: ReadZoneSetTable
private IEnumerable<FourthGenZoneSet> ReadZoneSetTable(StructureValueCollection tagValues, string countName, string addressName, IReader reader)
{
if (!tagValues.HasInteger(countName) || !tagValues.HasInteger(addressName))
return Enumerable.Empty<FourthGenZoneSet>();
var count = (int) tagValues.GetInteger(countName);
uint address = tagValues.GetInteger(addressName);
StructureLayout layout = _buildInfo.Layouts.GetLayout("zone set definition");
StructureValueCollection[] entries = ReflexiveReader.ReadReflexive(reader, count, address, layout, _metaArea);
return entries.Select(e => new FourthGenZoneSet(e, reader, _metaArea));
}
示例6: FreeZoneSetsInTable
private void FreeZoneSetsInTable(StructureValueCollection tagValues, string countName, string addressName, IReader reader)
{
if (!tagValues.HasInteger(countName) || !tagValues.HasInteger(addressName))
return;
var count = (int) tagValues.GetInteger(countName);
uint address = tagValues.GetInteger(addressName);
StructureLayout layout = _buildInfo.Layouts.GetLayout("zone set definition");
StructureValueCollection[] entries = ReflexiveReader.ReadReflexive(reader, count, address, layout, _metaArea);
foreach (StructureValueCollection entry in entries)
FourthGenZoneSet.Free(entry, _allocator);
}
示例7: SaveZoneSetTable
private void SaveZoneSetTable(IZoneSet[] sets, StructureValueCollection tagValues, string countName, string addressName, ReflexiveCache<int> cache, IStream stream)
{
if (!tagValues.HasInteger(countName) || !tagValues.HasInteger(addressName))
return;
var count = (int) tagValues.GetInteger(countName);
if (count != sets.Length)
throw new InvalidOperationException("Zone set count does not match");
uint address = tagValues.GetInteger(addressName);
StructureLayout layout = _buildInfo.Layouts.GetLayout("zone set definition");
List<StructureValueCollection> entries =
sets.Select(set => ((FourthGenZoneSet) set).Serialize(stream, _allocator, cache)).ToList();
ReflexiveWriter.WriteReflexive(entries, address, layout, _metaArea, stream);
}
示例8: LoadResourceTypes
private void LoadResourceTypes(StructureValueCollection values, IReader reader, StringIDSource stringIDs)
{
if (!values.HasInteger("number of resource types") || !values.HasInteger("resource type table address"))
return;
var count = (int) values.GetInteger("number of resource types");
uint address = values.GetInteger("resource type table address");
StructureLayout layout = _buildInfo.Layouts.GetLayout("resource type entry");
StructureValueCollection[] entries = ReflexiveReader.ReadReflexive(reader, count, address, layout, _metaArea);
_resourceTypes = entries.Select(e => new ThirdGenResourceType(e, stringIDs)).ToArray();
}
示例9: CalculateStringGroup
private void CalculateStringGroup(StructureValueCollection values, FileSegmenter segmenter)
{
if (DebugPointerConverter == null)
return;
StringArea = new FileSegmentGroup(DebugPointerConverter);
// StringIDs
StringIDCount = (int) values.GetInteger("string table count");
if (StringIDCount > 0)
{
int sidIndexTableOff = DebugPointerConverter.PointerToOffset(values.GetInteger("string index table offset"));
int sidDataOff = DebugPointerConverter.PointerToOffset(values.GetInteger("string table offset"));
var sidTableSize = (int) values.GetInteger("string table size");
StringIDIndexTable = segmenter.WrapSegment(sidIndexTableOff, StringIDCount*4, 4, SegmentResizeOrigin.End);
StringIDData = segmenter.WrapSegment(sidDataOff, sidTableSize, 1, SegmentResizeOrigin.End);
StringIDIndexTableLocation = StringArea.AddSegment(StringIDIndexTable);
StringIDDataLocation = StringArea.AddSegment(StringIDData);
// idk what this is, but H3Beta has it
if (values.HasInteger("string block offset"))
{
int sidBlockOff = DebugPointerConverter.PointerToOffset(values.GetInteger("string block offset"));
StringBlock = segmenter.WrapSegment(sidBlockOff, StringIDCount*0x80, 0x80, SegmentResizeOrigin.End);
StringBlockLocation = StringArea.AddSegment(StringBlock);
}
}
// Tag names
FileNameCount = (int) values.GetInteger("file table count");
if (FileNameCount > 0)
{
int nameIndexTableOff = DebugPointerConverter.PointerToOffset(values.GetInteger("file index table offset"));
int nameDataOff = DebugPointerConverter.PointerToOffset(values.GetInteger("file table offset"));
var fileTableSize = (int) values.GetInteger("file table size");
FileNameIndexTable = segmenter.WrapSegment(nameIndexTableOff, FileNameCount*4, 4, SegmentResizeOrigin.End);
FileNameData = segmenter.WrapSegment(nameDataOff, fileTableSize, 1, SegmentResizeOrigin.End);
FileNameIndexTableLocation = StringArea.AddSegment(FileNameIndexTable);
FileNameDataLocation = StringArea.AddSegment(FileNameData);
}
// Some H4-only unknown table
if (values.HasInteger("unknown table count") && values.HasInteger("unknown table offset"))
{
UnknownCount = (int) values.GetInteger("unknown table count");
if (UnknownCount > 0)
{
int unknownOff = DebugPointerConverter.PointerToOffset(values.GetInteger("unknown table offset"));
UnknownTable = segmenter.WrapSegment(unknownOff, UnknownCount*0x10, 0x10, SegmentResizeOrigin.End);
UnknownTableLocation = StringArea.AddSegment(UnknownTable);
}
}
}