diff options
| author | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-20 20:33:05 -0500 |
|---|---|---|
| committer | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-20 20:33:05 -0500 |
| commit | 767cdc1f6f6a63ce997fc9476911e2c361f9d402 (patch) | |
| tree | 49add55976f895441167c66cfa95e5c7688d18ce /MediaBrowser.Common/Serialization/ProtobufSerializer.cs | |
| parent | 845554722efaed872948a9e0f7202e3ef52f1b6e (diff) | |
Pushing missing changes
Diffstat (limited to 'MediaBrowser.Common/Serialization/ProtobufSerializer.cs')
| -rw-r--r-- | MediaBrowser.Common/Serialization/ProtobufSerializer.cs | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/MediaBrowser.Common/Serialization/ProtobufSerializer.cs b/MediaBrowser.Common/Serialization/ProtobufSerializer.cs deleted file mode 100644 index 1c79a272d..000000000 --- a/MediaBrowser.Common/Serialization/ProtobufSerializer.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System;
-using System.IO;
-
-namespace MediaBrowser.Common.Serialization
-{
- /// <summary>
- /// Protocol buffers is google's binary serialization format. This is a .NET implementation of it.
- /// You have to tag your classes with some annoying attributes, but in return you get the fastest serialization around with the smallest possible output.
- /// </summary>
- public static class ProtobufSerializer
- {
- /// <summary>
- /// This is an auto-generated Protobuf Serialization assembly for best performance.
- /// It is created during the Model project's post-build event.
- /// This means that this class can currently only handle types within the Model project.
- /// If we need to, we can always add a param indicating whether or not the model serializer should be used.
- /// </summary>
- private static readonly ProtobufModelSerializer ProtobufModelSerializer = new ProtobufModelSerializer();
-
- public static void SerializeToStream<T>(T obj, Stream stream)
- {
- ProtobufModelSerializer.Serialize(stream, obj);
- }
-
- public static T DeserializeFromStream<T>(Stream stream)
- where T : class
- {
- return ProtobufModelSerializer.Deserialize(stream, null, typeof(T)) as T;
- }
-
- public static object DeserializeFromStream(Stream stream, Type type)
- {
- return ProtobufModelSerializer.Deserialize(stream, null, type);
- }
-
- public static void SerializeToFile<T>(T obj, string file)
- {
- using (Stream stream = File.Open(file, FileMode.Create))
- {
- SerializeToStream(obj, stream);
- }
- }
-
- public static T DeserializeFromFile<T>(string file)
- where T : class
- {
- using (Stream stream = File.OpenRead(file))
- {
- return DeserializeFromStream<T>(stream);
- }
- }
- }
-}
|
