Exemple #1
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();
            }
        }
Exemple #2
0
 protected override void OnStart(string[] args)
 {
     controller = new ForwarderController(true);
     controller.Start();
 }