本文整理汇总了C#中IO.GetInputStream方法的典型用法代码示例。如果您正苦于以下问题:C# IO.GetInputStream方法的具体用法?C# IO.GetInputStream怎么用?C# IO.GetInputStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IO
的用法示例。
在下文中一共展示了IO.GetInputStream方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
/// <summary>
/// Seek the stream ahead however many bytes the size of this pad is
/// </summary>
/// <param name="ts"></param>
public override void Read(IO.ITagStream ts)
{
if (ts.Flags.Test(IO.ITagStreamFlags.Halo2OldFormat_UselessPadding))
ts.GetInputStream().Seek(Value, System.IO.SeekOrigin.Current);
}
示例2: Read
/// <summary>
/// Stream the field from a tag stream
/// </summary>
/// <param name="ts"></param>
/// <exception cref="Exceptions.InvalidStringId"></exception>
public override void Read(IO.ITagStream ts)
{
if (Handle.Set == -1) // HACK used to tell Read that we already read the string data (as this is an old halo 2 tag)
{
Handle = new Blam.StringId(Handle.Description, Handle.Index, Handle.Length, 0);
return;
}
if (!ts.Flags.Test(IO.ITagStreamFlags.DontStreamStringData)) // stream the string id value if we can
{
IO.EndianReader s = ts.GetInputStream();
relativeOffset = s.PositionUnsigned;
string value = null;
try
{
value = new string(s.ReadChars(Handle.Length));
if (Handle != Blam.StringId.Null)
Program.GetTagIndex(OwnerId).StringIds.TryAndGetStringId(value, out Handle);
}
catch (Exception ex)
{
throw new Exceptions.InvalidStringId(ex,
base.headerOffset, base.relativeOffset, ts,
Handle.Length, value);
}
}
}
示例3: Read
/// <summary>
/// Read the main body of this field from a tag stream
/// </summary>
/// <param name="ts"></param>
public virtual void Read(IO.ITagStream ts) { this.Read(ts.GetInputStream()); }
示例4: ReadHeader
/// <summary>
/// Stream the field header data from a tag stream
/// </summary>
/// <param name="ts"></param>
/// <exception cref="Exceptions.InvalidStringId"></exception>
public override void ReadHeader(IO.ITagStream ts)
{
IO.EndianReader s = ts.GetInputStream();
headerOffset = s.PositionUnsigned; // nifty for debugging
OwnerId = ts.OwnerId;
string value = null;
try
{
if (fieldType == FieldType.OldStringId && ts.Flags.Test(IO.ITagStreamFlags.Halo2OldFormat_StringId))
value = s.ReadAsciiString(28); // max of 28 characters in the string id in old builds
var owner = Program.GetTagIndex(OwnerId);
Handle.Read(s, owner.StringIds.Definition.Description);
if (value != null /*&& Handle != Blam.StringID.Null*/)
{
owner.StringIds.TryAndGetStringId(value, out Handle);
Handle = new Blam.StringId(Handle.Description, Handle.Index, Handle.Length,
-1); // HACK used to tell Read that we already read the string data (as this is an old halo 2 tag)
}
}
catch (Exception ex)
{
throw new Exceptions.InvalidStringId(ex,
base.headerOffset, uint.MaxValue,
ts, Handle.Length, value);
}
}
示例5: Read
public void Read(IO.ITagStream ts)
{
IO.EndianReader s = ts.GetInputStream();
ReadHeader(s, ts);
}