Ejemplo n.º 1
0
        private void btnPartialSave_Click(object sender, EventArgs e)
        {
            //btnTempLoad_Click(sender, e);
            Part_Editor pe = new Part_Editor();

            pe.mov = mov;
            pe.Show();
        }
Ejemplo n.º 2
0
        // Load Movie
        private void btnLoadMovie_Click(object sender, EventArgs e)
        {
            // Get the movie!
            bool firstFind = true;

            if (mov != null)
            {
                firstFind = false;
                mov.Dispose();
            }

            mov = new MovieEditor();
            if (mov.GetMovie(rdoVer9.Checked ? 9 : 432, (int)numInst.Value - 1) != 0)
            {
                return;
            }

            mov.DesyncDetected      += DesyncDetect;
            mov.RerecordIncremented += RerecordInc;
            mov.FrameEdited         += (f, c) => { shouldAutoSave = true; };
            if (firstFind)
            {
                Timer autoSaver = new Timer();
                autoSaver.Interval = 600000; // 10 mins
                autoSaver.Tick    += (s, te) => { AutoSave(); };
                autoSaver.Start();
            }

            // Enable interface.
            numViewFrame.Enabled   = true;
            btnCurrent.Enabled     = true;
            btnSave.Enabled        = true;
            btnInsert.Enabled      = true;
            btnDelete.Enabled      = true;
            btnSetNextTo.Enabled   = true;
            btnPartialSave.Enabled = true;
            lblMovieInfo.Visible   = true;

            // Reset display
            AutoChange         = true;
            numViewFrame.Value = 0;
            AutoChange         = false;
            UpdateDisplay();

            // Hide video find things
            lblInst.Visible   = false;
            numInst.Visible   = false;
            rdoVerHD.Visible  = false;
            rdoVer9.Visible   = false;
            btnLoadMovie.Text = "Refind";

            // Check for autosaved movie
            if (firstFind)
            {
                bool loadedMovie = false;
                if (File.Exists(GetAutoSaveMoviePath()))
                {
                    if (MessageBox.Show("The last movie was not saved. Do you wish to load the auto-saved version?", "Load auto-save?", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                    {
                        byte[] data = File.ReadAllBytes(GetAutoSaveMoviePath());
                        mov.reRecords = BitConverter.ToInt32(data, 0);
                        byte[] inputData = new byte[data.Length - 4];
                        Array.Copy(data, 4, inputData, 0, inputData.Length);

                        string loadingStr = "Loading autosave...";
                        lblDesync.Text = loadingStr;
                        Refresh();
                        mov.deleteFrames(0, mov.MovieLength - 1);
                        mov.UsePSave(inputData, 0, true);
                        if (lblDesync.Text == loadingStr)
                        {
                            lblDesync.Text = "";
                        }
                        loadedMovie = true;
                    }
                }

                // Are there partials to load?
                DirectoryInfo autoSaveDirectory = new DirectoryInfo(GetAutoSaveMoviePath()).Parent;
                if (autoSaveDirectory.GetFiles().Length > 1)
                {
                    if (loadedMovie || MessageBox.Show("DeSmuME movie editor did not shut down properly last time. Do you wish to load the auto-saved partials?", "Load auto-save?", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                    {
                        Part_Editor p = new Part_Editor();
                        p.mov = mov;
                        p.LoadAutoSavedZones();
                        p.Show();
                    }
                }
            }
        }