Ejemplo n.º 1
0
        private InsultDataSource LoadSource(string path)
        {
            JObject obj = JSONSerialization.LoadAsJObject(path);

            if (obj == null)
            {
                return(null);
            }

            string[] formats = null;
            Dictionary <string, string[]> categories = new Dictionary <string, string[]>();

            foreach (JProperty property in obj.Properties())
            {
                if (property.Name == "Formats")
                {
                    formats = property.First.ToObject <string[]>();
                }
                else
                {
                    categories.Add(property.Name, property.First.ToObject <string[]>());
                }
            }

            return(new InsultDataSource(formats, categories, _variables));
        }