當前位置: 首頁>>代碼示例>>C#>>正文


C# Controller.ShadowsocksController類代碼示例

本文整理匯總了C#中Shadowsocks.Controller.ShadowsocksController的典型用法代碼示例。如果您正苦於以下問題:C# ShadowsocksController類的具體用法?C# ShadowsocksController怎麽用?C# ShadowsocksController使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ShadowsocksController類屬於Shadowsocks.Controller命名空間,在下文中一共展示了ShadowsocksController類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ServerLogForm

        public ServerLogForm(ShadowsocksController controller)
        {
            this.controller = controller;
            this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon());
            InitializeComponent();
            this.Width = 760;

            Configuration config = controller.GetCurrentConfiguration();
            if (config.configs.Count < 8)
            {
                this.Height = 300;
            }
            else if (config.configs.Count < 20)
            {
                this.Height = 300 + (config.configs.Count - 8) * 16;
            }
            else
            {
                this.Height = 500;
            }
            UpdateTexts();
            UpdateLog();

            this.contextMenu1 = new ContextMenu(new MenuItem[] {
                this.clearItem = CreateMenuItem("&Clear", new EventHandler(this.ClearItem_Click)),
            });
            ServerDataGrid.ContextMenu = contextMenu1;
            controller.ConfigChanged += controller_ConfigChanged;
        }
開發者ID:norkts,項目名稱:shadowsocks-csharp,代碼行數:29,代碼來源:ServerLogForm.cs

示例2: PingForm

        public PingForm(ShadowsocksController sc)
        {
            InitializeComponent();

            var qqwryPath = Environment.CurrentDirectory + "\\qqwry.dat";
            if (Util.Utils.qqwry == null && File.Exists(qqwryPath)) Util.Utils.qqwry = new QQWry(qqwryPath);

            controller = sc;

            Font = Util.Utils.GetFont();

            PerformLayout();

            UpdateTexts();

            Icon = Icon.FromHandle(Resources.ssw128.GetHicon());

            LoadConfiguration(controller.GetConfiguration());

            if (dgvMain.Rows.Count <= 5)
            {
                foreach (var row in dgvMain.Rows)
                {
                    var t = new Thread(Ping) { IsBackground = true };
                    t.Start(row);
                }
            }
            else
            {
                ChangeStatus(I18N.GetString("DoSomething"));
                var t = new Thread(Go) { IsBackground = true };
                t.Start(dgvMain.Rows);
            }
        }
開發者ID:jackton,項目名稱:shadowsocks-csharp-withping,代碼行數:34,代碼來源:PingForm.cs

示例3: TCPRelay

 public TCPRelay(ShadowsocksController controller, Configuration conf)
 {
     _controller = controller;
     _config = conf;
     Handlers = new HashSet<TCPHandler>();
     _lastSweepTime = DateTime.Now;
 }
開發者ID:DZLZHCODE,項目名稱:shadowsocks-windows,代碼行數:7,代碼來源:TCPRelay.cs

示例4: StrategyManager

 public StrategyManager(ShadowsocksController controller)
 {
     _strategies = new List<IStrategy>();
     _strategies.Add(new BalancingStrategy(controller));
     _strategies.Add(new HighAvailabilityStrategy(controller));
     // TODO: load DLL plugins
 }
開發者ID:jiazhichao,項目名稱:shadowsocks-windows,代碼行數:7,代碼來源:StrategyManager.cs

示例5: Main

        static void Main()
        {
            Util.Utils.ReleaseMemory();
            using (Mutex mutex = new Mutex(false, "Global\\" + "71981632-A427-497F-AB91-241CD227EC1F"))
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                if (!mutex.WaitOne(0, false))
                {
                    Process[] oldProcesses = Process.GetProcessesByName("Shadowsocks");
                    if (oldProcesses.Length > 0)
                    {
                        Process oldProcess = oldProcesses[0];
                    }
                    MessageBox.Show("Shadowsocks is already running.\n\nFind Shadowsocks icon in your notify tray.");
                    return;
                }
                Directory.SetCurrentDirectory(Application.StartupPath);
#if !DEBUG
                Logging.OpenLogFile();
#endif
                ShadowsocksController controller = new ShadowsocksController();

                MenuViewController viewController = new MenuViewController(controller);

                controller.Start();

                Application.Run();
            }
        }
