Ejemplo n.º 1
0
        /// <summary>
        /// RESTORE An Archive file to target output folder
        /// </summary>
        /// <param name="_Input">Input file, Must be `.arc`</param>
        /// <param name="_Output">Output folder, If null, it will be same as input file folder</param>
        /// <param name="_Flag_Folder">Extract files to a subfolder of `_output`</param>
        /// <param name="_Mode">0: Normal, 1:Merge, 2:Restore To EncAudio</param>
        /// <param name="onComplete">(completeStatus)</param>
        /// <returns>Preliminary  Success</returns>
        public static bool startJob_RestoreCD(
            string _Input,
            string _Output,
            bool _Flag_Folder,
            int _Mode,
            Action <bool> onComplete)
        {
            // NOTE : JOB checks for input file
            if (LOCKED)
            {
                ERROR = "Engine is working"; return(false);
            }
            if (!FFMPEG_OK)
            {
                ERROR = "FFmpeg is not set"; return(false);
            }

            LOCKED = true;

            var par = new RestoreParams {
                inputFile      = _Input,                // Checked in the JOB
                outputDir      = _Output,               // Checked in the JOB
                flag_folder    = _Flag_Folder,
                mode           = _Mode,
                expectedTracks = HACK_CD_TRACKS
            };

            var j = new JobRestore(par);

            j.MAX_CONCURRENT = MAX_TASKS;
            j.onJobStatus    = jobStatusHandler;                        // For status and progress updates
            j.onComplete     = (s) =>
            {
                LOCKED = false;
                ERROR  = j.ERROR[1];
                onComplete(s);
            };

            j.start();

            return(true);
        }        // -----------------------------------------
Ejemplo n.º 2
0
        }        // -----------------------------------------

        /// <summary>
        /// RESTORE an arc file to target output folder
        /// </summary>
        /// <param name="_Input">Input file, Must be `.arc`</param>
        /// <param name="_Output">Output folder, If null, it will be same as input file folder</param>
        /// <param name="onComplete">(completeStatus)</param>
        /// <returns></returns>
        public static bool restoreARC(string _Input, string _Output,
                                      bool flag_folder, bool flag_forceSingle, Action <bool> onComplete)
        {
            // NOTE : JOB checks for input file
            if (LOCKED)
            {
                ERROR = "Engine is working"; return(false);
            }
            if (!FFMPEG_OK)
            {
                ERROR = "FFmpeg is not set"; return(false);
            }

            LOCKED = true;

            var par = new RestoreParams {
                inputFile        = _Input,              // Checked in the JOB
                outputDir        = _Output,             // Checked in the JOB
                flag_folder      = flag_folder,
                flag_forceSingle = flag_forceSingle     // SINGLE FILE
            };

            var j = new JobRestore(par);

            j.MAX_CONCURRENT = MAX_TASKS;
            j.onComplete     = (s) =>
            {
                LOCKED = false;
                ERROR  = j.ERROR[1];
                onComplete(s);
            };

            j.onJobStatus = jobStatusHandler;                           // For status and progress updates
            j.start();

            return(true);
        }        // -----------------------------------------