コード例 #1
0
 public static bool LoadFromFile(string fileName, out eagle obj) {
     System.Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
コード例 #2
0
 /// <summary>
 /// Deserializes xml markup from file into an eagle object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output eagle object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out eagle obj, out System.Exception exception) {
     exception = null;
     obj = default(eagle);
     try {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }
コード例 #3
0
 /// <summary>
 /// Deserializes workflow markup into an eagle object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output eagle object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out eagle obj, out System.Exception exception) {
     exception = null;
     obj = default(eagle);
     try {
         obj = Deserialize(xml);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }
コード例 #4
0
 public static bool Deserialize(string xml, out eagle obj) {
     System.Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
コード例 #5
0
        private Eagle.eagle GenerateSchematicCode(TestBench TestBench_obj)
        {
            // load schematic library
            Eagle.eagle eagle = null;
            try
            {
                eagle = Eagle.eagle.Deserialize(CyPhy2Schematic.Properties.Resources.schematicTemplate);
                Logger.WriteInfo("Parsed Eagle Library schema version: " + eagle.version);
            }
            catch (Exception e)
            {
                eagle = new Eagle.eagle();  // create an empty eagle object network
                Logger.WriteError("Error parsing XML: " + e.Message + "<br>Inner: " + e.InnerException + "<br>Stack: " + e.StackTrace);
            }
            // 2. The second traversal walks the lighter weight (largely CyPhy independent) object network and maps to the eagle XML object network
            //    the classes of this object network are automatically derived from the eagle XSD using the XSD2Code tool in the META repo
            //    an important step of this traversal is the routing which is implemented currently as a simple rats nest routing, 
            //        the traversal and visitor code is localized in (SchematicTraversal.cs)
            TestBench_obj.accept(new EdaVisitor() 
            { 
                eagle_obj = eagle, 
                Logger = Logger
            });

            // 2.5  Finally a serializer (XSD generated code), walks the object network and generates the XML file
            System.IO.Directory.CreateDirectory(this.mainParameters.OutputDirectory);
            String outFile = Path.Combine(this.mainParameters.OutputDirectory, "schema.sch");
            try
            {
                eagle.SaveToFile(outFile);
            }
            catch (Exception ex)
            {
                Logger.WriteError("Error Saving Schema File: {0}<br> Exception: {1}<br> Trace: {2}", 
                    outFile, ex.Message, ex.StackTrace);
            }

            return eagle;
        }