Ejemplo n.º 1
1
 static void Main(string[] args)
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     SingleInstanceController controller = new SingleInstanceController();
     controller.Run(args);
 }
Ejemplo n.º 2
1
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string path = Application.UserAppDataRegistry.Name.Substring(0, Application.UserAppDataRegistry.Name.LastIndexOf("\\"));
            path = path.Substring(path.IndexOf('\\') + 1);
            RegistryKey root = Registry.CurrentUser;
            settings = root.CreateSubKey(path);
            ViewerSettings = settings.CreateSubKey("Viewer");

            Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            Log("Startup");
            controller = new SingleInstanceController(args);
            controller.Run(args);
        }
Ejemplo n.º 3
0
        static void Main()
        {
            AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolve;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Toolbox.Library.Runtime.ExecutableDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);

            string[] args = Environment.GetCommandLineArgs();

            List <string> Files = new List <string>();

            foreach (var arg in args)
            {
                if (arg != Application.ExecutablePath)
                {
                    Files.Add(arg);
                }
            }

            try
            {
                Config.StartupFromFile(Runtime.ExecutableDir + "\\config.xml");
                Config.GamePathsFromFile(Runtime.ExecutableDir + "\\config_paths.xml");
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Failed to load config file! {ex}");
            }

            var domain = AppDomain.CurrentDomain;

            domain.AssemblyResolve += LoadAssembly;

            bool LoadedDX = TryLoadDirectXTex();

            if (!LoadedDX && !Toolbox.Library.Runtime.UseDirectXTexDecoder)
            {
                var result = MessageBox.Show("Direct X Tex Failed to load! Make sure to install Visual C++ and Direct X Tex. Do you want to go to the install sites?", "", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start("https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads");
                    System.Diagnostics.Process.Start("https://www.microsoft.com/en-us/download/details.aspx?id=35");
                }
            }

            MainForm.LoadConfig();

            if (Toolbox.Library.Runtime.UseSingleInstance)
            {
                SingleInstanceController controller = new SingleInstanceController();
                controller.Run(args);
            }
            else
            {
                MainForm form = new MainForm();
                form.OpenedFiles = Files;
                Application.Run(form);
            }
        }
Ejemplo n.º 4
0
        private static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            SingleInstanceController controller = new SingleInstanceController(typeof(MainForm));

            controller.MainFormCreated += delegate
            {
                Container = new UnityContainer().LoadConfiguration("browser");
                var users = Program.Container.Resolve <UserRegistry>();
                users.Add(new OctetString("neither"), DefaultPrivacyProvider.DefaultPair);
                users.Add(new OctetString("authen"), new DefaultPrivacyProvider(new MD5AuthenticationProvider(new OctetString("authentication"))));
                users.Add(new OctetString("privacy"), new DESPrivacyProvider(new OctetString("privacyphrase"),
                                                                             new MD5AuthenticationProvider(new OctetString("authentication"))));


                ToolStripManager.Renderer = new Office2007Renderer.Office2007Renderer();
            };
            controller.Run(args);
        }
Ejemplo n.º 5
0
        private static void Main()
        {
            if (UserSettings.UpdateSettings)
            {
                Settings.Default.Upgrade();
                UserSettings.UpdateSettings = false;
                Settings.Default.Reload();
            }

            Directory.SetCurrentDirectory(UserSettings.PatcherPath);
            Logger.Start();

            string[] args     = Environment.GetCommandLineArgs();
            var      argsList = new List <string>(args);

            argsList.Insert(0, Thread.CurrentThread.ManagedThreadId.ToString());
            Logger.Debug(Methods.MethodFullName(System.Reflection.MethodBase.GetCurrentMethod(), argsList.ToArray()));

            if (UserSettings.UseCustomTranslationServer && !string.IsNullOrWhiteSpace(UserSettings.CustomTranslationServer))
            {
                Urls.TranslationGitHubHome = UserSettings.CustomTranslationServer;
            }

            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Program.CurrentDomain_UnhandledException);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += new ThreadExceptionEventHandler(Program.Application_ThreadException);
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            var controller = new SingleInstanceController();

            controller.Run(args);
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            SingleInstanceController singleInstanceController = new SingleInstanceController();

            singleInstanceController.Run(args);
        }
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        string[] args = Environment.GetCommandLineArgs();
        SingleInstanceController controller = new SingleInstanceController();

        controller.Run(args);
    }
