public bool CheckLogin(string email, string pass) { string res = Util.generateSession(email, pass,13); if (res == "Bad login") { ErrorWindow error = new ErrorWindow(); error.Error.Content = "Bad Login"; error.Show(); return false; } else if (res == "Servers Down" || res == "" || res == null) { ErrorWindow error = new ErrorWindow(); error.Error.Content = "Minecraft login servers are down"; error.Show(); return false; } else if (res.Split(':').Length != 5) { ErrorWindow error = new ErrorWindow(); error.Error.Content = "A unkown error has occured. It may be that the login servers are down"; error.Show(); return false; } else { return true; } }
public FileStream CreateConfigs(string dir) { using (FileStream config = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + dir + "/config", FileMode.OpenOrCreate)) { } try { FileStream logindata = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/" + dir + "/logindata", FileMode.OpenOrCreate); return logindata; } catch { ErrorWindow error = new ErrorWindow(); error.Error.Content = "You Clicked so fast the app crashed, or someone set the logindata file to read only"; error.Error.Width = 480; error.Width = 480; error.Show(); return null; } }
private void Apply_Click(object sender, RoutedEventArgs e) { Uri siteUri = new Uri(ModPack.Text); WebRequest wr = WebRequest.Create(siteUri); try { using (HttpWebResponse response = (HttpWebResponse)wr.GetResponse()) { if (response.StatusCode == HttpStatusCode.OK) { s.ModPack = ModPack.Text; } response.Close(); } } catch { ErrorWindow error = new ErrorWindow(); error.Title = "Error"; error.Error.Content = "The URL could not be found."; error.Show(); } s.LaunchUpdate = Update.IsChecked.Value; s.Password = Password.IsChecked.Value; s.CloseLaunch = CloseLaunch.IsChecked.Value; s.Save(); }