Example #1
0
        public static void ThrowOnError(YARA_ERROR error)
        {
            switch (error)
            {
            case YARA_ERROR.SUCCESS:
                break;

            default:
                throw new YaraException(error);
            }
        }
Example #2
0
        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);
        }
Example #3
0
 public YaraException(YARA_ERROR error)
     : base(string.Format("Yara error code {0}", Enum.GetName(typeof(YARA_ERROR), error)))
 {
     YRError = error;
 }