Beispiel #1
0
        protected virtual ElementFieldFlags UpdateElement(
            ElementBase elem,
            InfContentsElem17 cttElem,
            InfElementsElemContainer17 elElem)
        {
#if DEBUG && !DEBUG_IN_PROD
            LogTo.Debug("[{0} {1}] Updating",
                        elem.GetType().Name,
                        elem.Id);
#endif

            ElementFieldFlags flags = ElementFieldFlags.None;

            void UpdateFlag(object sender, PropertyChangedEventArgs e)
            {
                var fieldFlag = ElementBase.FieldFlagMapping.SafeGet(e.PropertyName);

                flags |= fieldFlag;
            }

            elem.PropertyChanged += UpdateFlag;

            if (elElem != null)
            {
                elem.TitleTextId = elElem._elem.titleTextId;

                elem.TemplateId = elElem._elem.templateId;
                elem.ConceptId  = elElem._elem.conceptId;

                elem.ComponentPos = elElem._elem.componPos;
                // elem.AFactor = elElem._elem.AFactor
            }

            if (cttElem != null)
            {
                elem.Deleted = cttElem.deleted != 0;

                elem.ParentId      = cttElem.parentId;
                elem.FirstChildId  = cttElem.firstChildId;
                elem.LastChildId   = cttElem.lastChildId;
                elem.NextSiblingId = cttElem.nextSiblingId;
                elem.PrevSiblingId = cttElem.prevSiblingId;

                elem.DescendantCount = cttElem.descendantCount;
                elem.ChildrenCount   = cttElem.childrenCount;
            }

            elem.PropertyChanged -= UpdateFlag;

            elem.OnUpdated(flags);

            return(flags);
        }
Beispiel #2
0
        public static string DefaultParametersParser(ElementBase parameterContainer, ISupportParameterElement parameter, string template)
        {
            string matchPattern = @"\{__ARXML__\.([\S]*?)\}";

            foreach (Match match in Regex.Matches(template, matchPattern))
            {
                string refTarget = match.Groups[1].Value;
                string value     = parameterContainer.GetType().GetProperty(ReflectJObject.Value <string> (refTarget)).GetValue(parameterContainer) as string;
                template = template.Replace(match.Value, value);
            }
            return(template);
        }
        string IVbElementSerializer.Serialize(ElementBase element)
        {
            string key   = "";
            string value = "";

            switch (element.GetType().Name)
            {
            case "ReferenceElement":
                key   = "Reference";
                value = _referenceParser.Parse((ReferenceElement)element);
                break;

            case "ObjectElement":
                key   = "Object";
                value = ParseObject(element);
                break;

            case "ModuleElement":
                key   = "Module";
                value = ParseGeneric(element);
                break;

            case "ClassElement":
                key   = "Class";
                value = ParseGeneric(element);
                break;

            case "FormElement":
                key   = "Form";
                value = ParseFormOrUserControl(element);
                break;

            case "UserControlElement":
                key   = "UserControl";
                value = ParseFormOrUserControl(element);
                break;

            default:
                throw new NotSupportedException(string.Format("Element '{0}' is not supported!", element.GetType().Name));
            }

            return(string.Format("{0}={1}", key, value));
        }
Beispiel #4
0
 public void Visit(ElementBase node)
 {
     throw new QLError("Not implemented type to evaluate: " + node.GetType());
 }
Beispiel #5
0
 public void Visit(ElementBase elementBase)
 {
     Exceptions.Add(new QLError(string.Format("Type checker was called for {0} but is not implemented", elementBase.GetType().Name)));
 }