private void m_btnStop_Click(object sender, EventArgs e) { if (m_isStart) { ProxyTcp.CloseAll(); m_StatusLabel.Text = "代理停止工作"; } }
private void MSProxyForm_FormClosing(object sender, FormClosingEventArgs e) { ProxyTcp.CloseAll(); WritePrivateProfileString("conf", "path", m_filepath, "./mxdproxy.conf"); WritePrivateProfileString("conf", "ip", m_TboxIP.Text, "./mxdproxy.conf"); WritePrivateProfileString("conf", "login", m_TboxLoginPort.Text, "./mxdproxy.conf"); WritePrivateProfileString("conf", "shop", m_TboxShopPort.Text, "./mxdproxy.conf"); WritePrivateProfileString("conf", "channel", m_TboxChannelPort.Text, "./mxdproxy.conf"); }
private bool StartProxy() { if (m_isStart) { ProxyTcp.CloseAll(); } Object[] LoginPort = ParseStringToPort(m_TboxLoginPort.Text); if (LoginPort.Length == 1) { ProxyTcp proxytcp = new ProxyTcp((UInt16)LoginPort[0]); if (!proxytcp.Run()) { MessageBox.Show("环回网卡没设置正确或者端口被占用(本地服务器无须使用转发功能)"); return(false); } ; } Object[] ChannelPort = ParseStringToPort(m_TboxChannelPort.Text); foreach (UInt16 i in ChannelPort) { ProxyTcp proxytcp = new ProxyTcp(i); if (!proxytcp.Run()) { MessageBox.Show("环回网卡没设置正确或者端口被占用(本地服务器无须使用转发功能)"); return(false); } ; } object[] ShopPort = ParseStringToPort(m_TboxShopPort.Text); if (ShopPort.Length == 1) { ProxyTcp proxytcp = new ProxyTcp((UInt16)ShopPort[0]); if (!proxytcp.Run()) { MessageBox.Show("环回网卡没设置正确或者端口被占用(本地服务器无须使用转发功能)"); return(false); } ; } return(true); }