Пример #1
0
 public StubGenerator(ScenarioInterpreter scenarioInterpreter, ImplementationHelper implementationHelper, ITextWriter suggestionWriter, ISessionContext context)
 {
     _scenarioInterpreter = scenarioInterpreter;
     SuggestionWriter = suggestionWriter;
     _context = context;
     _implementationHelper = implementationHelper;
 }
Пример #2
0
 public StubGenerator(ScenarioInterpreter scenarioInterpreter, ImplementationHelper implementationHelper, ITextWriter suggestionWriter, IStoryContextFactory contextFactory)
 {
     _scenarioInterpreter = scenarioInterpreter;
     SuggestionWriter = suggestionWriter;
     _contextFactory = contextFactory;
     _implementationHelper = implementationHelper;
 }
Пример #3
0
 public StubGenerator(ScenarioInterpreter scenarioInterpreter, ImplementationHelper implementationHelper, ITextWriter suggestionWriter, ISessionContext context)
 {
     _scenarioInterpreter  = scenarioInterpreter;
     SuggestionWriter      = suggestionWriter;
     _context              = context;
     _implementationHelper = implementationHelper;
 }
Пример #4
0
 public static void PHPInclude(ITextWriter w, string[] Modules)
 {
     foreach (var v in Modules)
     {
         PHPInclude(w, v);
     }
 }
Пример #5
0
 public static void DefineScript(ITextWriter w, string[] Modules)
 {
     foreach (var v in Modules)
     {
         DefineScript(w, v);
     }
 }
Пример #6
0
        static void Main(string[] args)
        {
            //initialize the Unity IoC Container and Dependency Injection
            Bootstrap.Init();
            Initiator init = DependencyInjector.Retrieve <Initiator>();

            //Instantiate the apireader and console writer objects
            _reader = init.GetReader();
            _writer = init.GetWriter();
            _reader.SetClient(uriAddress);

            //attempt to read from the Web API
            try
            {
                //Write out to the console Message 1 and 2 from the API
                _writer.Write(_reader.GetMessage(1).Result);
                _writer.Write("<Press any key to exit>");
                Console.ReadLine();
                _writer.Write(_reader.GetMessage(2).Result);

                //pause for 1 second and exit
                System.Threading.Thread.Sleep(1000);
            }
            //If an error occurs, print out teh error message and exit.
            catch (Exception ex)
            {
                _writer.Write(ex.InnerException.Message);
                _writer.Write("Please ensure the target API application is running, and the server is accessable");
                _writer.Write("<Press any key to exit>");
                Console.ReadLine();
            }
        }
Пример #7
0
        private void printCor(ITextWriter writer, int start_clock, string header)
        {
            writer.writeLine(header);
            int  lastvalue = defaultValue;
            bool value_at_start_written = false;

            for (int i = 0; i < length; i++)
            {
                int key = clocks[i];
                if (start_clock == key)
                {
                    writer.writeLine(key + "=" + items[i].value);
                    value_at_start_written = true;
                }
                else if (start_clock < key)
                {
                    if (!value_at_start_written && lastvalue != defaultValue)
                    {
                        writer.writeLine(start_clock + "=" + lastvalue);
                        value_at_start_written = true;
                    }
                    int val = items[i].value;
                    writer.writeLine(key + "=" + val);
                }
                else
                {
                    lastvalue = items[i].value;
                }
            }
            if (!value_at_start_written && lastvalue != defaultValue)
            {
                writer.writeLine(start_clock + "=" + lastvalue);
            }
        }
Пример #8
0
 public JobQueueService(IJobQueueRepository jobQueueRepository, IProjectRepository projectRepository, IJobCounterService jobCounterService, ITextWriter textWriter)
 {
     _jobQueueRepository = jobQueueRepository;
     _projectRepository  = projectRepository;
     _jobCounterService  = jobCounterService;
     _textWriter         = textWriter;
 }
Пример #9
0
 public SdkAcquirer(HttpClient httpClient, ITextWriter textWriter, IInstallerLauncher installerLauncher, IPlatformIdentifier platformIdentifier)
 {
     _httpClient         = httpClient;
     _textWriter         = textWriter;
     _installerLauncher  = installerLauncher;
     _platformIdentifier = platformIdentifier;
 }
Пример #10
0
        public void PluginLoaderLogger_SafeSetWriter_Test()
        {
            // Arrange
            var pluginLoaderLogger = CreatePluginLoaderLogger();

            // Act
            ITextWriter[] textWriterArray = new ITextWriter[15];
            Parallel.Invoke(
                () => textWriterArray[0]  = pluginLoaderLogger.SafeSetWriter(),
                () => textWriterArray[1]  = pluginLoaderLogger.SafeSetWriter(),
                () => textWriterArray[2]  = pluginLoaderLogger.SafeSetWriter(),
                () => textWriterArray[3]  = pluginLoaderLogger.SafeSetWriter(),
                () => textWriterArray[4]  = pluginLoaderLogger.SafeSetWriter(),
                () => textWriterArray[5]  = pluginLoaderLogger.SafeSetWriter(),
                () => textWriterArray[6]  = pluginLoaderLogger.SafeSetWriter(),
                () => textWriterArray[7]  = pluginLoaderLogger.SafeSetWriter(),
                () => textWriterArray[8]  = pluginLoaderLogger.SafeSetWriter(),
                () => textWriterArray[9]  = pluginLoaderLogger.SafeSetWriter(),
                () => textWriterArray[10] = pluginLoaderLogger.SafeSetWriter(),
                () => textWriterArray[11] = pluginLoaderLogger.SafeSetWriter(),
                () => textWriterArray[12] = pluginLoaderLogger.SafeSetWriter(),
                () => textWriterArray[13] = pluginLoaderLogger.SafeSetWriter(),
                () => textWriterArray[14] = pluginLoaderLogger.SafeSetWriter()
                );
            var expected = pluginLoaderLogger.Writer;


            // Assert
            foreach (var textWriter in textWriterArray)
            {
                Assert.AreEqual(expected, textWriter);
            }
            _MockRepository.VerifyAll();
        }
Пример #11
0
        private List <VsqHandle> writeEventListCor(ITextWriter writer, int eos)
        {
            List <VsqHandle> handles = buildHandleList();

            writer.writeLine("[EventList]");
            List <VsqEvent> temp = new List <VsqEvent>();

            foreach (var @event in Events.iterator())
            {
                temp.Add(@event);
            }
            temp.Sort();
            int i = 0;

            while (i < temp.Count)
            {
                VsqEvent item = temp[i];
                if (!item.ID.Equals(VsqID.EOS))
                {
                    string ids   = "ID#" + PortUtil.formatDecimal("0000", item.ID.value);
                    int    clock = temp[i].Clock;
                    while (i + 1 < temp.Count && clock == temp[i + 1].Clock)
                    {
                        i++;
                        ids += ",ID#" + PortUtil.formatDecimal("0000", temp[i].ID.value);
                    }
                    writer.writeLine(clock + "=" + ids);
                }
                i++;
            }
            writer.writeLine(eos + "=EOS");
            return(handles);
        }
Пример #12
0
        /// <summary>
        /// Input dictionary and text matching with result writting to Output in accordance with the formatting
        /// </summary>
        public void Check(ITextWriter writer, INeighborsFormater formater, int maxDistance)
        {
            this.writer   = writer;
            this.formater = formater;
            CreateComponent(this.dictionaryBuilder);
            CreateComponent(this.textBuilder);

            IText           text       = (IText)this.textBuilder.GetResult();
            IWordDictionary dictionary = (IWordDictionary)this.dictionaryBuilder.GetResult();

            for (int i = 0; i != text.LinesCount; i++)
            {
                var textLine = text.GetLine(i, out int[] whitespaces);
                for (int j = 0; j != textLine.Length; j++)
                {
                    Word word              = textLine[j];
                    var  neighbors         = dictionary.FindNearestСoincidence(word, maxDistance);
                    var  formatedNeighbors = this.formater.FormatNeighbors(word, neighbors);
                    Word editedWord        = new Word(formatedNeighbors);
                    textLine[j] = editedWord;
                }

                this.writer.WriteLine(textLine, whitespaces);
            }
        }
Пример #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CsvWriter"/> class.
        /// </summary>
        /// <param name="textWriter">The <see cref="ITextWriter"/> to take ownership of.</param>
        /// <param name="format">The <see cref="CsvFormat"/> to use.</param>
        public CsvWriter( ITextWriter textWriter, CsvFormat format )
        {
            Ensure.That(textWriter).NotNull();
            Ensure.That(format).NotNull();

            this.csvFormat = format;
            this.tw = textWriter;
        }
Пример #14
0
 public CSVWriter(ITextWriter writer)
 {
     if (writer == null)
     {
         throw new ArgumentNullException(nameof(writer), "Please provide a valid text writer.");
     }
     _writer = writer;
 }
Пример #15
0
 public BenchmarkConfiguration(IBenchmarkConfiguration benchmarkConfiguration)
 {
     BenchmarkManager = benchmarkConfiguration?.BenchmarkManager ?? throw new ArgumentNullException(nameof(benchmarkConfiguration.BenchmarkManager));
     PerfCollector    = benchmarkConfiguration?.PerfCollector ?? throw new ArgumentNullException(nameof(benchmarkConfiguration.PerfCollector));
     TimeSpan         = benchmarkConfiguration?.TimeSpan ?? BenchmarkGlobalSettings.TestingTimeSpan;
     Spins            = benchmarkConfiguration?.Spins ?? BenchmarkGlobalSettings.TestingSpins;
     TextWriter       = benchmarkConfiguration?.TextWriter;
 }
Пример #16
0
 public SingleSolverBatchSolveComponent(ITextWriter report, ITextWriter progress)
 {
     Report                   = report;
     Progress                 = progress;
     Repository               = null;
     Tracking                 = null;
     StopOnConsecutiveFails   = 5;
     SkipPuzzlesWithSolutions = false;
 }
Пример #17
0
 protected ATextWriterInstaller(
     ITextWriter ancestor,
     ITextWriterReplicatorManager replicatorManager,
     T textWriterOfT,
     DisposeAncestor disposeAncestor)
     : base(ancestor, replicatorManager, textWriterOfT, disposeAncestor)
 {
     TextWriterOfT = textWriterOfT;
 }
Пример #18
0
        public TextOutputSink(ITextWriter writer, bool filterResults)
        {
            _textWriter    = writer;
            _filterResults = filterResults;

            // If a command doesn't customize its output, the default text outputter will be used
            _defaultTextSink = new DefaultTextFormatter(_textWriter);
            InitializeCustomTextFormatters();
        }
Пример #19
0
 /// <summary>
 /// インスタンスの内容をテキストファイルに出力します
 /// </summary>
 /// <param name="sw">出力先</param>
 public void write(ITextWriter sw)
 {
     sw.writeLine("[Common]");
     sw.writeLine("Version=" + Version);
     sw.writeLine("Name=" + Name);
     sw.writeLine("Color=" + Color);
     sw.writeLine("DynamicsMode=" + DynamicsMode);
     sw.writeLine("PlayMode=" + PlayMode);
 }
Пример #20
0
        /// <summary>
        /// Constructor of the class
        /// </summary>
        /// <param name="writer">nested writer</param>
        /// <exception cref="ArgumentNullException">if writer parameter is null</exception>
        protected OutputDecorator(ITextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            this.writer = writer;
        }
 public override void InitializePresenter(dynamic context)
 {
     _groupCount = 0;
     _options    = context.Options;
     if (_options.WriteToOutput)
     {
         _sw = _textWriter.Create(_options.OutputPath, true);
     }
 }
Пример #22
0
 /// <summary>
 /// 初始化布局
 /// </summary>
 /// <param name="textWriter">文本写入器</param>
 /// <param name="fit">自适应布局</param>
 public Layout(ITextWriter textWriter, bool fit)
     : base(textWriter)
 {
     AddClass("easyui-layout");
     if (fit)
     {
         AddDataOption("fit", true);
     }
 }
Пример #23
0
        public static void PHPInclude(ITextWriter e, string src)
        {
            if (!src.EndsWith(".php"))
            {
                src += ".php";
            }

            e.WriteLine("require_once '" + src + "';");
        }
Пример #24
0
        public static void DefineScript(ITextWriter w, string src)
        {
            if (!src.EndsWith(".js"))
            {
                src += ".js";
            }

            w.WriteLine("<script type='text/javascript' src='" + src + "'></script>");
        }
Пример #25
0
 public SingleSolverBatchSolveComponent(ITextWriter report, ITextWriter progress, ISokobanSolutionRepository?repository, ISolverRunTracking?tracking, int stopOnConsecutiveFails, bool skipPuzzlesWithSolutions)
 {
     Report                   = report;
     Progress                 = progress;
     Repository               = repository;
     Tracking                 = tracking;
     StopOnConsecutiveFails   = stopOnConsecutiveFails;
     SkipPuzzlesWithSolutions = skipPuzzlesWithSolutions;
 }
Пример #26
0
        public static async Task CollectData(IPerfCounterCollectorUC perfCollector, ITextWriter textWriter)
        {
            using (var chain = File.AppendText("UnifiedConcurrencyReport.txt").InstallInto(textWriter, DisposeAncestor.Yes))
            {
                await DataCollectorProcessor.Execute(perfCollector, chain);

                await chain.TextWriterOfT.FlushAsync();
            }
        }
Пример #27
0
 private void WriteException(ITextWriter report, Exception exception, int indent = 0)
 {
     report.WriteLine("   Type: {0}", exception.GetType().Name);
     report.WriteLine("Message: {0}", exception.Message);
     report.WriteLine(exception.StackTrace);
     if (exception.InnerException != null)
     {
         WriteException(report, exception.InnerException, indent + 1);
     }
 }
Пример #28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JsonWriter"/> class.
        /// </summary>
        /// <param name="textWriter">The <see cref="ITextWriter"/> to take ownership of.</param>
        /// <param name="indent"><c>true</c> to indent the output; otherwise, <c>false</c>.</param>
        /// <param name="produceAscii"><c>true</c> to write only ASCII characters (and encode others using unicode escape codes); otherwise, <c>false</c>. Non printable ASCII characters are always escaped, unless handled by the JSON standard.</param>
        public JsonWriter( ITextWriter textWriter, bool indent = true, bool produceAscii = false )
        {
            Ensure.That(textWriter).NotNull();

            this.textWriter = textWriter;
            this.indent = indent;
            this.produceAscii = produceAscii;

            this.parents = new Stack<JsonToken>();
        }
Пример #29
0
        public async Tasks.Task <bool> Close()
        {
            bool result;

            if (result = this.backend.NotNull() && await this.backend.Close())
            {
                this.backend = null;
            }
            return(result);
        }
Пример #30
0
 public LetterGeneratorController(ICsvReader csvReader,
                                  IPremiumBuilder <Customer> customerBuilder,
                                  ITextWriter textWriter,
                                  ILogger <LetterGeneratorController> logger)
 {
     this.csvReader       = csvReader;
     this.customerBuilder = customerBuilder;
     this.textWriter      = textWriter;
     this.logger          = logger;
 }
Пример #31
0
        /// <summary>
        /// Writes the hash value file (filename.extension) from the content of a File.
        /// </summary>
        /// <param name="reader">The reader for the input data.</param>
        /// <param name="writer">The textwriter for the output.</param>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/>is null</exception>
        /// <exception cref="ArgumentNullException"><paramref name="writer"/>is null</exception>
        public void WriteHash(ITextReader reader, ITextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            string hash = this.GetHashFromReader(reader);

            writer.Write(hash);
        }
Пример #32
0
 private string RenderInstance(object instance, string processorName = null)
 {
     lock (this)
     {
         writer = new StringBuilderTextWriter();
         Render(instance, processorName);
         var result = writer.ToString();
         writer = null;
         return(result);
     }
 }
Пример #33
0
        /// <summary>
        /// Writes the hash file (hash.extension) from a text.
        /// </summary>
        /// <param name="text">The text, null is equal as an empty string.</param>
        /// <param name="writer">The textwriter for the output.</param>
        /// <exception cref="ArgumentNullException"><paramref name="writer"/>is null</exception>
        public void WriteHashFromString(string text, ITextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            string hash = this.GetHashFromString(text);

            writer.Write(hash);
        }
Пример #34
0
 public JobQueueService(IJobQueueRepository jobQueueRepository, IProjectRepository projectRepository, IUserRepository userRepository,
                        IJobCounterService jobCounterService, IJobDefinitionService jobDefinitionService, ITextWriter textWriter, INotificationProvider notificationProvider)
 {
     _jobQueueRepository   = jobQueueRepository;
     _projectRepository    = projectRepository;
     _userRepository       = userRepository;
     _jobCounterService    = jobCounterService;
     _jobDefinitionService = jobDefinitionService;
     _textWriter           = textWriter;
     _notificationProvider = notificationProvider;
 }
Пример #35
0
        public void SetUp()
        {
            this.mockery = new Mockery();

            this.algorithm = this.mockery.NewMock<IHashAlgorithm>();

            this.reader = this.mockery.NewMock<ITextReader>();

            this.writer = this.mockery.NewMock<ITextWriter>();

            this.hashReader = this.mockery.NewMock<ITextReader>();

            this.testee = new HashService(this.algorithm);
        }
        public void SetupContext()
        {
            FakeWriter = MockRepository.GenerateMock<ITextWriter>();

            Generator =
                new StubGenerator(new ScenarioInterpreter(new InterpreterForTypeFactory(new ExtensionMethodHandler())),
                                  new ImplementationHelper(), FakeWriter, new FakeStoryContextFactory());

            TestStory = new Story("foo", "", new[]
                                                 {
                                                      TestHelper.BuildScenario("", new[] { "first line", "second line" }),
                                                      TestHelper.BuildScenario("", new[] { "first line", "second line", "third line" }),
                                                      TestHelper.BuildScenario("", new[] { "this line's weird, punctuation! should be: handled"})
                                                 });

            Generator.HandleStory(TestStory);
            Generator.Finished();

            Suggestions = (string) FakeWriter.GetArgumentsForCallsMadeOn(x => x.Write(Arg<string>.Is.Anything))[0][0];
        }
Пример #37
0
        /// <summary>
        /// Called when the object is being disposed of. Inheritors must call base.OnDispose to be properly disposed.
        /// </summary>
        /// <param name="disposing">If set to <c>true</c>, release both managed and unmanaged resources; otherwise release only the unmanaged resources.</param>
        protected override void OnDispose( bool disposing )
        {
            if( disposing )
            {
                //// dispose-only (i.e. non-finalizable) logic
                //// (managed, disposable resources you own)

                if( this.tw.NotNullReference() )
                {
                    this.tw.Close();
                    this.tw = null;
                }
            }

            //// shared cleanup logic
            //// (unmanaged resources)


            base.OnDispose(disposing);
        }
        public void SetupContext()
        {
            FakeWriter = MockRepository.GenerateMock<ITextWriter>();
            FakeResolver = MockRepository.GenerateMock<IAmbiguousMatchResolver>();

            var scenarioInterpreter = new ScenarioInterpreter(new InterpreterForTypeFactory(new AssemblyRegistry()), FakeResolver, new DefaultLanguageService());
            Generator =
                new StubGenerator(scenarioInterpreter,
                                  new ImplementationHelper(), FakeWriter, new FakeSessionContext());

            TestStory = new Story("foo", "", new[]
                                                 {
                                                      TestHelper.BuildScenario("", new[] { "first line", "second line" }),
                                                      TestHelper.BuildScenario("", new[] { "first line", "second line", "third line" }),
                                                      TestHelper.BuildScenario("", new[] { "this line's weird, punctuation! should be: handled"})
                                                 });

            Generator.HandleStories(new[] {TestStory});

            Suggestions = (string) FakeWriter.GetArgumentsForCallsMadeOn(x => x.Write(Arg<string>.Is.Anything))[0][0];
        }
 public SparkResultReportGenerator(ITextWriter fileWriter, string pathToTemplateFile)
 {
     _fileWriter = fileWriter;
     _pathToTemplateFile = pathToTemplateFile;
 }
Пример #40
0
 public SparkGlossaryFormatter(ITextWriter fileWriter, string pathToTemplateFile)
 {
     _fileWriter = fileWriter;
     _pathToTemplateFile = pathToTemplateFile;
 }
        /// <summary>
        /// Releases any resources held by an open reader.
        /// </summary>
        /// <param name="writer">The writer of the value.</param>
        protected override void CloseWriter( ITextWriter writer )
        {
            var valueNode = new DataStoreTextValue(this.currentValueNodeName, this.textWriter.ToString());
            this.currentValueNodeName = null;
            this.textWriter.Clear();

            this.AddChild(valueNode);
        }
Пример #42
0
            protected override void Dispose( bool disposing )
            {
                if( disposing )
                {
                    if( this.textWriter.NotNullReference() )
                    {
                        this.textWriter.Close();
                        this.textWriter = null;
                    }
                }

                base.Dispose(disposing);
            }
 /// <summary>
 /// Initializes a new instance of the <see cref="XmlDataStoreWriter"/> class.
 /// </summary>
 /// <param name="textWriter">The <see cref="ITextWriter"/> to take ownership of.</param>
 /// <param name="indent">Determines whether to indent the xml elements.</param>
 public XmlDataStoreWriter( ITextWriter textWriter, bool indent = true )
     : this(XmlWriter.Create(IOWrapper.Wrap(textWriter, DataStore.DefaultEncoding), new XmlWriterSettings() { Encoding = DataStore.DefaultEncoding, NewLineChars = DataStore.DefaultNewLine, Indent = indent, CloseOutput = true }))
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="JsonDataStoreWriter"/> class.
 /// </summary>
 /// <param name="textWriter">The <see cref="ITextWriter"/> to take ownership of.</param>
 /// <param name="indent">Determines whether to indent the JSON elements.</param>
 public JsonDataStoreWriter( ITextWriter textWriter, bool indent = true )
     : this(new JsonWriter(textWriter, indent: indent))
 {
 }
        private void CloseWriters()
        {
            if( this.currentBinaryWriter.NotNullReference() )
            {
                this.CloseWriter(this.currentBinaryWriter);
                this.currentBinaryWriter = null;
            }

            if( this.currentTextWriter.NotNullReference() )
            {
                this.CloseWriter(this.currentTextWriter);
                this.currentTextWriter = null;
            }
        }
Пример #46
0
 public XmlReportListener(ITextWriter fileWriter)
 {
     _fileWriter = fileWriter;
     _doc = new XmlDocument();
     _doc.LoadXml("<" + XmlNames.DocumentElement + "/>");
 }
 /// <summary>
 /// Releases any resources held by an open reader.
 /// </summary>
 /// <param name="writer">The writer of the value.</param>
 protected abstract void CloseWriter( ITextWriter writer );
 /// <summary>
 /// Returns a new <see cref="LogEntrySerializer"/> instance.
 /// If possible, use the other method to create an instance.
 /// </summary>
 /// <param name="xmlStream">The <see cref="ITextWriter"/> to write the Xml contents to.</param>
 /// <returns>The new <see cref="LogEntrySerializer"/> instance created.</returns>
 public static LogEntrySerializer ToXmlStream( ITextWriter xmlStream )
 {
     var writer = new XmlDataStoreWriter(xmlStream);
     writer.WriteObjectStart("LogEntries");
     return new LogEntrySerializer(writer);
 }
        /// <summary>
        /// Writes a BinaryValue or TextValue token. The writer implementation chooses which one.
        /// There is exactly one - binary or text - reader for each value.
        /// </summary>
        /// <param name="name">The name of the data store value.</param>
        /// <param name="binaryWriter">The <see cref="IBinaryWriter"/> that can be used to write the value; or <c>null</c>.</param>
        /// <param name="textWriter">The <see cref="ITextWriter"/> that can be used to write the value; or <c>null</c>.</param>
        public void WriteValue( string name, out IBinaryWriter binaryWriter, out ITextWriter textWriter )
        {
            this.ThrowIfDisposed();

            if( !DataStore.IsValidName(name) )
                throw new ArgumentException("Invalid data store name!").Store("name", name);

            this.CloseWriters();
            var isBinary = this.Write(name, isObjectStart: null);
            if( isBinary.HasValue )
            {
                this.currentBinaryWriter = isBinary.Value ? this.OpenBinaryWriter() : null;
                this.currentTextWriter = isBinary.Value ? null : this.OpenTextWriter();
                binaryWriter = this.currentBinaryWriter;
                textWriter = this.currentTextWriter;
            }
            else
            {
                binaryWriter = null;
                textWriter = null;
            }
        }
Пример #50
0
        /// <summary>
        /// Writes the hash value file (filename.extension) from the content of a File.
        /// </summary>
        /// <param name="reader">The reader for the input data.</param>
        /// <param name="writer">The textwriter for the output.</param>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/>is null</exception>
        /// <exception cref="ArgumentNullException"><paramref name="writer"/>is null</exception>
        public void WriteHash(ITextReader reader, ITextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            string hash = this.GetHashFromReader(reader);
            writer.Write(hash);
        }
        /// <summary>
        /// Releases any resources held by an open reader.
        /// </summary>
        /// <param name="writer">The writer of the value.</param>
        protected override void CloseWriter( ITextWriter writer )
        {
            var value = this.textWriter.ToString();
            this.textWriter.Clear();

            if( value.Length != 0 )
            {
                this.xmlWriter.WriteString(value);
                this.xmlWriter.WriteFullEndElement();
            }
            else
            {
                this.xmlWriter.WriteEndElement(); // not a full end element, that would be equivalent to an empty data store object
            }
        }
Пример #52
0
 public SparkReportListener(ITextWriter fileWriter, string pathToTemplateFile)
     : base(new SparkResultReportGenerator(fileWriter, pathToTemplateFile))
 {
 }
Пример #53
0
            internal ITexWriterAsTextWriter( ITextWriter textWriter, Encoding encoding )
            {
                if( textWriter.NullReference() )
                    throw new ArgumentNullException("textWriter").StoreFileLine();

                if( encoding.NullReference() )
                    throw new ArgumentNullException("encoding").StoreFileLine();

                this.encoding = encoding;
                this.textWriter = textWriter;
            }
Пример #54
0
 public TextInformationalMessageWriter(ITextWriter textWriter)
 {
     _textWriter = textWriter;
 }
Пример #55
0
 /// <summary>
 /// Wraps the specified <see cref="ITextWriter"/>, in <see cref="TextWriter"/>.
 /// </summary>
 /// <param name="textWriter">The <see cref="ITextWriter"/> to wrap.</param>
 /// <param name="encoding">The encoding to report through the <see cref="TextWriter"/>.</param>
 /// <returns>The disposable wrapper created.</returns>
 public static TextWriter Wrap( ITextWriter textWriter, Encoding encoding )
 {
     return new ITexWriterAsTextWriter(textWriter, encoding);
 }
Пример #56
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Base64WriterLE"/> class.
 /// </summary>
 /// <param name="textWriter">The <see cref="ITextWriter"/> being written to.</param>
 public Base64WriterLE( ITextWriter textWriter )
     : base()
 {
     this.TextWriter = textWriter;
 }
        /// <summary>
        /// Releases any resources held by an open reader.
        /// </summary>
        /// <param name="writer">The writer of the value.</param>
        protected override void CloseWriter( ITextWriter writer )
        {
            var value = this.textWriter.ToString();
            this.textWriter.Clear();

            this.jsonWriter.WriteUnknownValue(value);
        }
Пример #58
0
        /// <summary>
        /// Writes the hash file (hash.extension) from a text.
        /// </summary>
        /// <param name="text">The text, null is equal as an empty string.</param>
        /// <param name="writer">The textwriter for the output.</param>
        /// <exception cref="ArgumentNullException"><paramref name="writer"/>is null</exception>
        public void WriteHashFromString(string text, ITextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            string hash = this.GetHashFromString(text);
            writer.Write(hash);
        }