﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TLRigSerializerWrapper.cs">
//   Copyright (c) 2014 Alexander Logger. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System.IO;
using SharpTL;

namespace SerializersRace.SerializerWrappers
{
    public class SharpTLSerializerWrapper : ISerializerWrapper
    {
        private readonly TLRig _tlRig;

        public SharpTLSerializerWrapper()
        {
            _tlRig = TLRig.Default;
        }

        public SharpTLSerializerWrapper(TLRig tlRig)
        {
            _tlRig = tlRig;
        }

        public string Name
        {
            get { return "SharpTL"; }
        }

        public string Version
        {
            get { return "0.8"; }
        }

        public void PrepareSerializer<T>()
        {
            _tlRig.PrepareSerializer<T>();
        }

        public void Serialize(object obj, Stream stream)
        {
            _tlRig.Serialize(obj, stream);
        }
    }
}