開發者ID:xie3507,項目名稱:shadowsocks-csharp,代碼行數:31,代碼來源:Program.cs

示例6: MenuViewController

        public MenuViewController(ShadowsocksController controller)
        {
            this.controller = controller;

            LoadMenu();

            controller.ConfigChanged += controller_ConfigChanged;
            controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged;
            controller.Errored += controller_Errored;

            _notifyIcon = new NotifyIcon();
            UpdateTrayIcon();
            _notifyIcon.Visible = true;
            _notifyIcon.ContextMenu = contextMenu1;
            _notifyIcon.MouseDoubleClick += notifyIcon1_DoubleClick;

            //this.updateChecker = new UpdateChecker();
            //updateChecker.NewVersionFound += updateChecker_NewVersionFound;

            LoadCurrentConfiguration();

            //updateChecker.CheckUpdate(controller.GetConfigurationCopy());

            if (controller.GetConfigurationCopy().isDefault)
            {
                _isFirstRun = true;
                ShowConfigForm();
            }
        }
開發者ID:chiypg,項目名稱:shadowsocks-windows,代碼行數:29,代碼來源:MenuViewController.cs

示例7: LogForm

        public LogForm(ShadowsocksController controller, string filename)
        {
            this.controller = controller;
            this.filename = filename;
            InitializeComponent();
            Icon = Icon.FromHandle(Resources.ssw128.GetHicon());

            LogViewerConfig config = controller.GetConfigurationCopy().logViewer;
            if (config == null)
            {
                config = new LogViewerConfig();
            }
            else
            {
                topMostTrigger = config.topMost;
                wrapTextTrigger = config.wrapText;
                toolbarTrigger = config.toolbarShown;
                LogMessageTextBox.BackColor = config.GetBackgroundColor();
                LogMessageTextBox.ForeColor = config.GetTextColor();
                LogMessageTextBox.Font = config.GetFont();
            }

            controller.TrafficChanged += controller_TrafficChanged;

            UpdateTexts();
        }
開發者ID:txrtanzi,項目名稱:shadowsocks-windows,代碼行數:26,代碼來源:LogForm.cs

示例8: MenuViewController

        public MenuViewController(ShadowsocksController controller)
        {
            LoadMenu();
            LoadTrayIcon();

            this.controller = controller;
            controller.EnableStatusChanged += controller_EnableStatusChanged;
            controller.ConfigChanged += controller_ConfigChanged;
            controller.PACFileReadyToOpen += controller_PACFileReadyToOpen;
            controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged;
            controller.EnableGlobalChanged += controller_EnableGlobalChanged;
            controller.Errored += controller_Errored;

            this.updateChecker = new UpdateChecker();
            updateChecker.NewVersionFound += updateChecker_NewVersionFound;

            LoadCurrentConfiguration();

            updateChecker.CheckUpdate();

            if (controller.GetConfiguration().isDefault)
            {
                _isFirstRun = true;
                ShowConfigForm();
            }
        }
開發者ID:wushukai,項目名稱:shadowsocks-csharp,代碼行數:26,代碼來源:MenuViewController.cs

示例9: MenuViewController

        public MenuViewController(ShadowsocksController controller)
        {
            this.controller = controller;

            LoadMenu();

            controller.EnableStatusChanged += controller_EnableStatusChanged;
            controller.ConfigChanged += controller_ConfigChanged;
            controller.PACFileReadyToOpen += controller_FileReadyToOpen;
            controller.UserRuleFileReadyToOpen += controller_FileReadyToOpen;
            controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged;
            controller.EnableGlobalChanged += controller_EnableGlobalChanged;
            controller.Errored += controller_Errored;
            controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted;
            controller.UpdatePACFromGFWListError += controller_UpdatePACFromGFWListError;

            _notifyIcon = new NotifyIcon();
            UpdateTrayIcon();
            _notifyIcon.Visible = true;
            _notifyIcon.ContextMenu = contextMenu1;
            _notifyIcon.MouseDoubleClick += notifyIcon1_DoubleClick;

            this.updateChecker = new UpdateChecker();
            updateChecker.NewVersionFound += updateChecker_NewVersionFound;

            LoadCurrentConfiguration();

            updateChecker.CheckUpdate(controller.GetConfigurationCopy());

            if (controller.GetConfigurationCopy().isDefault)
            {
                _isFirstRun = true;
                ShowConfigForm();
            }
        }
