Esempio n. 1
0
        void Dump(bool isBatch)
        {
            if (m_Vd == null)
            {
                m_Vd = new ViewerDumper(this);
            }

            if (!int.TryParse(pidTextBox.Text, out int pid) || pid == 0)
            {
                ErrorMsg("Hey, type in valid value into PID box, seriously!");
                return;
            }

            _UpdateEffectivePath( );
            // Check if file already exists
            if (File.Exists(effectivePathTextBox.Text))
            {
                InfoMsg($"Looks like there is file exists at\n{effectivePathTextBox.Text}\nPlease resolve this manually, for safety reason (loss of data), program will not continue.");
                return;
            }

            // Try create directory once
            if (!Directory.Exists(savePathTextBox.Text))
            {
                Directory.CreateDirectory(savePathTextBox.Text);
            }

            if (!Directory.Exists(savePathTextBox.Text))
            {
                ErrorMsg($"Save path \n{savePathTextBox.Text}\nis invalid");
                return;
            }

            // Resetup if PID changed
            if (m_Vd.TargetPid != pid)
            {
                m_Vd.SetupTargetPid(pid);
            }

            m_Vd.BasePageOffset     = (int)startPageInput.Value;
            m_Vd.BaseSavePath       = savePathTextBox.Text;
            m_Vd.BetweenPageDelayMs = (int)betweenPageDelay.Value;
            m_Vd.SetupOutputEncoder(UsingOutputImageFormat);

            if (!m_Vd.IsReady)
            {
                ErrorMsg($"Cannot open DLSiteViewer process ID {pid}");
                return;
            }

            if (m_Popup == null)
            {
                m_Popup = new WorkingDialog(this);
            }

            backgroundWorker1.RunWorkerAsync(isBatch);
            m_Popup.ShowDialog(this);   // ShowDialog is blocking call
        }
Esempio n. 2
0
        private void BackgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            m_Popup.Close( ); // Note: this will dispose, so also set null, credit to ntsa (https://forums.e-hentai.org/index.php?showuser=189943) for this finding
            m_Popup = null;

            if (e.Cancelled)
            {
                InfoMsg("User cancelled operation. Are you joking to me?");
            }
            else
            {
                string s = e.Result as string;
                InfoMsg(s + "\nYou can also try using HTML generator to make a viewer HTML.");
            }
        }