/// <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)); }
/// <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))); }
/// <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); }
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(); }