Esempio n. 1
0
        protected Flow(FObj parent, PropertyList propertyList)
            : base(parent, propertyList)
        {
            this.name = GetElementName();

            if (parent.GetName().Equals("fo:page-sequence"))
            {
                this.pageSequence = (PageSequence)parent;
            }
            else
            {
                throw new FonetException("flow must be child of "
                    + "page-sequence, not "
                    + parent.GetName());
            }
            SetFlowName(GetProperty("flow-name").GetString());

            if (pageSequence.IsFlowSet)
            {
                if (this.name.Equals("fo:flow"))
                {
                    throw new FonetException("Only a single fo:flow permitted"
                        + " per fo:page-sequence");
                }
                else
                {
                    throw new FonetException(this.name
                        + " not allowed after fo:flow");
                }
            }
            pageSequence.AddFlow(this);
        }
Esempio n. 2
0
        protected PageSequenceMaster(FObj parent, PropertyList propertyList)
            : base(parent, propertyList)
        {
            this.name = "fo:page-sequence-master";

            subSequenceSpecifiers = new ArrayList();

            if (parent.GetName().Equals("fo:layout-master-set"))
            {
                this.layoutMasterSet = (LayoutMasterSet)parent;
                string pm = this.properties.GetProperty("master-name").GetString();
                if (pm == null)
                {
                    FonetDriver.ActiveDriver.FireFonetWarning(
                        "page-sequence-master does not have a page-master-name and so is being ignored");
                }
                else
                {
                    this.layoutMasterSet.addPageSequenceMaster(pm, this);
                }
            }
            else
            {
                throw new FonetException("fo:page-sequence-master must be child "
                    + "of fo:layout-master-set, not "
                    + parent.GetName());
            }
        }
        public AddEditPropertyListDialog(PropertyList propertyList)
        {
            InitializeComponent();
            Title = "Edit Component Property List";

            mViewPropertyList = new AddEditPropertyListViewModel(this, propertyList);
        }
Esempio n. 4
0
        public Block(FObj parent, PropertyList propertyList) : base(parent, propertyList)
        {
            this.name = "fo:block";

            switch (parent.GetName())
            {
                case "fo:basic-link":
                case "fo:block":
                case "fo:block-container":
                case "fo:float":
                case "fo:flow":
                case "fo:footnote-body":
                case "fo:inline":
                case "fo:inline-container":
                case "fo:list-item-body":
                case "fo:list-item-label":
                case "fo:marker":
                case "fo:multi-case":
                case "fo:static-content":
                case "fo:table-caption":
                case "fo:table-cell":
                case "fo:wrapper":
                    break;
                default:
                    throw new FonetException(
                        "fo:block must be child of " +
                            "fo:basic-link, fo:block, fo:block-container, fo:float, fo:flow, fo:footnote-body, fo:inline, fo:inline-container, fo:list-item-body, fo:list-item-label, fo:marker, fo:multi-case, fo:static-content, fo:table-caption, fo:table-cell or fo:wrapper " +
                            "not " + parent.GetName());
            }
            this.span = this.properties.GetProperty("span").GetEnum();
            ts = propMgr.getTextDecoration(parent);
        }
Esempio n. 5
0
        protected SimplePageMaster(FObj parent, PropertyList propertyList)
            : base(parent, propertyList)
        {
            this.name = "fo:simple-page-master";

            if (parent.GetName().Equals("fo:layout-master-set"))
            {
                this.layoutMasterSet = (LayoutMasterSet)parent;
                masterName = this.properties.GetProperty("master-name").GetString();
                if (masterName == null)
                {
                    FonetDriver.ActiveDriver.FireFonetWarning(
                        "simple-page-master does not have a master-name and so is being ignored");
                }
                else
                {
                    this.layoutMasterSet.addSimplePageMaster(this);
                }
            }
            else
            {
                throw new FonetException("fo:simple-page-master must be child "
                    + "of fo:layout-master-set, not "
                    + parent.GetName());
            }
            _regions = new Hashtable();
        }
Esempio n. 6
0
 public ProjectInfo(Project project)
 {
     _project = project;
     _properties = new ProjectPropertyList(_project);
     _references = new ReferenceList(_project);
     _dependencies = new List<string>();
 }
