本文整理汇总了C#中Blamite.Flexibility.StructureValueCollection.GetIntegerOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# StructureValueCollection.GetIntegerOrDefault方法的具体用法?C# StructureValueCollection.GetIntegerOrDefault怎么用?C# StructureValueCollection.GetIntegerOrDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blamite.Flexibility.StructureValueCollection
的用法示例。
在下文中一共展示了StructureValueCollection.GetIntegerOrDefault方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
private void Load(StructureValueCollection values)
{
Magic = (int)values.GetInteger("magic");
ParentMagic = (int)values.GetInteger("parent magic");
GrandparentMagic = (int)values.GetInteger("grandparent magic");
Description = new StringID((int)values.GetIntegerOrDefault("stringid", 0));
}
示例2: Load
private void Load(StructureValueCollection values, ushort index, StringTableReader stringReader)
{
Index = new DatumIndex((ushort)values.GetInteger("datum index salt"), index);
Opcode = (ushort)values.GetInteger("opcode");
ReturnType = (short)values.GetInteger("value type");
Type = (ScriptExpressionType)values.GetInteger("expression type");
_nextIndex = new DatumIndex(values.GetInteger("next expression index"));
_stringTableOffset = (int)values.GetIntegerOrDefault("string table offset", 0);
Value = values.GetInteger("value");
LineNumber = (short)values.GetIntegerOrDefault("source line", 0);
stringReader.RequestString(_stringTableOffset);
}
示例3: SaveResourceFixups
private void SaveResourceFixups(IList<ResourceFixup> fixups, StructureValueCollection values, IStream stream,
ReflexiveCache<ResourceFixup> cache)
{
var oldCount = (int) values.GetIntegerOrDefault("number of resource fixups", 0);
uint oldAddress = values.GetIntegerOrDefault("resource fixup table address", 0);
StructureLayout layout = _buildInfo.Layouts.GetLayout("resource fixup entry");
uint newAddress;
if (!cache.TryGetAddress(fixups, out newAddress))
{
// Write a new reflexive
IEnumerable<StructureValueCollection> entries = fixups.Select(f => SerializeResourceFixup(f));
newAddress = ReflexiveWriter.WriteReflexive(entries, oldCount, oldAddress, fixups.Count, layout, _metaArea,
_allocator, stream);
cache.Add(newAddress, fixups);
}
else if (oldAddress != 0 && oldCount > 0)
{
// Reflexive was cached - just free it
_allocator.Free(oldAddress, oldCount*layout.Size);
}
values.SetInteger("number of resource fixups", (uint) fixups.Count);
values.SetInteger("resource fixup table address", newAddress);
}
示例4: Deserialize
/// <summary>
/// Deserializes a bounding box from a set of values read from a structure.
/// </summary>
/// <param name="values">The values to use.</param>
/// <returns>The bounding box.</returns>
public static BoundingBox Deserialize(StructureValueCollection values)
{
var result = new BoundingBox();
result.MinX = values.GetFloat("min x");
result.MaxX = values.GetFloat("max x");
result.MinY = values.GetFloat("min y");
result.MaxY = values.GetFloat("max y");
result.MinZ = values.GetFloat("min z");
result.MaxZ = values.GetFloat("max z");
result.MinU = values.GetFloat("min u");
result.MaxU = values.GetFloat("max u");
result.MinV = values.GetFloat("min v");
result.MaxV = values.GetFloat("max v");
result.Unknown1 = (int) values.GetIntegerOrDefault("unknown 1", 3);
result.Unknown2 = (int) values.GetIntegerOrDefault("unknown 2", 0);
result.Unknown3 = (int) values.GetIntegerOrDefault("unknown 3", 0);
result.Unknown4 = (int) values.GetIntegerOrDefault("unknown 4", 0);
return result;
}
示例5: LoadPage
private ResourcePage LoadPage(StructureValueCollection values, int index, ThirdGenCacheFileReference[] externalFiles)
{
var result = new ResourcePage();
result.Index = index;
result.Salt = (ushort) values.GetInteger("salt");
result.Flags = (byte) values.GetInteger("flags");
result.CompressionMethod = ((int) values.GetInteger("compression codec index") != -1)
? ResourcePageCompression.Deflate
: ResourcePageCompression.None; // FIXME: hax/laziness
var externalFile = (int) values.GetInteger("shared cache file index");
result.FilePath = (externalFile != -1) ? externalFiles[externalFile].Path : null;
result.Unknown1 = (int) values.GetIntegerOrDefault("unknown 1", 0);
result.Offset = (int) values.GetInteger("compressed block offset");
result.CompressedSize = (int) values.GetInteger("compressed block size");
result.UncompressedSize = (int) values.GetInteger("uncompressed block size");
result.Checksum = values.GetInteger("checksum");
result.Hash1 = values.GetRaw("hash 1");
result.Hash2 = values.GetRaw("hash 2");
result.Hash3 = values.GetRaw("hash 3");
result.Unknown2 = (int) values.GetIntegerOrDefault("unknown 2", 0);
result.Unknown3 = (int) values.GetIntegerOrDefault("unknown 3", 0);
return result;
}
示例6: CalculateStringPointerConverter
private IPointerConverter CalculateStringPointerConverter(StructureValueCollection values)
{
// If the original raw table offset isn't zero, then "string offset magic" contains the base pointer to the string area
// and the string area is located immediately after the header
// Otherwise, pointers are just file offsets
uint magic = values.GetIntegerOrDefault("string offset magic", 0);
if (magic > 0 && values.GetIntegerOrDefault("raw table offset", 0) > 0)
return new BasedPointerConverter(magic, HeaderSize);
return new IdentityPointerConverter();
}
示例7: CalculateLocalePointerConverter
private IPointerConverter CalculateLocalePointerConverter(StructureValueCollection values)
{
uint mask = values.GetIntegerOrDefault("locale offset magic", 0);
if (mask != 0)
{
uint basePointer = values.GetInteger("locale data index offset");
int baseOffset = (int)(basePointer + mask);
return new BasedPointerConverter(basePointer, baseOffset);
}
return new IdentityPointerConverter(); // Locale pointers are file offsets
}