Пример #1
0
        private void ParseToken(JProperty jsonProperty, List <ActionBase> activeList)
        {
            var actionType = (ActionType)Enum.Parse(typeof(ActionType), JsonPreprocessor.DenumberActionWord(jsonProperty.Name), true);

            JToken value = jsonProperty.Value;

            if (value.Type == JTokenType.Object)

            {
                JObject jsonObject = value.ToObject <JObject>();

                ActionBase action = ParseObjectAction(jsonObject, actionType);
                action.Type = actionType;
                SetBaseDataForAction(jsonObject, action);

                activeList.Add(action);
            }
            else
            {
                ActionBase action = ParseObjectAction(jsonProperty, actionType);

                action.Type = actionType;

                activeList.Add(action);
            }
        }
Пример #2
0
        public override void ParseProjectFromFile(string file_path)
        {
            string  jsonText   = JsonPreprocessor.PreprocessJsonFile(File.ReadAllText(file_path));
            JObject jsonObject = JObject.Parse(jsonText);

            _mainProject.Name        = jsonObject["project"]["name"].ToString();
            _mainProject.Description = jsonObject["project"]["desc"].ToString();

            var jsonExecution = jsonObject["project"]["execution"].ToObject <JObject>();

            foreach (var property in jsonExecution.Properties())
            {
                ParseToken(property, this._actions);
            }
        }