public void Save() { PostInitializeProperties(); string path = MakeFullPath(ProjectName + ".xise"); XmlTextWriter wr = new XmlTextWriter(path, Encoding.UTF8); wr.Formatting = Formatting.Indented; wr.WriteStartDocument(false); //wr.WriteStartElement("project", "http://www.xilinx.com/XMLSchema"); wr.WriteStartElement("project"); wr.WriteAttributeString("xmlns", "http://www.xilinx.com/XMLSchema"); wr.WriteAttributeString("xmlns:xil_pn", "http://www.xilinx.com/XMLSchema"); wr.WriteStartElement("header"); wr.WriteEndElement(); wr.WriteStartElement("version"); wr.WriteAttributeString("xil_pn:ise_version", PropEnum.ToString(ISEVersion, EPropAssoc.ISE)); wr.WriteAttributeString("xil_pn:schema_version", "2"); wr.WriteEndElement(); var libraries = new HashSet <string>(); string ucf = null; wr.WriteStartElement("files"); foreach (string file in _projectFiles) { string type = GetFileType(file); wr.WriteStartElement("file"); wr.WriteAttributeString("xil_pn:name", MakeUNIXPath(file)); wr.WriteAttributeString("xil_pn:type", type); EComponentPurpose purpose = LookupAttribute <EComponentPurpose>(file); if (purpose == EComponentPurpose.SimulationAndSynthesis || purpose == EComponentPurpose.SimulationOnly) { wr.WriteStartElement("association"); wr.WriteAttributeString("xil_pn:name", "BehavioralSimulation"); wr.WriteEndElement(); } if (purpose == EComponentPurpose.SimulationAndSynthesis || purpose == EComponentPurpose.SynthesisOnly) { wr.WriteStartElement("association"); wr.WriteAttributeString("xil_pn:name", "Implementation"); wr.WriteEndElement(); } var library = LookupAttribute <LibraryAttribute>(file); if (library != null) { wr.WriteStartElement("library"); wr.WriteAttributeString("xil_pn:name", library.Name); libraries.Add(library.Name); wr.WriteEndElement(); } wr.WriteEndElement(); } wr.WriteEndElement(); wr.WriteStartElement("properties"); IList <PropDesc> allProps = PropEnum.EnumProps(typeof(EXilinxProjectProperties)); foreach (PropDesc pdesc in allProps) { string propID; if (!pdesc.IDs.TryGetValue(EPropAssoc.ISE, out propID)) { continue; } object propVal; //if (!Properties.TryGetValue(propID, out propVal)) if (!Properties.TryGetValue((EXilinxProjectProperties)pdesc.EnumValue, out propVal)) { propVal = pdesc.DefaultValue; } bool isDefault = propVal.Equals(pdesc.DefaultValue); string propValStr = PropEnum.ToString(propVal, EPropAssoc.ISE); wr.WriteStartElement("property"); wr.WriteAttributeString("xil_pn:name", propID); wr.WriteAttributeString("xil_pn:value", propValStr); wr.WriteAttributeString("xil_pn:valueState", isDefault ? "default" : "non-default"); wr.WriteEndElement(); } wr.WriteEndElement(); wr.WriteStartElement("bindings"); if (ucf != null && TopLevelComponent != null) { var gi = TopLevelComponent.QueryAttribute <VHDLGenInfo>(); wr.WriteStartElement("binding"); wr.WriteAttributeString("xil_pn:location", "/" + gi.EntityName); wr.WriteAttributeString("xil_pn:name", ucf); wr.WriteEndElement(); } wr.WriteEndElement(); wr.WriteStartElement("libraries"); foreach (string lib in libraries) { wr.WriteStartElement("library"); wr.WriteAttributeString("xil_pn:name", lib); wr.WriteEndElement(); } wr.WriteEndElement(); wr.WriteStartElement("autoManagedFiles"); wr.WriteEndElement(); wr.WriteEndElement(); wr.Close(); if (TwinProject != null) { TwinProject.Save(); } }
/// <summary> /// Creates the attribute. /// </summary> /// <param name="purpose">purpose of component</param> public ComponentPurpose(EComponentPurpose purpose) { Purpose = purpose; }