diff --git a/YaraSharp/Compiler.cpp b/YaraSharp/Compiler.cpp index 1975204..009d7ec 100644 --- a/YaraSharp/Compiler.cpp +++ b/YaraSharp/Compiler.cpp @@ -98,8 +98,19 @@ namespace YaraSharp UNREFERENCED_PARAMETER(ErrorLevel); UNREFERENCED_PARAMETER(UserData); - auto msg = String::Format("{0} in line {1} in file: {2}", - marshal_as(Message), LineNumber, + String^ errorLevel; + + if (ErrorLevel == YARA_ERROR_LEVEL_ERROR) + { + errorLevel = "ERROR"; + } + else if (ErrorLevel == YARA_ERROR_LEVEL_WARNING) + { + errorLevel = "WARNING"; + } + + auto msg = String::Format("{0}: {1} on line {2} in file: {3}", + errorLevel, marshal_as(Message), LineNumber, Filename ? marshal_as(Filename) : "[none]"); Errors->Add(msg); diff --git a/YaraSharp/YaraSharp.cpp b/YaraSharp/YaraSharp.cpp index cdd2eeb..4f4ae3c 100644 --- a/YaraSharp/YaraSharp.cpp +++ b/YaraSharp/YaraSharp.cpp @@ -14,7 +14,7 @@ namespace YaraSharp { CCompiler^ TestCompiler = gcnew CCompiler(ExternalVariables); - if (TestCompiler->AddFile(FilePathList[i])) + if (TestCompiler->AddFile(FilePathList[i]) || TestCompiler->GetErrors()->Count > 0) { CompilationErrors->Add(FilePathList[i], TestCompiler->GetErrors()); FilePathList->Remove(FilePathList[i--]); @@ -31,7 +31,7 @@ namespace YaraSharp CCompiler^ TestCompiler = gcnew CCompiler(ExternalVariables); for each (auto FilePath in FilePathList) { - if (TestCompiler->AddFile(FilePath)) + if (TestCompiler->AddFile(FilePath) || TestCompiler->GetErrors()->Count > 0) { CompilationErrors->Add(FilePath, TestCompiler->GetErrors()); FilePathList->Remove(FilePath);