Exemplo n.º 1
0
        public T[] WriteNewRecords(string sourceFile, string newFile, string destFile)
        {
            FileHelperEngine <T> engine = CreateEngineAndClearErrors();

            T[] res = OnlyNewRecords(sourceFile, newFile);
#endif
            engine.WriteFile(destFile, res);
            ErrorManager.AddErrors(engine.ErrorManager);
            return(res);
        }
Exemplo n.º 2
0
        /// <summary>Returns the records in newFile that not are in the sourceFile</summary>
        /// <param name="sourceFile">The file with the old records.</param>
        /// <param name="newFile">The file with the new records.</param>
        /// <returns>The records in newFile that not are in the sourceFile</returns>
#if !GENERICS
        public object[] OnlyNewRecords(string sourceFile, string newFile)
        {
            var engine = CreateEngineAndClearErrors();

            var olds = (IComparableRecord[])engine.ReadFile(sourceFile);

            ErrorManager.AddErrors(engine.ErrorManager);
            var currents = (IComparableRecord[])engine.ReadFile(newFile);

            ErrorManager.AddErrors(engine.ErrorManager);

            var news = new ArrayList();

            ApplyDiffOnlyIn1(currents, olds, news);

            return((object[])news.ToArray(mRecordInfo.mRecordType));
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Returns the duplicated records in both files.
        /// </summary>
        /// <param name="file1">A file with record.</param>
        /// <param name="file2">A file with record.</param>
        /// <returns>The records that appear in both files.</returns>
#if !GENERICS
        public object[] OnlyDuplicatedRecords(string file1, string file2)
        {
            var engine = CreateEngineAndClearErrors();

            var olds = (IComparableRecord[])engine.ReadFile(file1);

            ErrorManager.AddErrors(engine.ErrorManager);
            var currents = (IComparableRecord[])engine.ReadFile(file2);

            ErrorManager.AddErrors(engine.ErrorManager);

            var news = new ArrayList();

            ApplyDiffInBoth(currents, olds, news);

            return((object[])news.ToArray(mRecordInfo.mRecordType));
        }