コード例 #1
0
ファイル: Program.cs プロジェクト: jlacube/Par2NET
        /*
         Repair commandline /mt- /rf:"C:\Users\Jerome\Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\Tests\EntLib50.par2" /action:ParRepair

         *
         * Create commandline /if:"C:\Users\Jerome\Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\CreateTests\EntLib50.chm" /action:ParCreate /rbc:10 /mtcpu- /mtio-
         *
         *
         * /mtio- /mtcpu- /a:ParVerify /rf:C:\Users\Jerome\Documents\5150.Rue.Des.Ormes.LIMITED.FRENCHDVDRIP.XVID.AC3-TBoss\5150.par2
         *
         * /if:"C:\Users\Jerome\Documents\BigCreate\5150.Rue.Des.Ormes.LIMITED.FRENCHDVDRIP.XVID.AC3-TBoss.part01.rar" /if:"C:\Users\Jerome\Documents\BigCreate\5150.Rue.Des.Ormes.LIMITED.FRENCHDVDRIP.XVID.AC3-TBoss.part02.rar" /if:"C:\Users\Jerome\Documents\BigCreate\5150.Rue.Des.Ormes.LIMITED.FRENCHDVDRIP.XVID.AC3-TBoss.part03.rar" /action:ParCreate /rbc:10 /mtcpu- /mtio-
         *
         * /if:"C:\Users\Jerome\Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\CreateTests\EntLib50.chm" /if:"C:\Users\Jerome\Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\CreateTests\EntLib50_copy.chm" /if:"C:\Users\Jerome\Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\CreateTests\EntLib50_copy2.chm" /rbc:30 /mtio- /mtcpu+ /action:ParCreate
         *
         */
        static void Main(string[] args)
        {
            Par2LibraryArguments par2args = new Par2LibraryArguments();

            if (!Parser.ParseArgumentsWithUsage(args, par2args))
                return;

            switch (par2args.action)
            {
                case ParAction.ParCreate:
                    if (par2args.inputFiles.Length == 0 || (par2args.redundancy == -1 && par2args.recoveryblockcount == -1))
                    {
                        Parser.ArgumentsUsage(par2args.GetType());
                        return;
                    }
                    break;
                case ParAction.ParVerify:
                case ParAction.ParRepair:
                    if (par2args.recoveryFiles.Length == 0)
                    {
                        Parser.ArgumentsUsage(par2args.GetType());
                        return;
                    }
                    break;
            }

            Par2Library library = new Par2Library(par2args.multithreadCPU, par2args.multithreadIO);

            List<string> inputFiles = new List<string>(par2args.inputFiles);
            List<string> recoveryFiles = new List<string>(par2args.recoveryFiles);

            if (string.IsNullOrEmpty(par2args.targetPath))
            {
                if (par2args.action == ParAction.ParCreate)
                    par2args.targetPath = Path.GetDirectoryName(par2args.inputFiles[0]);
                else
                    par2args.targetPath = Path.GetDirectoryName(par2args.recoveryFiles[0]);
            }

            #if TimeTrack
            DateTime startTime = DateTime.Now;
            #endif
            ParResult result = library.Process(par2args);
            #if TimeTrack
            DateTime endTime = DateTime.Now;
            TimeSpan duration = endTime - startTime;

            System.Console.WriteLine("Duration : {0}h{1}m{2}s{3}ms", duration.Hours, duration.Minutes, duration.Seconds, duration.Milliseconds);
            #endif

            System.Console.WriteLine("Par2NET result : {0}", result);
            //recoveryFiles.Add(@"C:\USERS\Projects\__Perso\Par2NET\Par2NET\Tests\EntLib50.vol10+10.PAR2");
            //recoveryFiles.Add(@"C:\Documents and Settings\Jerome\My Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\Tests\EntLib50.vol10+10.PAR2");
            //recoveryFiles.Add(@"C:\Users\Jerome\Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\Tests\EntLib50.vol10+10.PAR2");

            //ParResult result = library.Process(ParVersion.Par2, inputFiles, recoveryFiles, ParAction.ParVerify, @"C:\Documents and Settings\Jerome\My Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\Tests");
            //ParResult result = library.Process(ParVersion.Par2, inputFiles, recoveryFiles, ParAction.ParRepair, @"C:\Documents and Settings\Jerome\My Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\Tests");
        }
