Example #1
0
        public static ModuleSettings GetSettings(string configFile = null)
        {
            XmlSerializer  serializer = new XmlSerializer(typeof(ModuleSettings));
            ModuleSettings data       = new ModuleSettings();

            try
            {
                string fileName = System.Environment.CurrentDirectory + "\\UserConfig.xml";
                if (!string.IsNullOrEmpty(configFile))
                {
                    fileName = configFile;
                }
                FileStream fs = new FileStream(fileName, FileMode.Open);
                data = (ModuleSettings)serializer.Deserialize(fs);
                fs.Close();
            }
            catch (System.IO.FileNotFoundException)
            {
                data = new ModuleSettings();
            }
            return(data);
        }