diff --git a/Netch/Controllers/Guard.cs b/Netch/Controllers/Guard.cs index 78633713..691e174e 100644 --- a/Netch/Controllers/Guard.cs +++ b/Netch/Controllers/Guard.cs @@ -17,15 +17,15 @@ namespace Netch.Controllers { private readonly Timer _flushFileStreamTimer = new(300) {AutoReset = true}; + private FileStream? _logFileStream; + + private StreamWriter? _logStreamWriter; + /// /// 日志文件(重定向输出文件) /// private string LogPath => Path.Combine(Global.NetchDir, $"logging\\{Name}.log"); - private FileStream? _logFileStream; - - private StreamWriter? _logStreamWriter; - /// /// 成功启动关键词 /// @@ -107,6 +107,9 @@ namespace Netch.Controllers WindowStyle = ProcessWindowStyle.Hidden } }; + + if (!File.Exists(Instance.StartInfo.FileName)) + throw new MessageException(i18N.Translate($"bin\\{MainFile} file not found!")); } ///