internal static NetFxToWinRtStreamAdapter Create(Stream stream) { if (stream == null) throw new ArgumentNullException(nameof(stream)); StreamReadOperationOptimization readOptimization = StreamReadOperationOptimization.AbstractStream; if (stream.CanRead) readOptimization = DetermineStreamReadOptimization(stream); NetFxToWinRtStreamAdapter adapter; if (stream.CanSeek) adapter = new RandomAccessStream(stream, readOptimization); else if (stream.CanRead && stream.CanWrite) adapter = new InputOutputStream(stream, readOptimization); else if (stream.CanRead) adapter = new InputStream(stream, readOptimization); else if (stream.CanWrite) adapter = new OutputStream(stream, readOptimization); else throw new ArgumentException(global::Windows.Storage.Streams.SR.Argument_NotSufficientCapabilitiesToConvertToWinRtStream); return adapter; }
public MainWindowViewModel() : base() { _stdOutStream = new InputOutputStream(); _programExecutor = new ProgramExecutor(_stdOutStream); ExecuteCommand = new DelegateCommand(DoExecute); Task.Factory.StartNew(OutputReader); }
public ProgramExecutor(InputOutputStream stdout) { _stdout = stdout; _scheduler = new Scheduler(); _interpreter = new Interpreter(_scheduler); _nativeResourceManager = new NativeResourceManager(); _nativeResourceManager.RegisterProvider <INativeFileProvider>(new DefaultFileProvider()); _nativeResourceManager.RegisterProvider <INativeStdioProvider>(new DefaultNativeStdioProvider(null, stdout)); _nativeResourceManager.RegisterBuiltins(_interpreter); _scheduler.SetInterpreter(_interpreter); }
public virtual void Dispose() { lock (this) { timer.Dispose(); Cancel(new TftpErrorPacket(0, "ITftpTransfer has been disposed.")); if (InputOutputStream != null) { InputOutputStream.Close(); InputOutputStream = null; } connection.Dispose(); } }
internal static NetFxToWinRtStreamAdapter Create(Stream stream) { if (stream == null) { throw new ArgumentNullException("stream"); } StreamReadOperationOptimization readOptimization = StreamReadOperationOptimization.AbstractStream; if (stream.CanRead) { readOptimization = DetermineStreamReadOptimization(stream); } NetFxToWinRtStreamAdapter adapter; if (stream.CanSeek) { adapter = new RandomAccessStream(stream, readOptimization); } else if (stream.CanRead && stream.CanWrite) { adapter = new InputOutputStream(stream, readOptimization); } else if (stream.CanRead) { adapter = new InputStream(stream, readOptimization); } else if (stream.CanWrite) { adapter = new OutputStream(stream, readOptimization); } else { throw new ArgumentException(SR.Argument_NotSufficientCapabilitiesToConvertToWinRtStream); } return(adapter); }
internal static NetFxToWinRtStreamAdapter Create(Stream stream) { if (stream == null) throw new ArgumentNullException("stream"); StreamReadOperationOptimization readOptimization = StreamReadOperationOptimization.AbstractStream; if (stream.CanRead) readOptimization = DetermineStreamReadOptimization(stream); NetFxToWinRtStreamAdapter adapter; if (stream.CanSeek) adapter = new RandomAccessStream(stream, readOptimization); else if (stream.CanRead && stream.CanWrite) adapter = new InputOutputStream(stream, readOptimization); else if (stream.CanRead) adapter = new InputStream(stream, readOptimization); else if (stream.CanWrite) adapter = new OutputStream(stream, readOptimization); else throw new ArgumentException(SR.Argument_NotSufficientCapabilitiesToConvertToWinRtStream); return adapter; }