public static List <VPNInfoEntity> GetFeiYiVPNS() { //WebHeaderCollection headers; //CookieCollection cookies; //string ctx = HttpRequest.GetCtx(feiYiUrl, "GET", Encoding.GetEncoding("GB2312"), null, null, "", out headers, out cookies); string ctx = HttpRequest.GetCtx(feiYiUrl, "GET", Encoding.GetEncoding("GB2312")); MatchCollection ms = feiYiReg.Matches(ctx); List <VPNInfoEntity> list = new List <VPNInfoEntity>(); foreach (Match ma in ms) { VPNInfoEntity entity = new VPNInfoEntity(); entity.Area = ma.Groups["area"].Value; entity.Ip = ma.Groups["ip"].Value; entity.User = ma.Groups["user"].Value; entity.Pwd = ma.Groups["pwd"].Value; entity.Info1 = ma.Groups["info1"].Value; entity.Info2 = ma.Groups["info2"].Value; entity.Info3 = ma.Groups["info3"].Value; if (SerializHelper.DisableList.ContainsKey(SerializHelper.GetEntityKey(entity))) { entity.Available = VPNInfoEntity.AvailableStatus.Disable; } list.Add(entity); } return(list); }
private void cmsi2Drop_Click(object sender, EventArgs e) { if (gd2.SelectedRows.Count > 0) { VPNInfoEntity entity = (VPNInfoEntity)gd2.SelectedRows[0].DataBoundItem; SerializHelper.RemoveEnableEntity(entity); SetGd2DataSource(); } }
void VPNConnectHelper_DialAsyncComplete(RasDialer dialer, DialCompletedEventArgs e) { if (e.Connected) { currTryVPNInfoEntity.Available = VPNInfoEntity.AvailableStatus.Enable; notifyIcon1.ShowBalloonTip(5000, "...", "连接成功", ToolTipIcon.Info); SerializHelper.AddEnableEntity(currTryVPNInfoEntity); ChangeBtnFind(); } else if (e.Error != null) { currTryVPNInfoEntity.Available = VPNInfoEntity.AvailableStatus.Disable; SerializHelper.AddDisableEntity(currTryVPNInfoEntity); notifyIcon1.ShowBalloonTip(3000, "...", currTryVPNInfoEntity.Ip + "\r\n" + e.Error.Message, ToolTipIcon.Info); FindNext(); } }
static void Application_ApplicationExit(object sender, EventArgs e) { SerializHelper.Save(); }