示例#1
0
文件: AmfFile.cs 项目: klorpa/CoCEd
 public void TestSerialization()
 {
     using (var stream = new ComparisonStream(FilePath))
     {
         using (var writer = new AmfWriter(stream))
         {
             writer.Run(this, Name, Format);
         }
         stream.AssertSameLength();
     }
 }
示例#2
0
文件: AmfFile.cs 项目: klorpa/CoCEd
 private void Write(string path, SerializationFormat format, string name)
 {
     EnsureDeleted(path);
     using (var stream = File.Create(path))
     {
         using (var writer = new AmfWriter(stream))
         {
             writer.Run(this, name, format);
             stream.Flush();
             stream.Close();
         }
     }
 }
示例#3
0
文件: AmfFile.cs 项目: klorpa/CoCEd
 public bool CanBeSaved(SerializationFormat format)
 {
     try
     {
         using (var stream = new MemoryStream())
         {
             using (var writer = new AmfWriter(stream))
             {
                 writer.Run(this, "Test", format);
                 stream.Flush();
                 stream.Close();
             }
         }
     }
     catch (Exception)
     {
         return(false);
     }
     return(true);
 }
示例#4
0
文件: AmfFile.cs 项目: Belgrath/CoCEd
 public void TestSerialization()
 {
     using (var stream = new ComparisonStream(FilePath))
     {
         using (var writer = new AmfWriter(stream))
         {
             writer.Run(this, Name, Format);
         }
         stream.AssertSameLength();
     }
 }
示例#5
0
文件: AmfFile.cs 项目: Belgrath/CoCEd
 private void Write(string path, SerializationFormat format, string name)
 {
     EnsureDeleted(path);
     using (var stream = File.Create(path))
     {
         using (var writer = new AmfWriter(stream))
         {
             writer.Run(this, name, format);
             stream.Flush();
             stream.Close();
         }
     }
 }
示例#6
0
文件: AmfFile.cs 项目: Belgrath/CoCEd
 public bool CanBeSaved(SerializationFormat format)
 {
     try
     {
         using (var stream = new MemoryStream())
         {
             using (var writer = new AmfWriter(stream))
             {
                 writer.Run(this, "Test", format);
                 stream.Flush();
                 stream.Close();
             }
         }
     }
     catch (Exception)
     {
         return false;
     }
     return true;
 }