/// <summary> Static constructor sets all the values to default empty strings </summary> static SobekCM_Library_Settings() { try { // Set some default values sobekDatabaseType = SobekCM_Database_Type_Enum.MSSQL; Base_SobekCM_Location_Relative = String.Empty; jpeg2000Server = String.Empty; base_url = String.Empty; baseDirectory = String.Empty; imageServerUrl = String.Empty; inProcessSubmissionLocation = String.Empty; sobekcmImageserver = String.Empty; canSubmit = false; cachingServer = String.Empty; privacyEmailAddress = String.Empty; metadataHelpUrl = String.Empty; helpUrl = String.Empty; includePartnersOnSystemHome = false; includeTreeviewOnSystemHome = false; Default_UI_Language = Web_Language_Enum.English; webOutputCachingMinutes = 0; builderVerbose = false; // Define new empty collections dispositionFutureTypes = new Dictionary<int, KeyValuePair<int, string>>(); dispositionPastTypes = new Dictionary<int, KeyValuePair<int, string>>(); workflowTypes = new Dictionary<int, KeyValuePair<int, string>>(); metadataFields = new List<Metadata_Search_Field>(); metadataFieldsByCode = new Dictionary<string, Metadata_Search_Field>(); metadataFieldsByID = new Dictionary<short, Metadata_Search_Field>(); metadataFieldsByFacetName = new Dictionary<string, Metadata_Search_Field>(); incomingFolders = new List<Builder_Source_Folder>(); searchStopWords = new List<string>(); // Should we read the configuration file? if (String.IsNullOrEmpty(SobekCM_Database.Connection_String)) { Read_Configuration_File(); SobekCM_Database.Connection_String = Database_Connection_String; } Refresh(SobekCM_Database.Get_Settings_Complete(null)); } catch (Exception) { // Do nothing here } }
public static void Read_Configuration_File( string config_file ) { if (!File.Exists(config_file)) return; System.IO.StreamReader reader = new System.IO.StreamReader(config_file); System.Xml.XmlTextReader xmlReader = new System.Xml.XmlTextReader(reader); while (xmlReader.Read()) { if (xmlReader.NodeType == System.Xml.XmlNodeType.Element) { string node_name = xmlReader.Name.ToLower(); switch (node_name) { case "connection_string": if (xmlReader.MoveToAttribute("type")) { if (xmlReader.Value.ToString().ToLower() == "postgresql") sobekDatabaseType = SobekCM_Database_Type_Enum.PostgreSQL; } xmlReader.Read(); Database_Connection_String = xmlReader.Value; break; case "error_emails": xmlReader.Read(); systemErrorEmail = xmlReader.Value; break; case "error_page": xmlReader.Read(); System_Error_URL = xmlReader.Value; break; case "ghostscript_executable": xmlReader.Read(); ghostscriptExecutable = xmlReader.Value; break; case "imagemagick_executable": xmlReader.Read(); imageMagickExecutable = xmlReader.Value; break; } } } xmlReader.Close(); reader.Close(); }