private void submit(object sender, DoWorkEventArgs e) { #if ARCADE //Don't submit scores yet, no matter what. return; #endif #if NO_SCORE_SUBMIT NotificationManager.ShowMessage(LocalisationManager.GetString(OsuString.Score_SubmissionDisabled)); return; #endif GameBase.User.spriteInfo.Text = LocalisationManager.GetString(OsuString.Score_SubmittingScore); try { byte[] zipped = new byte[0]; if (Pass) { if (BeatmapManager.Current.onlinePersonalScore != null && TotalScore > BeatmapManager.Current.onlinePersonalScore.TotalScore) { BeatmapManager.Current.Scores.Clear(); } //We should re-retrieve online scores no matter what, otherwise when clicking 'retry' the personal score won't be updated. ReplayCompressed = SevenZipHelper.Compress(new ASCIIEncoding().GetBytes(ReplayString)); #if DEBUG if (ReplayCompressed.Length < 100) { LoadLocalData(); } #endif zipped = ReplayCompressed; } pWebRequest req = new pWebRequest(General.WEB_ROOT + @"/web/osu-submit-modular.php"); req.AddFile(@"score", zipped); string iv = null; #if SUBMISSION_DEBUG File.AppendAllText(@"DEBUG.txt", @"Debug at " + DateTime.Now + @"\n"); #endif if (Pass) { Process[] procs = GameBase.Processes; GameBase.Processes = null; if (procs == null || procs.Length == 0) { procs = Process.GetProcesses(); } StringBuilder b = new StringBuilder(); foreach (Process p in procs) { string filename = string.Empty; try { filename = p.MainModule.FileName; FileInfo fi = new FileInfo(filename); if (fi != null) { filename = CryptoHelper.GetMd5String(fi.Length.ToString()) + @" " + filename; } } catch { } b.AppendLine(filename + @" | " + p.ProcessName + @" (" + p.MainWindowTitle + @")"); } #if SUBMISSION_DEBUG File.AppendAllText(@"DEBUG.txt", @"Running Processes:\n" + b + @"\n\n"); #endif req.AddParameter(@"pl", CryptoHelper.EncryptString(b.ToString(), Secrets.GetScoreSubmissionKey(), ref iv)); } else { req.AddParameter(@"x", Exit ? @"1" : @"0"); req.AddParameter(@"ft", FailTime.ToString()); } #if SUBMISSION_DEBUG File.AppendAllText(@"DEBUG.txt", @"\n1:" + onlineFormatted + @"\n"); File.AppendAllText(@"DEBUG.txt", @"\n2:" + GameBase.clientHash + @"\n"); File.AppendAllText(@"DEBUG.txt", @"\n3:" + iv + @"\n"); #endif req.AddParameter(@"score", CryptoHelper.EncryptString(onlineFormatted, Secrets.GetScoreSubmissionKey(), ref iv)); req.AddParameter(@"fs", CryptoHelper.EncryptString(visualSettingsString, Secrets.GetScoreSubmissionKey(), ref iv)); req.AddParameter(@"c1", GameBase.CreateUniqueId()); req.AddParameter(@"pass", ConfigManager.sPassword); req.AddParameter(@"osuver", General.VERSION.ToString()); req.AddParameter(@"s", CryptoHelper.EncryptString(GameBase.ClientHash, Secrets.GetScoreSubmissionKey(), ref iv)); try { if (Pass && ExtraData != null) { req.AddFile(@"i", ExtraData.ToArray()); } else { req.AddParameter(@"i", string.Empty); } } catch { } GameBase.ChangeAllowance++; ExtraData = null; req.AddParameter(@"iv", iv); int retryCount = Pass ? 10 : 2; int retryDelay = 7500; bool didError = false; while (retryCount-- > 0) { try { req.BlockingPerform(); SubmissionResponseString = req.ResponseString; #if SUBMISSION_DEBUG Debug.Print(SubmissionResponseString); File.AppendAllText(@"DEBUG.txt", @"\nres:" + SubmissionResponseString + @"\n\n\n\n\n-------------------\n\n\n\n"); #endif if (SubmissionResponseString.Contains(@"error:")) { switch (SubmissionResponseString.Replace(@"error: ", string.Empty)) { case @"reset": BanchoClient.HandlePasswordReset(); break; case @"verify": BanchoClient.RequireVerification(); break; case @"nouser": NotificationManager.ShowMessage(LocalisationManager.GetString(OsuString.Score_ErrorNoUser)); break; case @"pass": NotificationManager.ShowMessage(LocalisationManager.GetString(OsuString.Score_ErrorPassword)); break; case @"inactive": case @"ban": NotificationManager.ShowMessage("ERROR: Your account is no longer active. Please send an email to [email protected] if you think this is a mistake."); break; case @"beatmap": if (Beatmap != null && Beatmap.SubmissionStatus > osu_common.SubmissionStatus.Pending) { NotificationManager.ShowMessage(LocalisationManager.GetString(OsuString.Score_ErrorBeatmap)); Beatmap.SubmissionStatus = osu_common.SubmissionStatus.Unknown; } break; case @"disabled": NotificationManager.ShowMessage(LocalisationManager.GetString(OsuString.Score_ErrorDisabled)); break; case @"oldver": NotificationManager.ShowMessage(LocalisationManager.GetString(OsuString.Score_ErrorVersion)); GameBase.CheckForUpdates(true); break; case @"no": break; } didError = true; } break; } catch { } if (retryDelay >= 60000) { NotificationManager.ShowMessage(string.Format(LocalisationManager.GetString(OsuString.Score_SubmissionFailed), (retryDelay / 60000))); } Thread.Sleep(retryDelay); retryDelay *= 2; } if (didError) { SubmissionStatus = ScoreSubmissionStatus.Complete; return; } } catch (Exception ex) { } if (SubmissionComplete != null) { SubmissionComplete(this); } SubmissionStatus = ScoreSubmissionStatus.Complete; if (!Pass) { GameBase.User.Refresh(); } }