Example #1
0
        private void HandleHsError(IReadOnlyDictionary <string, int> nowValue)
        {
            var hsErrorPath = BmclCore.MinecraftDirectory;

            if (nowValue["hsError"] != _errorCount["hsError"])
            {
                Logger.Log("发现新的JVM错误报告");
                var hsErrorDir = new DirectoryInfo(hsErrorPath);
                var hsErrors   = hsErrorDir.GetFiles().Where(s => s.FullName.StartsWith("hs_err")).ToArray();
                Array.Sort(hsErrors,
                           (info1, info2) => (int)(info1.LastWriteTime - info2.LastWriteTime).TotalSeconds);
                var crashReportReader = new StreamReader(hsErrors[0].FullName);
                Logger.Log(crashReportReader.ReadToEnd(), Logger.LogType.Crash);
                crashReportReader.Close();
                ChildProcess.Exec(hsErrors[0].FullName);
            }
        }
Example #2
0
        private void HandleCrashReport(IReadOnlyDictionary <string, int> nowValue)
        {
            var crashReportsPath = Path.Combine(BmclCore.MinecraftDirectory, "crash-reports");

            if (nowValue["crashReport"] != _errorCount["crashReport"] && Directory.Exists(crashReportsPath))
            {
                Logger.Log("发现新的错误报告");
                var clientCrashReportDir = new DirectoryInfo(crashReportsPath);
                var clientReports        = clientCrashReportDir.GetFiles();
                Array.Sort(clientReports,
                           (info1, info2) => (int)(info1.LastWriteTime - info2.LastWriteTime).TotalSeconds);
                var crashReportReader = new StreamReader(clientReports[0].FullName);
                Logger.Log(crashReportReader.ReadToEnd(), Logger.LogType.Crash);
                crashReportReader.Close();
                ChildProcess.Exec(clientReports[0].FullName);
            }
        }