public void AddMastDoc(MAST mast) { if (mast == null || mast.triggers == null) { throw new NullReferenceException("Mast doc/triggers cannot be null"); } foreach (Trigger t in mast.triggers) { AddMastTrigger(t); } // start the timer if it isn't already, this will also kick off a timer tick immediately if (timer == null && !UseTimelineChanged) { StartTimer(); } }
/// <summary> /// Deserializes workflow markup into an MAST object /// </summary> // <param name="xml">string workflow markup to deserialize</param> // <param name="obj">Output MAST 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 MAST obj, out System.Exception exception) { exception = null; obj = null; try { System.IO.StringReader stringReader = new System.IO.StringReader(xml); System.Xml.XmlReader xmlTextReader = System.Xml.XmlReader.Create(stringReader); System.Xml.Serialization.XmlSerializer xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(MAST)); obj = ((MAST)(xmlSerializer.Deserialize(xmlTextReader))); return(true); } catch (System.Exception e) { exception = e; return(false); } }
public void AddMastDoc(string xml) { if (xml == null) { throw new NullReferenceException("Mast doc cannot be null"); } MAST mast; Exception ex; if (MAST.Deserialize(xml, out mast, out ex) && mast != null) { AddMastDoc(mast); return; } if (ex != null) { throw new Exception("Failed to deserialize Mast doc.", ex); } throw new Exception("Unknown error deserializing doc"); }
/// <summary> /// Deserializes workflow markup into an MAST object /// </summary> // <param name="xml">string workflow markup to deserialize</param> // <param name="obj">Output MAST 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 MAST obj, out System.Exception exception) { exception = null; obj = null; try { System.IO.StringReader stringReader = new System.IO.StringReader(xml); System.Xml.XmlReader xmlTextReader = System.Xml.XmlReader.Create(stringReader); System.Xml.Serialization.XmlSerializer xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(MAST)); obj = ((MAST)(xmlSerializer.Deserialize(xmlTextReader))); return true; } catch (System.Exception e) { exception = e; return false; } }