Esempio n. 1
0
        public SignalModelLibrary( Stream inputStream )
        {
            var xmlDocument = new XmlDocument();
            var sr = new StreamReader( inputStream );
            _xmlContent = sr.ReadToEnd();
            if (String.IsNullOrEmpty( _xmlContent ))
                throw new Exception( "Empty Input Document" );
            _xmlContent = _xmlContent.Trim();
            xmlDocument.LoadXml( _xmlContent );

            _tsfLibrary = TSFLibrary.Deserialize( _xmlContent );
            foreach (TSFType tsfType in _tsfLibrary.TSF)
            {
                string defaultSchema;
                string modelXml;
                string interfaceSchema = getInterface( xmlDocument, tsfType.name, out defaultSchema, out modelXml );
                if (string.IsNullOrEmpty( defaultSchema ))
                    if (xmlDocument.DocumentElement != null && xmlDocument.DocumentElement.Attributes[XMLNS] != null)
                        defaultSchema = xmlDocument.DocumentElement.Attributes[XMLNS].Value;
                var model = new SignalModel(
                    tsfType,
                    _tsfLibrary.targetNamespace,
                    defaultSchema,
                    interfaceSchema,
                    modelXml,
                    xmlDocument );

                SetSignalModel( tsfType.name, model );
            }
        }
 public static bool LoadFromFile(string fileName, out TSFLibrary obj)
 {
     System.Exception exception;
     return LoadFromFile(fileName, out obj, out exception);
 }
 public static bool Deserialize(string input, out TSFLibrary obj)
 {
     System.Exception exception;
     return Deserialize(input, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an TSFLibrary object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output TSFLibrary object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out TSFLibrary obj, out System.Exception exception)
 {
     exception = null;
     obj = default(TSFLibrary);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 /// <summary>
 /// Deserializes workflow markup into an TSFLibrary object
 /// </summary>
 /// <param name="input">string workflow markup to deserialize</param>
 /// <param name="obj">Output TSFLibrary object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string input, out TSFLibrary obj, out System.Exception exception)
 {
     exception = null;
     obj = default(TSFLibrary);
     try
     {
         obj = Deserialize(input);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }