private void LoadMiniatures() { FileStream fs = null; foundMiniatures.Clear(); try { XmlSerializer serializer = new XmlSerializer(typeof(ModelClasses.Miniatures)); fs = new FileStream(miniaturesFile, FileMode.Open); allMiniatures = (ModelClasses.Miniatures)serializer.Deserialize(fs); foreach (ModelClasses.Miniature mini in allMiniatures) { foundMiniatures.Add(mini); } fs.Close(); } catch (Exception excp) { if (fs != null) { fs.Dispose(); } } }
private void LoadExistingMiniatures() { FileStream fs = null; existingMiniatures.Clear(); try { XmlSerializer serializer = new XmlSerializer(typeof(ModelClasses.Miniatures)); fs = new FileStream(miniaturesFile, FileMode.Open); existingMiniatures = (ModelClasses.Miniatures)serializer.Deserialize(fs); fs.Close(); } catch (Exception excp) { if (fs != null) { fs.Dispose(); } } }