本文整理汇总了C#中WriteCallback类的典型用法代码示例。如果您正苦于以下问题:C# WriteCallback类的具体用法?C# WriteCallback怎么用?C# WriteCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WriteCallback类属于命名空间,在下文中一共展示了WriteCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendFileOperation
public SendFileOperation(string filename, WriteCallback callback)
{
this.filename = filename;
this.callback = callback;
Length = -1;
}
示例2: SendFileOperation
public SendFileOperation(string filename, WriteCallback callback)
{
this.file = new FileStream (file_name, FileMode.Open, FileAccess.Read)
this.callback = callback;
file_length = (int) file.Length;
ReadFile ();
}
示例3: SendFileOperation
public SendFileOperation(string filename, long size, WriteCallback callback)
{
this.filename = filename;
this.callback = callback;
// TODO: async. Don't think there is a good reason to do any locking here.
file_length = file.Length;
}
示例4: WriteFileOperation
public WriteFileOperation(FileStream file, WriteCallback callback)
{
this.file = file;
this.callback = callback;
file_length = (int) file.Length;
ReadFile ();
}
示例5: SendFileOperation
public SendFileOperation(FileStream file, WriteCallback callback)
{
this.file = file;
this.callback = callback;
// TODO: async. Don't think there is a good reason to do any locking here.
file_length = file.Length;
}
示例6: WriteBuffer
/// <summary>Initializes a new instance of the <see cref="WriteBuffer"/> class.</summary>
/// <param name="write">The method that is called when the buffer needs to be emptied.</param>
/// <param name="bufferSize">The size of the buffer in bytes.</param>
/// <exception cref="ArgumentNullException"><paramref name="write"/> equals <c>null</c>.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="bufferSize"/> is 0 or negative.</exception>
public WriteBuffer(WriteCallback write, int bufferSize)
: base(bufferSize)
{
if (write == null)
{
throw new ArgumentNullException(nameof(write));
}
this.write = write;
this.writeAsync = (b, o, c, t) => ThrowInvalidAsyncOperationException();
}
示例7: WriteLineHelper
internal WriteLineHelper(bool lineWrap, WriteCallback wlc, WriteCallback wc, DisplayCells displayCells)
{
if (wlc == null)
{
throw PSTraceSource.NewArgumentNullException("wlc");
}
if (displayCells == null)
{
throw PSTraceSource.NewArgumentNullException("displayCells");
}
this._displayCells = displayCells;
this.writeLineCall = wlc;
this.writeCall = (wc != null) ? wc : wlc;
this.lineWrap = lineWrap;
}
示例8: FlacWriter
public FlacWriter(Stream output, int bitDepth, int channels, int sampleRate)
{
stream = output;
writer = new BinaryWriter(stream);
inputBitDepth = bitDepth;
inputChannels = channels;
inputSampleRate = sampleRate;
context = FLAC__stream_encoder_new();
if (context == IntPtr.Zero)
throw new ApplicationException("FLAC: Could not initialize stream encoder!");
Check(
FLAC__stream_encoder_set_channels(context, channels),
"set channels");
Check(
FLAC__stream_encoder_set_bits_per_sample(context, bitDepth),
"set bits per sample");
Check(
FLAC__stream_encoder_set_sample_rate(context, sampleRate),
"set sample rate");
Check(
FLAC__stream_encoder_set_compression_level(context, 5),
"set compression level");
//Check(
// FLAC__stream_encoder_set_blocksize(context, 8192),
// "set block size");
write = new WriteCallback(Write);
seek = new SeekCallback(Seek);
tell = new TellCallback(Tell);
if (FLAC__stream_encoder_init_stream(context,
write, seek, tell,
null, IntPtr.Zero) != 0)
throw new ApplicationException("FLAC: Could not open stream for writing!");
}
示例9: FlacReader
public FlacReader(string input, WavWriter output)
{
if (output == null)
throw new ArgumentNullException("WavWriter");
stream = File.OpenRead(input);
reader = new BinaryReader(stream);
writer = output;
context = FLAC__stream_decoder_new();
if (context == IntPtr.Zero)
throw new ApplicationException("FLAC: Could not initialize stream decoder!");
write = new WriteCallback(Write);
metadata = new MetadataCallback(Metadata);
error = new ErrorCallback(Error);
if (FLAC__stream_decoder_init_file(context,
input, write, metadata, error,
IntPtr.Zero) != 0)
throw new ApplicationException("FLAC: Could not open stream for reading!");
}
示例10: SendFinalChunk
public void SendFinalChunk(WriteCallback callback)
{
EnsureMetadata ();
if (!chunk_encode || final_chunk_sent)
return;
final_chunk_sent = true;
var bytes = new List<ByteBuffer> ();
WriteChunk (bytes, 0, true);
var write_bytes = new SendBytesOperation (bytes, callback);
QueueWriteOperation (write_bytes);
}
示例11: FLAC__stream_encoder_init_stream
static extern int FLAC__stream_encoder_init_stream(IntPtr context, WriteCallback write, SeekCallback seek, TellCallback tell, MetadataCallback metadata, IntPtr userData);
示例12: WriteOperation
public WriteOperation(int index, WriteCallback callback)
{
this.index = index;
this.callback = callback;
}
示例13: FinishWrite
private void FinishWrite()
{
WriteCallback callback = write_callback;
write_data = null;
write_callback = null;
callback ();
}
示例14: FinishSendFile
private void FinishSendFile()
{
WriteCallback callback = write_callback;
write_callback = null;
send_file.Close ();
send_file = null;
send_file_count = 0;
send_file_offset = 0;
callback ();
}
示例15: Write
public void Write(IList<ArraySegment<byte>> data, WriteCallback callback)
{
CheckCanWrite ();
write_data = data;
write_callback = callback;
EnableWriting ();
}