本文整理汇总了C#中BlamLib.Seek方法的典型用法代码示例。如果您正苦于以下问题:C# BlamLib.Seek方法的具体用法?C# BlamLib.Seek怎么用?C# BlamLib.Seek使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlamLib
的用法示例。
在下文中一共展示了BlamLib.Seek方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
public override void Read(BlamLib.IO.EndianReader s)
{
int pos = 0;
Blam.CacheFile.ValidateHeaderAdjustEndian(s, 0x800);
s.Seek(4);
Halo1.Version ver = (Halo1.Version)(version = s.ReadInt32());
fileLength = s.ReadInt32();
if (fileLength < s.Length) throw new Debug.ExceptionLog("Compressed map editing not available yet!");
s.ReadInt32();
if (ver == Halo1.Version.PC_Demo)
{
pos = s.Position;
s.Position = 0x5EC;
offsetToIndex = s.ReadInt32();
s.Position = pos;
}
else
offsetToIndex = s.ReadInt32();
tagBufferSize = s.ReadInt32();
s.ReadInt32(); s.ReadInt32();
if (ver == Halo1.Version.PC_Demo)
{
pos = s.Position;
s.Position = 0x5E8;
name = s.ReadTagString();
s.Position = pos;
}
else
name = s.ReadTagString();
build = s.ReadTagString();
cacheType = (CacheType)s.ReadInt16();
s.ReadInt16();
s.ReadInt32(); // CRC
s.ReadInt32();
s.Seek((484 * sizeof(int)) + sizeof(uint), System.IO.SeekOrigin.Current);
CacheFile cache = s.Owner as CacheFile;
if (ver == Halo1.Version.Xbox) cache.EngineVersion = BlamVersion.Halo1_Xbox;
else if (ver == Halo1.Version.PC || ver == Halo1.Version.PC_Demo)
{
if(s.State == IO.EndianState.Big) cache.EngineVersion = BlamVersion.Halo1_XboxX;
else
{
// Interestingly, HaloPC is build 01.00.00.0564, HA10 is build 01.00.01.0563
// Little
if(build == "01.00.01.0563") cache.EngineVersion = BlamVersion.Halo1_PCX;
else cache.EngineVersion = BlamVersion.Halo1_PC;
}
}
else if (ver == Halo1.Version.CE) cache.EngineVersion = BlamVersion.Halo1_CE;
}
示例2: Read
public override void Read(BlamLib.IO.EndianReader s)
{
Blam.CacheFile.ValidateHeader(s, 0x800);
s.Seek(4);
s.ReadInt32(); // version, should be 5
fileLength = s.ReadInt32();
int xbox = s.ReadInt32(); // Xbox only field
offsetToIndex = s.ReadInt32();
s.ReadInt32(); // stream size
s.ReadInt32(); s.ReadInt32();
name = s.ReadTagString();
build = s.ReadTagString(); // Xbox only field. Always '400'
cacheType = (CacheType)s.ReadInt32();
s.ReadInt32(); // CRC
s.Seek((485 * sizeof(int)) + sizeof(uint), System.IO.SeekOrigin.Current);
CacheFile cf = s.Owner as CacheFile;
if (xbox != 0) cf.EngineVersion = BlamVersion.Stubbs_Xbox;
else cf.EngineVersion = BlamVersion.Stubbs_PC; // no way to tell when its mac...
}
示例3: ReadCString
public static string ReadCString(uint offset, BlamLib.IO.EndianReader io)
{
if (offset == 0) return string.Empty;
uint pos = io.PositionUnsigned;
io.Seek(offset);
byte btchar = 0;
var cstring = new System.Text.StringBuilder();
do
{
btchar = io.ReadByte();
if (btchar != 0)
cstring.Append((char)btchar);
} while (btchar != 0);
io.Seek(pos);
return cstring.ToString();
}
示例4: Read
public void Read(BlamLib.IO.EndianReader s)
{
GameMode = s.ReadInt32();
GameSimulation = (GameSimulation)s.ReadByte();
GameNetworkType = s.ReadByte();
GameTickRate = s.ReadInt16();
GameInstance = s.ReadUInt64();
Unknown010 = s.ReadInt32();
Language = s.ReadInt32();
DeterminismVersion = s.ReadInt32();
MapId.Read(s);
CachePath = s.ReadAsciiString(260);
InitialZoneSetIndex = s.ReadInt16();
Unknown12A = s.ReadBool();
DumpMachineIndex = s.ReadByte();
Unknown12C = s.ReadBool();
Unknown12D = s.ReadBool();
Unknown12E = s.ReadBool();
s.Seek(1, System.IO.SeekOrigin.Current);
GamePlayback = (GamePlayback)s.ReadInt16();
Unknown132 = s.ReadBool();
s.Seek(1, System.IO.SeekOrigin.Current);
Unknown134 = s.ReadInt32();
Unknown138 = s.ReadInt32();
CampaignDifficulty = s.ReadInt16();
CampaignInsertionPoint = s.ReadInt16();
CampaignMetagameScoring = s.ReadInt16();
Unknown142 = s.ReadBool();
Unknown143 = s.ReadBool();
PrimarySkulls = s.ReadInt32();
SecondarySkulls = s.ReadInt32();
for (int x = 0; x < Unknown14C.Length; x++) Unknown14C[x] = s.ReadBytes(30);
Unknown1C4 = s.ReadBool();
s.Seek(3 + 4, System.IO.SeekOrigin.Current);
Unknown1CC = s.ReadBytes(92);
EngineVariant.Read(s);
s.Seek(4, System.IO.SeekOrigin.Current);
MapVariant.Read(s);
Game.Read(s);
}
示例5: ReadTagInstances
protected void ReadTagInstances(BlamLib.IO.EndianReader s)
{
items = new Cache.CacheItemGen3[tagCount];
s.Seek(tagsOffset, System.IO.SeekOrigin.Begin);
for (int x = 0; x < tagCount; x++)
(items[x] = new Cache.CacheItemGen3()).Read(s);
}
示例6: ReadBeta
void ReadBeta(BlamLib.IO.EndianReader s)
{
s.ReadUInt32();
//s.ReadBool();
//s.ReadBool(); // false if it belongs to a untracked build
//s.ReadBool();
//s.ReadBool();
// Just read the booleans as a fucking int...
s.ReadInt32();
// Filetime.dwHighDateTime = s.ReadInt32();
// Filetime.dwLowDateTime = s.ReadInt32();
s.ReadInt32(); s.ReadInt32();
s.ReadInt32(); s.ReadInt32(); s.ReadInt32();
#region string id
// retail doesn't include the 128 byte per string id table, so nix the members
/*stringIdsBufferAlignedOffset = */s.ReadInt32();
stringIdsCount = s.ReadInt32();
stringIdsBufferSize = s.ReadInt32();
stringIdIndicesOffset = s.ReadInt32();
stringIdsBufferOffset = s.ReadInt32();
#endregion
#region filetimes?
// pretty sure this is a flags field
// used to tell which of the following 64bit values
// are used. Damn sure this are FILETIME structures, but
// hex workshop doesn't like them so I can't be for sure...
s.ReadInt32();
Filetime.dwHighDateTime = s.ReadInt32();
Filetime.dwLowDateTime = s.ReadInt32();
if (s.ReadInt32() != 0) flags.Add(CacheHeaderFlags.DependsOnMainMenu); s.ReadInt32();
if (s.ReadInt32() != 0) flags.Add(CacheHeaderFlags.DependsOnShared); s.ReadInt32();
if (s.ReadInt32() != 0) flags.Add(CacheHeaderFlags.DependsOnCampaign); s.ReadInt32();
#endregion
name = s.ReadTagString();
s.ReadInt32();
scenarioPath = s.ReadAsciiString(256);
needsShared = s.ReadInt32() == 1;
#region tag names
tagNamesCount = s.ReadInt32();
tagNamesBufferOffset = s.ReadInt32();
tagNamesBufferSize = s.ReadInt32();
tagNameIndicesOffset = s.ReadInt32();
#endregion
checksum = s.ReadUInt32(); // 0x2CC
s.Seek(32, System.IO.SeekOrigin.Current); // these bytes are always the same
baseAddress = s.ReadUInt32(); // expected base address
xdkVersion = s.ReadInt32(); // xdk version
#region memory partitions
memoryPartitions = new Partition[3];
memoryPartitions[0].BaseAddress = s.ReadUInt32(); // address
memoryPartitions[0].Size = s.ReadInt32(); // size
memoryPartitions[1].BaseAddress = s.ReadUInt32(); // address
memoryPartitions[1].Size = s.ReadInt32(); // size
memoryPartitions[2].BaseAddress = s.ReadUInt32(); // address
memoryPartitions[2].Size = s.ReadInt32(); // size
#endregion
s.Seek(256, System.IO.SeekOrigin.Current);
s.Seek(1004 + sizeof(uint), System.IO.SeekOrigin.Current);
Managers.BlamDefinition bdef = Program.GetManager(BlamVersion.Halo3_Beta);
uint base_address = (s.Owner as Blam.CacheFile).AddressMask = bdef[BlamVersion.Halo3_Beta].CacheTypes.BaseAddress - (uint)MemoryBufferOffset;
offsetToIndex = (int)(tagIndexAddress - base_address);
CalculatePartitionOffsets();
}
示例7: Read
public void Read(BlamLib.IO.EndianReader s)
{
s.Seek(4 + 4, System.IO.SeekOrigin.Current);
Count.Read(s);
Size.Read(s);
OffsetReferences.Read(s);
OffsetStrings.Read(s);
s.Seek(1 + 3, System.IO.SeekOrigin.Current);
}
示例8: ReadGroupTags
void ReadGroupTags(BlamLib.IO.EndianReader s)
{
groupTags = new CacheItemGroupTag[groupTagsCount];
s.Seek(groupTagsOffset, System.IO.SeekOrigin.Begin);
for (int x = 0; x < groupTagsCount; x++)
(groupTags[x] = new CacheItemGroupTag()).Read(s);
}
示例9: TagIndexInitializeAndRead
protected void TagIndexInitializeAndRead(BlamLib.IO.EndianReader s)
{
base.StringIdManagerInitializeAndRead();
base.InitializeReferenceManager(s.FileName);
base.InitializeTagIndexManager();
s.Seek(cacheHeader.OffsetToIndex, System.IO.SeekOrigin.Begin);
cacheIndex.Read(s);
}
示例10: ReadDependents
protected void ReadDependents(BlamLib.IO.EndianReader s)
{
DependentDatums = new DatumIndex[dependentTagsCount];
s.Seek(dependentTagsOffset, System.IO.SeekOrigin.Begin);
for (int x = 0; x < dependentTagsCount; x++)
{
s.Seek(sizeof(uint), System.IO.SeekOrigin.Current); // group tag
DependentDatums[x].Read(s);
}
}