public static string ToLoginResult(string UserName, string PassWord) { string paraUrlCoded = System.Web.HttpUtility.UrlEncode("UserName"); paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode(UserName); paraUrlCoded += "&" + System.Web.HttpUtility.UrlEncode("UserPassword"); paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode(Encryption.GetMd5Hash(PassWord)); return(NoFileRequestUtils.NoFilePostRequest("http://www.launchpadlight.com/sharer/Login", paraUrlCoded)); }
/// <summary> /// 发送验证邮箱的请求 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void m_btnSendEmail_Click(object sender, RoutedEventArgs e) { if (m_tbValidCode.Text.ToLower().Equals("")) { m_tbHelp.Text = "未填写验证码"; return; } else if (!m_tbValidCode.Text.ToLower().Equals(m_sValidCode.ToLower())) { m_tbHelp.Text = "验证码不正确"; ValidCode validCode = new ValidCode(5, ValidCode.CodeType.Alphas); m_iValidCode.Source = BitmapFrame.Create(validCode.CreateCheckCodeImage()); m_sValidCode = validCode.CheckCode; return; } if (m_tbEmail.Text.Length > 32) { m_tbHelp.Text = "邮箱过长"; return; } Regex r = new Regex("^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$"); if (!r.IsMatch(m_tbEmail.Text)) { m_tbHelp.Text = "邮箱格式不正确"; return; } //一分钟发一次 m_dtimer.Start(); m_iNowTime = 60; m_btnSendEmail.IsEnabled = false; string paraUrlCoded = System.Web.HttpUtility.UrlEncode("Email"); paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode(m_tbEmail.Text); //paraUrlCoded += "&" + System.Web.HttpUtility.UrlEncode("UserPassword"); //paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode(GetMd5Hash(pbUserPassword.Password)); string result = NoFileRequestUtils.NoFilePostRequest("http://www.launchpadlight.com/sharer/SendEmailValidCode", paraUrlCoded); if (result.Equals("success")) { //发送邮件成功,不处理 //Console.WriteLine("发送邮箱成功"); } else { //发送邮箱失败 //Console.WriteLine("发送邮箱失败"); //弹出对话框显示原因 System.Windows.Forms.MessageBox.Show(result); } }
private void LoadToList(bool IsChangePage, int Page) { listProjectInfo.Clear(); string paraUrlCoded = System.Web.HttpUtility.UrlEncode("Page"); paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode(Page.ToString()); string result = NoFileRequestUtils.NoFilePostRequest("http://www.launchpadlight.com/sharer/SelectProjectAll", paraUrlCoded); if (result.StartsWith("success:")) { listProjectInfo = JsonConvert.DeserializeObject <List <ProjectInfo> >(result.Substring(14)); //foreach(ProjectInfo p in listProjectInfo) { // if (p.ProjectRemarks.Length > 30) // { // p.ProjectRemarks = p.ProjectRemarks.Substring(0, 30); // } // else { // p.ProjectRemarks = p.ProjectRemarks.PadRight(' '); // } //} int count = int.Parse(result.Substring(8, 6)); //如果需要改变底栏 if (IsChangePage) { if (count <= 20) { tbPageNow.Text = 1.ToString(); tbPageCount.Text = 1.ToString(); } else { tbPageNow.Text = 1.ToString(); if (count % 20 == 0) { tbPageCount.Text = (count / 20).ToString(); } else { tbPageCount.Text = (count / 20 + 1).ToString(); } } } } m_dgProjectMain.ItemsSource = listProjectInfo; }
private void btnOk_Click(object sender, RoutedEventArgs e) { if (tbDescribe.Text.Length > 512 || tbDescribe.Text.Length <= 0) { tbDescribe.Select(0, tbDescribe.Text.Length); tbDescribe.Focus(); return; } string paraUrlCoded = System.Web.HttpUtility.UrlEncode("UserName"); paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode(mw.strUserName); paraUrlCoded += "&" + System.Web.HttpUtility.UrlEncode("UserPassword"); paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode(Encryption.GetMd5Hash(mw.strUserPassword)); paraUrlCoded += "&" + System.Web.HttpUtility.UrlEncode("UserId"); paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode(mw.mUser.UserId.ToString()); paraUrlCoded += "&" + System.Web.HttpUtility.UrlEncode("Type"); if (rbBug.IsChecked == true) { paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode("1"); } else { paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode("0"); } paraUrlCoded += "&" + System.Web.HttpUtility.UrlEncode("Describe"); paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode(tbDescribe.Text); paraUrlCoded += "&" + System.Web.HttpUtility.UrlEncode("Version"); paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode(mw.strNowVersion); paraUrlCoded += "&" + System.Web.HttpUtility.UrlEncode("UploadTime"); paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode(DateTime.Now.ToString()); if (NoFileRequestUtils.NoFilePostRequest("http://www.launchpadlight.com/sharer/Feekback", paraUrlCoded).StartsWith("success")) { new MessageDialog(mw, "Success").ShowDialog(); DialogResult = true; } else { new MessageDialog(mw, "Fail").ShowDialog(); DialogResult = true; } }
private void m_btnRegister_Click(object sender, RoutedEventArgs e) { if (m_tbUserName.Text.Equals("")) { m_tbHelp.Text = "未输入用户名"; return; } Regex r2 = new Regex("[%--`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——| {}【】‘;:”“'。,、?]");//格式 RegExp("[在中间定义特殊过滤字符]") if (r2.IsMatch(m_tbUserName.Text)) { m_tbHelp.Text = "用户名含特殊字符"; return; } if (m_pbPassWord.Password.Equals("") || m_pbPassWordAgain.Password.Equals("")) { m_tbHelp.Text = "未输入密码"; return; } if (!m_pbPassWord.Password.Equals(m_pbPassWordAgain.Password)) { m_tbHelp.Text = "两次密码不相同"; return; } if (m_tbValidCode.Text.ToLower().Equals("")) { m_tbHelp.Text = "未填写验证码"; return; } else if (!m_tbValidCode.Text.ToLower().Equals(m_sValidCode.ToLower())) { m_tbHelp.Text = "验证码不正确"; ValidCode validCode = new ValidCode(5, ValidCode.CodeType.Alphas); m_iValidCode.Source = BitmapFrame.Create(validCode.CreateCheckCodeImage()); m_sValidCode = validCode.CheckCode; return; } if (m_tbEmail.Text.Length > 32) { m_tbHelp.Text = "邮箱过长"; return; } Regex r = new Regex("^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$"); if (!r.IsMatch(m_tbEmail.Text)) { m_tbHelp.Text = "邮箱格式不正确"; return; } if (!r.IsMatch(m_tbEmail.Text)) { m_tbHelp.Text = "邮箱格式不正确"; return; } if (m_tbEmailValidCode.Text.ToLower().Equals("")) { m_tbHelp.Text = "未填写邮箱验证码"; return; } m_tbHelp.Text = ""; string paraUrlCoded = System.Web.HttpUtility.UrlEncode("UserName"); paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode(m_tbUserName.Text); paraUrlCoded += "&" + System.Web.HttpUtility.UrlEncode("UserPassword"); paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode(Encryption.GetMd5Hash(m_pbPassWord.Password)); paraUrlCoded += "&" + System.Web.HttpUtility.UrlEncode("UserEmail"); paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode(m_tbEmail.Text); paraUrlCoded += "&" + System.Web.HttpUtility.UrlEncode("EmailValidCode"); paraUrlCoded += "=" + System.Web.HttpUtility.UrlEncode(m_tbEmailValidCode.Text); string result = NoFileRequestUtils.NoFilePostRequest("http://www.launchpadlight.com/sharer/Register", paraUrlCoded); if (result.Equals("success")) { //Console.WriteLine("注册成功"); System.Windows.Forms.MessageBox.Show("注册成功"); lw.Close(); } else { //弹出对话框显示失败原因 System.Windows.Forms.MessageBox.Show(result.Substring(5)); ValidCode validCode = new ValidCode(5, ValidCode.CodeType.Alphas); m_iValidCode.Source = BitmapFrame.Create(validCode.CreateCheckCodeImage()); m_sValidCode = validCode.CheckCode; } }