示例#1
0
        private void btnLoadAccountsBySessions_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog
            {
                Title  = "Load accounts by sessions",
                Filter = Globals.SessionFileFilter
            };

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                foreach (var line in File.ReadAllLines(ofd.FileName))
                {
                    string[]        array   = line.Split(':');
                    CookieContainer session = null;
                    CookiesHelper.SetCookies(ref session, array[1]);
                    inputs.SAccounts.Add(new SAccount()
                    {
                        PhoneNumber = array[0], Session = session
                    });
                }
                Logger.LogMessage(this, inputs.SAccounts.Count + " accounts loaded from sessions.");
            }
            lblPhoneNumbers.Text = inputs.SAccounts.Count.ToString();

            foreach (var account in inputs.SAccounts)
            {
                var item = new ListViewItem(new string[] { account.PhoneNumber, "Accepted" });
                lstAccounts.Items.Add(item);
            }
        }
 public override void OnActionExecuting(ActionExecutingContext context)
 {
     base.OnActionExecuting(context);
     try
     {
         var request = context.HttpContext.Request;
         if (request != null)
         {
             string cookieValueFromContext = context.HttpContext.Request.Cookies[_cookiesName];
             // Only save last path with method GET, don't save another method
             if (request.Method == "GET")
             {
                 cookieValueFromContext = WebUtility.UrlEncode(string.Format("{0}{1}{2}", request.PathBase, request.Path, request.QueryString.Value));
             }
             // write to cookies
             CookiesHelper.SetCookies(context.HttpContext, _timeType, _cookiesName, cookieValueFromContext, _experience);
         }
     }
     catch
     {
         return;
     }
 }