using System; using System.ComponentModel; namespace FileHelpers { #if NET_1_1 /// Base class of and [EditorBrowsable(EditorBrowsableState.Never)] public abstract class WriteRecordEventArgs: EventArgs { internal WriteRecordEventArgs(object record, int lineNumber) { mRecord = record; mLineNumber = lineNumber; } #else /// Base class of and [EditorBrowsable(EditorBrowsableState.Never)] public abstract class WriteRecordEventArgs : EventArgs { internal WriteRecordEventArgs(T record, int lineNumber) { mRecord = record; mLineNumber = lineNumber; } #endif #if NET_1_1 private object mRecord; /// The current record. public object Record { get { return mRecord; } } #else private T mRecord; /// The current record. public T Record { get { return mRecord; } } #endif private int mLineNumber; /// The current line number. public int LineNumber { get { return mLineNumber; } } } /// Arguments for the #if NET_1_1 public sealed class BeforeWriteRecordEventArgs: WriteRecordEventArgs { internal BeforeWriteRecordEventArgs(object record, int lineNumber) #else public sealed class BeforeWriteRecordEventArgs: BeforeWriteRecordEventArgs { internal BeforeWriteRecordEventArgs(object record, int lineNumber) : base(record, lineNumber) {} } /// Arguments for the public class BeforeWriteRecordEventArgs: WriteRecordEventArgs { internal BeforeWriteRecordEventArgs(T record, int lineNumber) #endif : base(record, lineNumber) {} private bool mSkipThisRecord = false; /// Set this property as true if you want to bypass the current record. public bool SkipThisRecord { get { return mSkipThisRecord; } set { mSkipThisRecord = value; } } } /// Arguments for the #if NET_1_1 public sealed class AfterWriteRecordEventArgs: WriteRecordEventArgs { internal AfterWriteRecordEventArgs(object record, int lineNumber, string line): base(record, lineNumber) #else public sealed class AfterWriteRecordEventArgs: AfterWriteRecordEventArgs { internal AfterWriteRecordEventArgs(object record, int lineNumber, string line) :base(record, lineNumber, line) { } } /// Arguments for the public class AfterWriteRecordEventArgs: WriteRecordEventArgs { internal AfterWriteRecordEventArgs(T record, int lineNumber, string line): base(record, lineNumber) #endif { mRecordLine = line; } private string mRecordLine; /// The line to be written to the file. WARNING: you can change this and the engines will write it to the file. public string RecordLine { get { return mRecordLine; } set { mRecordLine = value; } } } }