public static void ThrowOnError(YARA_ERROR error) { switch (error) { case YARA_ERROR.SUCCESS: break; default: throw new YaraException(error); } }
public static YARA_ERROR CheckRule(string ruleFile) { YARA_ERROR error = YARA_ERROR.SUCCESS; Compiler comp = new Compiler(); try { comp.AddRuleFile(ruleFile); } catch (YaraException e) { error = e.YRError; } catch { error = YARA_ERROR.ERROR_INVALID_FILE; } comp.Dispose(); return(error); }
public YaraException(YARA_ERROR error) : base(string.Format("Yara error code {0}", Enum.GetName(typeof(YARA_ERROR), error))) { YRError = error; }