/// <summary> /// Saves XML document as XML file to specified location. /// </summary> /// <param name="snapshotXmlDoc">XML snapshot document.</param> /// <param name="path">Save path.</param> public static void SaveSnapshotsDocWithSpecificLocation(SerializeSnapshot snapshotXmlDoc, string path) { if (snapshotXmlDoc == null) { throw new ArgumentNullException("Parameter 'snapshotXmlDoc' may not be null."); } snapshotXmlDoc.SaveXmlFile(path); }
/// <summary> /// Saves XML document as XML file. /// </summary> /// <returns>Path to the saved Snapshot</returns> public static string SaveSnapshotsDoc(SerializeSnapshot snapshotXmlDoc, bool toTempFile = true) { if (snapshotXmlDoc == null) { throw new ArgumentNullException("Parameter 'snapshotXmlDoc' may not be null."); } string snapShotFilePath; if (toTempFile) { snapShotFilePath = "./snapshots/TemporarySnapshot.xml"; } else { snapShotFilePath = string.Format("./snapshots/SnapshotFile-{0}.xml", DateTime.Now.ToString("yyyyMMdd-HHmmssffff")); } snapshotXmlDoc.SaveXmlFile(snapShotFilePath); return(snapShotFilePath); }
/// <summary> /// Adds a new snapshot to the snapshots XML document /// </summary> /// <param name="snapshotXmlDoc">Target snapshots XML document</param> /// <param name="stepID">Snapshot number.</param> /// <param name="floatingObjects">Floating objects to be serialized.</param> /// <param name="tilesWorld">Tiles to be serialized.</param> public static void AddSnapshot(ulong stepID, FloatingObjectsSet floatingObjects, TilesWorld tilesWorld, SerializeSnapshot snapshotXmlDoc) { if (floatingObjects == null) { throw new ArgumentNullException("Parameter 'floatingObjects' may not be null."); } if (tilesWorld == null) { throw new ArgumentNullException("Parameter 'tilesWorld' may not be null."); } if (snapshotXmlDoc == null) { throw new ArgumentNullException("Parameter 'snapshotXmlDoc' may not be null."); } snapshotXmlDoc.Serialize(stepID, floatingObjects, tilesWorld); }