Ejemplo n.º 1
0
        private static JArray ProcessGpXml(string path)
        {
            if (!Directory.Exists(path))
            {
                return(null);
            }

            // Group Policy Preferences are all XML so those are handled here.
            string[] xmlFiles = Directory.GetFiles(path, "*.xml", SearchOption.AllDirectories);
            // create a dict for the stuff we find
            JArray processedGpXml = new JArray();

            // if we find any xml files
            if (xmlFiles.Length >= 1)
            {
                foreach (string xmlFile in xmlFiles)
                {
                    // send each one to get mangled into json
                    JObject parsedGppXmlToJson = Parsers.ParseGppXmlToJson(xmlFile);
                    if (parsedGppXmlToJson == null)
                    {
                        continue;
                    }
                    // then send each one to get assessed for fun things
                    JObject assessedGpp = AssessHandlers.AssessGppJson(parsedGppXmlToJson);
                    if (assessedGpp.HasValues)
                    {
                        processedGpXml.Add(assessedGpp);
                    }
                }
            }

            return(processedGpXml);
        }
Ejemplo n.º 2
0
        private static JObject ProcessGpXml(string Path)
        {
            if (!Directory.Exists(Path))
            {
                return(null);
            }
            // Group Policy Preferences are all XML so those are handled here.
            string[] xmlFiles = Directory.GetFiles(Path, "*.xml", SearchOption.AllDirectories);
            // create a dict for the stuff we find
            Dictionary <string, JObject> processedGpXml = new Dictionary <string, JObject>();

            // if we find any xml files
            if (xmlFiles.Length >= 1)
            {
                foreach (var xmlFile in xmlFiles)
                {
                    // send each one to get mangled into json
                    JObject parsedGppXmlToJson = Parsers.ParseGppXmlToJson(xmlFile);
                    // then send each one to get assessed for fun things
                    JObject assessedGpp = AssessHandlers.AssessGppJson(parsedGppXmlToJson);
                    if (assessedGpp != null)
                    {
                        processedGpXml.Add(xmlFile, assessedGpp);
                    }
                }
            }

            return((JObject)JToken.FromObject(processedGpXml));
        }