コード例 #1
0
        // UNECM - UNECM
        // --
        private void button4_Click(object sender, EventArgs e)
        {
            var app = new EcmTools();

            app.onComplete = (s) =>
            {
                if (!s)
                {
                    LOG.log(app.ERROR);
                }
                else
                {
                    LOG.log("ECM COMPLETE");
                }

                FormTools.invoke(this, () => {
                    this.Enabled = true;
                });
            };

            string file = FormTools.fileLoadDialog("ecm")[0];

            if (file != null)
            {
                app.unecm(file + "1");
                this.Enabled = false;
            }
        }
コード例 #2
0
        }// -----------------------------------------

        // --
        public override void start()
        {
            base.start();

            p = (RestoreParams)jobData;

            INPUT             = Path.Combine(p.tempDir, track.storedFileName);
            OUTPUT            = Path.Combine(p.tempDir, track.getFilenameRaw());
            track.workingFile = OUTPUT;     // Point to the new file

            // -
            var fileExt = Path.GetExtension(track.storedFileName);

            requirePostSizeFix = AudioMaster.isLossyByExt(fileExt);

            // --
            if (track.isData)
            {
                var ecm = new EcmTools(CDCRUSH.TOOLS_PATH);
                setupHandlers(ecm);
                ecm.unecm(INPUT);
            }
            else
            {
                // No need to convert back, end the task
                if (p.mode == 2)
                {
                    // Point to correct file
                    track.workingFile = INPUT;
                    complete();
                    return;
                }

                var ffmp = new FFmpeg(CDCRUSH.FFMPEG_PATH);

                if (fileExt.ToLower() == ".tak")
                {
                    var tak = new Tak(CDCRUSH.TOOLS_PATH);
                    setupHandlers(tak);

                    tak.decodeToStream(INPUT, (_out) => {
                        ffmp.convertWavStreamToPCM(OUTPUT, (_in) => {
                            _out.CopyTo(_in);
                            _in.Close();
                        });
                    });
                }
                else
                {
                    setupHandlers(ffmp);
                    ffmp.audioToPCM(INPUT, track.workingFile);
                }
            }

            log("Restoring track -" + track.storedFileName);
        }// -----------------------------------------
コード例 #3
0
        }        // -----------------------------------------

        private void btn_unecm_Click(object sender, EventArgs e)
        {
            if (SELECTED_FILES == null)
            {
                return;
            }
            var app = new EcmTools(prog.CDCRUSH.TOOLS_PATH);

            app.onComplete = (s) => {
                LOG.log("--ECM Complete :: {0}", s);
            };
            app.onProgress = (p) => {
                LOG.log("--ECM Progress :: {0}", p);
            };
            app.unecm(SELECTED_FILES[0]);
        } // -----------------------------------------
コード例 #4
0
        }// -----------------------------------------

        // --
        public override void start()
        {
            base.start();

            p = (RestoreParams)jobData;

            log("Restoring track -" + track.storedFileName);

            // --
            crushedTrackPath = Path.Combine(p.tempDir, track.storedFileName);
            // Set the final track pathname now, I need this for later.
            track.workingFile = Path.Combine(p.tempDir, track.getFilenameRaw());

            // --
            if (track.isData)
            {
                var ecm = new EcmTools(CDCRUSH.TOOLS_PATH);
                ecm.onComplete = (s) => {
                    if (s)
                    {
                        deleteOldFile();
                        if (!checkTrackMD5())
                        {
                            fail(msg: "MD5 checksum is wrong!");
                            return;
                        }
                        complete();
                    }
                    else
                    {
                        fail(msg: ecm.ERROR);
                    }
                };
                ecm.unecm(crushedTrackPath);
                killExtra = () => ecm.kill();
            }
            else
            {
                if (Path.GetExtension(track.storedFileName) == ".ogg")
                {
                    isOgg = true;
                }
                else
                {
                    isFlac = true;             // must be flac
                }

                var ffmp = new FFmpeg(CDCRUSH.FFMPEG_PATH);
                ffmp.onComplete = (s) => {
                    if (s)
                    {
                        deleteOldFile();                 // Don't need it
                        if (isOgg)
                        {
                            correctPCMSize();
                        }
                        if (isFlac)
                        {
                            if (!checkTrackMD5())
                            {
                                fail(msg: "MD5 checksum is wrong!");
                                return;
                            }
                        }
                        complete();
                    }
                    else
                    {
                        fail(msg: ffmp.ERROR);
                    }
                };

                ffmp.audioToPCM(crushedTrackPath);
                killExtra = () => ffmp.kill();
            }
        }// -----------------------------------------
コード例 #5
0
        }// -----------------------------------------

        // --
        public override void start()
        {
            base.start();

            p = (RestoreParams)jobData;

            // --
            crushedTrackPath = Path.Combine(p.tempDir, track.storedFileName);
            // Set the final track pathname now, I need this for later.
            track.workingFile = Path.Combine(p.tempDir, track.getFilenameRaw());

            // --
            if (track.isData)
            {
                var ecm = new EcmTools(CDCRUSH.TOOLS_PATH);
                ecm.onComplete = (s) => {
                    ecm.onProgress = handleProgress;
                    if (s)
                    {
                        deleteOldFile();
                        if (!checkTrackMD5())
                        {
                            fail(msg: "MD5 checksum is wrong!");
                            return;
                        }
                        complete();
                    }
                    else
                    {
                        fail(msg: ecm.ERROR);
                    }
                };
                ecm.unecm(crushedTrackPath);
                killExtra = () => ecm.kill();
            }
            else
            {
                // No need to convert back
                if (p.flag_encCue)
                {
                    // Fix current file
                    track.workingFile = crushedTrackPath;
                    complete();
                    return;
                }

                // --
                isFlac = (Path.GetExtension(track.storedFileName) == ".flac");

                var ffmp = new FFmpeg(CDCRUSH.FFMPEG_PATH);
                ffmp.onProgress = handleProgress;
                ffmp.onComplete = (s) => {
                    if (s)
                    {
                        deleteOldFile();                 // Don't need it
                        if (!isFlac)
                        {
                            // OGG and MP3 don't restore to the exact byte length
                            correctPCMSize();
                        }
                        else
                        {
                            // FLAC restores to exact bytes
                            if (!checkTrackMD5())
                            {
                                fail(msg: "MD5 checksum is wrong!");
                                return;
                            }
                        }
                        complete();
                    }
                    else
                    {
                        fail(msg: ffmp.ERROR);
                    }
                };

                ffmp.audioToPCM(crushedTrackPath);
                killExtra = () => ffmp.kill();
            }

            log("Restoring track -" + track.storedFileName);
        }// -----------------------------------------