ReadEventArgs.cs :  » Persistence-Frameworks » FileHelpers-Library » FileHelpers » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Persistence Frameworks » FileHelpers Library 
FileHelpers Library » FileHelpers » ReadEventArgs.cs
using System;
using System.ComponentModel;

namespace FileHelpers{

    /// <summary>Base class of <see cref="BeforeReadRecordEventArgs"/> and <see cref="AfterReadRecordEventArgs"/></summary>
    [EditorBrowsable(EditorBrowsableState.Never)]
  public abstract class ReadRecordEventArgs: EventArgs
  {
    internal ReadRecordEventArgs(string line, int lineNumber)
    {
      mRecordLine = line;
      mLineNumber = lineNumber;
    }

    private string mRecordLine;

    private int mLineNumber;

    /// <summary>The current line number.</summary>
    public int LineNumber
    {
      get { return mLineNumber; }
    }

    /// <summary>The just read record line.</summary>
    public string RecordLine
    {
      get { return mRecordLine; }
    }

  }

  /// <summary>Arguments for the <see cref="BeforeReadRecordHandler"/></summary>
#if NET_1_1
  public sealed class BeforeReadRecordEventArgs: ReadRecordEventArgs
#else
    public sealed class BeforeReadRecordEventArgs: BeforeReadRecordEventArgs<object>
    {
        internal BeforeReadRecordEventArgs(string line)
            : this(line, -1)
        { }

        internal BeforeReadRecordEventArgs(string line, int lineNumber)
            : base(line, lineNumber)
        { }
    }

    /// <summary>Arguments for the <see cref="BeforeReadRecordHandler"/></summary>
    public class BeforeReadRecordEventArgs<T> : ReadRecordEventArgs
#endif
  {
    internal BeforeReadRecordEventArgs(string line): this(line, -1)
    {}

    internal BeforeReadRecordEventArgs(string line, int lineNumber): base(line, lineNumber)
    {}

    private bool mSkipThisRecord = false;

    /// <summary>Set this property to true if you want to bypass the current line.</summary>
    public bool SkipThisRecord
    {
      get { return mSkipThisRecord; }
      set { mSkipThisRecord = value; }
    }

  }

  /// <summary>Arguments for the <see cref="AfterReadRecordHandler"/></summary>
#if NET_1_1
  public sealed class AfterReadRecordEventArgs: ReadRecordEventArgs
  {
    internal AfterReadRecordEventArgs(string line, object newRecord): this(line, newRecord, -1)
    {}

    internal AfterReadRecordEventArgs(string line, object newRecord, int lineNumber): base(line, lineNumber)
    {
      mRecord = newRecord;
    }

    private object mRecord;

    /// <summary>The current record.</summary>
    public object Record
    {
      get { return mRecord; }
      set { mRecord = value; }
    }

#else
    public sealed class AfterReadRecordEventArgs: AfterReadRecordEventArgs<object>
    {
        internal AfterReadRecordEventArgs(string line, object newRecord)
            : this(line, newRecord, -1)
        { }

        internal AfterReadRecordEventArgs(string line, object newRecord, int lineNumber)
            : base(line, newRecord, lineNumber)
        {
        }
    }

    /// <summary>Arguments for the <see cref="AfterReadRecordHandler"/></summary>
    public class AfterReadRecordEventArgs<T> : ReadRecordEventArgs
  {
    internal AfterReadRecordEventArgs(string line, T newRecord): this(line, newRecord, -1)
    {}

    internal AfterReadRecordEventArgs(string line, T newRecord, int lineNumber): base(line, lineNumber)
    {
      mRecord = newRecord;
    }

    private T mRecord;

    /// <summary>The current record.</summary>
    public T Record
    {
      get { return mRecord; }
      set { mRecord = value; }
    }
#endif


    private bool mSkipThisRecord = false;

    /// <summary>Set this property to true if you want to bypass the current record.</summary>
    public bool SkipThisRecord
    {
      get { return mSkipThisRecord; }
      set { mSkipThisRecord = value; }
    }

  }


}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.