本文整理汇总了C#中BitStream.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# BitStream.Reset方法的具体用法?C# BitStream.Reset怎么用?C# BitStream.Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitStream
的用法示例。
在下文中一共展示了BitStream.Reset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
/// <summary>
/// Parses this object out of a stream
/// </summary>
protected override void Parse()
{
BinaryReader br = new BinaryReader(this._dataStream);
this._fontID = br.ReadUInt16();
BitStream bits = new BitStream(this._dataStream);
bits.GetBits(5); //reserved
this._fontFlagsHasFontData = ((0 != bits.GetBits(1)) ? true : false);
this._fontFlagsItalic = ((0 != bits.GetBits(1)) ? true : false);
this._fontFlagsBold = ((0 != bits.GetBits(1)) ? true : false);
this._fontName = SwfStrings.SwfString(this._SwfVersion, br);
bits.Reset();
this._restOfTheRecord = new Byte[this._dataStream.Length - this._dataStream.Position];
this._dataStream.Read(this._restOfTheRecord, 0, this._restOfTheRecord.Length);
// another funny statement "FontData : When present, this is an OpenType"
// Kräht der Gockel auf dem Mist ändert sich das Wetter oder es bleibt wie es ist. XD
//if (!this._dataStream.Position.Equals(this._dataStream.Length))// if something is present ^^
//{
// this._fontData.Parse(this._dataStream);
//}
}
示例2: Parse
/// <summary>
/// Parses this object out of a stream
/// </summary>
public void Parse(Stream input)
{
log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
BitStream bits = new BitStream(input);
this._pictureStartCode = bits.GetBits(17);
this._version = (byte)bits.GetBits(5);
this._temporalReference = (byte)bits.GetBits(8);
this._pictureSize = (byte)bits.GetBits(3);
if (this._pictureSize.Equals(0))
{
this._customWidth = (UInt16)bits.GetBits(8);
this._customHeight = (UInt16)bits.GetBits(8);
}
else if (this._pictureSize.Equals(1))
{
this._customWidth = (UInt16)bits.GetBits(16);
this._customHeight = (UInt16)bits.GetBits(16);
}
else
{
SwfFormatException e = new SwfFormatException("Not supported picture size.");
log.Error(e.Message);
throw e;
}
this._pictureType = (byte)bits.GetBits(2);
this._deblockingFlag = Convert.ToBoolean(bits.GetBits(1));
this._quantizer = (byte)bits.GetBits(5);
this._extraInformationFlag = Convert.ToBoolean(bits.GetBits(1));
bits.Reset();
BinaryReader br = new BinaryReader(input);
byte tempByte = 0;
if (this._extraInformationFlag)
{
this._extraInformation = new List<byte>();
while (0 != (tempByte = br.ReadByte()))
{
this._extraInformation.Add(tempByte);
}
}
this._extraInformation.Add(0);
this._macroBlock = new MacroBlock(this._SwfVersion);
this._macroBlock.Parse(input);
//this._pictureStuffing.Parse(input);
}
示例3: ParseFlags
/// <summary>
/// Parses the flags of this object out of a stream.
/// </summary>
/// <param name="br">The BinaryReader</param>
/// <param name="bs">The Bitstream</param>
private void ParseFlags(BinaryReader br, BitStream bs)
{
this._PlaceFlagHasClipActions = 0 != bs.GetBits(1) ? true : false;
this._PlaceFlagHasClipDepth = 0 != bs.GetBits(1) ? true : false;
this._PlaceFlagHasName = 0 != bs.GetBits(1) ? true : false;
this._PlaceFlagHasRatio = 0 != bs.GetBits(1) ? true : false;
this._PlaceFlagHasColorTransform = 0 != bs.GetBits(1) ? true : false;
this._PlaceFlagHasMatrix = 0 != bs.GetBits(1) ? true : false;
this._PlaceFlagHasCharacter = 0 != bs.GetBits(1) ? true : false;
this._PlaceFlagMove = 0 != bs.GetBits(1) ? true : false;
bs.GetBits(3); // Reserved
this._PlaceFlagHasImage = 0 != bs.GetBits(1) ? true : false;
this._PlaceFlagHasClassName = 0 != bs.GetBits(1) ? true : false;
this._PlaceFlagHasCacheAsBitmap = 0 != bs.GetBits(1) ? true : false;
this._PlaceFlagHasBlendMode = 0 != bs.GetBits(1) ? true : false;
this._PlaceFlagHasFilterList = 0 != bs.GetBits(1) ? true : false;
bs.Reset();
if (!(_PlaceFlagMove || _PlaceFlagHasCharacter))
{
SwfFormatException e = new SwfFormatException("Object is neither a creation (PlaceFlagHasCharacter) nor an update (PlaceFlagMove).");
Log.Error(this, e.Message);
throw e;
}
}