private void ExtractData() { var ruleStruct = Marshal.PtrToStructure <YR_RULES>(BasePtr); Rules = ObjRefHelper .GetRules(ruleStruct.rules_list_head) .Select(rule => new Rule(rule)) .ToList(); RuleCount = ruleStruct.num_rules; StringsCount = ruleStruct.num_strings; NamespacesCount = ruleStruct.num_namespaces; }
private void ExtractRules() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { var ruleStruct = Marshal.PtrToStructure <YR_RULES_WINDOWS>(BasePtr); Rules = ObjRefHelper .GetRules(ruleStruct.rules_list_head) .Select(rule => new Rule(rule)) .ToList(); } else { var ruleStruct = Marshal.PtrToStructure <YR_RULES_UNIX>(BasePtr); Rules = ObjRefHelper .GetRules(ruleStruct.rules_list_head) .Select(rule => new Rule(rule)) .ToList(); } }