示例#1
0
 private void writeWorldBuildingsToIsolatedStorage(WorldBuilding v)
 {
     var settings1 = IsolatedStorageFile.GetUserStoreForApplication();
     if (settings1.FileExists("WorldBuilding"))
     {
         settings1.DeleteFile("WorldBuilding");
     }
     using (var fileStream = settings1.OpenFile("WorldBuilding", FileMode.Create))
     {
         var serializer = new DataContractSerializer(typeof(WorldBuilding));
         serializer.WriteObject(fileStream, v);
     }
 }
示例#2
0
        private void ReadWorldBuildingsFromIsolatedStorage()
        {

            var settings1 = IsolatedStorageFile.GetUserStoreForApplication();
            if (settings1.FileExists("WorldBuilding"))
            {
                using (var fileStream = settings1.OpenFile("WorldBuilding", FileMode.Open))
                {
                    var serializer = new DataContractSerializer(typeof(WorldBuilding));
                    _worldbuildings = (WorldBuilding)serializer.ReadObject(fileStream);
                }
            }
        }