private List <ServerInfo> LoadServerInfosFromFile() { string filepath = FileUtil.DataFolder.FullFilePath(ServerInfoSavedXmlFile); List <ServerInfo> slist = null; try { slist = ServerInfosXmlSerializer.FromXmlFile(filepath); } catch (FileNotFoundException) { } catch (DirectoryNotFoundException) { } catch (Exception e) { AddinViewController.ShowErrorDialog("Can't load servers in " + filepath, e.ToString()); } if (slist == null) { return(new List <ServerInfo>()); } return(slist); }
public void SaveServerInfos(List <ServerInfo> update) { string filepath = FileUtil.DataFolder.FullFilePath(ServerInfoSavedXmlFile); try { ServerInfosXmlSerializer.ToXmlFile(update, filepath); } catch (Exception e) { AddinViewController.ShowErrorDialog("Can't save servers in:" + filepath, e.ToString()); update = null; } if (update != null) { serverInfoCache = ListCloner.Copy(update); serverInfoCacheInited = true; } }