E() public static méthode

public static E ( string content ) : void
content string
Résultat void
Exemple #1
0
        public void EnableProxy(ProxyItem pi)
        {
            Logger.V(">> AppManager.EnableProxy(@1.ProxyAddr:" + pi.m_szProxyAddr + ")");
            m_semaphore.WaitOne();
            string args = true.ToString() + " "
                          + "\"" + pi.m_szProxyAddr + "\" "
                          + "\"" + pi.m_szBypass + "\" "
                          + pi.m_isAutoConfDisabled.ToString();

            RunProcessProxyAgent(args);
            if (IeProxyOptions.ProxyEnable != true ||
                IeProxyOptions.ProxyAddr != pi.m_szProxyAddr ||
                IeProxyOptions.Bypass != pi.m_szBypass ||
                IeProxyOptions.AutoConfDisabled != pi.m_isAutoConfDisabled)
            {
                Logger.W("AppManager.EnableProxy :: "
                         + "Failed to enable system proxy as specified for the 1st round.");
                RunProcessProxyAgent(args);
                if (IeProxyOptions.ProxyEnable != true ||
                    IeProxyOptions.ProxyAddr != pi.m_szProxyAddr ||
                    IeProxyOptions.Bypass != pi.m_szBypass ||
                    IeProxyOptions.AutoConfDisabled != pi.m_isAutoConfDisabled)
                {
                    Logger.E("AppManager.EnableProxy :: "
                             + "Failed to enable system proxy as specified for the 2nd round.");
                }
                else
                {
                    Logger.I("AppManager.EnableProxy :: "
                             + "Correctly enable system proxy as specified for the 2nd round.");
                }
            }
            else
            {
                Logger.I("AppManager.EnableProxy :: "
                         + "Correctly enable system proxy as specified for the 1st round.");
            }
            NotifyGuiNetworkChanged(this, new EventArgs());
            m_semaphore.Release();
            Logger.V("<< AppManager.EnableProxy(@1.ProxyAddr:" + pi.m_szProxyAddr + ")");
        }
Exemple #2
0
        public void EnableProxy()
        {
            Logger.V(">> AppManager.EnableProxy");
            m_semaphore.WaitOne();
            string szProxyAddr = IeProxyOptions.ProxyAddr;
            string szBypass    = IeProxyOptions.Bypass;
            string args        = true.ToString() + " "
                                 + "\"" + szProxyAddr + "\" "
                                 + "\"" + szBypass + "\" "
                                 + true.ToString();

            RunProcessProxyAgent(args);
            if (IeProxyOptions.ProxyEnable != true ||
                IeProxyOptions.AutoConfDisabled != true)
            {
                Logger.W("AppManager.EnableProxy :: "
                         + "Failed to enable system proxy for the 1st round.");
                System.Threading.Thread.Sleep(1000);
                RunProcessProxyAgent(args);
                if (IeProxyOptions.ProxyEnable != true ||
                    IeProxyOptions.AutoConfDisabled != true)
                {
                    Logger.E("AppManager.EnableProxy :: "
                             + "Failed to enable system proxy for the 2nd round.");
                }
                else
                {
                    Logger.I("AppManager.EnableProxy :: "
                             + "Correctly enable system proxy for the 2nd round.");
                }
            }
            else
            {
                Logger.I("AppManager.EnableProxy :: "
                         + "Correctly enable system proxy for the 1st round.");
            }
            NotifyGuiNetworkChanged(this, new EventArgs());
            m_semaphore.Release();
            Logger.V("<< AppManager.EnableProxy");
        }
Exemple #3
0
        static void Main()
        {
            try {
                string path = Process.GetCurrentProcess().MainModule.FileName;
                path = Path.GetDirectoryName(path);

                bool  createdNew;
                Mutex instance = new Mutex(true,
                                           Process.GetCurrentProcess().ProcessName, out createdNew);

                if (createdNew)
                {
                    Logger.Initialize(
                        Path.Combine(path, AppManager.APP_NEW_LOG_FILE_NAME),
                        Path.Combine(path, AppManager.APP_OLD_LOG_FILE_NAME));
                    AppManager appManager = new AppManager(path);

                    if (!appManager.LoadAppEnvironment())
                    {
                        string msg = @"'" + AppManager.PROXY_AGENT_FILE_NAME
                                     + "' is missing." + Environment.NewLine
                                     + @"Failed to launch " + AppManager.ASSEMBLY_PRODUCT + @".";
                        Logger.E(msg);
                        MessageBox.Show(msg,
                                        AppManager.ASSEMBLY_PRODUCT,
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);
                        if (appManager.LoadAppProfile())
                        {
                            string msg = @"New profile '" + Profile.PROFILE_FILE_NAME
                                         + @"' has been created successfully.";
                            Logger.I(msg);
                            DialogResult dr = MessageBox.Show(msg
                                                              + Environment.NewLine
                                                              + @"It is strongly recommended to set the options before using "
                                                              + AppManager.ASSEMBLY_PRODUCT + @"."
                                                              + Environment.NewLine
                                                              + @"Would you like to set the options right now?",
                                                              AppManager.ASSEMBLY_PRODUCT,
                                                              MessageBoxButtons.YesNo,
                                                              MessageBoxIcon.Question);

                            if (dr == DialogResult.Yes)
                            {
                                dr = DlgOptions.Instance.ShowDialog(
                                    appManager.AppProfile);
                                if ((dr == DialogResult.OK) &&
                                    (!appManager.AppProfile.Equals(DlgOptions.DlgProfile)))
                                {
                                    appManager.AppProfile = new Profile(DlgOptions.DlgProfile);
                                    Profile.Save(DlgOptions.DlgProfile);
                                }
                            }
                        }
                        if (!appManager.IsLoadAppProfileFailed())
                        {
                            Application.Run(new FormMain(appManager));
                        }
                    }

                    instance.ReleaseMutex();
                }
                else
                {
                    MessageBox.Show(
                        "ProxyManager is already running.",
                        AppManager.ASSEMBLY_PRODUCT,
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                }
            } catch (Exception x) {
                string msg = x.Message + Environment.NewLine + x.StackTrace;
                Logger.E(msg);
                MessageBox.Show(msg,
                                AppManager.ASSEMBLY_PRODUCT,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            } finally {
                Logger.Terminate();
            }
        }