Пример #1
0
 public void TestSerialization()
 {
     using (var stream = new ComparisonStream(FilePath))
     {
         using (var writer = new AmfWriter(stream))
         {
             writer.Run(this, Name, Format);
         }
         stream.AssertSameLength();
     }
 }
Пример #2
0
 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
 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
 public void TestSerialization()
 {
     using (var stream = new ComparisonStream(FilePath))
     {
         using (var writer = new AmfWriter(stream))
         {
             writer.Run(this, Name, Format);
         }
         stream.AssertSameLength();
     }
 }
Пример #5
0
 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
 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;
 }