Beispiel #1
0
        public virtual void Merge(string source1, string source2, string destination)
        {
            var sourceFiles1 = _fileReader.Read(source1);
            var sourceFiles2 = _fileReader.Read(source2);

            _innerMerger.Merge(sourceFiles1, sourceFiles2, destination);
        }
        public bool MergeFile(Guid id, string name)
        {
            FileMerger merger = new FileMerger();

            merger.Merge(Path.Combine(Configurations.UploadsFolder, id.ToString()), name);
            return(true);
        }
Beispiel #3
0
        public void WriteResult(string outputFile)
        {
            WritePartition(false); // write last partition

            _buffer.Dispose();
            _buffer = null !;

            GC.Collect();

            var outputDirectory = Path.GetDirectoryName(Path.GetFullPath(outputFile));

            if (string.IsNullOrWhiteSpace(outputDirectory))
            {
                outputDirectory = ".";
            }
            var merger = new FileMerger(new MergeOptions
            {
                DeletePartitions = true,
                FileMask         = Constants.PartitionFileName,
                Folder           = outputDirectory,
                Output           = outputFile
            });

            merger.Merge();
        }
        public void TestMethod1()
        {
            FileMerger m = new FileMerger();

            m.Merge(@"C:\Source\Repos\large-file-upload-from-browser\LargeFileUpload.Web\Content\Uploads\a3cedb61-0fcc-47e0-b05c-059139e07965",
                    "PRD_Standardization.docx");
            Assert.IsTrue(true);
        }
Beispiel #5
0
        private void MergeFiles()
        {
            bool isSuccess = false;

            try
            {
                // updateLog(string.Format("\r\nStart Time: {0}", DateTime.Now.ToLongTimeString()));
                updateLog(string.Format(Properties.Resources.msgMerging, AppOptions.mergeOrigFile));
                Application.DoEvents();

                FileMerger _merger = new FileMerger(AppOptions.mergeOrigFile, AppOptions.mergeInPath, AppOptions.mergeInfoFile);
                _merger.OnProgress += new FileMerger.OnProgressDelegate(updateProgress);
                _merger.Merge();

                if (_merger.FilesCount.HasValue)
                {
                    updateLog(string.Format(Properties.Resources.msgMergeScc, _merger.FilesCount.Value));
                }
                else
                {
                    updateLog(Properties.Resources.errMergeNoFiles);
                }

                isSuccess = true;
                // updateLog(string.Format("End Time: {0}\r\n", DateTime.Now.ToLongTimeString()));
            }
            catch (Exception ex)
            {
                updateLog(string.Format(Properties.Resources.errMergeUnexp, ex.Message));
            }

            updateProgress(100);

            if (isSuccess)
            {
                MessageBox.Show(Properties.Resources.msbMergeFinished,
                                Properties.Resources.MergeTitle,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(Properties.Resources.errMerge,
                                Properties.Resources.MergeTitle,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }

            changeButtonsView(true);
        }
Beispiel #6
0
        private static int ExecuteMerge(MergeOptions options)
        {
            if (!options.Validate())
            {
                return(1);
            }

            var merger = new FileMerger(options);
            var timer  = Stopwatch.StartNew();

            var partitionCount = Directory.GetFiles(options.Folder, options.FileMask).Length;

            Console.WriteLine($"Merge {partitionCount} partition started...");

            merger.Merge();

            Console.WriteLine($"Partitions merge executed at {timer.Elapsed}");
            return(0);
        }
        public void MergeFile(string id, string name)
        {
            FileMerger merger = new FileMerger();

            merger.Merge(Path.Combine(Configurations.UploadsFolder, id.ToString()), name);
        }