Ejemplo n.º 1
0
 public void ProcessStatistics(object results)
 {
     Monitor.Enter(statisticsLock);
     UpdateCounters((object [])results);
     UpdatePercentage();
     UpdateStatisticControlsCbk updateStatisticControls = new UpdateStatisticControlsCbk(UpdateStatisticControls);
     Invoke(updateStatisticControls);
     Monitor.Exit(statisticsLock);
 }
Ejemplo n.º 2
0
 public void ProcessStatistics(object results)
 {
     Monitor.Enter(statisticsLock);
     UpdateCounters((object [])results);
     UpdatePercentage();
     UpdateStatisticControlsCbk updateStatisticControls = new UpdateStatisticControlsCbk(UpdateStatisticControls);
     Invoke(updateStatisticControls);
     Monitor.Exit(statisticsLock);
 }
Ejemplo n.º 3
0
        public Form1()
        {
            InitializeComponent();
            radioButtonLogHigh3.Click  += new EventHandler(radioButtonLogHigh3_Click);
            radioButtonLogHigh2.Click  += new EventHandler(radioButtonLogHigh2_Click);
            radioButtonLogHigh.Click   += new EventHandler(radioButtonLogHigh_Click);
            radioButtonLogMedium.Click += new EventHandler(radioButtonLogMedium_Click);
            radioButtonLogNone.Click   += new EventHandler(radioButtonLogNone_Click);
            ProxyMode                      = 0;
            listenerList                   = new ArrayList();
            textBoxRemoteIp.Text           = Convert.ToString(GetLocalInternalIP());
            LogUtility.LogUtility.FileName = Environment.CurrentDirectory + "\\log.txt";
            LogUtility.LogUtility.SetLevel(LogUtility.LogLevels.LEVEL_LOG_HIGH3);
            if (File.Exists(LogUtility.LogUtility.FileName))
            {
                File.Delete(LogUtility.LogUtility.FileName);
            }
            Listener.InitGlobalObjects();
            statistics1.DebugMode = false /*true*/;
            m_ContextMenu         = new ContextMenu();
            MenuItem[] logLevelSubItems = new MenuItem[5];
            logLevelSubItems[0] = new MenuItem("None", OnSetLogLevelNone);
            logLevelSubItems[1] = new MenuItem("Medium", OnSetLogLevelMedium);
            logLevelSubItems[2] = new MenuItem("High", OnSetLogLevelHigh);
            logLevelSubItems[3] = new MenuItem("High2", OnSetLogLevelHigh2);
            logLevelSubItems[4] = new MenuItem("High3", OnSetLogLevelHigh3);
            MenuItem menuItem = new MenuItem("Log level", logLevelSubItems);

            m_ContextMenu.MenuItems.Add(menuItem);
            MenuItem[] modeSubItems = new MenuItem[2];
            modeSubItems[0] = new MenuItem("Raw", OnSetModeRaw);
            modeSubItems[1] = new MenuItem("Http", OnSetModePack);
            menuItem        = new MenuItem("Mode", modeSubItems);
            m_ContextMenu.MenuItems.Add(menuItem);
            m_ContextMenu.MenuItems.Add("Start", buttonStart_Click);
            m_ContextMenu.MenuItems.Add("Stop", buttonStop_Click);
            m_ContextMenu.MenuItems.Add("Flush", buttonFlush_Click);
            m_ContextMenu.MenuItems.Add("Set remote IP", SetRemoteIp);
            m_ContextMenu.MenuItems.Add("Reset statistics", ResetStatistics);
            m_NotifyIcon             = new NotifyIcon();
            m_NotifyIcon.Text        = "Receiver side proxy";
            m_NotifyIcon.ContextMenu = m_ContextMenu;
            m_NotifyIcon.Icon        = new System.Drawing.Icon("BlackBerry-8830.ico");
            m_NotifyIcon.Visible     = true;
            Visible                   = false;
            ShowInTaskbar             = false;
            total                     = 0;
            totalSaved                = 0;
            savedPercentage           = 0;
            m_UpdateStatisticControls = new UpdateStatisticControlsCbk(ProcessStatistics);
            m_StatisticsLock          = new object();
            LogUtility.LogUtility.SetSilent(false);
            ProxyMode   = 1;
            this.Shown += new EventHandler(Form1_Shown);
        }
