Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string email = bunifuMetroTextbox1.Text;
- bool IsRealEmail = Regex.IsMatch(email, @"^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$");
- if (bunifuMetroTextbox1.Text == "" || bunifuMetroTextbox2.Text == "")
- {
- label3.Text = "Please type in and username and password.";
- return;
- }
- else if (bunifuMetroTextbox1.Text.Contains("@"))
- {
- try
- {
- string emails = bunifuMetroTextbox1.Text;
- string password = Hash(bunifuMetroTextbox2.Text);
- bool r = validate_loginemail(emails, password);
- if (r)
- {
- Assembly assembly = Assembly.GetExecutingAssembly();
- FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
- string v1 = fileVersionInfo.ProductVersion;
- string v2 = new WebClient().DownloadString("string");
- var version1 = new Version(v1);
- var version2 = new Version(v2);
- var vrz = version1.CompareTo(version2);
- if (vrz > 0)
- {
- //just go on with the program; there is nothing to update
- }
- else if (vrz < 0)
- {
- DialogResult dialogResult = System.Windows.Forms.MessageBox.Show("There is a new update! Would you like to update?", "Update Program", MessageBoxButtons.YesNo);
- if (dialogResult == DialogResult.Yes)
- {
- System.Diagnostics.Process.Start("http://www.google.com");
- }
- else if (dialogResult == DialogResult.No)
- {
- Form1 objFrmMain = new Form1();
- this.Hide();
- objFrmMain.ShowDialog();
- this.Close();
- return;
- }
- }
- else
- {
- //// Get the object used to communicate with the server.
- //FtpWebRequest request = (FtpWebRequest)WebRequest.Create("string");
- //request.Method = WebRequestMethods.Ftp.UploadFile;
- //// This example assumes the FTP site uses anonymous logon.
- //request.Credentials = new NetworkCredential("anonymous", "janeDoe@contoso.com");
- //MemoryStream memStr = new MemoryStream(UTF8Encoding.Default.GetBytes("asdf"));
- //System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
- //Byte[] bytes = Encoding.GetBytes(memStr);
- //Stream requestStream = request.GetRequestStream();
- //requestStream.Write(bytes, 0, bytes.Length);
- //requestStream.Close();
- Form1 objFrmMain = new Form1();
- this.Hide();
- objFrmMain.ShowDialog();
- this.Close();
- return;
- }
- }
- else
- {
- label3.Text = "Incorrect username or password";
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- else
- {
- try
- {
- string username = bunifuMetroTextbox1.Text;
- string password = Hash(bunifuMetroTextbox2.Text);
- bool r = validate_login(username, password);
- if (r)
- {
- //call Assmebly + identify
- Assembly assembly = Assembly.GetExecutingAssembly();
- FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
- //compare Assembly to txt in FTP server
- string v1 = fileVersionInfo.ProductVersion;
- string v2 = new WebClient().DownloadString("string");
- var version1 = new Version(v1);
- var version2 = new Version(v2);
- var vrz = version1.CompareTo(version2);
- if (vrz > 0)
- {
- //just go on with the program; there is nothing to update
- }
- else if (vrz < 0)
- {
- DialogResult dialogResult = System.Windows.Forms.MessageBox.Show("There is a new update! Would you like to update?", "Update Program", MessageBoxButtons.YesNo);
- if (dialogResult == DialogResult.Yes)
- {
- System.Diagnostics.Process.Start("http://www.google.com");
- }
- else if (dialogResult == DialogResult.No)
- {
- Form1 objFrmMain = new Form1();
- this.Hide();
- objFrmMain.ShowDialog();
- this.Close();
- return;
- }
- }
- else
- {
- //string writer = new WebClient().DownloadString("string");
- //System.IO.StreamWriter file = new System.IO.StreamWriter(writer);
- //file.WriteLine(localIPs);
- Form1 objFrmMain = new Form1();
- this.Hide();
- objFrmMain.ShowDialog();
- this.Close();
- return;
- }
- }
- else
- {
- label3.Text = "Incorrect username or password";
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement