public VolumeSnapshot LoadSnapshotRevision(VolumeSource source, VolumeSnapshotRevision revision) { if (mSnapshotDictionary.ContainsKey(revision)) { return(mSnapshotDictionary[revision]); } else { XmlDocument doc = new XmlDocument(); doc.Load(GetRevisionFileName(revision)); XmlNode snapshotXmlNode = PWLib.XmlHelp.GetFirstChildWithName(doc, VolumeSnapshotXml.XmlSnapshotElement); VolumeSnapshot snapshot = VolumeSnapshot.BuildFromXml(source, snapshotXmlNode); mSnapshotDictionary.Add(revision, snapshot); return(snapshot); } }
public VolumeSnapshot LoadSnapshotRevision(VolumeSource source, VolumeSnapshotRevision revision) { if (mSnapshotDictionary.ContainsKey(revision)) { return(mSnapshotDictionary[revision]); } else { if (!mSnapshotXmlCache.ContainsKey(revision)) { throw new Exception("Could not locate snapshot revision '" + revision.ToString() + "' in database"); } string xmlFragment = mSnapshotXmlCache[revision]; XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlFragment); XmlNode snapshotXmlNode = PWLib.XmlHelp.GetFirstChildWithName(doc, VolumeSnapshotXml.XmlSnapshotElement); VolumeSnapshot snapshot = VolumeSnapshot.BuildFromXml(source, snapshotXmlNode); mSnapshotDictionary.Add(revision, snapshot); return(snapshot); } }