internal static void SaveLastTempCode(string code, string tempOutPath) { if (string.IsNullOrEmpty(tempOutPath)) { return; } try { string filePath = Path.Combine(tempOutPath, "__last_temp_code.cs"); RetryFile.WriteAllText(filePath, code); } catch { /* 输出最近一次运行时运行的代码,方便调试程序,忽略写文件出现的异常。 */ } }
internal static void SaveLastCompileError(CompilerResults cr, string tempOutPath) { if (string.IsNullOrEmpty(tempOutPath)) { return; } try { string errorText = GetCompileErrorMessage(cr); string filePath = Path.Combine(tempOutPath, "__last_CompilerError.txt"); RetryFile.WriteAllText(filePath, errorText); } catch { /* 输出最近一次运行时运行的异常,方便调试程序,忽略写文件出现的异常。 */ } }