Beispiel #1
0
        /// <summary>Load errors from a file.</summary>
        /// <param name="fileName">The file that contains the errors.</param>
        public static ErrorInfo[] LoadErrors(string fileName)
        {
            FileHelperEngine engine = new FileHelperEngine(typeof(ErrorInfo));

            return((ErrorInfo[])engine.ReadFile(fileName));
        }
Beispiel #2
0
 /// <summary>
 /// Read an array of data from a supplied engine
 /// </summary>
 /// <typeparam name="T">Type of record to parse</typeparam>
 /// <param name="engine">Engine to read record from</param>
 /// <param name="maxRecords">Maximum number of records</param>
 /// <returns>array of data</returns>
 public T[] ReadWithEngine <T>(FileHelperEngine <T> engine, int maxRecords) where T : class
 {
     return(engine.ReadFile(Path, maxRecords));
 }
Beispiel #3
0
 /// <summary>
 /// array of data for a file
 /// </summary>
 /// <typeparam name="T">type or record</typeparam>
 /// <param name="engine">engine to process data</param>
 /// <returns>array of data</returns>
 public T[] ReadWithEngine <T>(FileHelperEngine <T> engine) where T : class
 {
     return(engine.ReadFile(Path));
 }
Beispiel #4
0
        /// <summary>
        /// Used to read a file without instanciate the engine.<br />
        /// <b>This is feature limited method try to use the non static methods.</b>
        /// </summary>
        /// <param name="recordClass">The record class.</param>
        /// <param name="fileName">The file name</param>
        /// <returns>The read records.</returns>
        public static object[] ReadFile(Type recordClass, string fileName)
        {
            FileHelperEngine engine = new FileHelperEngine(recordClass);

            return(engine.ReadFile(fileName));
        }
Beispiel #5
0
        /// <summary>
        /// Used to read a file without instantiating the engine.<br />
        /// <b>This method has limited features.  We recommend using the non static methods.</b>
        /// </summary>
        /// <param name="fileName">The file name</param>
        /// <param name="maxRecords">The max number of records to read. Int32.MaxValue or -1 to read all records.</param>
        /// <returns>The read records.</returns>
        public static T[] ReadFile <T>(string fileName, int maxRecords) where T : class
        {
            var engine = new FileHelperEngine <T>();

            return(engine.ReadFile(fileName, maxRecords));
        }
Beispiel #6
0
        /// <summary>
        /// Used to read a file without instantiating the engine.<br />
        /// <b>This method has limited features.  We recommend using the non static methods.</b>
        /// </summary>
        /// <param name="recordClass">The record class.</param>
        /// <param name="fileName">The file name</param>
        /// <param name="maxRecords">The max number of records to read. Int32.MaxValue or -1 to read all records.</param>
        /// <returns>The read records.</returns>
        public static object[] ReadFile(Type recordClass, string fileName, int maxRecords)
        {
            var engine = new FileHelperEngine(recordClass);

            return(engine.ReadFile(fileName, maxRecords));
        }