Esempio n. 7
0
        public Flusso(Variable father, string[] fields, List<string> map)
        {
            this.father = father;
            protocolname = map[0];
            propertyDefinitions = VarDefinitions.Map[map[0]];
            propertyValues = new PropertyList();
            if (Regex.IsMatch(map[0], "Variables|Common", RegexOptions.IgnoreCase))
                name = map[0];
            else
                name = fields[1];

            name = name.Trim();
            foreach (var pt in propertyDefinitions)
            {
                if (!pt.Value.Visibile) continue;
                int i = map.FindIndex(x => x == pt.Key);
                if (pt.Key=="Abilitato")
                {
                    if (!Boolean.TryParse(fields[i-1], out abilitazione)) abilitazione = false;
                }
                if (i > 0)
                {
                    propertyValues.Add(pt.Key, fields[i - 1].Replace("%sc%",";").Trim(),pt.Value);
                }
                else
                    propertyValues.Add(pt.Key, "", pt.Value);
            }   
        }
Esempio n. 8
0
        public override Property GetShorthand(PropertyList propertyList) {
            Property p = null;
            ListProperty listprop;

            if (p == null) {
                listprop = (ListProperty) propertyList.GetExplicitProperty("border-top");
                if (listprop != null) {
                    IShorthandParser shparser = new GenericShorthandParser(listprop);
                    p = shparser.GetValueForProperty(PropName, this, propertyList);
                }
            }

            if (p == null) {
                listprop = (ListProperty) propertyList.GetExplicitProperty("border-width");
                if (listprop != null) {
                    IShorthandParser shparser = new BoxPropShorthandParser(listprop);
                    p = shparser.GetValueForProperty(PropName, this, propertyList);
                }
            }

            if (p == null) {
                listprop = (ListProperty) propertyList.GetExplicitProperty("border");
                if (listprop != null) {
                    IShorthandParser shparser = new GenericShorthandParser(listprop);
                    p = shparser.GetValueForProperty(PropName, this, propertyList);
                }
            }

            return p;
        }
Esempio n. 9
0
 protected override Property convertValueForProperty(
     string propName, PropertyMaker maker, PropertyList propertyList)
 {
     Property p = null;
     if (propName.IndexOf("-top") >= 0)
     {
         p = getElement(0);
     }
     else if (propName.IndexOf("-right") >= 0)
     {
         p = getElement(count() > 1 ? 1 : 0);
     }
     else if (propName.IndexOf("-bottom") >= 0)
     {
         p = getElement(count() > 2 ? 2 : 0);
     }
     else if (propName.IndexOf("-left") >= 0)
     {
         p = getElement(count() > 3 ? 3 : (count() > 1 ? 1 : 0));
     }
     if (p != null)
     {
         return maker.ConvertShorthandProperty(propertyList, p, null);
     }
     return p;
 }
Esempio n. 10
0
        public override Property Compute(PropertyList propertyList)
        {
            Property computedProperty = null;
            Property correspondingProperty = propertyList.GetProperty("text-align");
            if (correspondingProperty != null)
            {
                int correspondingValue = correspondingProperty.GetEnum();

                if (correspondingValue == TextAlign.JUSTIFY)
                {
                    computedProperty = new EnumProperty(Constants.START);
                }
                else if (correspondingValue == TextAlign.END)
                {
                    computedProperty = new EnumProperty(Constants.END);
                }
                else if (correspondingValue == TextAlign.START)
                {
                    computedProperty = new EnumProperty(Constants.START);
                }
                else if (correspondingValue == TextAlign.CENTER)
                {
                    computedProperty = new EnumProperty(Constants.CENTER);
                }

            }
            return computedProperty;
        }
Esempio n. 11
0
        public override Property Make(PropertyList propertyList) {
            if (m_defaultProp == null) {
                m_defaultProp = Make(propertyList, "0", propertyList.getParentFObj());
            }
            return m_defaultProp;

        }
Esempio n. 12
0
 public AbstractTableBody(FObj parent, PropertyList propertyList) : base(parent, propertyList)
 {
     if (!(parent is Table))
     {
         FonetDriver.ActiveDriver.FireFonetError(
             "A table body must be child of fo:table, not " + parent.GetName());
     }
 }
