public Guid GetInstanceAssociation(Guid instanceKey)
{
Guid instanceId = Guid.Empty;
try
{
var files = Directory.GetFiles(_dataDirectory, string.Format("Key.{0}.*.xml", instanceKey));
if(files.Length > 0)
{
// TWR: Changed to use filename only as full path might also include periods!!
var fileName = Path.GetFileName(files[0]);
if(fileName != null)
{
var nodes = fileName.Split('.');
if(nodes.Length == 4)
{
Guid.TryParse(nodes[2], out instanceId);
}
}
}
}
catch(Exception exception)
{
Dev2Logger.Log.Error(exception);
throw new InstancePersistenceException(exception.Message, exception);
}
return instanceId;
}