コード例 #2
0
        private void FullChainRoot_InnerDomain(string[] args, bool needRepair)
        {
            Par2LibraryArguments par2args = new Par2LibraryArguments();

            if (!Parser.ParseArgumentsWithUsage(args, par2args))
            {
                return;
            }

            switch (par2args.action)
            {
            case ParAction.ParCreate:
                if (par2args.inputFiles.Length == 0 || (par2args.redundancy == -1 && par2args.recoveryblockcount == -1))
                {
                    Parser.ArgumentsUsage(par2args.GetType());
                    return;
                }
                break;

            case ParAction.ParVerify:
            case ParAction.ParRepair:
                if (par2args.recoveryFiles.Length == 0)
                {
                    Parser.ArgumentsUsage(par2args.GetType());
                    return;
                }
                break;
            }

            Par2Library library = new Par2Library(par2args.multithreadCPU, par2args.multithreadIO);

            List <string> inputFiles    = new List <string>(par2args.inputFiles);
            List <string> recoveryFiles = new List <string>(par2args.recoveryFiles);

            if (string.IsNullOrEmpty(par2args.targetPath))
            {
                if (par2args.action == ParAction.ParCreate)
                {
                    par2args.targetPath = Path.GetDirectoryName(par2args.inputFiles[0]);
                }
                else
                {
                    par2args.targetPath = Path.GetDirectoryName(par2args.recoveryFiles[0]);
                }
            }

            ParResult result = library.Process(par2args);

            Assert.AreEqual <ParResult>(ParResult.Success, result);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: jhdscript/Par2NET
        /*
         * Repair commandline /mt- /rf:"C:\Users\Jerome\Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\Tests\EntLib50.par2" /action:ParRepair
         *
         *
         * Create commandline /if:"C:\Users\Jerome\Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\CreateTests\EntLib50.chm" /action:ParCreate /rbc:10 /mtcpu- /mtio-
         *
         *
         * /mtio- /mtcpu- /a:ParVerify /rf:C:\Users\Jerome\Documents\5150.Rue.Des.Ormes.LIMITED.FRENCHDVDRIP.XVID.AC3-TBoss\5150.par2
         *
         * /if:"C:\Users\Jerome\Documents\BigCreate\5150.Rue.Des.Ormes.LIMITED.FRENCHDVDRIP.XVID.AC3-TBoss.part01.rar" /if:"C:\Users\Jerome\Documents\BigCreate\5150.Rue.Des.Ormes.LIMITED.FRENCHDVDRIP.XVID.AC3-TBoss.part02.rar" /if:"C:\Users\Jerome\Documents\BigCreate\5150.Rue.Des.Ormes.LIMITED.FRENCHDVDRIP.XVID.AC3-TBoss.part03.rar" /action:ParCreate /rbc:10 /mtcpu- /mtio-
         *
         * /if:"C:\Users\Jerome\Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\CreateTests\EntLib50.chm" /if:"C:\Users\Jerome\Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\CreateTests\EntLib50_copy.chm" /if:"C:\Users\Jerome\Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\CreateTests\EntLib50_copy2.chm" /rbc:30 /mtio- /mtcpu+ /action:ParCreate
         *
         */
        static void Main(string[] args)
        {
            Par2LibraryArguments par2args = new Par2LibraryArguments();

            if (!Parser.ParseArgumentsWithUsage(args, par2args))
            {
                return;
            }

            switch (par2args.action)
            {
            case ParAction.ParCreate:
                if (par2args.inputFiles.Length == 0 || (par2args.redundancy == -1 && par2args.recoveryblockcount == -1))
                {
                    Parser.ArgumentsUsage(par2args.GetType());
                    return;
                }
                break;

            case ParAction.ParVerify:
            case ParAction.ParRepair:
                if (par2args.recoveryFiles.Length == 0)
                {
                    Parser.ArgumentsUsage(par2args.GetType());
                    return;
                }
                break;
            }

            Par2Library library = new Par2Library(par2args.multithreadCPU, par2args.multithreadIO);

            List <string> inputFiles    = new List <string>(par2args.inputFiles);
            List <string> recoveryFiles = new List <string>(par2args.recoveryFiles);

            if (string.IsNullOrEmpty(par2args.targetPath))
            {
                if (par2args.action == ParAction.ParCreate)
                {
                    par2args.targetPath = Path.GetDirectoryName(par2args.inputFiles[0]);
                }
                else
                {
                    par2args.targetPath = Path.GetDirectoryName(par2args.recoveryFiles[0]);
                }
            }

#if TimeTrack
            DateTime startTime = DateTime.Now;
#endif
            ParResult result = library.Process(par2args);
#if TimeTrack
            DateTime endTime  = DateTime.Now;
            TimeSpan duration = endTime - startTime;

            System.Console.WriteLine("Duration : {0}h{1}m{2}s{3}ms", duration.Hours, duration.Minutes, duration.Seconds, duration.Milliseconds);
#endif

            System.Console.WriteLine("Par2NET result : {0}", result);
            //recoveryFiles.Add(@"C:\USERS\Projects\__Perso\Par2NET\Par2NET\Tests\EntLib50.vol10+10.PAR2");
            //recoveryFiles.Add(@"C:\Documents and Settings\Jerome\My Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\Tests\EntLib50.vol10+10.PAR2");
            //recoveryFiles.Add(@"C:\Users\Jerome\Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\Tests\EntLib50.vol10+10.PAR2");

            //ParResult result = library.Process(ParVersion.Par2, inputFiles, recoveryFiles, ParAction.ParVerify, @"C:\Documents and Settings\Jerome\My Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\Tests");
            //ParResult result = library.Process(ParVersion.Par2, inputFiles, recoveryFiles, ParAction.ParRepair, @"C:\Documents and Settings\Jerome\My Documents\Visual Studio 2010\Projects\Par2NET\Par2NET\Tests");
        }