/// <summary> /// Serializes the given object into the given stream. /// </summary> /// <param name="obj">Object to serialize</param> /// <param name="stream">Target stream.</param> /// <param name="codec">The codec to use.</param> public void Save(object obj, Stream stream, ISerializeCodec codec) { SerializeStream serializeStream = new SerializeStream(codec, stream, true); serializeStream.Save(obj); serializeStream.Close(); }
/// <summary> /// Loads an object from a file. /// </summary> /// <param name="stream">Stream to load object from.</param> /// <param name="codec">The codec to use for loading the file.</param> /// <returns>The loaded object.</returns> public object Load(Stream stream, ISerializeCodec codec) { SerializeStream serializeStream = new SerializeStream(codec, stream, false); object obj = serializeStream.Load(); serializeStream.Close(); return(obj); }