本文整理汇总了C#中System.IO.Stream.ReadASCII方法的典型用法代码示例。如果您正苦于以下问题:C# Stream.ReadASCII方法的具体用法?C# Stream.ReadASCII怎么用?C# Stream.ReadASCII使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.Stream
的用法示例。
在下文中一共展示了Stream.ReadASCII方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VxlReader
public VxlReader(Stream s)
{
if (!s.ReadASCII(16).StartsWith("Voxel Animation"))
throw new InvalidDataException("Invalid vxl header");
s.ReadUInt32();
LimbCount = s.ReadUInt32();
s.ReadUInt32();
BodySize = s.ReadUInt32();
s.Seek(770, SeekOrigin.Current);
// Read Limb headers
Limbs = new VxlLimb[LimbCount];
for (var i = 0; i < LimbCount; i++)
{
Limbs[i] = new VxlLimb();
Limbs[i].Name = s.ReadASCII(16);
s.Seek(12, SeekOrigin.Current);
}
// Skip to the Limb footers
s.Seek(802 + 28*LimbCount + BodySize, SeekOrigin.Begin);
var LimbDataOffset = new uint[LimbCount];
for (var i = 0; i < LimbCount; i++)
{
LimbDataOffset[i] = s.ReadUInt32();
s.Seek(8, SeekOrigin.Current);
Limbs[i].Scale = s.ReadFloat();
s.Seek(48, SeekOrigin.Current);
Limbs[i].Bounds = new float[6];
for (var j = 0; j < 6; j++)
Limbs[i].Bounds[j] = s.ReadFloat();
Limbs[i].Size = s.ReadBytes(3);
Limbs[i].Type = (NormalType)s.ReadByte();
}
for (var i = 0; i < LimbCount; i++)
{
s.Seek(802 + 28*LimbCount + LimbDataOffset[i], SeekOrigin.Begin);
ReadVoxelData(s, Limbs[i]);
}
}
示例2: IdxEntry
public IdxEntry(Stream s)
{
var name = s.ReadASCII(16);
var pos = name.IndexOf('\0');
if (pos != 0)
name = name.Substring(0, pos);
Filename = string.Concat(name, ".wav");
Offset = s.ReadUInt32();
Length = s.ReadUInt32();
SampleRate = s.ReadUInt32();
Flags = s.ReadUInt32();
ChunkSize = s.ReadUInt32();
}
示例3: IdxEntry
public IdxEntry(Stream s)
{
var asciiname = s.ReadASCII(16);
var pos = asciiname.IndexOf('\0');
if (pos != 0)
asciiname = asciiname.Substring(0, pos);
Name = asciiname;
Extension = DefaultExtension;
Offset = s.ReadUInt32();
Length = s.ReadUInt32();
SampleRate = s.ReadUInt32();
Flags = s.ReadUInt32();
ChunkSize = s.ReadUInt32();
Hash = HashFilename(string.Concat(Name, ".", Extension), PackageHashType.CRC32);
}
示例4: IdxReader
public IdxReader(Stream s)
{
s.Seek(0, SeekOrigin.Begin);
var id = s.ReadASCII(4);
if (id != "GABA")
throw new InvalidDataException("Unable to load Idx file, did not find magic id, found {0} instead".F(id));
var two = s.ReadInt32();
if (two != 2)
throw new InvalidDataException("Unable to load Idx file, did not find magic number 2, found {0} instead".F(two));
SoundCount = s.ReadInt32();
Entries = new List<IdxEntry>();
for (var i = 0; i < SoundCount; i++)
Entries.Add(new IdxEntry(s));
}
示例5: IsIcnD2
bool IsIcnD2(Stream s)
{
if (s.Length < 0x20)
return false;
var start = s.Position;
s.Position = 0x18;
if (s.ReadASCII(4) != "SSET")
{
s.Position = start;
return false;
}
ssetLength = int2.Swap(s.ReadUInt32()) - 8;
s.Position += 3;
ssetOffset = 0x18 + 16;
if (s.Length < ssetOffset + ssetLength)
{
s.Position = start;
return false;
}
s.Position = ssetOffset + ssetLength;
if (s.ReadASCII(4) != "RPAL")
{
s.Position = start;
return false;
}
rpalLength = int2.Swap(s.ReadUInt32());
rpalOffset = ssetOffset + ssetLength + 8;
if (s.Length < rpalOffset + rpalLength)
{
s.Position = start;
return false;
}
s.Position = rpalOffset + rpalLength;
if (s.ReadASCII(4) != "RTBL")
{
s.Position = start;
return false;
}
rtblLength = int2.Swap(s.ReadUInt32());
rtblOffset = rpalOffset + rpalLength + 8;
if (s.Length < rtblOffset + rtblLength)
{
s.Position = start;
return false;
}
numTiles = ssetLength / TileSize;
if (rtblLength < numTiles)
{
s.Position = start;
return false;
}
s.Position = start;
return true;
}