SecureDelete.Schedule.HistoryManager.DeserializeHistory C# (CSharp) Method

DeserializeHistory() private method

private DeserializeHistory ( byte data ) : HistoryCategory>.Dictionary
data byte
return HistoryCategory>.Dictionary
        private Dictionary<Guid, HistoryCategory> DeserializeHistory(byte[] data)
        {
            if(data == null) {
                return null;
            }

            BinaryFormatter serializer = new BinaryFormatter();
            MemoryStream stream = new MemoryStream(data);

            try {
                return (Dictionary<Guid, HistoryCategory>)serializer.Deserialize(stream);
            }
            catch(Exception e) {
                Debug.ReportError("Error while deserializing task history. Exception: {0}", e.Message);
                return null;
            }
            finally {
                if(stream != null) {
                    stream.Close();
                }
            }
        }