Esempio n. 13
0
        public BuildEngine(FrameworkVersions toolsVersion, string frameworkPath)
        {
            _framework = toolsVersion;
            _frameworkPath = frameworkPath;
			Engine = CreateEngine(_framework, _frameworkPath);
            _projects = new ProjectList(this, _framework);
            _properties = new PropertyList(Engine.GlobalProperties);
        }
 public override Property Make(PropertyList propertyList)
 {
     if (m_defaultProp == null)
     {
         m_defaultProp = Make(propertyList, "use-target-processing-context", propertyList.getParentFObj());
     }
     return m_defaultProp;
 }
Esempio n. 15
0
 public override Property Make(PropertyList propertyList)
 {
     if (m_defaultProp == null)
     {
         m_defaultProp = Make(propertyList, "use-normal-stylesheet", propertyList.getParentFObj());
     }
     return m_defaultProp;
 }
Esempio n. 16
0
 public virtual void LoadExternalFile(string path)
 {
     ExternalFile = path;
     if (string.IsNullOrEmpty(path))
         Properties = new PropertyList();
     else
         Properties = environmentLoader.LoadProperties(path);
 }
        public DataRecordConverterTypeBuilder(DataRecordConverterSpec queryInfo)
        {
            _queryInfo = Verify.ArgumentNotNull(queryInfo, "queryInfo");

            PropertyInfo[] properties = queryInfo.RecordType.GetProperties();

            var propertyMap = new NameDictionary<PropertyInfo>();
            var dataRecordMap = new NameDictionary<DataRecordFieldInfo>();

            foreach (DataRecordFieldInfo field in queryInfo.Fields)
            {
                dataRecordMap.Add(field.FieldName, field);
            }

            foreach (PropertyInfo property in properties)
            {
                if (property.HasPublicSetter())
                {
                    propertyMap.Add(property.Name, property);
                }
            }

            foreach (DataRecordFieldInfo field in queryInfo.Fields)
            {
                var propertyList = new PropertyList(queryInfo.RecordType, field.FieldName);
                if (propertyList.HasErrors)
                {
                    _errors.AddRange(propertyList.Errors);
                }
                else if (DataRecordConverterMethod.CanHandleConversion(field.FieldType, propertyList.PropertyType))
                {
                    _mapFieldToProperty.Add(field, propertyList);
                }
                else
                {
                    _errors.Add(string.Format("Cannot convert from {0} to {1} for {2}",
                                              field.FieldType.Name, propertyList.PropertyType.Name, field.FieldName));
                }
            }

            foreach (PropertyInfo property in properties)
            {
                if (property.HasPublicSetter())
                {
                    DataRecordFieldInfo field;
                    if (dataRecordMap.TryGetValue(property.Name, out field))
                    {
                        _mapPropertyToField.Add(property, field);
                    }
                    else
                    {
                        _errors.Add(string.Format("Query result does not have a column named '{0}'",
                                                  property.Name));
                    }
                }
            }
        }
Esempio n. 18
0
        public void CreateNewPropertyWithBestInitialValues_InitialListTest()
        {
            var properties = new PropertyList();

            var newProperty = properties.CreateNew(_classifiers);

            Assert.AreEqual("New Property 1", newProperty.Name);
            Assert.AreEqual(String, newProperty.Type);
        }
Esempio n. 19
0
 public virtual PropertyList LoadProperties(string path)
 {
     var xml = XElement.Parse(fileSystem.ReadAllText(path));
     var result = new PropertyList();
     var propertyNodes = xml.Descendants(ScopedName("PropertyGroup")).Descendants();
     foreach (var node in propertyNodes)
         result.Add(node.Name.LocalName, node.Value);
     return result;
 }
Esempio n. 20
0
        protected InlineContainer(FObj parent, PropertyList propertyList)
            : base(parent, propertyList)
        {
            this.name = "fo:inline-container";

            BorderAndPadding bap = propMgr.GetBorderAndPadding();
            BackgroundProps bProps = propMgr.GetBackgroundProps();
            MarginInlineProps mProps = propMgr.GetMarginInlineProps();
            RelativePositionProps mRelProps = propMgr.GetRelativePositionProps();
        }
Esempio n. 21
0
 public PageMasterReference(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
     this.name = GetElementName();
     if (GetProperty("master-reference") != null)
     {
         SetMasterName(GetProperty("master-reference").GetString());
     }
     validateParent(parent);
 }
Esempio n. 22
0
        public virtual void SaveProperties(PropertyList properties, string path)
        {
            var propertyLines = properties.Select(p => string.Format("<{0}>{1}</{0}>", p.Key, p.Value)).ToArray();
            fileSystem.WriteAllText(path, string.Format(@"<?xml version='1.0' encoding='utf-8'?>
<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
    <PropertyGroup>
        {0}
    </PropertyGroup>
</Project>", string.Join(Environment.NewLine + "        ", propertyLines)));
        }
Esempio n. 23
0
 protected internal Root(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
     this.name = "fo:root";
     pageSequences = new ArrayList();
     if (parent != null)
     {
         throw new FonetException("root must be root element");
     }
 }
Esempio n. 24
0
 protected override Property ConvertPropertyDatatype(
     Property p, PropertyList propertyList, FObj fo)
 {
     String nameval = p.GetNCname();
     if (nameval != null)
     {
         return new ColorTypeProperty(new ColorType(nameval));
     }
     return base.ConvertPropertyDatatype(p, propertyList, fo);
 }
Esempio n. 25
0
        public void CreateNewPropertyWithBestInitialValues_DifferentNameTest()
        {
            var properties = new PropertyList();
            properties.CreateProperty("New Property 1", String);
            properties.CreateProperty("Name", String);

            var newProperty = properties.CreateNew(_classifiers);

            Assert.AreEqual("New Property 2", newProperty.Name);
            Assert.AreEqual(String, newProperty.Type);
        }
        public AddEditPropertyListViewModel(AddEditPropertyListDialog view, int propertyListGroupId)
        {
            View = view;
            mPropertyList = new PropertyList { PropertyListGroupId = propertyListGroupId };
            LoadPropertyLists(propertyListGroupId);

            FireLoaded();

            OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanModifyConfig);
            CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, x => true);
        }
Esempio n. 27
0
        public void CreateNewPropertyWithBestInitialValues_TypeTest()
        {
            var properties = new PropertyList();
            properties.CreateProperty("New Property 1", Integer);
            properties.CreateProperty("New Property 2", Integer);
            properties.CreateProperty("New Property 3", String);

            var newProperty = properties.CreateNew(_classifiers);

            Assert.AreEqual("New Property 4", newProperty.Name);
            Assert.AreEqual(Integer, newProperty.Type);
        }
Esempio n. 28
0
        public void SwitchingToExternalFileShouldSetExternalFileProperties()
        {
            var properties = new PropertyList().Add("key1", "value1").Add("key2", "value2");
            environmentLoader.Setup(loader => loader.LoadProperties(@"c:\ops\config.properties")).Returns(properties);
            form.LoadExternalFile(@"c:\ops\config.properties");
            form.Properties = new PropertyList();
            form.UsePackagedEnvironment = false;

            form.ToggleConfigSelection();

            Assert.That(form.Properties, Is.EqualTo(properties));
        }
Esempio n. 29
0
        public void SwitchingToPackagedFileLoadsEnvironmentProperties()
        {
            var properties = new PropertyList().Add("key1", "value1").Add("key2", "value2");
            environmentLoader.Setup(loader => loader.GetProperties("dev")).Returns(properties);
            form.Environments = new[] { "dev" };
            form.SelectedEnvironment = "dev";
            form.UsePackagedEnvironment = true;

            form.ToggleConfigSelection();

            Assert.That(form.Properties, Is.EqualTo(properties));
        }
Esempio n. 30
0
        public static void WriteXml(XmlWriter writer, PropertyList propList)
        {
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent = true;
            settings.IndentChars = "  ";
            settings.OmitXmlDeclaration = false;
            settings.Encoding = Encoding.UTF8;
            settings.NewLineChars = Environment.NewLine;

            WritePropertyList(writer, propList);
        }
Esempio n. 31
0
 public Table(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
     this.name = "fo:table";
 }
Esempio n. 32
0
 public TableColumn(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
 }
Esempio n. 33
0
 protected MultiSwitch(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
     this.name = "fo:multi-switch";
 }
Esempio n. 34
0
 public override IPercentBase GetPercentBase(FObj fo, PropertyList propertyList)
 {
     return(new LengthBase(fo, propertyList, LengthBase.INH_FONTSIZE));
 }
Esempio n. 35
0
 protected InitialPropertySet(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
 }
Esempio n. 36
0
        public static void ImportXML(string path, string file)
        {
            using (var xml = new XmlDataStore <ConquestSerial, Conquest>(path, file))
            {
                xml.OnDeserialize = doc =>
                {
                    XmlElement root = doc.DocumentElement;

                    if (root == null)
                    {
                        return(true);
                    }

                    foreach (XmlElement conquestNode in root.ChildNodes.OfType <XmlElement>())
                    {
                        string typeAttr = conquestNode.GetAttribute("type");
                        var    type     = new TypeSelectProperty <Conquest>(typeAttr);

                        if (!type.IsNotNull)
                        {
                            continue;
                        }

                        var conquest = type.CreateInstance <Conquest>();
                        PropertyList <Conquest> pList = conquest.GetProperties(
                            BindingFlags.Instance | BindingFlags.Public,
                            p => p.CanWrite && p.Name != "Enabled" && p.Name != "InvokeReset" && p.Name != "InvokeClear");

                        foreach (XmlElement conquestPropNode in conquestNode.ChildNodes.OfType <XmlElement>())
                        {
                            string pName = conquestPropNode.Name;
                            string dType = conquestPropNode.GetAttribute("type");
                            string data  = conquestPropNode.GetAttribute("value");

                            switch (dType)
                            {
                            case "Type":
                            {
                                Type t = null;

                                if (!String.IsNullOrWhiteSpace(data))
                                {
                                    t = Type.GetType(data, false, true) ??
                                        ScriptCompiler.FindTypeByName(data, true) ??
                                        ScriptCompiler.FindTypeByFullName(data);
                                }

                                pList.Set(pName, t);
                            }
                            break;

                            default:
                            {
                                DataType dataType;

                                if (!Enum.TryParse(dType, out dataType))
                                {
                                    continue;
                                }

                                SimpleType sType;

                                if (SimpleType.TryParse(data, dataType, out sType) && sType.Flag != DataType.Null)
                                {
                                    pList.Set(pName, sType.Value);
                                }
                            }
                            break;
                            }
                        }

                        pList.Serialize(conquest);

                        xml.AddOrReplace(conquest.UID, conquest);
                    }

                    return(true);
                };

                if (xml.Import() == DataStoreResult.OK)
                {
                    xml.CopyTo(ConquestRegistry);

                    xml.Document.Delete();
                }

                foreach (Exception e in xml.Errors)
                {
                    e.ToConsole();
                }
            }
        }
Esempio n. 37
0
        public static void ExportXML(string path, string file)
        {
            using (var xml = new XmlDataStore <ConquestSerial, Conquest>(path, file))
            {
                xml.OnSerialize = doc =>
                {
                    XmlElement root = doc.CreateElement("Conquests");

                    foreach (Conquest conquest in xml.Values)
                    {
                        PropertyList <Conquest> pList = conquest.GetProperties(
                            BindingFlags.Instance | BindingFlags.Public,
                            p => p.CanWrite && p.Name != "Enabled" && p.Name != "InvokeReset" && p.Name != "InvokeClear");

                        XmlElement conquestNode = doc.CreateElement("Conquest");

                        conquestNode.SetAttribute("type", conquest.GetType().Name);

                        foreach (KeyValuePair <string, object> kv in pList.Where(kv => SimpleType.IsSimpleType(kv.Value))
                                 )
                        {
                            string flag;
                            string value;

                            if (SimpleType.IsSimpleType(kv.Value))
                            {
                                SimpleType sType = SimpleType.FromObject(kv.Value);

                                flag  = sType.Flag.ToString();
                                value = sType.Value.ToString();
                            }
                            else if (kv.Value is Type)
                            {
                                flag  = "Type";
                                value = ((Type)kv.Value).Name;
                            }
                            else if (kv.Value is ITypeSelectProperty)
                            {
                                flag  = "Type";
                                value = ((ITypeSelectProperty)kv.Value).TypeName ?? String.Empty;
                            }
                            else
                            {
                                continue;
                            }

                            XmlElement conquestPropNode = doc.CreateElement(kv.Key);

                            conquestPropNode.SetAttribute("type", flag);
                            conquestPropNode.SetAttribute("value", value);

                            conquestNode.AppendChild(conquestPropNode);
                        }

                        root.AppendChild(conquestNode);
                    }

                    doc.AppendChild(root);

                    return(true);
                };

                ConquestRegistry.CopyTo(xml, true);

                xml.Export();

                foreach (Exception e in xml.Errors)
                {
                    e.ToConsole();
                }
            }
        }
 public ExternalGraphic(FObj parent, PropertyList propertyList) : base(parent, propertyList)
 {
     this.name = "fo:external-graphic";
 }
 public override FObj Make(FObj parent, PropertyList propertyList)
 {
     return(new ExternalGraphic(parent, propertyList));
 }
