Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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;
            }
        }