void init() { try { SplashScreen.CloseAll(); BringToFrontEx(); bool hasLanguage = LocalisationManager.IsInitialised; if (!hasLanguage) { Invoke(delegate { LocalisationManager.SetLanguage(null, false, delegate { hasLanguage = true; }, osu.Properties.Resources.en); }); int timeout = 20000; while (!hasLanguage && (timeout -= 100) > 0) { setText(@"Downloading localisation...", true); Thread.Sleep(100); } } while (true) { try { instance = new SingleInstance(OsuMain.ClientGuid, 500); } catch (TooManyInstancesException) { if (OsuMain.IsWine) { break; } setText(LocalisationManager.GetString(OsuString.Maintenance_OsuIsAlreadyRunning), true); Thread.Sleep(100); continue; } break; } if (!DotNetFramework.CheckInstalled(FrameworkVersion.dotnet4)) { Process installProcess = null; string dotNetInstallFilename = Environment.OSVersion.Version.Major < 6 ? @"dotNetFx40_Full_setup.exe" : @"NDP452-KB2901954-Web.exe"; setText(LocalisationManager.GetString(OsuString.Maintenance_DotNetInstall), true); pFileWebRequest fnr = new pFileWebRequest(dotNetInstallFilename, @"http://m1.ppy.sh/r/" + dotNetInstallFilename); fnr.DownloadProgress += delegate(pWebRequest sender, long current, long total) { setProgress((float)current / total * 100, OsuString.Maintenance_DotNetInstall); }; try { fnr.BlockingPerform(); installProcess = Process.Start(dotNetInstallFilename, @"/passive /promptrestart"); while (installProcess != null && !installProcess.HasExited) { setText(LocalisationManager.GetString(OsuString.Maintenance_WaitingForDotNetComplete), true); setProgress(); Thread.Sleep(500); } } catch { } GeneralHelper.FileDelete(dotNetInstallFilename); label.Click += manualDotNetInstall; while (!DotNetFramework.CheckInstalled(FrameworkVersion.dotnet4, false)) { setText(LocalisationManager.GetString(OsuString.Maintenance_DotNetFailed), true); setProgress(); Thread.Sleep(500); } label.Click -= manualDotNetInstall; } setText(); setProgress(); } catch { } }
public ErrorDialog(Exception ex, bool submitError) { SplashScreen.CloseAll(); IsHandlingError = true; BringToFrontEx(); ControlAdded += control_ControlAdded; ControlRemoved += control_ControlRemoved; InitializeComponent(); StringBuilder errBuf = new StringBuilder(); foreach (string line in ex.ToString().Split('\n')) { if (line.Contains("Microsoft.Xna.Framework.Game.Tick")) { break; } else { errBuf.AppendLine(line.Trim('\r')); } } string errorString = errBuf.ToString(); textBoxDetails.Text = errorString; StackTrace trace = new StackTrace(ex); if (submitError) { worker = new BackgroundWorker(); worker.DoWork += delegate { OsuError osuError = new OsuError(); StringBuilder report = new StringBuilder(); foreach (StackFrame frame in DebugHelper.FilterFrames(trace.GetFrames())) { report.AppendLine("METHOD " + frame.GetMethod()); report.AppendLine("Module " + frame.GetMethod().Module); report.AppendLine("Il-Offset: " + frame.GetILOffset() + " Jit-offset: " + frame.GetNativeOffset()); report.AppendLine("IL code "); report.AppendLine(DebugHelper.OpcodeToIL(frame.GetMethod())); report.AppendLine(); MethodBody MB = frame.GetMethod().GetMethodBody(); List <ExceptionHandlingClause> Exceptions = MB != null ? new List <ExceptionHandlingClause>(MB.ExceptionHandlingClauses) : null; if (Exceptions == null || Exceptions.Count == 0) { continue; } report.AppendLine("possible caught exceptions:"); //we don't use toString as this method assumes FilterOffset!=null //(bad ms code) foreach (ExceptionHandlingClause E in Exceptions) { try { report.AppendLine(String.Format("catchType:{0}, Flags:{1}, HandlerLength:{2}, " + "HandlerOffset:{3}, TryLength:{4}, TryOffset:{5}", E.CatchType, E.Flags, E.HandlerLength, E.HandlerOffset, E.TryLength, E.TryOffset)); } catch { report.AppendLine("Unknown ExceptionType"); } } report.AppendLine("ENDMETHOD"); report.AppendLine(); } osuError.ILTrace = report.ToString(); osuError.StackTrace = errorString; osuError.Exception = ex != null?ex.GetType().ToString() : string.Empty; ErrorSubmission.Submit(osuError); }; worker.RunWorkerAsync(); } }