コード例 #1
0
ファイル: CommonEngine.cs プロジェクト: zjmsky/FileHelpers
        /// <summary>
        /// Transform the records of type sourceType in the sourceFile in
        /// records of type destType and write them to the destFile. (but
        /// returns the transformed records) WARNING: this is a slower method
        /// that the TransformFileAssync.
        /// </summary>
        /// <param name="sourceFile">The file with records to be transformed</param>
        /// <param name="destFile">The destination file with the transformed records</param>
        /// <returns>The transformed records.</returns>
        public static object[] TransformFile <TSource, TDest>(string sourceFile, string destFile)
            where TSource : class, ITransformable <TDest>
            where TDest : class
        {
            var engine = new FileTransformEngine <TSource, TDest>();

            return(engine.TransformFile(sourceFile, destFile));
        }
コード例 #2
0
        /// <summary><b>Faster way</b> to Transform the records of type sourceType in the sourceFile in records of type destType and write them to the destFile.</summary>
        /// <param name="sourceType">The Type of the records in the source File.</param>
        /// <param name="destType">The Type of the records in the dest File.</param>
        /// <param name="sourceFile">The file with records to be transformed</param>
        /// <param name="destFile">The destination file with the transformed records</param>
        /// <returns>The number of transformed records</returns>
        public static int TransformFileAsync(string sourceFile, Type sourceType, string destFile, Type destType)
        {
            FileTransformEngine engine = new FileTransformEngine(sourceType, destType);

            return(engine.TransformFileAsync(sourceFile, destFile));
        }