private static void PerformOperatingSystemCheck(Action <string, string> messageCallback) { // This check is only on Windows to ensure app runs on supported Windows operating systems #if WINDOWS var os = Environment.OSVersion.Version; if (os < ALOTInstallerCoreLib.MIN_SUPPORTED_WINDOWS_OS) { MERLog.Fatal($@"This operating system version is below the minimum supported version: {os}, minimum supported: {ALOTInstallerCoreLib.MIN_SUPPORTED_WINDOWS_OS}"); messageCallback?.Invoke("This operating system is not supported", $"Mass Effect 2 Randomizer is not supported on this operating system. The application may not work. To ensure application compatibility or receive support from ME3Tweaks, upgrade to a version of Windows that is supported by Microsoft."); } #endif }
private static void initAppCenter() { #if !DEBUG if (APIKeys.HasAppCenterKey && !telemetryStarted) { Microsoft.AppCenter.Crashes.Crashes.GetErrorAttachments = (ErrorReport report) => { var attachments = new List <ErrorAttachmentLog>(); // Attach some text. string errorMessage = "ALOT Installer has crashed! This is the exception that caused the crash:\n" + report.StackTrace; MERLog.Fatal(errorMessage); Log.Error("Note that this exception may appear to occur in a follow up boot due to how appcenter works"); string log = LogCollector.CollectLatestLog(false); if (log.Length < 1024 * 1024 * 7) { attachments.Add(ErrorAttachmentLog.AttachmentWithText(log, "crashlog.txt")); } else { //Compress log var compressedLog = LZMA.CompressToLZMAFile(Encoding.UTF8.GetBytes(log)); attachments.Add(ErrorAttachmentLog.AttachmentWithBinary(compressedLog, "crashlog.txt.lzma", "application/x-lzma")); } // Attach binary data. //var fakeImage = System.Text.Encoding.Default.GetBytes("Fake image"); //ErrorAttachmentLog binaryLog = ErrorAttachmentLog.AttachmentWithBinary(fakeImage, "ic_launcher.jpeg", "image/jpeg"); return(attachments); }; AppCenter.Start(APIKeys.AppCenterKey, typeof(Analytics), typeof(Crashes)); } #else if (!APIKeys.HasAppCenterKey) { Debug.WriteLine(" >>> This build is missing an API key for AppCenter!"); } else { Debug.WriteLine("This build has an API key for AppCenter"); } #endif telemetryStarted = true; }