public PairContentWriter(IContentWriter keyContentWriter, IContentWriter valueContentWriter, IXmlAttributeInterpreter xmlAttributeInterpreter) { this.keyContentWriter = keyContentWriter; this.valueContentWriter = valueContentWriter; keyNodeInfo = xmlAttributeInterpreter.GetPropertyNodeInfo(typeof(DictionaryKeyValuePair).GetProperty("Key")); valueNodeInfo = xmlAttributeInterpreter.GetPropertyNodeInfo(typeof(DictionaryKeyValuePair).GetProperty("Value")); }
public ProcessorInstance(ProcessorType type) { Type = type; Instance = type.CreateInstance(); WriterInstance = type.CreateWriterInstance(); LoaderHash = StringHash(LoaderName); }
public AssetWriter(IAssetContentCache cache, IContentWriter writer, IETagGenerator <IEnumerable <AssetFile> > eTagGenerator) { _cache = cache; _writer = writer; _eTagGenerator = eTagGenerator; }
public AssetWriter(IAssetContentCache cache, IContentWriter writer, IETagGenerator <IEnumerable <AssetFile> > eTagGenerator, IOutputWriter output, IAssetCacheHeaders cachingHeaders) { _cache = cache; _writer = writer; _eTagGenerator = eTagGenerator; _output = output; _cachingHeaders = cachingHeaders; }
public AssetWriter(IAssetContentCache cache, IContentWriter writer, IETagGenerator<IEnumerable<AssetFile>> eTagGenerator, IOutputWriter output, IAssetCacheHeaders cachingHeaders) { _cache = cache; _writer = writer; _eTagGenerator = eTagGenerator; _output = output; _cachingHeaders = cachingHeaders; }
public ClipBoardContentWriter(IContentWriter contentWriter) { if (contentWriter is ClipBoardContentWriter) { throw new System.ArgumentException("参数类型错误"); } _contentWriter = contentWriter; }
public BattleshipsGame(IGameBoardVisualizer boardVisualizer, IInputReader inputReader, IContentWriter writer, IInputValidator validator) { _boardVisualizer = boardVisualizer; _inputReader = inputReader; _writer = writer; _validator = validator; }
public void SetUp() { _boardVisualizer = new Mock <IGameBoardVisualizer>().Object; _writer = new Mock <IContentWriter>().Object; _inputValidatorMock = new Mock <IInputValidator>(); _inputReaderMock = new Mock <IInputReader>(); _inputReaderMock.Setup(r => r.ReadInput()).Returns(USER_INPUT); _gameBoardMock = new Mock <IGameBoard>(); _gameBoardMock.Setup(b => b.GetCurrentBoardState()).Returns(new BoardFields()); }
public ContentNegotiator(IContentAccepts accepts, IContentWriter writer, INamingConventionSwitcher namingConventionSwitcher) { _accepts = accepts; _writer = writer; _jsonSerializerSettings = new JsonSerializerSettings { ContractResolver = new NameSwitcherContractResolver(namingConventionSwitcher), //Converters = { new RestItemDataJsonConverter(namingConventionSwitcher) } }; }
/// <summary> /// Gets the content writer for the item at the specified path. /// </summary> /// <param name="providerInstance"> /// The provider instance to use. /// </param> /// <param name="path"> /// The path to the item if it was specified on the command line. /// </param> /// <param name="context"> /// The context which the core command is running. /// </param> /// <exception cref="NotSupportedException"> /// If the <paramref name="providerInstance"/> does not support this operation. /// </exception> /// <exception cref="PipelineStoppedException"> /// If the pipeline is being stopped while executing the command. /// </exception> /// <exception cref="ProviderInvocationException"> /// If the provider threw an exception. /// </exception> private IContentWriter GetContentWriterPrivate( CmdletProvider providerInstance, string path, CmdletProviderContext context) { // All parameters should have been validated by caller Dbg.Diagnostics.Assert( providerInstance != null, "Caller should validate providerInstance before calling this method"); Dbg.Diagnostics.Assert( path != null, "Caller should validate path before calling this method"); Dbg.Diagnostics.Assert( context != null, "Caller should validate context before calling this method"); IContentWriter result = null; try { result = providerInstance.GetContentWriter(path, context); } catch (NotSupportedException) { throw; } catch (LoopFlowException) { throw; } catch (PipelineStoppedException) { throw; } catch (ActionPreferenceStopException) { throw; } catch (Exception e) // Catch-all OK, 3rd party callout. { throw NewProviderInvocationException( "GetContentWriterProviderException", SessionStateStrings.GetContentWriterProviderException, providerInstance.ProviderInfo, path, e); } return(result); }
protected override void ProcessRecord() { foreach (string path in Path) { using (IContentWriter writer = InvokeProvider.Content.GetWriter(path).Single()) { IList items = writer.Write(Value); // Need to close writer before disposing it otherwise Microsoft's // FileSystemProvider throws an exception. writer.Close(); } } }
public override async Task WriteResponseBodyAsync(OutputFormatterWriteContext context) { HttpResponse response = context.HttpContext.Response; IContentWriter writer = _writers[response.ContentType]; (bool success, byte[] data) = await writer.Write(context.Object); if (success && data != null) { await response.Body.WriteAsync(data, 0, data.Length); } }
internal ContentHolder(PathInfo pathInfo, IContentReader reader, IContentWriter writer) { if (pathInfo != null) { this._pathInfo = pathInfo; this._reader = reader; this._writer = writer; return; } else { throw PSTraceSource.NewArgumentNullException("pathInfo"); } }
internal ContentHolder( PathInfo pathInfo, IContentReader reader, IContentWriter writer) { if (pathInfo == null) { throw PSTraceSource.NewArgumentNullException("pathInfo"); } PathInfo = pathInfo; Reader = reader; Writer = writer; }
public GzipProcessor( IFileService fileService, ILogger logger, IContentReader reader, IContentWriter writer, IChunkProcessor processor, Settings settings) { _fileService = fileService; _logger = logger; _reader = reader; _writer = writer; _processor = processor; _settings = settings; }
public FormOneline(ContentWriterFactory contentWriterFactory , OnelineApp app , IContentSource contentSource) { InitializeComponent(); _contentWriterFactory = contentWriterFactory; _textBoxContentWriter = _contentWriterFactory.Create(ContentWriterType.TextBox, txtContent); _clipBoardContentWriter = _contentWriterFactory.Create(ContentWriterType.ClipBoard, txtContent); _app = app; _contentSource = contentSource; _app.ContentWriter = _textBoxContentWriter; _timerForAuto.Enabled = false; _timerForAuto.Tick += TimerForAuto_AutoGetContent; _timerForAuto.Tick += TimerForAuto_Transform; }
public void TestGetContentWriter() { FileSystemProvider fileSystemProvider = new FileSystemProvider(); ProviderInfo providerInfoToSet = GetProvider(); fileSystemProvider.SetProviderInformation(providerInfoToSet); fileSystemProvider.Context = new CmdletProviderContext(GetExecutionContext()); IContentWriter contentWriter = fileSystemProvider.GetContentWriter(testPath); contentWriter.Write(new List <string>() { "contentWriterTestContent" }); contentWriter.Close(); Assert.Equal(File.ReadAllText(testPath), testContent + @"contentWriterTestContent" + System.Environment.NewLine); }
} // GetContentWriter /// <summary> /// Gets the content writer for the specified item. /// </summary> /// <param name="paths"> /// The path(s) to the item(s) to get the content writer from. /// </param> /// <param name="context"> /// The context which the core command is running. /// </param> /// <returns> /// The content writers for all items that the path resolves to. /// </returns> /// <exception cref="ArgumentNullException"> /// If <paramref name="path"/> is null. /// </exception> /// <exception cref="ProviderNotFoundException"> /// If the <paramref name="path"/> refers to a provider that could not be found. /// </exception> /// <exception cref="DriveNotFoundException"> /// If the <paramref name="path"/> refers to a drive that could not be found. /// </exception> /// <exception cref="NotSupportedException"> /// If the provider that the <paramref name="path"/> refers to does /// not support this operation. /// </exception> /// <exception cref="ProviderInvocationException"> /// If the provider threw an exception. /// </exception> /// <exception cref="ItemNotFoundException"> /// If <paramref name="path"/> does not contain glob characters and /// could not be found. /// </exception> internal Collection <IContentWriter> GetContentWriter( string[] paths, CmdletProviderContext context) { if (paths == null) { throw PSTraceSource.NewArgumentNullException("paths"); } ProviderInfo provider = null; CmdletProvider providerInstance = null; Collection <IContentWriter> results = new Collection <IContentWriter>(); foreach (string path in paths) { if (path == null) { throw PSTraceSource.NewArgumentNullException("paths"); } Collection <string> providerPaths = Globber.GetGlobbedProviderPathsFromMonadPath( path, true, context, out provider, out providerInstance); foreach (string providerPath in providerPaths) { IContentWriter result = GetContentWriterPrivate(providerInstance, providerPath, context); if (result != null) { results.Add(result); } } } return(results); } // GetContentWriter
public IContentWriter Create(ContentWriterType writerType, TextBox textBox = null) { IContentWriter contentWriter = null; switch (writerType) { default: case ContentWriterType.TextBox: if (textBox == null) { throw new ArgumentNullException(nameof(TextBox)); } contentWriter = new TextBoxContentWriter(textBox); break; case ContentWriterType.ClipBoard: contentWriter = new ClipBoardContentWriter(new TextBoxContentWriter(textBox)); break; } return(contentWriter); }
public ItemValueWriter(XmlElementInfo itemNodeInfo, IContentWriter contentWriter) { this.itemNodeInfo = itemNodeInfo; this.contentWriter = contentWriter; }
internal ContentHolder( PathInfo pathInfo, IContentReader reader, IContentWriter writer) { if (pathInfo == null) { throw PSTraceSource.NewArgumentNullException("pathInfo"); } PathInfo = pathInfo; Reader = reader; Writer = writer; } // constructor
public void SetWorker(IContentWriter writer) { worker = writer; }
public ProjectResourceUpdate WithContent(IContentWriter content) { DeferredContent = content; return(this); }
public ContentController(IContentReader contentReader, IContentWriter contentWriter) { _contentReader = contentReader; _contentWriter = contentWriter; }
/// <summary> /// Registers the specified content writer. /// </summary> /// <param name="writer">Writer to register.</param> public void RegisterContentWriter(IContentWriter writer) { _readerWriter.AddWriter(writer); Trace.TraceInformation("Added content writer \"{0}\" for content type [{1}]", writer.GetType().Name, writer.ContentType); }
public AssetHttpHandler(IContentWriter writer, IEnumerable<string> routeValues) { _writer = writer; _routeValues = routeValues; }
public AttributeValueWriter(XmlElementInfo xmlElementInfo, IContentWriter contentWriter) { this.xmlElementInfo = xmlElementInfo; this.contentWriter = contentWriter; }
public void AddWriter(IContentWriter writer) { this.writers.Add(writer.ContentType, writer); }
public DictionaryValueWriter(XmlElementInfo xmlElementInfo, IContentWriter keyWriter, IContentWriter valueWriter, IXmlAttributeInterpreter xmlAttributeInterpreter) { itemContentWriter = new PairContentWriter(keyWriter, valueWriter, xmlAttributeInterpreter); arrayValueWriter = new ArrayValueWriter(xmlElementInfo, itemContentWriter); }
public ArrayValueWriter(XmlElementInfo xmlElementInfo, IContentWriter itemContentWriter) { this.xmlElementInfo = xmlElementInfo; this.itemContentWriter = itemContentWriter; }
public ListValueWriter(XmlElementInfo xmlElementInfo, IContentWriter itemContentWriter) { arrayValueWriter = new ArrayValueWriter(xmlElementInfo, itemContentWriter); }