31 |
catch (Exception ex) { xmltv_logger.Log.Error.WriteLine(ex.ToString()); return false; } |
catch (Exception ex) { xmltv_logger.Log.Error.WriteLine(ex.ToString()); return false; } |
32 |
return true; |
return true; |
33 |
} |
} |
34 |
public bool DeSerialize(string file, out T unpacked_data) |
public T DeSerialize(string file, out bool status) |
35 |
{ |
{ |
36 |
unpacked_data = default(T); |
T unpacked_data = default(T); |
37 |
bool retVal = false; |
using (Stream stream = File.Open(file, FileMode.Open)) { unpacked_data = DeSerialize(stream, out status); } |
38 |
using (Stream stream = File.Open(file, FileMode.Open)) { retVal = DeSerialize(stream, out unpacked_data); } |
return unpacked_data; |
|
return retVal; |
|
39 |
} |
} |
40 |
public bool DeSerialize(Stream stream, out T unpacked_data) |
public T DeSerialize(Stream stream, out bool status) |
41 |
{ |
{ |
42 |
unpacked_data = default(T); |
T unpacked_data = default(T); |
43 |
try |
try |
44 |
{ |
{ |
45 |
BinaryFormatter bin = new BinaryFormatter(); |
BinaryFormatter bin = new BinaryFormatter(); |
46 |
unpacked_data = (T)bin.Deserialize(stream); |
unpacked_data = (T)bin.Deserialize(stream); |
47 |
} |
} |
48 |
catch (Exception ex) { xmltv_logger.Log.Error.WriteLine(ex.ToString()); return false; } |
catch (Exception ex) { xmltv_logger.Log.Error.WriteLine(ex.ToString()); status = false; } |
49 |
return true; |
status = true; |
50 |
|
return unpacked_data; |
51 |
} |
} |
52 |
#endregion |
#endregion |
53 |
} |
} |