private void LoadPluginFiles() { if (File.Exists(pluginsFile)) { XmlTextReader textReader = null; try { XmlSerializer deserializer = new XmlSerializer(typeof(IceChatPluginFile)); textReader = new XmlTextReader(pluginsFile); iceChatPlugins = (IceChatPluginFile)deserializer.Deserialize(textReader); textReader.Close(); } catch (Exception) { textReader.Close(); errorMessages.Add("There was a problem loading IceChatPlugins.xml. No plugins loaded"); iceChatPlugins = new IceChatPluginFile(); SavePluginFiles(); } } else { iceChatPlugins = new IceChatPluginFile(); SavePluginFiles(); } }
private void LoadPluginFiles() { if (File.Exists(pluginsFile)) { XmlSerializer deserializer = new XmlSerializer(typeof(IceChatPluginFile)); TextReader textReader = new StreamReader(pluginsFile); iceChatPlugins = (IceChatPluginFile)deserializer.Deserialize(textReader); textReader.Close(); textReader.Dispose(); } else { iceChatPlugins = new IceChatPluginFile(); SavePluginFiles(); } }