示例#1
0
 public void LoadFromFile(string loadFileName, ref Sprite sprite)
 {
     if (File.Exists(loadFileName))
     {
         Stream            TestFileStream = File.OpenRead(loadFileName);
         BinaryFormatter   deserializer   = new BinaryFormatter();
         Sprite.SpriteSave spriteSave     = (Sprite.SpriteSave)deserializer.Deserialize(TestFileStream);
         sprite.Loadsprite(spriteSave);
         TestFileStream.Close();
     }
 }
示例#2
0
 public void SaveToFile(string saveFileName, Sprite sprite)
 {
     if (sprite != null)
     {
         Stream            saveFileStream = File.Create(saveFileName);
         BinaryFormatter   serializer     = new BinaryFormatter();
         Sprite.SpriteSave spriteSave     = sprite.SaveSprite();
         serializer.Serialize(saveFileStream, spriteSave);
         saveFileStream.Close();
     }
 }