예제 #1
0
        public ConfigForm(ForwarderController controller)
        {
            this.Font = System.Drawing.SystemFonts.MessageBoxFont;
            InitializeComponent();

            // a dirty hack
            this.ServersListBox.Dock = System.Windows.Forms.DockStyle.Fill;
            this.PerformLayout();

            this.Icon = Icon.FromHandle(Resources.f128.GetHicon());

            this.controller           = controller;
            controller.ConfigChanged += controller_ConfigChanged;

            LoadCurrentConfiguration();
        }
예제 #2
0
        public SSForwardView(ForwarderController controller)
        {
            _controller = controller;
            LoadMenu();

            _controller.EnableStatusChanged += _controller_EnableStatusChanged;
            _controller.ConfigChanged       += _controller_ConfigChanged;
            _controller.Errored             += _controller_Errored;

            _notifyIcon = new NotifyIcon();
            UpdateTrayIcon();
            _notifyIcon.Visible     = true;
            _notifyIcon.ContextMenu = _contextMenu;

            LoadCurrentConfiguration();
            if (controller.GetConfiguration().isDefault)
            {
                _isFirstRun = true;
                ShowConfigForm();
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            if (args != null && args.Length > 0)
            {
                foreach (string s in args)
                {
                    if (s == "--svc")
                    {
                        is_svc = true;
                        break;
                    }
                }
            }
            //Directory.SetCurrentDirectory(Application.StartupPath);
            Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

            Logging.OpenLogFile(is_svc);
            ForwarderController controller = null;

            if (is_svc)
            {
                ServiceBase[] servicesToRun;
                servicesToRun = new ServiceBase[]
                {
                    new Services.TcpUdpForwarder()
                };
                ServiceBase.Run(servicesToRun);
            }
            else
            {
                controller = new ForwarderController(is_svc);
                SSForwardView viewController = new SSForwardView(controller);
                controller.Start();
                Application.Run();
            }
        }
예제 #4
0
 protected override void OnStop()
 {
     controller.Stop();
     controller = null;
 }
예제 #5
0
 protected override void OnStart(string[] args)
 {
     controller = new ForwarderController(true);
     controller.Start();
 }