예제 #1
0
        public void Save(MapId id, PSLM model)
        {
            string file = Path.Combine(MapFolderPath, id.ToInternalFileName());

            using (var bw = new BinaryWriter(File.Create(file)))
            {
                model.WriteTo(bw);
            }
        }
예제 #2
0
 public void IdenticalThroughLoadSaveCycle()
 {
     foreach (var file in Directory.GetFiles(Path.Combine(TestConstants.TestModFolder, RanseiLink.Core.Services.Constants.MapFolderPath)))
     {
         var    unchangedBytes = File.ReadAllBytes(file);
         string temp           = Path.GetTempFileName();
         PSLM   map;
         using (var br = new BinaryReader(File.OpenRead(file)))
         {
             map = new PSLM(br);
         }
         using (var bw = new BinaryWriter(File.Create(temp)))
         {
             map.WriteTo(bw);
         }
         var shouldBeUnchangedBytes = File.ReadAllBytes(temp);
         File.Delete(temp);
         shouldBeUnchangedBytes.Should().Equal(unchangedBytes);
     }
 }