--- trunk/libxmltv/Core/XMLTVSerializer.cs 2013/03/08 05:20:12 49 +++ trunk/libxmltv/Core/XMLTVSerializer.cs 2013/03/08 06:15:44 50 @@ -31,23 +31,23 @@ namespace libxmltv.Core catch (Exception ex) { xmltv_logger.Log.Error.WriteLine(ex.ToString()); return false; } return true; } - public bool DeSerialize(string file, out T unpacked_data) + public T DeSerialize(string file, out bool status) { - unpacked_data = default(T); - bool retVal = false; - using (Stream stream = File.Open(file, FileMode.Open)) { retVal = DeSerialize(stream, out unpacked_data); } - return retVal; + T unpacked_data = default(T); + using (Stream stream = File.Open(file, FileMode.Open)) { unpacked_data = DeSerialize(stream, out status); } + return unpacked_data; } - public bool DeSerialize(Stream stream, out T unpacked_data) + public T DeSerialize(Stream stream, out bool status) { - unpacked_data = default(T); + T unpacked_data = default(T); try { BinaryFormatter bin = new BinaryFormatter(); unpacked_data = (T)bin.Deserialize(stream); } - catch (Exception ex) { xmltv_logger.Log.Error.WriteLine(ex.ToString()); return false; } - return true; + catch (Exception ex) { xmltv_logger.Log.Error.WriteLine(ex.ToString()); status = false; } + status = true; + return unpacked_data; } #endregion } |