/// <summary>
/// Boot strap the Session
/// </summary>
private void InitPersistSettings()
{
lock (SettingsLock)
{
if (!_debugOptsEndPoint.PathExist(_debugPath))
{
var args = new Dev2PutRawOperationTO(WriteType.Overwrite, "");
ActivityIOFactory.CreateOperationsBroker().PutRaw(_debugOptsEndPoint, args);
}
else
{
// fetch from disk
var filesToCleanup = new List <string>();
using (Stream s = _debugOptsEndPoint.Get(_debugPath, filesToCleanup))
{
if (s.Length > 0)
{
var bf = new XmlSerializer(typeof(List <SaveDebugTO>));
try
{
var settings = (List <SaveDebugTO>)bf.Deserialize(s);
_debugPersistSettings.Values.ToList().ForEach(a => a.CleanUp());
_debugPersistSettings.Clear();
// now push back into the Dictionary
foreach (SaveDebugTO dto in settings)
{
if (dto.ServiceName.Length > 0)
{
var tmp = new DebugTO();
tmp.CopyFromSaveDebugTO(dto);
string error;
tmp.BinaryDataList = DeSerialize(tmp.XmlData, tmp.DataList,
enTranslationTypes.XML, out error);
_debugPersistSettings[dto.WorkflowID] = tmp;
}
}
}
catch (Exception e)
{
Dev2Logger.Log.Error(e);
}
}
else
{
Dev2Logger.Log.Error("No debug data stream [ " + _debugPath + " ] ");
}
s.Close();
s.Dispose();
filesToCleanup.ForEach(File.Delete);
}
}
}
}