예제 #1
0
        public void Extract(IControl control)
        {
            var name = string.IsNullOrWhiteSpace(ComponentName) ? Name : Name + "|" + ComponentName;

            if (!AutoValues.TryGetValue(name, out var value))
            {
                value = new AutoValue
                {
                    Name = name,
                };
                AutoValues.Add(name, value);
            }

            value.ControlUniqueId     = control.ControlUniqueId;
            control.ControlUniqueId   = null;
            value.PublishOrderIndex   = control.PublishOrderIndex.GetValueOrDefault();
            control.PublishOrderIndex = null;

            if (control.Template.Id == @"http://microsoft.com/appmagic/Component")
            {
                // Only remove version for Templates.
                value.TemplateLastModified                    = control.Template.LastModifiedTimestamp;
                control.Template.LastModifiedTimestamp        = null;
                value.TemplateComponentDefinitionLastModified = control.Template.ComponentDefinitionInfo.LastModifiedTimestamp;
                control.Template.ComponentDefinitionInfo.LastModifiedTimestamp = null;
                value.TemplateVersion    = control.Template.Version;
                control.Template.Version = null;
            }
        }
예제 #2
0
        public bool Extract(Rule rule)
        {
            if (!JsRulesHandled.Contains(rule.Property))
            {
                return(false);
            }

            if (!AutoValues.TryGetValue(Name, out var value))
            {
                value = new AutoValue
                {
                    Name = Name,
                };
                AutoValues.Add(Name, value);
            }

            switch (rule.Property)
            {
            case "ZIndex":
                value.ZIndex = rule.InvariantScript;
                break;

            default:
                throw new Exception($"Rule Property {rule.Property} not defined for AutoValueExtractor.Extract");
            }

            rule.InvariantScript = "AutoValue";
            return(true);
        }