/// <summary> Returns the list of items currently loaded to a SobekCM instance </summary> /// <param name="SobekCM_Base_URL">Base SobekCM URL</param> /// <returns>DataSet</returns> public static DataSets.SobekCM_All_Items Current_SobekCM_Items(string SobekCM_Base_URL) { try { // Create the return value data set DataSets.SobekCM_All_Items returnVal = new DataSets.SobekCM_All_Items(); // Create the stream to get the information from the web WebResponse objResponse; WebRequest objRequest = System.Net.HttpWebRequest.Create(SobekCM_Base_URL); objRequest.Timeout = 15000; objResponse = objRequest.GetResponse(); // Load the data into the DataSet returnVal.ReadXml(objResponse.GetResponseStream()); // Return this value return returnVal; } catch { return null; } }
/// <summary> Load the list of SobekCM items in preparation for Bib package building </summary> /// <param name="SobekCM_Base_URL">Base URL for the SobekCM instance </param> /// <param name="Drive_Location"> Location on the local or network drive for the list of items to be checked and stored </param> public static SobekCM_All_Items Load_SobekCM_Item_List(string SobekCM_Base_URL, string Drive_Location) { // Pull the sobekcm list, if there is one from today if (File.Exists(Drive_Location)) { FileInfo thisFileInfo = new FileInfo(Drive_Location); DateTime fileCreation = thisFileInfo.LastWriteTime; if ((fileCreation.Year == DateTime.Now.Year) && (fileCreation.Month == DateTime.Now.Month) && (fileCreation.Day == DateTime.Now.Day)) { try { sobekItems = new SobekCM_All_Items(); sobekItems.ReadXml(Drive_Location); } catch { sobekItems = null; } } } if (sobekItems == null) { sobekItems = SobekCM_Item_Database.Current_SobekCM_Items(SobekCM_Base_URL); if (sobekItems != null) { try { sobekItems.WriteXml(Drive_Location, XmlWriteMode.WriteSchema); } catch { } } else { if (File.Exists(Drive_Location)) { try { sobekItems = new SobekCM_All_Items(); sobekItems.ReadXml(Drive_Location); } catch { sobekItems = null; } } } } return sobekItems; }