Ejemplo n.º 4
0
 public Form1()
 {
     InitializeComponent();
     radioButtonLogHigh3.Click += new EventHandler(radioButtonLogHigh3_Click);
     radioButtonLogHigh2.Click += new EventHandler(radioButtonLogHigh2_Click);
     radioButtonLogHigh.Click += new EventHandler(radioButtonLogHigh_Click);
     radioButtonLogMedium.Click += new EventHandler(radioButtonLogMedium_Click);
     radioButtonLogNone.Click += new EventHandler(radioButtonLogNone_Click);
     ProxyMode = 0;
     listenerList = new ArrayList();
     textBoxRemoteIp.Text = Convert.ToString(GetLocalInternalIP());
     LogUtility.LogUtility.FileName = Environment.CurrentDirectory + "\\log.txt";
     LogUtility.LogUtility.SetLevel(LogUtility.LogLevels.LEVEL_LOG_HIGH3);
     if (File.Exists(LogUtility.LogUtility.FileName))
     {
         File.Delete(LogUtility.LogUtility.FileName);
     }
     Listener.InitGlobalObjects();
     statistics1.DebugMode = false/*true*/;
     m_ContextMenu = new ContextMenu();
     MenuItem[] logLevelSubItems = new MenuItem[5];
     logLevelSubItems[0] = new MenuItem("None", OnSetLogLevelNone);
     logLevelSubItems[1] = new MenuItem("Medium", OnSetLogLevelMedium);
     logLevelSubItems[2] = new MenuItem("High", OnSetLogLevelHigh);
     logLevelSubItems[3] = new MenuItem("High2", OnSetLogLevelHigh2);
     logLevelSubItems[4] = new MenuItem("High3", OnSetLogLevelHigh3);
     MenuItem menuItem = new MenuItem("Log level", logLevelSubItems);
     m_ContextMenu.MenuItems.Add(menuItem);
     MenuItem[] modeSubItems = new MenuItem[2];
     modeSubItems[0] = new MenuItem("Raw", OnSetModeRaw);
     modeSubItems[1] = new MenuItem("Http", OnSetModePack);
     menuItem = new MenuItem("Mode", modeSubItems);
     m_ContextMenu.MenuItems.Add(menuItem);
     m_ContextMenu.MenuItems.Add("Start", buttonStart_Click);
     m_ContextMenu.MenuItems.Add("Stop", buttonStop_Click);
     m_ContextMenu.MenuItems.Add("Flush", buttonFlush_Click);
     m_ContextMenu.MenuItems.Add("Set remote IP", SetRemoteIp);
     m_ContextMenu.MenuItems.Add("Reset statistics", ResetStatistics);
     m_NotifyIcon = new NotifyIcon();
     m_NotifyIcon.Text = "Receiver side proxy";
     m_NotifyIcon.ContextMenu = m_ContextMenu;
     m_NotifyIcon.Icon = new System.Drawing.Icon("BlackBerry-8830.ico");
     m_NotifyIcon.Visible = true;
     Visible = false;
     ShowInTaskbar = false;
     total = 0;
     totalSaved = 0;
     savedPercentage = 0;
     m_UpdateStatisticControls = new UpdateStatisticControlsCbk(ProcessStatistics);
     m_StatisticsLock = new object();
     LogUtility.LogUtility.SetSilent(false);
     ProxyMode = 1;
     this.Shown += new EventHandler(Form1_Shown);
 }
