public ApplicationSettings(string fileName)
        {
            _fileName = Path.GetFullPath(fileName);
            _fileFolder = Path.GetDirectoryName(_fileName);

            _autoUpdate = new AutoUpdateSettings();
            _mainWindow = new WindowSettings();
            _dataSources = new DataSources();
            _quickFilters = new QuickFilters();
        }
Exemple #2
0
 private ApplicationSettings(ApplicationSettings other)
 {
     _fileName     = other._fileName;
     _fileFolder   = other._fileFolder;
     _autoUpdate   = other._autoUpdate.Clone();
     _mainWindow   = other._mainWindow.Clone();
     _dataSources  = other._dataSources.Clone();
     _quickFilters = other._quickFilters.Clone();
     _export       = other._export.Clone();
     _logViewer    = other._logViewer.Clone();
 }
Exemple #3
0
        public ApplicationSettings(string fileName)
        {
            _fileName   = Path.GetFullPath(fileName);
            _fileFolder = Path.GetDirectoryName(_fileName);

            _autoUpdate   = new AutoUpdateSettings();
            _mainWindow   = new MainWindowSettings();
            _dataSources  = new DataSources();
            _quickFilters = new QuickFilters();
            _logViewer    = new LogViewerSettings();
            _export       = new ExportSettings();
        }
Exemple #4
0
        public AutoUpdater(IActionCenter actionCenter, AutoUpdateSettings settings)
        {
            if (actionCenter == null)
                throw new ArgumentNullException("actionCenter");
            if (settings == null)
                throw new ArgumentNullException("settings");

            _syncRoot = new object();
            _actionCenter = actionCenter;
            _settings = settings;
            _latestVersionChanged = new List<Action<VersionInfo>>();
        }
 public void Setup()
 {
     _settings = new AutoUpdateSettings();
 }
        public void TestStoreRestore()
        {
            _settings.ProxyServer = "http://eumex.ip";
            _settings.ProxyUsername = "******";
            _settings.ProxyPassword = "******";
            _settings.AutomaticallyInstallUpdates = true;
            _settings.CheckForUpdates = true;

            using (var stream = new MemoryStream())
            {
                using (var writer = XmlWriter.Create(stream))
                {
                    writer.WriteStartElement("xml");
                    writer.WriteStartElement("autoupdate");
                    _settings.Save(writer);
                    writer.WriteEndElement();
                    writer.WriteEndElement();
                }

                stream.Position = 0;

                using (var reader = XmlReader.Create(stream))
                {
                    var settings = new AutoUpdateSettings();
                    reader.Read();
                    reader.Read();
                    reader.Read();
                    settings.Restore(reader);

                    settings.CheckForUpdates.Should().BeTrue();
                    settings.AutomaticallyInstallUpdates.Should().BeTrue();
                    settings.ProxyServer.Should().Be("http://eumex.ip");
                    settings.ProxyUsername.Should().Be("foo");
                    settings.ProxyPassword.Should().Be("bar");
                }
            }
        }