RecordOptions.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 » RecordOptions.cs
using System;
using System.Diagnostics;
using System.ComponentModel;

namespace FileHelpers{
  /// <summary>
  /// This class allows you to set some options of the records but at runtime.
  /// With this options the library is more flexible than never.
  /// </summary>
    [EditorBrowsable(EditorBrowsableState.Advanced)]
  public abstract class RecordOptions
  {
    
#if NET_2_0
    [DebuggerDisplay("FileHelperEngine for type: {RecordType.Name}. ErrorMode: {ErrorManager.ErrorMode.ToString()}. Encoding: {Encoding.EncodingName}")]
#endif
        internal RecordInfo mRecordInfo;
  
    internal RecordOptions(RecordInfo info)
    {
      mRecordInfo = info;
            mRecordConditionInfo = new RecordConditionInfo(info);
      mIgnoreCommentInfo = new IgnoreCommentInfo(info);
    }
    
    /// <summary>Indicates the number of first lines to be discarded.</summary>
    public int IgnoreFirstLines
    {
      get { return mRecordInfo.mIgnoreFirst; }
      set
      {
        ExHelper.PositiveValue(value);
        mRecordInfo.mIgnoreFirst= value;
      }
    }

    /// <summary>Indicates the number of lines at the end of file to be discarded.</summary>
    public int IgnoreLastLines
    {
      get { return mRecordInfo.mIgnoreLast; }
      set
      {
        ExHelper.PositiveValue(value);
        mRecordInfo.mIgnoreLast = value;
      }
    }

    /// <summary>Indicates that the engine must ignore the empty lines while reading.</summary>
    public bool IgnoreEmptyLines
    {
      get { return mRecordInfo.mIgnoreEmptyLines; }
      set { mRecordInfo.mIgnoreEmptyLines= value; }
    }

    private RecordConditionInfo mRecordConditionInfo;
    
    /// <summary>Allow to tell the engine what records must be included or excluded while reading.</summary>
        public RecordConditionInfo RecordCondition
        {
            get { return mRecordConditionInfo; }
        }


    private IgnoreCommentInfo mIgnoreCommentInfo;

    /// <summary>Indicates that the engine must ignore the lines with this comment marker.</summary>
    public IgnoreCommentInfo IgnoreCommentedLines
    {
      get { return mIgnoreCommentInfo; }
    }
 
        /// <summary>Allow to tell the engine what records must be included or excluded while reading.</summary>
        [EditorBrowsable(EditorBrowsableState.Advanced)]
    public sealed class RecordConditionInfo
        {
            RecordInfo mRecordInfo;
            internal RecordConditionInfo(RecordInfo ri)
            {
                mRecordInfo = ri;
            }

            /// <summary>The condition used to include or exclude records.</summary>
            public RecordCondition Condition
            {
                get { return mRecordInfo.mRecordCondition; }
                set { mRecordInfo.mRecordCondition = value; }
            }

            /// <summary>The selector used by the <see cref="RecordCondition"/>.</summary>
            public string Selector
            {
                get { return mRecordInfo.mRecordConditionSelector; }
                set { mRecordInfo.mRecordConditionSelector = value; }
            }
        }



    /// <summary>Indicates that the engine must ignore the lines with this comment marker.</summary>
    [EditorBrowsable(EditorBrowsableState.Advanced)]
    public sealed class IgnoreCommentInfo
    {
      RecordInfo mRecordInfo;
      internal IgnoreCommentInfo(RecordInfo ri)
      {
        mRecordInfo = ri;
      }

      /// <summary>
      /// <para>Indicates that the engine must ignore the lines with this comment marker.</para>
      /// <para>An emty string or null indicates that the engine dont look for comments</para>
      /// </summary>
      public string CommentMarker
      {
        get { return mRecordInfo.mCommentMarker; }
        set
        {
          if (value != null)
            value = value.Trim();
          mRecordInfo.mCommentMarker = value;
        }
      }

      /// <summary>Indicates if the comment can have spaces or tabs at left (true by default)</summary>
      public bool InAnyPlace
      {
        get { return mRecordInfo.mCommentAnyPlace; }
        set { mRecordInfo.mCommentAnyPlace = 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.