Ejemplo n.º 5
0
        public Form1()
        {
            InitializeComponent();
            radioButtonLogHigh3.Click  += new EventHandler(radioButtonLogHigh3_Click);
            radioButtonLogHigh2.Click  += new EventHandler(radioButtonLogHigh2_Click);
            radioButtonLogHigh.Click   += new EventHandler(radioButtonLogHigh_Click);
            radioButtonLogMedium.Click += new EventHandler(radioButtonLogMedium_Click);
            radioButtonLogNone.Click   += new EventHandler(radioButtonLogNone_Click);
            radioButtonHttp.Click      += new EventHandler(radioButtonHttp_Click);
            radioButtonRaw.Click       += new EventHandler(radioButtonRaw_Click);
            radioButtonPackHttp.Click  += new EventHandler(radioButtonPackHttp_Click);
            radioButtonPackRaw.Click   += new EventHandler(radioButtonPackRaw_Click);
            listenerList = new ArrayList();
            LogUtility.LogUtility.FileName = Environment.CurrentDirectory + "\\log.txt";
            LogUtility.LogUtility.SetLevel(LogUtility.LogLevels.LEVEL_LOG_HIGH3);
            if (File.Exists(LogUtility.LogUtility.FileName))
            {
                File.Delete(LogUtility.LogUtility.FileName);
            }
            if (radioButtonHttp.Checked)
            {
                ProxyType = 1;
            }
            else if (radioButtonPackHttp.Checked)
            {
                ProxyType = 2;
            }
            else
            {
                ProxyType = 0;
            }
            statistics1.DebugMode = false /*true*/;
            m_ContextMenu         = new ContextMenu();
            MenuItem [] logLevelSubItems = new MenuItem[5];
            logLevelSubItems[0] = new MenuItem("None", OnSetLogLevelNone);
            logLevelSubItems[1] = new MenuItem("Medium", OnSetLogLevelMedium);
            logLevelSubItems[2] = new MenuItem("High", OnSetLogLevelHigh);
            logLevelSubItems[3] = new MenuItem("High2", OnSetLogLevelHigh2);
            logLevelSubItems[4] = new MenuItem("High3", OnSetLogLevelHigh3);
            MenuItem menuItem = new MenuItem("Log level", logLevelSubItems);

            m_ContextMenu.MenuItems.Add(menuItem);
            MenuItem[] modeSubItems = new MenuItem[4];
            modeSubItems[0] = new MenuItem("Raw", OnSetModeRaw);
            modeSubItems[1] = new MenuItem("Http", OnSetModeHttp);
            modeSubItems[2] = new MenuItem("Pack raw", OnSetModePackRaw);
            modeSubItems[3] = new MenuItem("Pack Http", OnSetModePackHttp);
            menuItem        = new MenuItem("Mode", modeSubItems);
            m_ContextMenu.MenuItems.Add(menuItem);
            m_ContextMenu.MenuItems.Add("Start", buttonStart_Click);
            m_ContextMenu.MenuItems.Add("Stop", buttonStop_Click);
            m_ContextMenu.MenuItems.Add("Reset statitics", ResetStatistics);
            m_NotifyIcon             = new NotifyIcon();
            m_NotifyIcon.Text        = "Sender side proxy";
            m_NotifyIcon.ContextMenu = m_ContextMenu;
            m_NotifyIcon.Icon        = new System.Drawing.Icon("Wi-Fi.ico");
            m_NotifyIcon.Visible     = true;
            Visible                   = false;
            ShowInTaskbar             = false;
            totalReceived             = 0;
            totalSent                 = 0;
            totalSaved                = 0;
            savedPercentage           = 0;
            m_UpdateStatisticControls = new UpdateStatisticControlsCbk(ProcessStatistics);
            m_StatisticsLock          = new object();
            ProxyType                 = 2;
            LogUtility.LogUtility.SetSilent(false);
        }