コード例 #1
0
            public void Run()
            {
                IntPtr path = JNIEnv.NewString(m_service.m_configPath);

                try
                {
                    m_service.BroadcastStatus(true);

                    var jclass = JNIEnv.FindClass("com.trojan_plus.android.TrojanPlusVPNService");
                    RunMain(JNIEnv.Handle, jclass, path);
                }
                catch (Exception ex)
                {
                    Log.Error(TAG, ex.Message + "\n" + ex.StackTrace);
                }
                finally
                {
                    JNIEnv.DeleteLocalRef(path);
                }

                m_service.CloseFD();
                m_service.StopSelf();
                m_service.m_worker = null;
                m_service.BroadcastStatus(false);
            }
コード例 #2
0
            public void Run()
            {
                IntPtr path = JNIEnv.NewString(service.runConfigPath);

                try
                {
                    if (service.notification != null)
                    {
                        service.notification.Show();
                    }

                    service.BroadcastStatus(true);

                    var jclass = JNIEnv.FindClass("com.trojan_plus.android.TrojanPlusVPNService");
                    RunMain(JNIEnv.Handle, jclass, path);
                }
                catch (Exception ex)
                {
                    Crashes.TrackError(ex);
                    Log.Error(TAG, ex.Message + "\n" + ex.StackTrace);
                }
                finally
                {
                    JNIEnv.DeleteLocalRef(path);
                }

                if (service.notification != null)
                {
                    service.notification.Destroy();
                }

                service.CloseFD();
                service.StopSelf();
                service.worker = null;
                service.BroadcastStatus(false);
            }