Ejemplo n.º 8
0
        static void Main()
        {
            string[] args = Environment.GetCommandLineArgs();
            // Register\Unregister APP URL
            {
                int argCount = 0;
                if (args != null && args.Length > 0)
                {
                    try
                    {
                        foreach (string cmd in args)
                        {
                            string command = cmd.StartsWith("/") ? cmd.Substring(1) : cmd;
                            if (command.CompareTo("install") == 0)
                            {
                                // Register service url using netsh to avoid running the app as privileged
                                // user later (Only needed for installation)
                                DemoUtils.RegisterServiceUrl();
                                // Register Custom app url
                                Utils.RegisterAppUrl("Leadtools.WebScanning.Host");
                                return;
                            }
                            else if (command.CompareTo("uninstall") == 0)
                            {
                                DemoUtils.UnRegisterServiceUrl();
                                Utils.UnregisterAppUrl("Leadtools.WebScanning.Host");
                                return;
                            }
                            argCount++;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        return;
                    }
                }
            }

            if (!Support.SetLicense())
            {
                return;
            }

            SingleInstanceController controller;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            controller = new SingleInstanceController();
            controller.Run(args);
        }
Ejemplo n.º 9
0
 static void Main(string[] args)
 {
     try
     {
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         SingleInstanceController controller = new SingleInstanceController();
         controller.Run(args);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error: " + ex.Message + Environment.NewLine +
                         "Arguments: " + Environment.CommandLine, $"{Application.ProductName} - Startup error occurred", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
 }
Ejemplo n.º 10
0
        static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);

            using (SingleInstanceController siController = new SingleInstanceController()) {
                if (siController.RegisterNewInstance())
                {
                    frmMain mainForm = new frmMain();
                    siController.MainForm = mainForm;
                    Application.Run(mainForm);
                }
            }
        }
Ejemplo n.º 11
0
        public static void Main()
        {
            ResolveEventHandler ev = new ResolveEventHandler(AssemblyLoader.AssemblyResolve);

            AppDomain.CurrentDomain.AssemblyResolve    += ev;
            AppDomain.CurrentDomain.UnhandledException += new System.UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.Automatic);

            ApplicationController = new SingleInstanceController();
            ApplicationController.Run(Environment.GetCommandLineArgs());
            AppDomain.CurrentDomain.AssemblyResolve -= ev;
        }
Ejemplo n.º 12
0
        private static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            SingleInstanceController controller = new SingleInstanceController(typeof(MainForm));

            controller.MainFormCreated += delegate
            {
                Container = new UnityContainer().LoadConfiguration("compiler");
                ToolStripManager.Renderer = new Office2007Renderer.Office2007Renderer();
            };
            controller.Run(args);
        }
Ejemplo n.º 13
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string path = Application.UserAppDataRegistry.Name.Substring(0, Application.UserAppDataRegistry.Name.LastIndexOf("\\"));

            path = path.Substring(path.IndexOf('\\') + 1);
            RegistryKey root = Registry.CurrentUser;

            settings = root.CreateSubKey(path);

            Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            Log("Startup");
            controller = new SingleInstanceController(args);
            controller.Run(args);
        }
Ejemplo n.º 14
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var tempPath = Application.StartupPath + @"\temp";

            if (Directory.Exists(tempPath))
            {
                Directory.Delete(tempPath, true);
                Directory.CreateDirectory(tempPath);
            }

#if DEBUG
            Application.Run(new MainForm());
#else
            string[] args = Environment.GetCommandLineArgs();
            SingleInstanceController controller = new SingleInstanceController();
            controller.Run(args);
#endif
        }
Ejemplo n.º 15
0
        private static void Main()
        {
            Directory.SetCurrentDirectory(UserSettings.PatcherPath);
            Logger.Start();

            string[] args     = Environment.GetCommandLineArgs();
            var      argsList = new List <string>(args);

            argsList.Insert(0, Thread.CurrentThread.ManagedThreadId.ToString());
            Logger.Debug(Methods.MethodFullName(System.Reflection.MethodBase.GetCurrentMethod(), argsList.ToArray()));

            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Program.CurrentDomain_UnhandledException);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += new ThreadExceptionEventHandler(Program.Application_ThreadException);
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            var controller = new SingleInstanceController();

            controller.Run(args);
        }
Ejemplo n.º 16
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            string[] args = Environment.GetCommandLineArgs();
            MainForm.executableDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
            //If the update has been installed and there is an update for the updater then run it
            if (Directory.Exists(Path.Combine(MainForm.executableDir, "new_updater/")))
            {
                Directory.Delete(Path.Combine(MainForm.executableDir, "updater/"), true);
                Directory.Move(Path.Combine(MainForm.executableDir, "new_updater/"), Path.Combine(MainForm.executableDir, "updater/"));
            }
            SingleInstanceController controller = new SingleInstanceController();

            controller.Run(args);

            /*MainForm.Instance.filesToOpen = args;
             * MainForm.executableDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
             * Application.Run(MainForm.Instance);*/
        }
