Example #1
0
        public override void RunSub(ICloneable _threadParameter)
        {
            this.JudgeTaskCancelFlag();
            CheckFileParameter param = (CheckFileParameter)_threadParameter;

            MatchFile.CheckDirectoryIsExists(param.OriginalDirectory, true);
            MatchFile.CheckDirectoryIsExists(param.OutputDirectory, true);

            DirectoryInfo originalFold    = new DirectoryInfo(param.OriginalDirectory);
            DirectoryInfo destinationFold = new DirectoryInfo(param.OutputDirectory);


            var originalfiles    = originalFold.GetFiles();
            var destinationfiles = destinationFold.GetFiles();
            List <CheckResult> listCheckResult    = new List <CheckResult>();
            List <PairFile>    convertingFileList = MatchFile.GetPairFileList(param);

            // Check Original First
            foreach (FileInfo file in originalfiles)
            {
                this.JudgeTaskCancelFlag();
                CheckResult checkresult = this.AnalyzeandReturnCheckResult(file, convertingFileList, destinationfiles);
                listCheckResult.Add(checkresult);
            }
            //check destination
            foreach (FileInfo file in destinationfiles)
            {
                this.JudgeTaskCancelFlag();
                CheckResult checkresult;
                try
                {
                    checkresult = listCheckResult.First(f =>
                    {
                        return((f.DestinationFileNameWithExtension == Path.GetFileNameWithoutExtension(file.Name)) && (f.DestinationExtension == Path.GetExtension(file.Name)));
                    });
                    if (checkresult == null)
                    {
                        // Destination is more than original
                        listCheckResult.Add(GetDestinationCheckResult(file));
                    }
                }
                catch (InvalidOperationException ex)
                {
                    // no equal item
                    listCheckResult.Add(GetDestinationCheckResult(file));
                }
                catch (Exception ex)
                {
                }
            }
            LogCheckResult(listCheckResult);
            foreach (DirectoryInfo dir in originalFold.GetDirectories())
            {
                CheckFileParameter paramSub = (CheckFileParameter)param.Clone();
                paramSub.OriginalDirectory = dir.FullName;
                paramSub.OutputDirectory  += "\\" + dir.Name;
                RunSub(paramSub);
            }
        }
Example #2
0
        public override void RunSub(ICloneable _threadParameter)
        {
            this.JudgeTaskCancelFlag();
            CheckFileParameter param = (CheckFileParameter)_threadParameter;

            MatchFile.CheckDirectoryIsExists(param.OriginalDirectory, true);
            MatchFile.CheckDirectoryIsExists(param.OutputDirectory, true);

            DirectoryInfo originalFold    = new DirectoryInfo(param.OriginalDirectory);
            DirectoryInfo destinationFold = new DirectoryInfo(param.OutputDirectory);


            var originalfiles    = originalFold.GetFiles();
            var destinationfiles = destinationFold.GetFiles();
            List <CheckResult> listCheckResult    = new List <CheckResult>();
            List <PairFile>    convertingFileList = MatchFile.GetPairFileList(param);

            // Check Original First
            foreach (FileInfo file in originalfiles)
            {
                this.JudgeTaskCancelFlag();
                CheckResult checkresult = this.AnalyzeandReturnCheckResult(file, convertingFileList, destinationfiles);
                if ((checkresult.OriginalFileNameWithExtension == checkresult.DestinationFileNameWithExtension) &&
                    (checkresult.OriginalExtension == checkresult.DestinationExtension) &&
                    (checkresult.OriginalFileSize == checkresult.DestinationFileSize))
                {
                    listCheckResult.Add(checkresult);
                }
            }
            //check destination

            LogCheckResult(listCheckResult);
            foreach (DirectoryInfo dir in originalFold.GetDirectories())
            {
                CheckFileParameter paramSub = (CheckFileParameter)param.Clone();
                paramSub.OriginalDirectory = dir.FullName;
                paramSub.OutputDirectory  += "\\" + dir.Name;
                RunSub(paramSub);
            }
        }