Esempio n. 40
0
 public override FObj Make(FObj parent, PropertyList propertyList)
 {
     return(new Declarations(parent, propertyList));
 }
Esempio n. 41
0
 public ListItemBody(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
 }
Esempio n. 42
0
 public override FObj Make(FObj parent, PropertyList propertyList)
 {
     return(new RegionAfter(parent, propertyList));
 }
Esempio n. 43
0
 /// <summary>
 /// 添加 Property 元素
 /// </summary>
 /// <param name="Name">需要定义的属性</param>
 /// <param name="Value">属性的值</param>
 public void AddProperty(string Name, string Value)
 {
     Property property = new Property(Name, Value);
     PropertyList.Add(property);
 }
Esempio n. 44
0
        protected override IEnumerable <object> EnumerateReferences(PropertyList record)
        {
            yield return(record.PropertyListAssociations);

            yield return(record.ListIdentifier);
        }
Esempio n. 45
0
 public LengthBase(FObj parentFO, PropertyList plist, int iBaseType)
 {
     this.parentFO     = parentFO;
     this.propertyList = plist;
     this.iBaseType    = iBaseType;
 }
Esempio n. 46
0
 protected override Expression <Func <PropertyList, bool> > FindExisting(PropertyList record)
 => existing => existing.ListIdentifierId == record.ListIdentifierId;
Esempio n. 47
0
 public override FObj Make(FObj parent, PropertyList propertyList)
 {
     return(new MultiSwitch(parent, propertyList));
 }
Esempio n. 48
0
 public PropertyInfo(PropertyMaker maker, PropertyList plist, FObj fo)
 {
     this.maker = maker;
     this.plist = plist;
     this.fo    = fo;
 }
Esempio n. 49
0
        public void UpdateData(DataContent dc, PropertyList includeList, PropertyList excludeList, PropertyList ignoreIfEmptyList)
        {
            ArrayList theList = includeList == null?new ArrayList(comps.Keys) : new ArrayList(includeList.KeySet());

            foreach (String k in  theList)
            {
                Control textBox       = (Control)comps[k];
                bool    doExcludeThis = false;
                if (excludeList != null && excludeList.ContainsProperty(textBox.Name))
                {
                    doExcludeThis = true;
                }
                if (!doExcludeThis)
                {
                    try
                    {
                        Object o = GetFieldValue(k);
                        if (!doExcludeThis && o == null)
                        {
                            if (ignoreIfEmptyList != null && ignoreIfEmptyList.ContainsProperty(textBox.Name))
                            {
                                doExcludeThis = true;
                            }
                        }
                        if (!doExcludeThis)
                        {
                            dc.SetProperty(k, o);
                        }
                    }catch (Exception exc)
                    {
                        if (textBox is TextBox)
                        {
                            textBox.Text = "";
                            textBox.Focus();
                        }
                        throw exc;
                    }
                }
            }
        }
Esempio n. 50
0
 public Wrapper(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
     this.name = "fo:wrapper";
 }
Esempio n. 51
0
            internal Type GetOrCreate(IEnumerable <string> properties, Func <IEnumerable <string>, Type> factory)
            {
                var key = new PropertyList(properties);

                return(GetOrCreate(key, x => factory(properties)));
            }
Esempio n. 52
0
 public override FObj Make(FObj parent, PropertyList propertyList)
 {
     return(new Wrapper(parent, propertyList));
 }
 public override FObj Make(FObj parent, PropertyList propertyList)
 {
     return(new RepeatablePageMasterReference(parent, propertyList));
 }