Ejemplo n.º 17
0
        static void Main()
        {
            try
            {
#if !DEBUG
                SquirrelAwareApp.HandleEvents(onAppUpdate: UpdateForm.OnAppUpdate,
                                              onAppUninstall: UpdateForm.OnAppUninstall,
                                              onInitialInstall: UpdateForm.OnInitialInstall);
#endif

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                var args = Environment.GetCommandLineArgs();
                SingleInstanceController controller = new SingleInstanceController();
                controller.Run(args);
            }
            catch (Exception ex)
            {
                logger.Fatal(ex);
            }
        }
Ejemplo n.º 18
0
        private static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var controller = new SingleInstanceController(typeof(MainForm));

            controller.MainFormCreated += delegate
            {
                Container = new UnityContainer().LoadConfiguration("compiler");
                ToolStripManager.Renderer = new Office2007Renderer.Office2007Renderer();
                var dir         = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); // Insert the path to your xshd-files.
                var fsmProvider = new FileSyntaxModeProvider(dir);
                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider);                                  // Attach to the text editor.
            };
            controller.Run(args);
        }
Ejemplo n.º 19
0
 static void Main(string[] args)
 {
     try
     {
         using (SingleInstanceController controller = new SingleInstanceController())
         {
             if (controller.IsSingle("{23D5DB57-EB0C-44A3-AC80-0515D8F23471}"))
             {
                 if (!Arguments.Process(args))
                 {
                     Application.EnableVisualStyles();
                     Application.SetCompatibleTextRenderingDefault(false);
                     Application.Run(new ZsForm());
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 20
0
        static void Main(String[] args)
        {
            //AutoCloseMessageBox.ShowMessage(20, "执行此操作需要微信绑定者进行授权!\n请按照公众号提示操作后重试!");
            //return;
            //AutoCloseMessageBox acmb = new AutoCloseMessageBox(100, "123");
            //acmb.ShowDialog();
            //return;
            //PornClassifier.Init();
            //FFMPEGWrapper.Init();
            ////PornClassifier.Instance.ClassifyVideoFile("1.mp4");
            //PornClassifier.Instance.ClassifyVideoFile("D:\\迅雷下载\\国产真实母子视频做爰[连干4次].rmvb");
            //return;
            //FFMPEGWrapper ffmpeg = new FFMPEGWrapper();
            //ffmpeg.Open("1.mp4");
            //ffmpeg.ReadFrame(4000);
            //ffmpeg.Dispose();
            //return;
            //ProcessThreadCollection ptc = Process.GetCurrentProcess().Threads;
            //Console.WriteLine("Start Threads Num: " + ptc.Count);
            //Thread t = new Thread(() =>
            //{
            //    //try
            //    //{
            //        while (true)
            //        {
            //            Console.WriteLine("loop!");
            //        }
            //    //}
            //    //catch (Exception e)
            //    //{
            //    //    Console.WriteLine(e.ToString());
            //    //}
            //});
            //t.Start();
            //Console.WriteLine(t.ThreadState);
            //t.Abort();
            //t.Join();
            //return;
            //Bitmap nbm = new Bitmap(400, 400);
            //Graphics g = Graphics.FromImage(nbm);
            //SolidBrush solidBrush = new SolidBrush(Color.Red);
            //g.FillRectangle(solidBrush, 0, 0, nbm.Width, nbm.Height);
            //SolidBrush stringBrush = new SolidBrush(Color.Yellow);
            //g.DrawString("山妖卫士", new Font("微软雅黑", nbm.Width/10, GraphicsUnit.Pixel), stringBrush, new Point(0, 0));
            //g.Flush();
            //nbm.Save("test.jpg");
            //return;
            //for (int i = 0; i < 1000;i++ )
            //{
            //    //pdb.InsertPornPic("http://www.ifeng.com/yxz.jpg", PornClassifier.ImageType.P**n);
            //    PornDatabase pdb = new PornDatabase();
            //}
            //return;
            //FileSystemWatcher watcher = new FileSystemWatcher();
            //LocalScan.LocalScanWork();
            //SystemProxyHelper.EnableProxyHTTP("127.0.0.1", 8090);
            //FireFoxHelper.AddFirefox();
            //string x = Console.ReadLine();
            //SystemProxyHelper.DisableAllProxy();
            //FireFoxHelper.RemoveFirefox();
            //return;
            try
            {
                //throw new Exception("test error 2");
                //when uninstall send email and return
                if (args.Contains("-uninstall"))
                {
                    //NotificationRoutines.SendUninstallNotification().Wait();
                    return;
                }
                RegisterApplicationRestart(null, 0);
                //Init();
                InitLogAndDirs();

                string systemMutexName = "masa_troll_guard_mutex";
                bool   result;
                systemMutex = new System.Threading.Mutex(true, systemMutexName, out result);
                //if(!result)
                //{
                //    log.Error("Exit due to another running instance: " + systemMutex.ToString());
                //    return;
                //}
                //如果是开机启动,则延时两分钟,减少对开机启动时间的影响
                if (args.Contains("-notvisible"))
                {
                    //System.Threading.Thread.Sleep(120000);
                }
                //必须在绑定之前,这样才能正常访问web的绑定服务
                SSLInit();

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                //bool bindingSuccess = true;
                //if (Properties.Settings.Default.openid == "" ||
                //    Properties.Settings.Default.userNickname == "")
                //{
                //    WechatForm bindingForm = WechatForm.GetInstance();
                //    //bindingForm.ShowDialog();
                //    //使用以下一行也可以
                //    //WechatSingleInstanceController controller = new WechatSingleInstanceController();
                //    //controller.Run(args);
                //    Application.Run(bindingForm);
                //    bindingSuccess = bindingForm.BindingSuccess;
                //    RealBindingSucess = bindingForm.BindingSuccess;
                //}

                //if (bindingSuccess)
                //{
                InitForBusinessLogic();
                Application.ApplicationExit += OnApplicationExit;
                //MainForm mainform = new MainForm(args);
                //Application.Run(mainform);
                SingleInstanceController controller = new SingleInstanceController();
                controller.Run(args);
                CleanUp();
                //}
                log.Info("Exit from Main!");
            }
            catch (Exception e)
            {
                //如果意外退出,一定要记得关闭代理,否则会导致用户无法上网
                CleanUp();
                log.Error(e.ToString());
                ReportErrorOnline(e.ToString());
                MessageBox.Show("程序由于未知问题崩溃,我们尽快处理,给您带来的不便敬请谅解!",
                                "程序崩溃", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 21
0
        static void Main(string[] param)
        {
            _param2 = param;
            if (param != null && param.Length > 0)
            {
                _param = param[0];
                if (param.Length > 1)
                {
                    _param_2 = param[1];
                }
                else
                {
                    _param_2 = "";
                }
                if (_param.ToUpper() == "CLOSE")
                {
                    System.Diagnostics.Process.GetCurrentProcess().Kill();
                }

                if (_param.ToUpper() == "SETDB")
                {
                    if (_param2.Length > 1 && _param2[1].Trim().Length > 0)
                    {
                        Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\AMTANGEE\RemoteUrl");
                        if (regKey != null)
                        {
                            if (_param2[1].Trim() == "0")
                            {
                                try
                                {
                                    regKey.SetValue("DefaultDB", "0");
                                    regKey.DeleteValue("DefaultDB");
                                }
                                catch { }
                            }
                            else
                            {
                                regKey.SetValue("DefaultDB", _param2[1].Trim(), RegistryValueKind.String);
                            }
                        }

                        if (_param2[1].Trim() == "0")
                        {
                            MessageBox.Show("Standard-Datenbank für FileViewer wurde auf Standard-Einstellungen zurückgesetzt!");
                        }
                        else
                        {
                            MessageBox.Show("Standard-Datenbank für FileViewer wurde auf '" + _param2[1].Trim() + "' gesetzt!");
                        }
                    }
                    return;
                }

                if (_param == "REG_ALL" || _param == "REG_ALL_ADMIN")
                {
                    try
                    {
                        if (!IsUserAdministrator() && _param != "REG_ALL_ADMIN")
                        {
                            System.Diagnostics.Process process = new System.Diagnostics.Process();
                            process.StartInfo.FileName  = System.Reflection.Assembly.GetEntryAssembly().Location;
                            process.StartInfo.Arguments = "REG_ALL_ADMIN";
                            process.StartInfo.Verb      = "runas";
                            process.Start();
                            return;
                        }
                        RegisterUrl();
                        RegisterSendTo();
                        RegisterEML();
                        RegisterFileOpen();
                        RegisterCall();
                    }
                    catch
                    {
                    }
                    return;
                }

                if (_param == "REG_URL" || _param == "REG_URL_ADMIN")
                {
                    try
                    {
                        if (!IsUserAdministrator() && _param != "REG_URL_ADMIN")
                        {
                            System.Diagnostics.Process process = new System.Diagnostics.Process();
                            process.StartInfo.FileName  = System.Reflection.Assembly.GetEntryAssembly().Location;
                            process.StartInfo.Arguments = "REG_URL_ADMIN";
                            process.StartInfo.Verb      = "runas";
                            process.Start();
                            return;
                        }
                        RegisterUrl();
                    }
                    catch
                    {
                    }

                    MessageBox.Show("Registrierung erfolgreich!");
                    return;
                }
                if (_param == "REG_CALL" || _param == "REG_CALL_ADMIN")
                {
                    try
                    {
                        if (!IsUserAdministrator() && _param != "REG_CALL_ADMIN")
                        {
                            System.Diagnostics.Process process = new System.Diagnostics.Process();
                            process.StartInfo.FileName  = System.Reflection.Assembly.GetEntryAssembly().Location;
                            process.StartInfo.Arguments = "REG_CALL_ADMIN";
                            process.StartInfo.Verb      = "runas";
                            process.Start();
                            return;
                        }
                        RegisterCall();
                    }
                    catch
                    {
                    }

                    MessageBox.Show("Registrierung erfolgreich!");
                    return;
                }
                if (_param == "REG_WITHOUT_PARAM_ADMIN")
                {
                    try
                    {
                        RegisterFileOpen();
                    }
                    catch
                    {
                    }

                    return;
                }


                if (_param == "REG_EML" || _param == "REG_EML_ADMIN")
                {
                    try
                    {
                        if (!IsUserAdministrator() && _param != "REG_EML_ADMIN")
                        {
                            System.Diagnostics.Process process = new System.Diagnostics.Process();
                            process.StartInfo.FileName  = System.Reflection.Assembly.GetEntryAssembly().Location;
                            process.StartInfo.Arguments = "REG_EML_ADMIN";
                            process.StartInfo.Verb      = "runas";
                            process.Start();
                            return;
                        }
                        RegisterEML();
                    }
                    catch (Exception exc)
                    {
                        MessageBox.Show("Fehler beim Registrieren! Fehler: \r\n" + exc.Message);
                    }

                    MessageBox.Show("Registrierung erfolgreich!");
                    return;
                }

                if (_param == "REG_SENDTO")
                {
                    try
                    {
                        RegisterSendTo();
                    }
                    catch
                    {
                    }

                    MessageBox.Show("Registrierung erfolgreich!");
                    return;
                }


                try
                {
                    if (System.IO.File.Exists(_param))
                    {
                        System.IO.FileInfo fi = new System.IO.FileInfo(_param);
                        bool found            = false;
                        switch (fi.Extension.Replace(".", "").ToUpper())
                        {
                        case "EML":
                            SetAssociation(".eml", "EML_File", System.IO.Path.Combine(AMTANGEE.SDK.Global.AMTANGEEDirectory, "FileViewer.exe"), "OPENEML", "4", "EML-Datei");
                            found = true;
                            break;

                        case "MSG":
                            SetAssociation(".msg", "MSG_File", System.IO.Path.Combine(AMTANGEE.SDK.Global.AMTANGEEDirectory, "FileViewer.exe"), "OPENMSG", "4", "MSG-Datei");
                            found = true;
                            break;

                        case "VCF":
                            SetAssociation(".vcf", "VCF_File", System.IO.Path.Combine(AMTANGEE.SDK.Global.AMTANGEEDirectory, "FileViewer.exe"), "OPENVCF", "5", "VCF-Datei");
                            found = true;
                            break;

                        case "ICS":
                            SetAssociation(".ics", "ICS_File", System.IO.Path.Combine(AMTANGEE.SDK.Global.AMTANGEEDirectory, "FileViewer.exe"), "OPENICS", "6", "ICS-Datei");
                            found = true;
                            break;

                        case "VCS":
                            SetAssociation(".vcs", "VCS_File", System.IO.Path.Combine(AMTANGEE.SDK.Global.AMTANGEEDirectory, "FileViewer.exe"), "OPENVCS", "6", "VCS-Datei");
                            found = true;
                            break;
                        }

                        if (found)
                        {
                            System.Diagnostics.Process.Start(_param);
                            return;
                        }
                    }
                }
                catch
                {
                }
            }
            else
            {
                if (!IsUserAdministrator())
                {
                    System.Diagnostics.Process process = new System.Diagnostics.Process();
                    process.StartInfo.FileName  = System.Reflection.Assembly.GetEntryAssembly().Location;
                    process.StartInfo.Arguments = "REG_WITHOUT_PARAM_ADMIN";
                    process.StartInfo.Verb      = "runas";
                    process.Start();
                    return;
                }
                RegisterFileOpen();
                return;
            }
            SingleInstanceController controller = new SingleInstanceController();

            controller.Run(param);
        }