Files
ChanSort/source/ChanSort/Program.cs
hbeham 6776b21454 - update to DX 17.1.7
- added a "DllName" property to all loaders (set automatically in the main app) for improved error output
- added a "View" class that lets loaders show a dialog prompt without adding direct references to DX assemblies
- Samsung SCM loader now prompts for TV series if it can't be auto-detected uniquely
- added fixes for Samsung .zip format from 288adf7bd2
- added popup to open download page for VC2010 x86 redist if not installed (needed to open SQLite files)
- added hack to work around a problem in the SharpZipLib when Windows returns an invalid code page
2017-10-28 13:20:39 +02:00

53 lines
1.7 KiB
C#

using System;
using System.Globalization;
using System.Threading;
using System.Windows.Forms;
namespace ChanSort.Ui
{
static class Program
{
internal static bool ChangeLanguage;
[STAThread]
static void Main()
{
// if there is no valid locale set up in the Windows region settings, SharpZipLib will fail to open zip files.
if (Thread.CurrentThread.CurrentCulture.TextInfo.OEMCodePage <= 1)
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
if (Thread.CurrentThread.CurrentUICulture.TextInfo.OEMCodePage <= 1)
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.ThreadException += Application_ThreadException;
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
DevExpress.Skins.SkinManager.EnableFormSkins();
do
{
ChangeLanguage = false;
Application.Run(new MainForm());
} while (ChangeLanguage);
}
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
HandleException(e.Exception);
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
HandleException(e.ExceptionObject as Exception);
}
private static void HandleException(Exception ex)
{
MessageBox.Show(
"Bei der Programmausführung trat folgender Fehler auf:\n" + (ex == null ? "(null)" : ex.ToString()),
"Fehler bei Programmausführung", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}