コード例 #1
0
 private void BtnExportFiles_Clicked(object sender, EventArgs e)
 {
     try
     {
         foreach (var policyPath in Filenames.EXPOSED_POLICIES)
         {
             File.WriteAllText(policyPath.getAppPublic(), File.ReadAllText(policyPath.getAppPrivate()));
         }
     }
     catch (Exception ex)
     {
         AndroidBridge.e(TAG, ex);
         AndroidBridge.ToastIt("Export failed: " + ex.Message);
     }
 }
コード例 #2
0
        private void BtnImportPolicies_Clicked(object sender, EventArgs e)
        {
            try
            {
                foreach (var policyPath in Filenames.EXPOSED_POLICIES)
                {
                    File.WriteAllText(policyPath.getAppPrivate(), File.ReadAllText(policyPath.getAppPublic()));
                }

                // Reload policies:
                FilteringObjects.httpPolicy.reloadPolicy(File.ReadAllText(Filenames.HTTP_POLICY.getAppPrivate()));
                FilteringObjects.timePolicy.reloadPolicy(File.ReadAllText(Filenames.TIME_POLICY.getAppPrivate()));
            }
            catch (Exception ex)
            {
                AndroidBridge.e(TAG, ex);
                AndroidBridge.ToastIt("Import failed: " + ex.Message);
            }
        }
コード例 #3
0
        private void BtnInfoPage_Clicked(object sender, EventArgs e)
        {
            try
            {
                this.lblGitStatus.Text = GitInfo.GetInfo();

                lblInfo.Text = string.Format("[{0}] BlockZone? {1}, Filtering? {2}, Service up? {3}, Blocked now? {4}, Locked? {5} ",
                                             DateTime.Now,
                                             FilterUtils.FilteringObjects.isInWifiBlockZone,
                                             FilterUtils.FilteringObjects.isFiltering,
                                             AndroidBridge.isForegroundServiceUp(),
                                             FilterUtils.FilteringObjects.timePolicy.isBlockedNow(),
                                             FilterUtils.TimeLock.isLocked()
                                             );
            }
            catch (Exception ex)
            {
                AndroidBridge.e(TAG, ex);
            }
        }