/// <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));
        }
Ejemplo n.º 2
0
        /// <summary>Allow to declaratively show what records must be included or excluded</summary>
        /// <param name="condition">The condition used to include or exclude each record</param>
        /// <param name="selector">The selector for the condition.</param>
        public ConditionalRecordAttribute(RecordCondition condition, string selector)
        {
            ExHelper.CheckNullOrEmpty(selector, "selector");

            mCondition         = condition;
            mConditionSelector = selector;
        }
Ejemplo n.º 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="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));
        }
Ejemplo n.º 4
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));
        }
Ejemplo n.º 6
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)));
        }
Ejemplo n.º 7
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);
		}
Ejemplo n.º 8
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();
        }
 /// <summary>Allow to declaratively show what records must be included or excluded</summary>
 /// <param name="condition">The condition used to include or exclude each record <see cref="RecordCondition"/>conditions</param>
 /// <param name="conditionSelector">The selector (match string) for the condition.</param>
 public ConditionalRecordAttribute(RecordCondition condition, string conditionSelector)
 {
     Condition         = condition;
     ConditionSelector = conditionSelector;
     ExHelper.CheckNullOrEmpty(conditionSelector, "conditionSelector");
 }