本文整理汇总了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;
}
示例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);
}
}
示例3: TCPRelay
public TCPRelay(ShadowsocksController controller, Configuration conf)
{
_controller = controller;
_config = conf;
Handlers = new HashSet<TCPHandler>();
_lastSweepTime = DateTime.Now;
}
示例4: StrategyManager
public StrategyManager(ShadowsocksController controller)
{
_strategies = new List<IStrategy>();
_strategies.Add(new BalancingStrategy(controller));
_strategies.Add(new HighAvailabilityStrategy(controller));
// TODO: load DLL plugins
}
示例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();
}
}
示例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();
}
}
示例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();
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例12: StatisticsStrategyConfigurationForm
public StatisticsStrategyConfigurationForm(ShadowsocksController controller)
{
if (controller == null) return;
InitializeComponent();
_controller = controller;
_controller.ConfigChanged += (sender, args) => LoadConfiguration();
LoadConfiguration();
Load += (sender, args) => InitData();
}
示例13: ConfigForm
public ConfigForm(ShadowsocksController controller)
{
InitializeComponent();
UpdateTexts();
this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon());
this.controller = controller;
controller.ConfigChanged += controller_ConfigChanged;
LoadCurrentConfiguration();
}
示例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;
}
示例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();
}