Example #1
0
        private void StartClash()
        {
retry:
            try
            {
                clash.Start();
                clash.Exited += Clash_Exited;
            }
            catch (Clash.ServiceMissingException e)
            {
                logger.LogInformation(e, "Clash service not installed.");
                try
                {
                    Clash.InstallClashService();
                }
                catch (Exception ex)
                {
                    logger.LogError(ex, "Install Clash service failed.");
                    ExitApp();
                    return;
                }

                goto retry;
            }
            catch (Exception e)
            {
                logger.LogError(e, "Start Clash failed.");
                MessageBox.Show("Start Clash failed.\n" + e.Message);
                ExitApp();
            }
        }