public static void UnhandledThreadExceptionHandler(object sender, ThreadExceptionEventArgs e)
 {
     GoogleAnalyticsUtils.SendError(CommonSettings.AppName(), CommonSettings.AppVersion(), e.Exception);
     LogHelpers.LogError(e.Exception.Message + "#" + e.Exception.StackTrace);
     MessageBox.Show("Oops, something went wrong! Make sure to update the latest version or leave a comment to report bugs at http://mangabot.github.io. Thank you.", CommonSettings.AppName(), MessageBoxButtons.OK, MessageBoxIcon.Error);
     Application.Exit();
 }
Ejemplo n.º 2
0
        private void tsbtToZip_Click(object sender, EventArgs e)
        {
            if (dgvPhotos.RowCount == 0)
            {
                MessageBox.Show("No photo to ouput.", "Not Found", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            SaveFileDialog sf = new SaveFileDialog();

            sf.Filter = "ZIP|*.zip";
            if (sf.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                String        fileName = sf.FileName;
                List <string> rows     = new List <string>();
                foreach (DataGridViewRow r in dgvPhotos.Rows)
                {
                    if (File.Exists(r.Cells[COLUMN_PATH].Value.ToString()))
                    {
                        rows.Add(r.Cells[COLUMN_PATH].Value.ToString());
                    }
                }

                SetLabelStatus("Zipping photos...");
                EnableOrDisableButtons(false);
                new Thread(new ParameterizedThreadStart((object list) =>
                {
                    try
                    {
                        string filePath      = Path.GetDirectoryName(fileName) + "\\" + Path.GetFileNameWithoutExtension(fileName) + ".zip";
                        List <string> images = (List <string>)list;
                        FileUtils.ZipFiles(images.ToArray(), filePath);
                        EnableOrDisableButtons(true);
                        SetLabelStatus("Complete");
                        ShowMessageBox("Convert successfully");
                    }
                    catch (Exception ex)
                    {
                        GoogleAnalyticsUtils.SendError(Properties.Settings.Default.AppName, Properties.Settings.Default.AppVersion, ex);
                        EnableOrDisableButtons(true);
                        SetLabelStatus("Failed");
                        ShowMessageBox("Convert failed");
                    }
                })).Start(rows);
            }
        }
Ejemplo n.º 3
0
        void executor_DoWork(object sender, DoWorkEventArgs e)
        {
            String parentFolderPath = task.Path;

            Directory.CreateDirectory(parentFolderPath);
            switch (task.Type)
            {
            case Enums.LinkType.MANGA:
                GoogleAnalyticsUtils.SendEvent(CommonSettings.AppName(), CommonSettings.AppVersion(), task.Site.ToString(), EventAction.DOWNLOAD_MANGA, task.Url);
                DownloadManga(e, task);
                break;

            case Enums.LinkType.CHAPTER:
                GoogleAnalyticsUtils.SendEvent(CommonSettings.AppName(), CommonSettings.AppVersion(), task.Site.ToString(), EventAction.DOWNLOAD_CHAPTER, task.Url);
                DownloadChapter(e, task);
                break;

            case Enums.LinkType.PAGE:
                GoogleAnalyticsUtils.SendEvent(CommonSettings.AppName(), CommonSettings.AppVersion(), task.Site.ToString(), EventAction.DOWNLOAD_PAGE, task.Url);
                DownloadPage(task.Name, task.Url, task.Site, parentFolderPath);
                executor.ReportProgress(1, new DownloadData(task.Sender, 100));
                break;
            }
        }