/// <summary>
        /// Transform the contents of the sourceFile and write them to the
        /// destFile. (faster and uses less memory, best choice for big
        /// files)
        /// </summary>
        /// <param name="sourceStream">The source stream.</param>
        /// <param name="destStream">The destination stream.</param>
        /// <returns>The number of transformed records.</returns>
        public int TransformFileFast(TextReader sourceStream, StreamWriter destStream)
        {
            ExHelper.CheckNullParam(sourceStream, "sourceStream");
            ExHelper.CheckNullParam(destStream, "destStream");

            return(CoreTransformAsync(sourceStream, destStream));
        }
Example #2
0
        /// <summary>
        /// Transform the contents of the sourceFile and write them to the
        /// destFile. (faster and uses less memory, best choice for big
        /// files)
        /// </summary>
        /// <param name="sourceFile">The source file.</param>
        /// <param name="destStream">The destination stream.</param>
        /// <returns>The number of transformed records.</returns>
        public int TransformFileFast(string sourceFile, StreamWriter destStream)
        {
            ExHelper.CheckNullParam(sourceFile, "sourceFile");
            ExHelper.CheckNullParam(destStream, "destStream");

            return(CoreTransformAsync(new InternalStreamReader(sourceFile, SourceEncoding, true, EngineBase.DefaultReadBufferSize * 5), destStream));
        }
Example #3
0
        /// <summary>
        /// Transform the contents of the sourceFile and write them to the
        /// destFile. (faster and uses less memory, best choice for big
        /// files)
        /// </summary>
        /// <param name="sourceStream">The source stream.</param>
        /// <param name="destFile">The destination file.</param>
        /// <returns>The number of transformed records.</returns>
        public int TransformFileFast(TextReader sourceStream, string destFile)
        {
            ExHelper.CheckNullParam(sourceStream, "sourceStream");
            ExHelper.CheckNullParam(destFile, "destFile");

            return(CoreTransformAsync(sourceStream, new StreamWriter(destFile, false, DestinationEncoding, EngineBase.DefaultWriteBufferSize * 5)));
        }
        /// <summary>
        /// Transform the contents of the sourceFile and write them to the
        /// destFile.(use only if you need the array of the transformed
        /// records, TransformFileFast is faster)
        /// </summary>
        /// <param name="sourceFile">The source file.</param>
        /// <param name="destFile">The destination file.</param>
        /// <returns>The transformed records.</returns>
        public TDestination[] TransformFile(string sourceFile, string destFile)
        {
            ExHelper.CheckNullParam(sourceFile, "sourceFile");
            ExHelper.CheckNullParam(destFile, "destFile");
            ExHelper.CheckDifferentsParams(sourceFile, "sourceFile", destFile, "destFile");

            return(CoreTransformFile(sourceFile, destFile));
        }
Example #5
0
        /// <summary>
        /// Transform the contents of the sourceFile and write them to the
        /// destFile. (faster and uses less memory, best choice for big
        /// files)
        /// </summary>
        /// <param name="sourceFile">The source file.</param>
        /// <param name="destFile">The destination file.</param>
        /// <returns>The number of transformed records.</returns>
        public int TransformFileFast(string sourceFile, string destFile)
        {
            ExHelper.CheckNullParam(sourceFile, "sourceFile");
            ExHelper.CheckNullParam(destFile, "destFile");
            ExHelper.CheckDifferentsParams(sourceFile, "sourceFile", destFile, "destFile");

            return(CoreTransformAsync(new InternalStreamReader(sourceFile, SourceEncoding, true, EngineBase.DefaultReadBufferSize * 5), new StreamWriter(destFile, false, DestinationEncoding, EngineBase.DefaultWriteBufferSize * 5)));
        }
Example #6
0
		/// <summary>Transform the contents of the sourceFile and write them to the destFile. (faster and use less memory, best choice for big files)</summary>
		/// <param name="sourceFile">The source file.</param>
		/// <param name="destFile">The destination file.</param>
		/// <returns>The number of transformed records.</returns>
		public int TransformFileAsync(string sourceFile, string destFile)
		{
			ExHelper.CheckNullParam(sourceFile, "sourceFile");
			ExHelper.CheckNullParam(destFile, "destFile");
			ExHelper.CheckDifferentsParams(sourceFile, "sourceFile", destFile, "destFile");

			if (mConvert1to2 == null)
				throw new BadUsageException("You must define a method in the class " + SourceType.Name + " with the attribute [TransfortToRecord(typeof(" + DestinationType.Name + "))] that return an object of type " + DestinationType.Name);

			return CoreTransformAsync(sourceFile, destFile, mSourceType, mDestinationType, mConvert1to2);
		}
Example #7
0
        public FileTransformEngine()
        {
            Type sourceType = typeof(Source);
            Type destType   = typeof(Destination);
#endif
            //throw new NotImplementedException("This feature is not ready yet. In the next release maybe work =)");
            ExHelper.CheckNullParam(sourceType, "sourceType");
            ExHelper.CheckNullParam(destType, "destType");
            ExHelper.CheckDifferentsParams(sourceType, "sourceType", destType, "destType");

            mSourceType      = sourceType;
            mDestinationType = destType;

            ValidateRecordTypes();
        }