public static Dictionary<Guid, guidanceExplorer> addGuidanceExplorerObject(this TM_FileStorage tmFileStorage, Dictionary<Guid, guidanceExplorer> guidanceExplorers, guidanceExplorer newGuidanceExplorer, string xmlFile)
{
if (newGuidanceExplorer.notNull())
{
try
{
var libraryGuid = newGuidanceExplorer.library.name.guid();
//check if the name is already there
foreach(guidanceExplorer guidanceExplorer in guidanceExplorers.Values)
{
if (guidanceExplorer.library.caption == newGuidanceExplorer.library.caption)
{
"[addGuidanceExplorerObject]: Skipping load due to duplicate Library name '{0}' was in both library {1} and {2}".error(guidanceExplorer.library.caption, guidanceExplorer.library.name, newGuidanceExplorer.library.name);
return guidanceExplorers;
}
}
//check if the guid is already there
if (guidanceExplorers.hasKey(libraryGuid))
{
"[addGuidanceExplorerObject]: for {0} , duplicate LibraryID detected, assiging a new Library Id: {0}".error(newGuidanceExplorer.library.caption, libraryGuid);
libraryGuid = Guid.NewGuid();
newGuidanceExplorer.library.name = libraryGuid.str();
"[addGuidanceExplorerObject]: new ID for library {0} is now {1}".error(newGuidanceExplorer.library.caption, libraryGuid);
newGuidanceExplorer.xmlDB_Save_GuidanceExplorer(TM_Xml_Database.Current);//, false);
}
tmFileStorage.GuidanceExplorers_Paths.add(newGuidanceExplorer, xmlFile); // add this mapping so that we can find it base on name
guidanceExplorers.Add(libraryGuid, newGuidanceExplorer);
}
catch//(Exception ex)
{
"[addGuidanceExplorerObject] error importing guidanceExplorer: {0}".error(newGuidanceExplorer);
}
}
return guidanceExplorers;
}