public void ContentsCanBeSavedAndRestoredFromAFilename()
        {
            list.SaveServer(new Server("1.2.3.4", 5678), "SERVER ONE");
            list.SaveProfile(@"X:\path\to\some.DayZProfile");
            list.SaveServer(new Server("5.6.7.8", 4321), "SERVER TWO");

            list.SaveToFilename(filename);

            list.Reset();

            list.LoadFromFilename(filename);

            Assert.AreEqual(5, list.Count);
            Assert.AreEqual("Most Recent (Stable)", list[0].DisplayName);
            Assert.AreEqual("Most Recent (Experimental)", list[1].DisplayName);
            Assert.AreEqual("SERVER TWO (5.6.7.8:4321)", list[2].DisplayName);
            Assert.AreEqual(@"Most Recent (X:\path\to\some.DayZProfile)", list[3].DisplayName);
            Assert.AreEqual("SERVER ONE (1.2.3.4:5678)", list[4].DisplayName);
        }
Beispiel #2
0
 private void PersistSavedServers()
 {
     try
     {
         Directory.CreateDirectory(ApplicationDataFolder());
         serverList.SaveToFilename(ServersFilename());
     }
     catch (Exception error)
     {
         Console.WriteLine($"Failed to save saved servers: {error}");
     }
 }