Exemple #1
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!RightMenu.Init())
            {
                return;
            }

            if (args.Length > 0)
            {
                if (args[0] == "-reg")
                {
                    RightMenu.Add();
                    return;
                }
                else if (args[0] == "-unreg")
                {
                    RightMenu.Delete();
                    return;
                }
                Application.Run(new FormMain(args[0]));
            }
            else
            {
                Application.Run(new FormMain());
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            try
            {
                //设置应用程序处理异常方式:ThreadException处理
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                //处理UI线程异常
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                //处理非UI线程异常
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

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

                if (args.Length > 0)
                {
                    string command = args[0];
                    if (command == "-reg")
                    {
                        if (args.Length > 1)
                        {
                            command = args[1];
                            if (command == "-shift")
                            {
                                RightMenu.Add(true);
                                return;
                            }
                        }
                        RightMenu.Add();
                        return;
                    }
                    else if (command == "-unreg")
                    {
                        RightMenu.Delete();
                        return;
                    }
                    // why the disk root directory has '"' ??
                    if (command.LastIndexOf('"') == command.Length - 1)
                    {
                        command = command.Substring(0, command.Length - 1);
                    }

                    Application.Run(new FormMain(command));
                }
                else
                {
                    Client.Start();
                    if (!RightMenu.Init())
                    {
                        return;
                    }
                    Application.Run(new FormMain());
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Exemple #3
0
        static void Main(string[] args)
        {
            try
            {
                //设置应用程序处理异常方式:ThreadException处理
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                //处理UI线程异常
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                //处理非UI线程异常
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                I18n.InitCurrentCulture();

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                CommandLine.RedirectConsoleOutput();
                if (args.Length > 0)
                {
                    List <string> commands = new List <string>(args);
                    if (commands[0] == "/reg")
                    {
                        if (args.Length > 1)
                        {
                            commands.Remove("/reg");
                            RightMenu.ShiftSetting shift = commands.Contains("/shift") ? RightMenu.ShiftSetting.True : RightMenu.ShiftSetting.False;
                            RightMenu.FastSetting  fast  = commands.Contains("/fast") ? RightMenu.FastSetting.True : RightMenu.FastSetting.False;
                            RightMenu.Add(shift, fast);
                            return;
                        }
                        RightMenu.Add();
                        return;
                    }
                    else if (commands[0] == "/unreg")
                    {
                        RightMenu.FastSetting fast = commands.Contains("/fast") ? RightMenu.FastSetting.True : RightMenu.FastSetting.False;
                        RightMenu.Delete(fast);
                        return;
                    }
                    else if (commands[0] == "/q")
                    {
                        if (args.Length > 1)
                        {
                            FormMain.QuickPasteEx(commands[1]);
                            return;
                        }
                    }

                    // why the disk root directory has '"' ??
                    if (commands[0].LastIndexOf('"') == commands[0].Length - 1)
                    {
                        commands[0] = commands[0].Substring(0, commands[0].Length - 1);
                    }

                    Application.Run(new FormMain(commands[0]));
                }
                else
                {
                    Client.Start();
                    if (!RightMenu.Init())
                    {
                        return;
                    }
                    Application.Run(new FormMain());
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Exemple #4
0
        static void Main(string[] args)
        {
            try
            {
                //设置应用程序处理异常方式:ThreadException处理
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                //处理UI线程异常
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                //处理非UI线程异常
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                I18n.InitCurrentCulture();

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                CommandLine.RedirectConsoleOutput();
                if (args.Length > 0)
                {
                    List <string> commands = new List <string>(args);
                    if (commands[0] == "/reg")
                    {
                        if (args.Length > 1)
                        {
                            commands.Remove("/reg");
                            RightMenu.ShiftSetting shift = commands.Contains("/shift") ? RightMenu.ShiftSetting.True : RightMenu.ShiftSetting.False;
                            RightMenu.FastSetting  fast  = commands.Contains("/fast") ? RightMenu.FastSetting.True : RightMenu.FastSetting.False;
                            RightMenu.Add(shift, fast);
                            return;
                        }
                        RightMenu.Add();
                        return;
                    }
                    else if (commands[0] == "/unreg")
                    {
                        RightMenu.FastSetting fast = commands.Contains("/fast") ? RightMenu.FastSetting.True : RightMenu.FastSetting.False;
                        RightMenu.Delete(fast);
                        return;
                    }
                    else if (commands[0] == "/q")
                    {
                        // quick paste mode
                        if (args.Length == 2)
                        {
                            ModeController.QuickPasteEx(commands[1]);
                            return;
                        }
                        else if (args.Length == 3)
                        {
                            ModeController.QuickPasteEx(commands[1], commands[2]);
                            return;
                        }
                    }
                    else if (commands[0] == "monitor")
                    {
                        if (ApplicationHelper.IsPasteExMonitorModeProcessExist())
                        {
                            MessageBox.Show(Resources.Strings.TipMonitorProcessExisted,
                                            Resources.Strings.TitleError, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                        // monitor mode
                        Application.Run(new FormMain(null));
                        return;
                    }

                    // why the disk root directory has '"' ??
                    if (commands[0].LastIndexOf('"') == commands[0].Length - 1)
                    {
                        commands[0] = commands[0].Substring(0, commands[0].Length - 1);
                    }

                    Application.Run(new FormMain(commands[0]));
                }
                else
                {
                    Client.Start();
                    if (!RightMenu.Init())
                    {
                        return;
                    }
                    if (Properties.Settings.Default.DefaultStartupMonitorModeEnabled)
                    {
                        // Monitor Mode Entrance 2
                        ApplicationHelper.StartSelf("monitor", false);
                        return;
                    }
                    else
                    {
                        Application.Run(new FormMain());
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }