public static FavoritesOptions.cFavorite addFavorite(FavoritesOptions fo, String ip, int port) { if (fo == null) { fo = getFavoritesOptions(); } FavoritesOptions.cFavorite rv = new FavoritesOptions.cFavorite() { ip = ip.Trim().ToLower(), port = port }; fo.Favorites.Add(rv); fo.Save("./conf/favorites.xml"); return(rv); }
public static FavoritesOptions getFavoritesOptions() { if (fo == null) { try { fo = FavoritesOptions.Load("./conf/favorites.xml"); } catch (Exception ex) { fo = new FavoritesOptions(); fo.Save("./conf/favorites.xml"); } } return(fo); }