Ejemplo n.º 1
0
        /// <summary>Constructor</summary>
        /// <param name="json">json object to parse into a Config</param>
        public static Config Parse(JObject json)
        {
            Config c = new Config();

            c.Option  = ConfigOption.Parse((JObject)json["options"]);
            c.Context = ConfigContext.Parse((JObject)json["context"]);
            c.ID      = (string)json["id"];
            return(c);
        }
Ejemplo n.º 2
0
        /// <summary>Constructor</summary>
        /// <param name="json">json object to parse into a Config</param>
        public static Config Parse(JObject json)
        {
            var c = new Config
            {
                JsonFromResponse = json,
                Option           = ConfigOption.Parse((JObject)json["options"]),
                Context          = ConfigContext.Parse((JObject)json["context"]),
                ID = (string)json["id"],
            };

            return(c);
        }
Ejemplo n.º 3
0
        /// <summary>parse a json object into a Config Context</summary>
        /// <param name="json">takes a json object and converts it to a ConfigContext</param>
        public static ConfigContext Parse(JObject json)
        {
            ConfigContext cc = new ConfigContext();
            cc.IsGlobal = (bool?)json["is_global"];

            // check to see if the project ids is empty
            JToken jval = json["project_ids"];
            if (null != jval && jval.HasValues)
            {
                // add values to the list if not empty
                cc.ProjectIDs = new List<string>();
                JArray jarray = (JArray)jval;
                foreach (JValue jsonItem in jarray)
                {
                    cc.ProjectIDs.Add((string)jsonItem);
                }
            }
            return cc;
        }
Ejemplo n.º 4
0
        /// <summary>parse a json object into a Config Context</summary>
        /// <param name="json">takes a json object and converts it to a ConfigContext</param>
        public static ConfigContext Parse(JObject json)
        {
            ConfigContext cc = new ConfigContext();

            cc.IsGlobal = (bool?)json["is_global"];

            // check to see if the project ids is empty
            JToken jval = json["project_ids"];

            if (null != jval && jval.HasValues)
            {
                // add values to the list if not empty
                cc.ProjectIDs = new List <string>();
                JArray jarray = (JArray)jval;
                foreach (JValue jsonItem in jarray)
                {
                    cc.ProjectIDs.Add((string)jsonItem);
                }
            }
            return(cc);
        }
Ejemplo n.º 5
0
        /// <summary>parse a json object into a Config Context</summary>
        /// <param name="json">takes a json object and converts it to a ConfigContext</param>
        public static ConfigContext Parse(JObject json)
        {
            var cc = new ConfigContext
            {
                JsonFromResponse = json,
                IsGlobal         = (bool?)json["is_global"],
            };

            // check to see if the project ids is empty
            var jval = json["project_ids"];

            if (null != jval && jval.HasValues)
            {
                // add values to the list if not empty
                cc.ProjectIDs = new List <string>();
                var jarray = (JArray)jval;
                foreach (var jsonItem in jarray.Cast <JValue>())
                {
                    cc.ProjectIDs.Add((string)jsonItem);
                }
            }
            return(cc);
        }