/// <summary> /// Creates the instance of Open Model from xml string /// </summary> /// <param name="xmlString">The input string</param> /// <returns>The new instance of Open Model</returns> public static OpenModel LoadFromString(string xmlString) { var stringReader = new System.IO.StringReader(xmlString); var serializer = new XmlSerializer(typeof(OpenModel)); OpenModel openModel = serializer.Deserialize(stringReader) as OpenModel; openModel.ReferenceElementsReconstruction(); return(openModel); }
/// <summary> /// Creates the instance of Open Model from the stream /// </summary> /// <param name="xmlFileStream">The input stream</param> /// <returns>The new instance of Open Model</returns> public static OpenModel LoadFromStream(Stream xmlFileStream) { XmlReaderSettings xmlSettings = new XmlReaderSettings(); xmlSettings.CloseInput = false; XmlReader reader = XmlReader.Create(xmlFileStream, xmlSettings); XmlSerializer xs = new XmlSerializer(typeof(OpenModel)); OpenModel openModel = (xs.Deserialize(reader) as OpenModel); openModel.ReferenceElementsReconstruction(); return(openModel); }