Esempio n. 54
0
 protected Declarations(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
     this.name = "fo:declarations";
 }
Esempio n. 55
0
 protected Float(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
     this.name = "fo:float";
 }
Esempio n. 56
0
 protected MultiPropertySet(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
 }
Esempio n. 57
0
 public override FObj Make(FObj parent, PropertyList propertyList)
 {
     return(new PageSequence(parent, propertyList));
 }
Esempio n. 58
0
 protected RegionAfter(FObj parent, PropertyList propertyList)
     : base(parent, propertyList)
 {
     precedence = this.properties.GetProperty("precedence").GetEnum();
 }
Esempio n. 59
0
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                throw new Exception("Usage: esp32.exe <esp-idf directory>");
            }

            if (args[0] == "/periph")
            {
                ParsePeripheralRegisters(args[1]);
                return;
            }

            if (args[0] == "R")
            {// Only rename files
                RenameDublFiles(args[1]);
                return;
            }
            var bspBuilder = new ESP32BSPBuilder(new BSPDirectories(args[0], @"..\..\Output", @"..\..\rules"));

            PathTools.CopyDirectoryRecursive(@"..\..\bsp-template", bspBuilder.Directories.OutputDir);

            string registerSetFile = Path.Combine(bspBuilder.Directories.OutputDir, "registers.xml");
            var    registers       = PeripheralRegisterParser.ParsePeripheralRegisters(Path.Combine(bspBuilder.Directories.InputDir, "esp-idf.orig"));

            XmlTools.SaveObject(new MCUDefinition {
                MCUName = "ESP32", RegisterSets = registers
            }, registerSetFile);

            var bsp = XmlTools.LoadObject <BoardSupportPackage>(Path.Combine(bspBuilder.BSPRoot, "bsp.xml"));

            var commonPseudofamily = new MCUFamilyBuilder(bspBuilder, XmlTools.LoadObject <FamilyDefinition>(bspBuilder.Directories.RulesDir + @"\CommonFiles.xml"));
            List <EmbeddedFramework> frameworks = new List <EmbeddedFramework>(bsp.Frameworks);

            frameworks.AddRange(commonPseudofamily.GenerateFrameworkDefinitions());
            bsp.Frameworks = frameworks.ToArray();

            List <string> projectFiles = new List <string>();
            PropertyList  unused       = null;

            if (commonPseudofamily.Definition.CoreFramework != null)
            {
                foreach (var job in commonPseudofamily.Definition.CoreFramework.CopyJobs)
                {
                    job.CopyAndBuildFlags(bspBuilder, projectFiles, null, ref unused);
                }
            }

            var mainFamily = bsp.MCUFamilies.First();

            if (mainFamily.AdditionalSourceFiles != null || mainFamily.AdditionalHeaderFiles != null || bsp.FileConditions != null)
            {
                throw new Exception("TODO: merge lists");
            }

            mainFamily.AdditionalSourceFiles = projectFiles.Where(f => !MCUFamilyBuilder.IsHeaderFile(f)).ToArray();
            mainFamily.AdditionalHeaderFiles = projectFiles.Where(f => MCUFamilyBuilder.IsHeaderFile(f)).ToArray();
            bsp.FileConditions = bspBuilder.MatchedFileConditions.ToArray();

            foreach (var fn in Directory.GetFiles(Path.Combine(bspBuilder.Directories.OutputDir, @"esp-idf\components\nghttp"), "*.?", SearchOption.AllDirectories))
            {
                string ext = Path.GetExtension(fn).ToLower();
                if (ext != ".c" && ext != ".h")
                {
                    continue;
                }

                var  lines   = File.ReadAllLines(fn);
                bool changed = false;
                for (int i = 0; i < lines.Length; i++)
                {
                    if (lines[i].Contains("<config.h>"))
                    {
                        lines[i] = lines[i].Replace("<config.h>", "<nghttp-config.h>");
                        changed  = true;
                    }
                }
                if (changed)
                {
                    File.WriteAllLines(fn, lines);
                }
            }

            foreach (var mcu in bsp.SupportedMCUs)
            {
                mcu.MCUDefinitionFile = Path.GetFileName(registerSetFile);
            }

            File.WriteAllText(Path.Combine(bspBuilder.Directories.OutputDir, @"esp-idf\components\nghttp\port\include\nghttp-config.h"), "#include \"config.h\"\n");

            string linkerScript    = Path.Combine(bspBuilder.Directories.OutputDir, @"esp-idf\components\esp32\ld\esp32.common.ld");
            var    lines2          = File.ReadAllLines(linkerScript).ToList();
            Regex  rgLibrary       = new Regex(@"(.*)\*lib([0-9a-zA-Z_-]+).a:\(([^()]+)\)");
            Regex  rgFileInLibrary = new Regex(@"(.*)\*lib([0-9a-zA-Z_-]+).a:([0-9a-zA-Z_-]+\.o)\(([^()]+)\)");

            for (int i = 0; i < lines2.Count; i++)
            {
                var m = rgLibrary.Match(lines2[i]);
                if (m.Success)
                {
                    string dir = Path.Combine(bspBuilder.Directories.OutputDir, @"esp-idf\components\" + m.Groups[2].Value);
                    if (Directory.Exists(dir))
                    {
                        string[] fns = Directory.GetFiles(dir)
                                       .Select(f => Path.GetFileName(f))
                                       .Where(f => f.EndsWith(".S", StringComparison.InvariantCultureIgnoreCase) || f.EndsWith(".c", StringComparison.InvariantCultureIgnoreCase))
                                       .Select(f => Path.ChangeExtension(f, ".o"))
                                       .OrderBy(f => f)
                                       .ToArray();

                        int j = 0;

                        foreach (var fn in fns)
                        {
                            lines2.Insert(i + ++j, $"{m.Groups[1].Value}*{fn}({m.Groups[3].Value}) /* => {lines2[i]}*/");
                        }
                        lines2.RemoveAt(i--);
                        i += j;
                        continue;
                    }
                }
                m = rgFileInLibrary.Match(lines2[i]);
                if (m.Success)
                {
                    lines2[i] = $"{m.Groups[1].Value}*{m.Groups[3].Value}({m.Groups[4].Value}) /* => {lines2[i]} */";
                }
            }
            File.WriteAllLines(linkerScript, lines2);

            XmlTools.SaveObject(bsp, Path.Combine(bspBuilder.BSPRoot, "BSP.XML"));

            RenameDublFiles(bspBuilder.BSPRoot);
        }
Esempio n. 60
0
        protected PageSequence(FObj parent, PropertyList propertyList)
            : base(parent, propertyList)
        {
            this.name = "fo:page-sequence";

            if (parent.GetName().Equals("fo:root"))
            {
                this.root = (Root)parent;
            }
            else
            {
                throw new FonetException("page-sequence must be child of root, not "
                                         + parent.GetName());
            }

            layoutMasterSet = root.getLayoutMasterSet();
            layoutMasterSet.checkRegionNames();

            _flowMap = new Hashtable();

            thisIsFirstPage = true;
            ipnValue        = this.properties.GetProperty("initial-page-number").GetString();

            if (ipnValue.Equals("auto"))
            {
                pageNumberType = AUTO;
            }
            else if (ipnValue.Equals("auto-even"))
            {
                pageNumberType = AUTO_EVEN;
            }
            else if (ipnValue.Equals("auto-odd"))
            {
                pageNumberType = AUTO_ODD;
            }
            else
            {
                pageNumberType = EXPLICIT;
                try
                {
                    int pageStart = Int32.Parse(ipnValue);
                    this.currentPageNumber = (pageStart > 0) ? pageStart - 1 : 0;
                }
                catch (FormatException)
                {
                    throw new FonetException("\"" + ipnValue
                                             + "\" is not a valid value for initial-page-number");
                }
            }

            masterName = this.properties.GetProperty("master-reference").GetString();

            this.pageNumberGenerator =
                new PageNumberGenerator(this.properties.GetProperty("format").GetString(),
                                        this.properties.GetProperty("grouping-separator").GetCharacter(),
                                        this.properties.GetProperty("grouping-size").GetNumber().IntValue(),
                                        this.properties.GetProperty("letter-value").GetEnum());

            this.forcePageCount =
                this.properties.GetProperty("force-page-count").GetEnum();
        }