public DebugTO PersistDebugSession(DebugTO to)
{
lock (SettingsLock)
{
if (to.DataList != null)
to.DataListHash = to.DataList.GetHashCode();
// set incoming hash //2013.01.22: Ashley Lewis - Added condition for Bug 7837
to.Error = string.Empty;
if (to.RememberInputs)
{
// update the current TO
_debugPersistSettings[to.WorkflowID] = to;
}
else
{
// no longer relavent, remove it
DebugTO tmp;
if (_debugPersistSettings.TryGetValue(to.WorkflowID, out tmp))
{
_debugPersistSettings[to.WorkflowID].CleanUp();
_debugPersistSettings.Remove(to.WorkflowID);
}
}
var settingList = new List<SaveDebugTO>();
// build the list
foreach (string key in _debugPersistSettings.Keys)
{
DebugTO tmp;
if (key.Length > 0 && _debugPersistSettings.TryGetValue(key, out tmp))
{
SaveDebugTO that = tmp.CopyToSaveDebugTO();
settingList.Add(that);
}
}
// push to disk
using (Stream s = File.Open(_debugPersistPath, FileMode.Truncate))
{
var bf = new XmlSerializer(typeof (List<SaveDebugTO>));
bf.Serialize(s, settingList);
}
}
return to;
}
protected const string RootTag = "DataList";