// //==================================================================================================== /// <summary> /// get a list of collections available on the server /// </summary> public static bool getCollectionFolderConfigCollectionList(CoreController core, ref List <CollectionLibraryModel> localCollectionStoreList, ref string return_ErrorMessage) { bool returnOk = true; try { // //----------------------------------------------------------------------------------------------- // Load LocalCollections from the Collections.xml file //----------------------------------------------------------------------------------------------- // string localCollectionStoreListXml = getCollectionFolderConfigXml(core); if (!string.IsNullOrEmpty(localCollectionStoreListXml)) { XmlDocument LocalCollections = new XmlDocument(); try { LocalCollections.LoadXml(localCollectionStoreListXml); } catch (Exception) { string Copy = "Error loading privateFiles\\addons\\Collections.xml"; LogController.logInfo(core, Copy); return_ErrorMessage += "<P>" + Copy + "</P>"; returnOk = false; } if (returnOk) { if (GenericController.toLCase(LocalCollections.DocumentElement.Name) != GenericController.toLCase(Constants.CollectionListRootNode)) { string Copy = "The addons\\Collections.xml has an invalid root node, [" + LocalCollections.DocumentElement.Name + "] was received and [" + Constants.CollectionListRootNode + "] was expected."; LogController.logInfo(core, Copy); return_ErrorMessage += "<P>" + Copy + "</P>"; returnOk = false; } else { // // Get a list of the collection guids on this server // if (GenericController.toLCase(LocalCollections.DocumentElement.Name) == "collectionlist") { foreach (XmlNode LocalListNode in LocalCollections.DocumentElement.ChildNodes) { switch (GenericController.toLCase(LocalListNode.Name)) { case "collection": var collection = new CollectionLibraryModel(); localCollectionStoreList.Add(collection); foreach (XmlNode CollectionNode in LocalListNode.ChildNodes) { if (CollectionNode.Name.ToLowerInvariant() == "name") { collection.name = CollectionNode.InnerText; } else if (CollectionNode.Name.ToLowerInvariant() == "guid") { collection.guid = CollectionNode.InnerText; } else if (CollectionNode.Name.ToLowerInvariant() == "path") { collection.path = CollectionNode.InnerText; } else if (CollectionNode.Name.ToLowerInvariant() == "lastchangedate") { collection.lastChangeDate = GenericController.encodeDate(CollectionNode.InnerText); } } break; } } } } } } } catch (Exception ex) { LogController.logError(core, ex); throw; } return(returnOk); }
// //==================================================================================================== /// <summary> /// return a list of collections on the /// </summary> public static List <CollectionLibraryModel> getCollectionLibraryList(CoreController core) { var result = new List <CollectionLibraryModel>(); try { var LibCollections = new XmlDocument() { XmlResolver = null }; try { LibCollections.Load("http://support.contensive.com/GetCollectionList?iv=" + CoreController.codeVersion() + "&includeSystem=1&includeNonPublic=1"); } catch (Exception) { string UserError = "There was an error reading the Collection Library. The site may be unavailable."; LogController.logInfo(core, UserError); ErrorController.addUserError(core, UserError); return(null); } if (GenericController.toLCase(LibCollections.DocumentElement.Name) != GenericController.toLCase(Constants.CollectionListRootNode)) { string UserError = "There was an error reading the Collection Library file. The '" + Constants.CollectionListRootNode + "' element was not found."; LogController.logInfo(core, UserError); ErrorController.addUserError(core, UserError); return(null); } foreach (XmlNode collectionNode in LibCollections.DocumentElement.ChildNodes) { if (collectionNode.Name.ToLower(CultureInfo.InvariantCulture).Equals("collection")) { // // Read the collection var collection = new CollectionLibraryModel(); result.Add(collection); foreach (XmlNode CollectionNode in collectionNode.ChildNodes) { switch (GenericController.toLCase(CollectionNode.Name)) { case "name": collection.name = CollectionNode.InnerText; break; case "guid": collection.guid = CollectionNode.InnerText; break; case "version": collection.version = CollectionNode.InnerText; break; case "description": collection.description = CollectionNode.InnerText; break; case "contensiveversion": collection.contensiveVersion = CollectionNode.InnerText; break; case "lastchangedate": collection.lastChangeDate = GenericController.encodeDate(CollectionNode.InnerText); break; } } } } } catch (Exception) { throw; } return(result); }