public SelectorToolConfig() { // Open xml myFileFuncs = new FileFunctions(); string strAppDLL = System.Reflection.Assembly.GetExecutingAssembly().Location; string strFolder = myFileFuncs.GetDirectoryName(strAppDLL); // Get the XML file string strXMLFile = strFolder + @"\AODataSelector.xml"; // Read the file. XmlDocument xmlConfig = new XmlDocument(); xmlConfig.Load(strXMLFile); XmlNode currNode = xmlConfig.DocumentElement.FirstChild; // This gets us the DataSelector. xmlDataSelector = (XmlElement)currNode; // Get all of the detail into the object FileDSN = xmlDataSelector["FileDSN"].InnerText; ConnectionString = xmlDataSelector["ConnectionString"].InnerText; LogFilePath = xmlDataSelector["LogFilePath"].InnerText; DefaultExtractPath = xmlDataSelector["DefaultExtractPath"].InnerText; DefaultQueryPath = xmlDataSelector["DefaultQueryPath"].InnerText; DefaultFormat = xmlDataSelector["DefaultFormat"].InnerText; DatabaseSchema = xmlDataSelector["DatabaseSchema"].InnerText; IncludeWildcard = xmlDataSelector["IncludeWildcard"].InnerText; ExcludeWildcard = xmlDataSelector["ExcludeWildcard"].InnerText; RecMax = xmlDataSelector["RecMax"].InnerText; DefaultSetSymbology = xmlDataSelector["DefaultSetSymbology"].InnerText; LayerLocation = xmlDataSelector["LayerLocation"].InnerText; EnableSpatialPlotting = xmlDataSelector["EnableSpatialPlotting"].InnerText; }
public SelectorToolConfig() { // Open xml myFileFuncs = new FileFunctions(); string strAppDLL = System.Reflection.Assembly.GetExecutingAssembly().Location; string strFolder = myFileFuncs.GetDirectoryName(strAppDLL); // Get the XML file path //string strXMLFile = strFolder + @"\AODataSelector.xml"; string strXMLFile = Settings.Default.XMLFile; // If the XML file path is blank or doesn't exist if (String.IsNullOrEmpty(strXMLFile) || (!myFileFuncs.FileExists(strXMLFile))) { // Prompt the user for the correct file path string strFolder2 = GetConfigFilePath(); if (!String.IsNullOrEmpty(strFolder2)) strXMLFile = strFolder2 + @"\DataSelector.xml"; // Check the new file path exists if (myFileFuncs.FileExists(strXMLFile)) { Settings.Default.XMLFile = strXMLFile; Settings.Default.Save(); } else { MessageBox.Show("XML File not found."); } } // Read the file. XmlDocument xmlConfig = new XmlDocument(); xmlConfig.Load(strXMLFile); XmlNode currNode = xmlConfig.DocumentElement.FirstChild; // This gets us the DataSelector. xmlDataSelector = (XmlElement)currNode; // Get all of the detail into the object FileDSN = xmlDataSelector["FileDSN"].InnerText; ConnectionString = xmlDataSelector["ConnectionString"].InnerText; LogFilePath = xmlDataSelector["LogFilePath"].InnerText; DefaultExtractPath = xmlDataSelector["DefaultExtractPath"].InnerText; DefaultQueryPath = xmlDataSelector["DefaultQueryPath"].InnerText; DefaultFormat = xmlDataSelector["DefaultFormat"].InnerText; DatabaseSchema = xmlDataSelector["DatabaseSchema"].InnerText; IncludeWildcard = xmlDataSelector["IncludeWildcard"].InnerText; ExcludeWildcard = xmlDataSelector["ExcludeWildcard"].InnerText; RecMax = xmlDataSelector["RecMax"].InnerText; DefaultSetSymbology = xmlDataSelector["DefaultSetSymbology"].InnerText; LayerLocation = xmlDataSelector["LayerLocation"].InnerText; EnableSpatialPlotting = xmlDataSelector["EnableSpatialPlotting"].InnerText; }