Exemple #1
0
        public static TesterSettings RecallSettings()
        {
            TesterSettings settings    = new TesterSettings();
            string         applDataDir = TesterSettings.BuildApplDataDir();

            Pather.AssureDirectoryExists(applDataDir);
            string applStateFileName = "TesterSettings.xml";
            string applStatePath     = Path.Combine(applDataDir, applStateFileName);

            if (File.Exists(applStatePath) == true)
            {
                try
                {
                    using (XmlTextReader tr = new XmlTextReader(applStatePath))
                    {
                        settings.ReadXml(tr);
                    }
                }
                catch (Exception)
                {
                    settings = new TesterSettings();
                }
            }

            return(settings);
        }
Exemple #2
0
        public void StoreSettings()
        {
            string applDataDir       = TesterSettings.BuildApplDataDir();
            string applStateFileName = "TesterSettings.xml";
            string applStatePath     = Path.Combine(applDataDir, applStateFileName);

            using (StreamWriter stmw = new StreamWriter(applStatePath))
            {
                XmlSerializer xmlser = new XmlSerializer(typeof(TesterSettings));
                xmlser.Serialize(stmw, this);
            }
        }
Exemple #3
0
        /// <summary>
        /// check that settings exist for the appl.
        /// </summary>
        /// <returns></returns>
        public static bool SettingsExist()
        {
            TesterSettings settings    = new TesterSettings();
            string         applDataDir = TesterSettings.BuildApplDataDir();

            Pather.AssureDirectoryExists(applDataDir);
            string applStateFileName = "TesterSettings.xml";
            string applStatePath     = Path.Combine(applDataDir, applStateFileName);

            if (File.Exists(applStatePath) == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }