public override Task ExecuteAsync(IWritingContext context) { if (!context.Document.Focused) { context.Document.Focus(); } context.Document.ExecCommand("Italic", false, null); return(Task.CompletedTask); }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> /// <param name="disposing">True if the instance needs to be disposed of.</param> protected virtual void Dispose(bool disposing) { if (disposed) { return; } if (disposing) { context.Dispose(); } context = null; disposed = true; }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> /// <param name="disposing">True if the instance needs to be disposed of.</param> protected virtual void Dispose(bool disposing) { if (disposed) { return; } Flush(); if (disposing) { serializer?.Dispose(); } serializer = null; context = null; disposed = true; }
/// <summary> /// Initializes a new instance of the <see cref="TypeConverterException"/> class /// with a specified error message and a reference to the inner exception that /// is the cause of this exception. /// </summary> /// <param name="context">The writing context.</param> /// <param name="message">The error message that explains the reason for the exception.</param> /// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param> public TypeConverterException(IWritingContext context, string message, Exception innerException) : base(context, message, innerException) { }
/// <summary> /// Initializes a new instance of the <see cref="TypeConverterException"/> class. /// </summary> /// <param name="context">The writing context.</param> public TypeConverterException(IWritingContext context) : base(context) { }
/// <summary> /// Creates a new CSV writer using the given <see cref="ISerializer"/>. /// </summary> /// <param name="serializer">The serializer.</param> public CsvWriter(ISerializer serializer) { this.serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); context = serializer.Context as IWritingContext ?? throw new InvalidOperationException($"For {nameof( ISerializer )} to be used in {nameof( CsvWriter )}, {nameof( ISerializer.Context )} must also implement {nameof( IWritingContext )}."); recordManager = ObjectResolver.Current.Resolve <RecordManager>(this); }
/// <summary> /// Creates a new serializer using the given <see cref="TextWriter"/> /// and <see cref="CsvHelper.Configuration.Configuration"/>. /// </summary> /// <param name="writer">The <see cref="TextWriter"/> to write the CSV file data to.</param> /// <param name="configuration">The configuration.</param> /// <param name="leaveOpen">true to leave the reader open after the CsvReader object is disposed, otherwise false.</param> public CsvSerializer(TextWriter writer, Configuration.Configuration configuration, bool leaveOpen) { context = new WritingContext(writer, configuration, leaveOpen); }
public abstract Task ExecuteAsync(IWritingContext context);
public ToolsManager(ExtensionManager extensionManager, IWritingContext writingContext) { this.extensionManager = extensionManager; this.writingContext = writingContext; }
/// <summary> /// Initializes a new instance of the <see cref="WriterException"/> class /// with a specified error message. /// </summary> /// <param name="context">The writing context.</param> /// <param name="message">The message that describes the error.</param> public WriterException(IWritingContext context, string message) : base(context, message) { }
/// <summary> /// Initializes a new instance of the <see cref="TypeConverterException"/> class /// with a specified error message. /// </summary> /// <param name="typeConverter">The type converter.</param> /// <param name="memberMapData">The member map data.</param> /// <param name="value">The value.</param> /// <param name="context">The writing context.</param> /// <param name="message">The message that describes the error.</param> public TypeConverterException(ITypeConverter typeConverter, MemberMapData memberMapData, object value, IWritingContext context, string message) : base(context, message) { TypeConverter = typeConverter; MemberMapData = memberMapData; Value = value; }
/// <summary> /// Initializes a new instance of the <see cref="WriterException"/> class. /// </summary> /// <param name="context">The writing context.</param> public WriterException(IWritingContext context) : base(context) { }
public SerializerMock(bool throwExceptionOnWrite = false) { Context = new WritingContext(new StringWriter(), new CsvHelper.Configuration.Configuration(), false); this.throwExceptionOnWrite = throwExceptionOnWrite; }
public override Task ExecuteAsync(IWritingContext context) { throw new NotImplementedException(); }
/// <summary> /// Initializes a new instance of the <see cref="CsvHelperException"/> class /// with a specified error message. /// </summary> /// <param name="context">The writing context.</param> /// <param name="message">The message that describes the error.</param> public CsvHelperException(IWritingContext context, string message) : base(message) { WritingContext = context; }
/// <summary> /// Initializes a new instance of the <see cref="CsvHelperException"/> class. /// </summary> public CsvHelperException(IWritingContext context) { WritingContext = context; }