本文整理汇总了C#中BitStream.WriteFlush方法的典型用法代码示例。如果您正苦于以下问题:C# BitStream.WriteFlush方法的具体用法?C# BitStream.WriteFlush怎么用?C# BitStream.WriteFlush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitStream
的用法示例。
在下文中一共展示了BitStream.WriteFlush方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write
/// <summary>
///
/// </summary>
/// <param name="output"></param>
public override void Write( Stream output )
{
BinaryWriter bw = new BinaryWriter( output );
bw.Write( ( byte )_FilterType );
bw.Write( ( byte )_GradientColors.Count );
for ( int i = 0; i < _GradientColors.Count; i++ )
{
_GradientColors[ i ].Write( output );
}
for ( int i = 0; i < _GradientRatio.Count; i++ )
{
bw.Write( _GradientRatio[ i ] );
}
bw.Write( _BlurX );
bw.Write( _BlurY );
bw.Write( _Angle );
bw.Write( _Distance );
bw.Write( _Strength );
BitStream bits = new BitStream( output );
bits.WriteBits( 1, ( _InnerShadow ? 1 : 0 ) );
bits.WriteBits( 1, ( _KnockOut ? 1 : 0 ) );
bits.WriteBits( 1, ( _CompositeSource ? 1 : 0 ) );
bits.WriteBits( 1, ( _OnTop ? 1 : 0 ) );
bits.WriteBits( 4, _Passes );
bits.WriteFlush();
}
示例2: Write
/// <summary>
///
/// </summary>
/// <param name="output"></param>
public override void Write( Stream output )
{
BinaryWriter bw = new BinaryWriter( output );
bw.Write( ( byte )_FilterType );
bw.Write( _MatrixX );
bw.Write( _MatrixY );
bw.Write( _DivisorFLOAT );
bw.Write( _BiasFLOAT );
if ( _MatrixValues.Count != ( _MatrixX * _MatrixY ) )
{
IndexOutOfRangeException e = new IndexOutOfRangeException( "_MatrixValues does not have " + (_MatrixX*_MatrixY).ToString("d") + " entries, does have " + _MatrixValues.Count.ToString( "d" ) );
throw e;
}
for ( int i = 0; i < _MatrixValues.Count; i++ )
{
bw.Write( _MatrixValues[ i ] );
}
_DefaultColor.Write( output );
BitStream bits = new BitStream( output );
bits.WriteBits( 6, 0 );
bits.WriteBits( 1, ( _Clamp ? 1 : 0 ) );
bits.WriteBits( 1, ( _PreserveAlpha ? 1 : 0 ) );
bits.WriteFlush();
}
示例3: Write
/// <summary>
/// Writes this object back to a stream
/// </summary>
/// <param name="output">The stream to write to.</param>
public void Write(Stream output)
{
log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
BitStream bits = new BitStream(output);
bits.WriteBits(17, (Int32)this._pictureStartCode);
bits.WriteBits(5, (Int32)this._version);
bits.WriteBits(8, (Int32)this._temporalReference);
bits.WriteBits(3, (Int32)this._pictureSize);
if (this._pictureSize.Equals(0))
{
bits.WriteBits(8, (Int32)this._customWidth);
bits.WriteBits(8, (Int32)this._customHeight);
}
else if (this._pictureSize.Equals(1))
{
bits.WriteBits(16, (Int32)this._customWidth);
bits.WriteBits(16, (Int32)this._customHeight);
}
else
{
SwfFormatException e = new SwfFormatException("Not supported picture size.");
log.Error(e.Message);
throw e;
}
bits.WriteBits(2, (Int32)this._pictureType);
bits.WriteBits(1, Convert.ToInt32(this._deblockingFlag));
bits.WriteBits(5, (Int32)this._quantizer);
bits.WriteBits(1, Convert.ToInt32(this._extraInformationFlag));
bits.WriteFlush();
if (this._extraInformationFlag)
{
for (int i = 0; i < this._extraInformation.Count; i++)
{
output.WriteByte(this._extraInformation[i]);
}
}
this._macroBlock.Write(output);
// this._pictureStuffing.Write(output);
}
示例4: Render
/// <summary>
/// Renders the DefineFuntion parameters back to a output stream
/// </summary>
/// <param name="outputStream">The outputstream</param>
/// <returns>The output stream position</returns>
protected override ulong Render( BinaryWriter outputStream )
{
long pos = outputStream.BaseStream.Position;
Helper.SwfStrings.SwfWriteString( this.Version, outputStream, _functionName );
_numParams = ( ushort )_Parameters.Count;
outputStream.Write( _numParams );
outputStream.Write( _numRegister );
BitStream bits = new BitStream( outputStream.BaseStream );
bits.WriteBits( 1, ( _PreloadParentFlag ? 1 : 0 ) );
bits.WriteBits( 1, ( _PreloadRootFlag ? 1 : 0 ) );
bits.WriteBits( 1, ( _SuppressSuperFlag ? 1 : 0 ) );
bits.WriteBits( 1, ( _PreloadSuperFlag ? 1 : 0 ) );
bits.WriteBits( 1, ( _SuppressArgumentsFlag ? 1 : 0 ) );
bits.WriteBits( 1, ( _PreloadArgumentsFlag ? 1 : 0 ) );
bits.WriteBits( 1, ( _SuppressThisFlag ? 1 : 0 ) );
bits.WriteBits( 1, ( _PreloadThisFlag ? 1 : 0 ) );
bits.WriteBits( 7, 0 );
bits.WriteBits( 1, ( _PreloadGlobalFlag ? 1 : 0 ) );
bits.WriteFlush();
for ( int i = 0; i < _Parameters.Count; i++ )
{
outputStream.Write( _Parameters[ i ].Register );
Helper.SwfStrings.SwfWriteString( this.Version, outputStream, _Parameters[ i ].ParamName );
}
outputStream.Write( _codeSize );
return ( ulong )( outputStream.BaseStream.Position - pos );
}
示例5: Write
/// <summary>
///
/// </summary>
/// <param name="output"></param>
public override void Write(Stream output)
{
this.WriteTagHeader(output);
BinaryWriter bw = new BinaryWriter(output);
bw.Write(this._fontID);
bw.Write(this._fontNameLen);
bw.Write(this._fontName);
BitStream bits = new BitStream(output);
bits.WriteBits(2, 0); // reserved bits
bits.WriteBits(1, Convert.ToInt32(this._fontFlagsSmallText));
bits.WriteBits(1, Convert.ToInt32(this._fontFlagsShiftJIS));
bits.WriteBits(1, Convert.ToInt32(this._fontFlagsANSI));
bits.WriteBits(1, Convert.ToInt32(this._fontFlagsItalic));
bits.WriteBits(1, Convert.ToInt32(this._fontFlagsBold));
bits.WriteBits(1, Convert.ToInt32(this._fontFlagsWideCodes));
bits.WriteFlush();
if (this._fontFlagsWideCodes)
{
for (int i = 0; i < this._wideCodeTable.Length; i++)
{
bw.Write(this._wideCodeTable[i]);
}
}
else
{
for (int i = 0; i < this._codeTable.Length; i++)
{
bw.Write(this._codeTable[i]);
}
}
}
示例6: Write
/// <summary>
///
/// </summary>
/// <param name="output"></param>
public override void Write(Stream output)
{
this.WriteTagHeader(output);
long pos = output.Position;
BitStream bits = new BitStream(output);
bits.WriteBits(1, (_PlaceFlagHasClipActions ? 1 : 0));
bits.WriteBits(1, (_PlaceFlagHasClipDepth ? 1 : 0));
bits.WriteBits(1, (_PlaceFlagHasName ? 1 : 0));
bits.WriteBits(1, (_PlaceFlagHasRatio ? 1 : 0));
bits.WriteBits(1, (_PlaceFlagHasColorTransform ? 1 : 0));
bits.WriteBits(1, (_PlaceFlagHasMatrix ? 1 : 0));
bits.WriteBits(1, (_PlaceFlagHasCharacter ? 1 : 0));
bits.WriteBits(1, (_PlaceFlagMove ? 1 : 0));
bits.WriteFlush();
BinaryWriter bw = new BinaryWriter(output);
bw.Write(_Depth);
if (_PlaceFlagHasCharacter)
bw.Write(_CharacterID);
if (_PlaceFlagHasMatrix)
base._TransformMatrix.Write(output);
if (_PlaceFlagHasColorTransform)
_CxFormWithAlpha.Write(output);
if (_PlaceFlagHasRatio)
bw.Write(_Ratio);
if (_PlaceFlagHasName)
Helper.SwfStrings.SwfWriteString(this.Version, bw, _Name);
if (_PlaceFlagHasClipDepth)
bw.Write(_ClipDepth);
if (this.Version >= 5)
{
if (_PlaceFlagHasClipActions)
_ClipActions.Write(output);
}
}
示例7: Render
//
// We have to do the rendering inside this class, as we are not
// inhereting from AbstractTagCodeHandler
//
private MemoryStream Render( byte version )
{
MemoryStream ms = new MemoryStream();
BinaryWriter bw = new BinaryWriter( ms );
bw.Write( this._buttonID );
BitStream bits = new BitStream( ms );
// reserved Bits and flags
bits.WriteBits( 7, 0 );
bits.WriteBits( 1, ( this._trackAsMenu ? 1 : 0 ) );
bits.WriteFlush();
if ( 0 == this._actions.Count )
{
//
// resetting this value. It could be that we used to have
// actions in this button but they got nuked when an exception
// was raised during their parsing.
//
this._actionOffset = 0;
}
else
{
int charactersSum = 0;
for ( int i = 0; i < this._characters.Count; i++ )
{
charactersSum += ( int )_characters[ i ].Length;
}
charactersSum++; // EndCharacter
this._actionOffset = ( ushort )charactersSum;
this._actionOffset += sizeof( ushort ); // The ActionOffset field itself
}
bw.Write( this._actionOffset );
for ( int i = 0; i < this._characters.Count; i++ )
{
this._characters[ i ].Write( ms, version );
}
bw.Write( ( byte )0x00 ); // EndCharacter
for ( int i = 0; i < this._actions.Count; i++ )
{
this._actions[ i ].Write( ms, version, ( ( i + 1 ) == this._actions.Count ? true : false ) );
}
return ms;
}
示例8: Write
/// <summary>
/// Writes this object back to a stream
/// </summary>
/// <param name="output">The stream to write to.</param>
public override void Write(Stream output)
{
BinaryWriter bw = new BinaryWriter(output);
this.WriteTagHeader(output);
bw.Write(this._textID);
BitStream bits = new BitStream(output);
bits.WriteBits(2, (Int32)this._useFlashType);
bits.WriteBits(3, (Int32)this._gridFit);
bits.WriteBits(3, 0); // reserved
bits.WriteFlush();
bits.WriteBitsFB(32, this._thickness);
bits.WriteBitsFB(32, this._sharpness);
output.WriteByte(0); // reserved byte
}
示例9: Render
/// <summary>
/// Renders a try statement back to an output stream
/// </summary>
/// <param name="outputStream">The output stream</param>
/// <returns>The output stream position</returns>
protected override ulong Render( System.IO.BinaryWriter outputStream )
{
long pos = outputStream.BaseStream.Position;
BitStream bits = new BitStream( outputStream.BaseStream );
bits.WriteBits( 5, 0 );
bits.WriteBits( 1, ( _CatchInRegisterFlag ? 1 : 0 ) );
bits.WriteBits( 1, ( _FinallyBlockFlag ? 1 : 0 ) );
bits.WriteBits( 1, ( _CatchBlockFlag ? 1 : 0 ) );
bits.WriteFlush();
outputStream.Write( _trySize );
outputStream.Write( _catchSize );
outputStream.Write( _finallySize );
if ( _CatchInRegisterFlag )
{
outputStream.Write( _catchRegister );
}
else
{
Helper.SwfStrings.SwfWriteString( this.Version, outputStream, _catchName );
}
return ( ulong )( outputStream.BaseStream.Position - pos );
}
示例10: Render
/// <summary>
/// Writes the method and the flags back to an outputstream
/// </summary>
/// <param name="outputStream">The output stream</param>
/// <returns>One(1)</returns>
protected override ulong Render( System.IO.BinaryWriter outputStream )
{
BitStream bits = new BitStream( outputStream.BaseStream );
bits.WriteBits( 2, ( int )( ( byte )_sendVarsMethod ) );
bits.WriteBits( 4, 0 );
bits.WriteBits( 1, ( _loadTargetFlag ? 1 : 0 ) );
bits.WriteBits( 1, ( _loadVariablesFlag ? 1 : 0 ) );
bits.WriteFlush();
return 1;
}
示例11: Write
/// <summary>
///
/// </summary>
/// <param name="output"></param>
public override void Write( Stream output )
{
BinaryWriter bw = new BinaryWriter( output );
bw.Write( ( byte )_FilterType );
_GlowColor.Write( output );
bw.Write( _BlurX );
bw.Write( _BlurY );
bw.Write( _Strength );
BitStream bits = new BitStream( output );
bits.WriteBits( 1, ( _InnerGlow ? 1 : 0 ) );
bits.WriteBits( 1, ( _KnockOut ? 1 : 0 ) );
bits.WriteBits( 1, ( _CompositeSource ? 1 : 0 ) );
bits.WriteBits( 5, _Passes );
bits.WriteFlush();
}
示例12: WriteFlags
/// <summary>
///
/// </summary>
/// <param name="output"></param>
protected virtual void WriteFlags(Stream output)
{
BinaryWriter bw = new BinaryWriter(output);
BitStream bits = new BitStream(output);
bw.Write(this._fontID);
bits.WriteBits(1, this._fontFlagsHasLayout ? 1 : 0);
bits.WriteBits(1, this._fontFlagsShiftJIS ? 1 : 0);
bits.WriteBits(1, this._fontFlagsSmallText ? 1 : 0);
bits.WriteBits(1, this._fontFlagsANSI ? 1 : 0);
bits.WriteBits(1, this._fontFlagsWideOffsets ? 1 : 0);
bits.WriteBits(1, this._fontFlagsWideCodes ? 1 : 0);
bits.WriteBits(1, this._fontFlagsItalic ? 1 : 0);
bits.WriteBits(1, this._fontFlagsBold ? 1 : 0);
bits.WriteFlush();
if (this._SwfVersion <= 5)
{
bw.Write((byte)0);
}
else
{
bw.Write((byte)this._languageCode);
}
bw.Write(this._fontNameLen);
output.Write(this._fontName, 0, this._fontName.Length);
bw.Write(this._numberOfGlyphs);
if (this._hasGlyphs)
{
if (this._fontFlagsWideOffsets)
{
for (int i = 0; i < this._wideOffsetTable.Length; i++)
{
bw.Write(this._wideOffsetTable[i]);
}
bw.Write(this._wideCodeTableOffset);
}
else
{
for (int i = 0; i < this._offsetTable.Length; i++)
{
bw.Write(this._offsetTable[i]);
}
bw.Write(this._codeTableOffset);
}
for (int i = 0; i < this._glyphShapeTable.Length; i++)
{
this._glyphShapeTable[i].Write(output);
}
}
}
示例13: Write
/// <summary>
///
/// </summary>
/// <param name="output"></param>
public override void Write(Stream output)
{
//Log.Debug(this, "Writing DefineSound Tag");
WriteTagHeader(output);
byte[] id = BitConverter.GetBytes(this._soundID);
output.Write(id, 0, 2);
output.Flush();
BitStream bits = new BitStream(output);
bits.WriteBits(4, getFormatID(this._soundFormat));
bits.WriteBits(2, getSoundRateID(this._soundRate));
bits.WriteBits(1, this._soundSize == SoundSize.snd_8bit ?0 :1);
bits.WriteBits(1, this._soundType == SoundType.mono ?0 :1);
bits.WriteFlush();
byte[] size = BitConverter.GetBytes(this._soundSampleCount);
output.Write(size, 0, 4);
output.Write(this._soundData, 0, this._soundData.Length);
output.Flush();
}
示例14: Write
/// <summary>
///
/// </summary>
/// <param name="output"></param>
public override void Write(Stream output)
{
this.WriteTagHeader(output);
BinaryWriter bw = new BinaryWriter(output);
bw.Write(_fontID);
BitStream bits = new BitStream(output);
bits.WriteBits(2, (Int32)this._CSMTableHint);
bits.WriteBits(6, 0);
bits.WriteFlush();
try
{
for (int i = 0; i < this._ZoneTable.Length; i++)
{
this._ZoneTable[i].Write(output);
}
}
catch(Exception ex)
{
Log.Warn(this,ex.Message);
}
}
示例15: Write
/// <summary>
///
/// </summary>
/// <param name="output"></param>
public override void Write( Stream output )
{
BinaryWriter bw = new BinaryWriter( output );
bw.Write( ( byte )_FilterType );
_ShadowColor.Write( output );
_HighlightColor.Write( output );
bw.Write( _BlurX );
bw.Write( _BlurY );
bw.Write( _Angle );
bw.Write( _Distance );
bw.Write( _Strength );
BitStream bits = new BitStream( output );
bits.WriteBits( 1, ( _InnerShadow ? 1 : 0 ) );
bits.WriteBits( 1, ( _KnockOut ? 1 : 0 ) );
bits.WriteBits( 1, ( _CompositeSource ? 1 : 0 ) );
bits.WriteBits( 1, ( _OnTop ? 1 : 0 ) );
bits.WriteBits( 4, _Passes );
bits.WriteFlush();
}