開發者ID:nenew,項目名稱:shadowsocks-windows,代碼行數:35,代碼來源:MenuViewController.cs

示例10: Main

        static void Main()
        {
            Util.Utils.ReleaseMemory();
            using (Mutex mutex = new Mutex(false, "Global\\ShadowsocksR_" + Application.StartupPath.GetHashCode()))
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                if (!mutex.WaitOne(0, false))
                {
                    MessageBox.Show(I18N.GetString("Find Shadowsocks icon in your notify tray.") + "\n" +
                        I18N.GetString("If you want to start multiple Shadowsocks, make a copy in another directory."),
                        I18N.GetString("ShadowsocksR is already running."));
                    return;
                }
                Directory.SetCurrentDirectory(Application.StartupPath);
            //#if !DEBUG
                Logging.OpenLogFile();
            //#endif
                ShadowsocksController controller = new ShadowsocksController();

                MenuViewController viewController = new MenuViewController(controller);

                controller.Start();

                Application.Run();
            }
        }
開發者ID:norkts,項目名稱:shadowsocks-csharp,代碼行數:28,代碼來源:Program.cs

示例11: TCPHandler

        public TCPHandler(ShadowsocksController controller, Configuration config, TCPRelay tcprelay, Socket socket)
        {
            this._controller = controller;
            this._config = config;
            this._tcprelay = tcprelay;
            this._connection = socket;

            lastActivity = DateTime.Now;
        }
開發者ID:Frenda,項目名稱:shadowsocks-windows,代碼行數:9,代碼來源:TCPRelay.cs

示例12: StatisticsStrategyConfigurationForm

 public StatisticsStrategyConfigurationForm(ShadowsocksController controller)
 {
     if (controller == null) return;
     InitializeComponent();
     _controller = controller;
     _controller.ConfigChanged += (sender, args) => LoadConfiguration();
     LoadConfiguration();
     Load += (sender, args) => InitData();
 }
開發者ID:YAIBA2,項目名稱:shadowsocks-csharp,代碼行數:9,代碼來源:StatisticsStrategyConfigurationForm.cs

示例13: ConfigForm

        public ConfigForm(ShadowsocksController controller)
        {
            InitializeComponent();
            UpdateTexts();
            this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon());

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

            LoadCurrentConfiguration();
        }
開發者ID:wushukai,項目名稱:shadowsocks-csharp,代碼行數:11,代碼來源:ConfigForm.cs

示例14: TCPHandler

        public TCPHandler(ShadowsocksController controller, Configuration config, TCPRelay tcprelay, Socket socket)
        {
            _controller = controller;
            _config = config;
            _tcprelay = tcprelay;
            _connection = socket;
            _proxyTimeout = config.proxy.proxyTimeout * 1000;
            _serverTimeout = config.GetCurrentServer().timeout * 1000;

            lastActivity = DateTime.Now;
        }
開發者ID:passanstoi,項目名稱:shadowsocks-windows,代碼行數:11,代碼來源:TCPRelay.cs

示例15: ConfigForm

        public ConfigForm(ShadowsocksController controller)
        {
            InitializeComponent();

            this.Font = System.Drawing.SystemFonts.MessageBoxFont;
            this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon());
            this._lastSelectedSsServerInfo = null;
            this._ssController = controller;
            controller.ConfigChanged += ssController_ConfigChanged;

            UpdateTexts();
            LoadCurrentConfiguration();
        }
開發者ID:fanyangxi,項目名稱:shadowsocks-windows,代碼行數:13,代碼來源:ConfigForm.cs


注:本文中的Shadowsocks.Controller.ShadowsocksController類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。