Exemplo n.º 1
0
        public override Task ExecuteAsync(IWritingContext context)
        {
            if (!context.Document.Focused)
            {
                context.Document.Focus();
            }

            context.Document.ExecCommand("Italic", false, null);
            return(Task.CompletedTask);
        }
Exemplo n.º 2
0
        /// <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;
        }
Exemplo n.º 3
0
        /// <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;
        }
Exemplo n.º 4
0
 /// <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)
 {
 }
Exemplo n.º 5
0
 /// <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)
 {
 }
Exemplo n.º 6
0
 /// <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);
 }
Exemplo n.º 7
0
 /// <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);
 }
Exemplo n.º 8
0
 public abstract Task ExecuteAsync(IWritingContext context);
Exemplo n.º 9
0
 public ToolsManager(ExtensionManager extensionManager, IWritingContext writingContext)
 {
     this.extensionManager = extensionManager;
     this.writingContext   = writingContext;
 }
Exemplo n.º 10
0
 /// <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)
 {
 }
Exemplo n.º 11
0
 /// <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;
 }
Exemplo n.º 12
0
 /// <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)
 {
 }
Exemplo n.º 13
0
 public SerializerMock(bool throwExceptionOnWrite = false)
 {
     Context = new WritingContext(new StringWriter(), new CsvHelper.Configuration.Configuration(), false);
     this.throwExceptionOnWrite = throwExceptionOnWrite;
 }
Exemplo n.º 14
0
 public override Task ExecuteAsync(IWritingContext context)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 15
0
 /// <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;
 }
Exemplo n.º 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CsvHelperException"/> class.
 /// </summary>
 public CsvHelperException(IWritingContext context)
 {
     WritingContext = context;
 }