public void can_read_then_write_modified_show_build_age_value_to_xml()
        {
            var views = _parser.ParseXml();
            var xmlModified = _parser.CreateUpdatedXml(new ViewSettings
                              {
                                URL = "http://new",
                                ProjectNameRegEx = "[a-z]",
                                CategoryRegEx = "[1-9]",
                                ServerNameRegEx = "^(http://).*",
                                SkinName = "StackPhoto",
                                ViewName = "NewView",
                                ShowOnlyBroken = true,
                                ShowServerName = true,
                                ShowOutOfDate = true,
                                ShowBuildAge = true,
                                OutOfDateDifferenceInMinutes = 45,
                              });

            _parser = new ViewSettingsParser(new StringReader(xmlModified));

            views = _parser.ParseXml();
            var view1 = views.First();

            view1.ShowBuildAge.ShouldBe(true);
        }
Exemplo n.º 2
0
 public static ICollection<ViewSettings> Read(string xmlFile)
 {
     using (var stream = new StreamReader(xmlFile))
     {
         var reader = new ViewSettingsParser(stream);
         return reader.ParseXml();
     }
 }
Exemplo n.º 3
0
 public static ICollection <ViewSettings> Read(string xmlFile)
 {
     using (var stream = new StreamReader(xmlFile))
     {
         var reader = new ViewSettingsParser(stream);
         return(reader.ParseXml());
     }
 }
Exemplo n.º 4
0
 //-----
 // modify functionality (below) is only for the settings dialog save functionality
 //-----
 public static void Modify(string xmlFile, ViewSettings viewSettings)
 {
     string xmlUpdated;
     using (var stream = new StreamReader(xmlFile))
     {
         var parser = new ViewSettingsParser(stream);
         xmlUpdated = parser.CreateUpdatedXml(viewSettings);
     }
     using (var stream = new StreamWriter(xmlFile))
     {
         stream.Write(xmlUpdated);
     }
 }
Exemplo n.º 5
0
        //-----
        // modify functionality (below) is only for the settings dialog save functionality
        //-----

        public static void Modify(string xmlFile, ViewSettings viewSettings)
        {
            string xmlUpdated;

            using (var stream = new StreamReader(xmlFile))
            {
                var parser = new ViewSettingsParser(stream);
                xmlUpdated = parser.CreateUpdatedXml(viewSettings);
            }
            using (var stream = new StreamWriter(xmlFile))
            {
                stream.Write(xmlUpdated);
            }
        }
Exemplo n.º 6
0
        public void Save()
        {
            try
            {
                if (IsOneView)
                {
                    ViewSettingsParser.Modify(_configLocation.FileName, new ViewSettings
                    {
                        URL = URL,
                        ProjectNameRegEx             = ProjectNameRegEx,
                        CategoryRegEx                = CategoryRegEx,
                        ServerNameRegEx              = ServerNameRegEx,
                        SkinName                     = SkinName,
                        ViewName                     = ViewName,
                        ShowOnlyBroken               = ShowOnlyBroken,
                        ShowServerName               = ShowServerName,
                        ShowOutOfDate                = ShowOutOfDate,
                        OutOfDateDifferenceInMinutes = OutOfDateDifferenceInMinutes
                    });
                }

                var config = OpenExeConfiguration();

                config.AppSettings.Settings[PollFrequencyKey].Value        = PollFrequency.ToString();
                config.AppSettings.Settings[ShowCountdownKey].Value        = ShowCountdown.ToString();
                config.AppSettings.Settings[ShowProgressKey].Value         = ShowProgress.ToString();
                config.AppSettings.Settings[PlaySoundsKey].Value           = PlaySounds.ToString();
                config.AppSettings.Settings[PlaySpeechKey].Value           = PlaySpeech.ToString();
                config.AppSettings.Settings[BrokenBuildSoundKey].Value     = BrokenBuildSound;
                config.AppSettings.Settings[FixedBuildSoundKey].Value      = FixedBuildSound;
                config.AppSettings.Settings[BrokenBuildTextKey].Value      = BrokenBuildText;
                config.AppSettings.Settings[FixedBuildTextKey].Value       = FixedBuildText;
                config.AppSettings.Settings[SpeechVoiceNameKey].Value      = SpeechVoiceName;
                config.AppSettings.Settings[BreakerGuiltStrategyKey].Value = _breakerGuiltStrategy;
                config.Save(ConfigurationSaveMode.Minimal);
            }
            catch (Exception ex)
            {
                // config may be edited in the file (manually) - we cannot show an error dialog here
                // because it's entirely reasonable that the user doesn't have access to the machine running
                // the exe, in order to close a dialog
                _log.Error(ex.Message, ex);
            }
        }
        public void can_read_then_write_modified_view_to_xml()
        {
            var views = _parser.ParseXml();
            var xmlModified = _parser.CreateUpdatedXml(new ViewSettings
                              {
                                URL = "http://new",
                                ProjectNameRegEx = "[a-z]",
                                CategoryRegEx = "[1-9]",
                                SkinName = "StackPhoto",
                              });

            _parser = new ViewSettingsParser(new StringReader(xmlModified));

            views = _parser.ParseXml();
            var view1 = views.First();

            view1.URL.ShouldBe("http://new");
            view1.SkinName.ShouldBe("StackPhoto");
            view1.ProjectNameRegEx.ShouldBe("[a-z]");
            view1.CategoryRegEx.ShouldBe("[1-9]");
        }
Exemplo n.º 8
0
 public void SetUp()
 {
     _parser = new ViewSettingsParser(new StringReader(XML));
 }
Exemplo n.º 9
0
 private void LoadViewSettings()
 {
     _viewList = ViewSettingsParser.Read(_configLocation.FileName);
     _viewQueue.Clear();
 }