本文整理汇总了C#中Blamite.Flexibility.StructureValueCollection.SetInteger方法的典型用法代码示例。如果您正苦于以下问题:C# StructureValueCollection.SetInteger方法的具体用法?C# StructureValueCollection.SetInteger怎么用?C# StructureValueCollection.SetInteger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blamite.Flexibility.StructureValueCollection
的用法示例。
在下文中一共展示了StructureValueCollection.SetInteger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Serialize
/// <summary>
/// Serializes this instance.
/// </summary>
/// <returns>A collection of structure values.</returns>
public StructureValueCollection Serialize()
{
var result = new StructureValueCollection();
result.SetInteger("virtual address", VirtualAddress);
result.SetInteger("size", Size);
return result;
}
示例2: Serialize
/// <summary>
/// Serializes this instance.
/// </summary>
/// <returns>The serialized structure values.</returns>
public StructureValueCollection Serialize()
{
var values = new StructureValueCollection();
values.SetInteger("range start index", (uint) StartIndex);
values.SetInteger("range size", (uint) Size);
return values;
}
示例3: Serialize
public StructureValueCollection Serialize(IList<ITagClass> classList)
{
var result = new StructureValueCollection();
result.SetInteger("memory address", (MetaLocation != null) ? MetaLocation.AsPointer() : 0);
result.SetInteger("class index", (Class != null) ? (uint) classList.IndexOf(Class) : 0xFFFFFFFF);
result.SetInteger("datum index salt", Index.Salt);
return result;
}
示例4: SaveResourceInfoBuffer
private void SaveResourceInfoBuffer(byte[] buffer, StructureValueCollection values, IStream stream)
{
// Free the old info buffer
var oldSize = (int) values.GetInteger("resource info buffer size");
uint oldAddress = values.GetInteger("resource info buffer address");
if (oldAddress >= 0 && oldSize > 0)
_allocator.Free(oldAddress, oldSize);
// Write a new one
uint newAddress = 0;
if (buffer.Length > 0)
{
newAddress = _allocator.Allocate(buffer.Length, 0x10, stream);
stream.SeekTo(_metaArea.PointerToOffset(newAddress));
stream.WriteBlock(buffer);
}
// Update values
values.SetInteger("resource info buffer size", (uint) buffer.Length);
values.SetInteger("resource info buffer address", newAddress);
}
示例5: 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);
}
示例6: VisitTagRef
public void VisitTagRef(TagRefData field)
{
SeekToOffset(field.Offset);
if (field.WithClass)
{
var values = new StructureValueCollection();
if (field.Value != null)
{
values.SetInteger("class magic", (uint)field.Value.RawTag.Class.Magic);
values.SetInteger("datum index", field.Value.RawTag.Index.Value);
}
else
{
values.SetInteger("class magic", 0xFFFFFFFF);
values.SetInteger("datum index", 0xFFFFFFFF);
}
StructureWriter.WriteStructure(values, _tagRefLayout, _writer);
}
else
{
_writer.WriteUInt32(field.Value == null ? 0xFFFFFFFF : field.Value.RawTag.Index.Value);
}
}
示例7: Serialize
/// <summary>
/// Serializes the header's values, storing them into a StructureValueCollection.
/// </summary>
/// <param name="localeArea">The locale area of the cache file. Can be null.</param>
/// <param name="localePointerMask">The value to add to locale pointers to translate them to file offsets.</param>
/// <returns>The resulting StructureValueCollection.</returns>
public StructureValueCollection Serialize(FileSegmentGroup localeArea)
{
StructureValueCollection values = new StructureValueCollection();
values.SetInteger("file size", (uint)FileSize);
values.SetInteger("type", (uint)Type);
values.SetString("internal name", InternalName);
values.SetString("scenario name", ScenarioName);
values.SetInteger("xdk version", (uint)XDKVersion);
AdjustPartitions();
values.SetArray("partitions", SerializePartitions());
if (_originalRawTableOffset != 0)
{
if (RawTable != null)
values.SetInteger("raw table offset", (uint)RawTable.Offset);
if (localeArea != null)
{
// I really don't know what these next two values are supposed to mean...anyone got anything?
values.SetInteger("eof index offset", localeArea.OffsetToPointer((int)FileSize)); // Reach, H4
values.SetInteger("eof index offset plus string data size", localeArea.OffsetToPointer((int)(FileSize + StringArea.Size))); // H3
}
}
else
{
values.SetInteger("meta offset", (uint)MetaArea.Offset);
}
if (RawTable != null)
values.SetInteger("raw table size", (uint)RawTable.Size);
if (MetaArea != null)
{
values.SetInteger("virtual base address", MetaArea.BasePointer);
values.SetInteger("index header address", IndexHeaderLocation.AsPointer());
values.SetInteger("virtual size", (uint)MetaArea.Size);
}
if (StringBlockLocation != null)
values.SetInteger("string block offset", (uint)StringBlockLocation.AsPointer());
values.SetInteger("string table count", (uint)StringIDCount);
if (StringIDData != null)
{
values.SetInteger("string table size", (uint)StringIDData.Size);
values.SetInteger("string table offset", StringIDDataLocation.AsPointer());
}
if (StringIDIndexTableLocation != null)
values.SetInteger("string index table offset", StringIDIndexTableLocation.AsPointer());
if (StringArea != null)
{
values.SetInteger("string data size", (uint)StringArea.Size);
values.SetInteger("string offset magic", StringArea.BasePointer);
}
values.SetInteger("file table count", (uint)FileNameCount);
if (FileNameData != null)
{
values.SetInteger("file table offset", FileNameDataLocation.AsPointer());
values.SetInteger("file table size", (uint)FileNameData.Size);
}
if (FileNameIndexTableLocation != null)
values.SetInteger("file index table offset", FileNameIndexTableLocation.AsPointer());
if (localeArea != null)
{
values.SetInteger("locale data index offset", localeArea.BasePointer);
values.SetInteger("locale data size", (uint)localeArea.Size);
values.SetInteger("locale offset magic", (uint)-localeArea.PointerMask);
}
if (UnknownTableLocation != null)
{
values.SetInteger("unknown table count", (uint)UnknownCount);
values.SetInteger("unknown table offset", UnknownTableLocation.AsPointer());
}
return values;
}
示例8: Serialize
public StructureValueCollection Serialize()
{
var result = new StructureValueCollection();
result.SetInteger("string count", (uint) StringCount);
result.SetInteger("locale table size", LocaleData != null ? (uint) LocaleData.Size : 0);
if (LocaleIndexTableLocation != null)
result.SetInteger("locale index table offset", LocaleIndexTableLocation.AsPointer());
if (LocaleDataLocation != null)
result.SetInteger("locale data index offset", LocaleDataLocation.AsPointer());
if (IndexTableHash != null)
result.SetRaw("index table hash", IndexTableHash);
if (StringDataHash != null)
result.SetRaw("string data hash", StringDataHash);
return result;
}
示例9: Serialize
/// <summary>
/// Serializes the header's values, storing them into a StructureValueCollection.
/// </summary>
/// <param name="localeArea">The locale area of the cache file. Can be null.</param>
/// <param name="localePointerMask">The value to add to locale pointers to translate them to file offsets.</param>
/// <returns>The resulting StructureValueCollection.</returns>
public StructureValueCollection Serialize(FileSegmentGroup localeArea)
{
var values = new StructureValueCollection();
values.SetInteger("file size", FileSize);
values.SetInteger("type", (uint) Type);
values.SetString("internal name", InternalName);
values.SetString("scenario name", ScenarioName);
values.SetInteger("xdk version", (uint) XDKVersion);
AdjustPartitions();
values.SetArray("partitions", SerializePartitions());
RebuildInteropData(localeArea);
values.SetArray("offset masks", SectionOffsetMasks.Select(m =>
{
var result = new StructureValueCollection();
result.SetInteger("mask", m);
return result;
}).ToArray());
values.SetArray("sections", Sections.Select(s => s.Serialize()).ToArray());
values.SetInteger("tag buffer offset", Sections[(int) ThirdGenInteropSectionType.Tag].VirtualAddress);
if (MetaArea != null)
{
values.SetInteger("virtual base address", MetaArea.BasePointer);
values.SetInteger("index header address", IndexHeaderLocation.AsPointer());
values.SetInteger("virtual size", (uint) MetaArea.Size);
}
if (StringBlockLocation != null)
values.SetInteger("string block offset", StringBlockLocation.AsPointer());
values.SetInteger("string table count", (uint) StringIDCount);
if (StringIDData != null)
{
values.SetInteger("string table size", (uint) StringIDData.Size);
values.SetInteger("string table offset", StringIDDataLocation.AsPointer());
}
if (StringIDIndexTableLocation != null)
values.SetInteger("string index table offset", StringIDIndexTableLocation.AsPointer());
if (StringArea != null)
values.SetInteger("string data size", (uint) StringArea.Size);
values.SetInteger("file table count", (uint) FileNameCount);
if (FileNameData != null)
{
values.SetInteger("file table offset", FileNameDataLocation.AsPointer());
values.SetInteger("file table size", (uint) FileNameData.Size);
}
if (FileNameIndexTableLocation != null)
values.SetInteger("file index table offset", FileNameIndexTableLocation.AsPointer());
if (localeArea != null)
{
values.SetInteger("locale data index offset", localeArea.BasePointer);
values.SetInteger("locale data size", (uint) localeArea.Size);
}
if (UnknownTableLocation != null)
{
values.SetInteger("unknown table count", (uint) UnknownCount);
values.SetInteger("unknown table offset", UnknownTableLocation.AsPointer());
}
return values;
}
示例10: SerializeResourceFixup
private StructureValueCollection SerializeResourceFixup(ResourceFixup fixup)
{
var result = new StructureValueCollection();
result.SetInteger("offset", (uint) fixup.Offset);
result.SetInteger("address", fixup.Address);
return result;
}
示例11: SerializePointer
private StructureValueCollection SerializePointer(ResourcePointer pointer)
{
var result = new StructureValueCollection();
result.SetInteger("primary page index", (pointer.PrimaryPage != null) ? (uint) pointer.PrimaryPage.Index : 0xFFFFFFFF);
result.SetInteger("primary offset", (uint) pointer.PrimaryOffset);
result.SetInteger("primary unknown", (uint) pointer.PrimaryUnknown);
result.SetInteger("secondary page index",
(pointer.SecondaryPage != null) ? (uint) pointer.SecondaryPage.Index : 0xFFFFFFFF);
result.SetInteger("secondary offset", (uint) pointer.SecondaryOffset);
result.SetInteger("secondary unknown", (uint) pointer.SecondaryUnknown);
return result;
}
示例12: SerializePage
private StructureValueCollection SerializePage(ResourcePage page, ThirdGenCacheFileReference[] externalFiles)
{
var result = new StructureValueCollection();
result.SetInteger("salt", page.Salt);
result.SetInteger("flags", page.Flags);
result.SetInteger("compression codec index",
(page.CompressionMethod != ResourcePageCompression.None) ? 0 : 0xFFFFFFFF);
result.SetInteger("shared cache file index",
(page.FilePath != null) ? (uint) FindExternalFile(externalFiles, page.FilePath) : 0xFFFFFFFF);
result.SetInteger("unknown 1", (uint) page.Unknown1);
result.SetInteger("compressed block offset", (uint) page.Offset);
result.SetInteger("compressed block size", (uint) page.CompressedSize);
result.SetInteger("uncompressed block size", (uint) page.UncompressedSize);
result.SetInteger("checksum", page.Checksum);
result.SetRaw("hash 1", page.Hash1);
result.SetRaw("hash 2", page.Hash2);
result.SetRaw("hash 3", page.Hash3);
result.SetInteger("unknown 2", (uint) page.Unknown2);
result.SetInteger("unknown 3", (uint) page.Unknown3);
return result;
}
示例13: SaveTags
private void SaveTags(StructureValueCollection headerValues, IStream stream)
{
var oldCount = (int) headerValues.GetInteger("number of tags");
uint oldAddress = headerValues.GetInteger("tag table address");
StructureLayout layout = _buildInfo.Layouts.GetLayout("tag entry");
IEnumerable<StructureValueCollection> entries = _tags.Select(t => ((ThirdGenTag) t).Serialize(Classes));
// hax, _tags is a list of ITag objects so we have to upcast
uint newAddress = ReflexiveWriter.WriteReflexive(entries, oldCount, oldAddress, _tags.Count, layout, _metaArea,
_allocator, stream);
headerValues.SetInteger("number of tags", (uint) _tags.Count);
headerValues.SetInteger("tag table address", newAddress);
}
示例14: ImportShader
/// <summary>
/// Deserializes a serialized shader and injects it into the cache file.
/// </summary>
/// <param name="serializedShader">The serialized shader data to inject.</param>
/// <param name="stream">The stream to manipulate. It should be positioned where the shader pointer should be written.</param>
/// <returns>
/// <c>true</c> if the shader was successfully deserialized and injected.
/// </returns>
public bool ImportShader(byte[] serializedShader, IStream stream)
{
if (serializedShader == null || serializedShader.Length == 0)
{
// Null shader
stream.WriteUInt32(0);
return true;
}
var pointerOffset = stream.Position;
using (var reader = new EndianReader(new MemoryStream(serializedShader), Endian.BigEndian))
{
// Check the magic
if (reader.ReadInt32() != SerializationMagic)
return false;
// Read the shader type and determine which info layout to use
var type = (ShaderType)reader.ReadByte();
StructureLayout infoLayout = null;
if (type == ShaderType.Pixel)
infoLayout = _pixelShaderInfoLayout;
else if (type == ShaderType.Vertex)
infoLayout = _vertexShaderInfoLayout;
if (infoLayout == null)
return false;
// Read and verify the layout size
var infoLayoutSize = reader.ReadInt32();
if (infoLayoutSize != infoLayout.Size)
return false;
// Read the raw debug info and data
var debugInfoSize = reader.ReadUInt32();
var debugInfo = reader.ReadBlock((int)debugInfoSize);
var dataSize = reader.ReadUInt32();
var data = reader.ReadBlock((int)dataSize);
// Allocate space for the shader data and write it in
var dataAddr = _cacheFile.Allocator.Allocate((int)dataSize, 0x10, stream); // 16-byte aligned
var dataOffset = _cacheFile.MetaArea.PointerToOffset(dataAddr);
stream.SeekTo(dataOffset);
stream.WriteBlock(data);
// Allocate and zero space for the info structures
var infoSize = infoLayoutSize + (int)debugInfoSize;
var infoAddr = _cacheFile.Allocator.Allocate(infoSize, stream);
var infoOffset = _cacheFile.MetaArea.PointerToOffset(infoAddr);
stream.SeekTo(infoOffset);
StreamUtil.Fill(stream, 0, infoSize);
// Write the basic info structure
stream.SeekTo(infoOffset);
var infoValues = new StructureValueCollection();
infoValues.SetInteger("shader data address", dataAddr);
StructureWriter.WriteStructure(infoValues, infoLayout, stream);
// Write the debug info structure
stream.WriteBlock(debugInfo);
// Finally, write the shader pointer
stream.SeekTo(pointerOffset);
stream.WriteUInt32(infoAddr);
}
return true;
}
示例15: SerializeDefinitionFixup
private StructureValueCollection SerializeDefinitionFixup(ResourceDefinitionFixup fixup)
{
var result = new StructureValueCollection();
result.SetInteger("offset", (uint) fixup.Offset);
result.SetInteger("type index", (uint) fixup.Type);
return result;
}