#region /* ----------------------------------------------------------------------- * * * Copyright 2011-2012 GRNET S.A. All rights reserved. * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * 1. Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and * documentation are those of the authors and should not be * interpreted as representing official policies, either expressed * or implied, of GRNET S.A. * * ----------------------------------------------------------------------- */ #endregion using System.ComponentModel.Composition; using System.Configuration; using System.Diagnostics; using System.Dynamic; using Pithos.Client.WPF.Properties; using Pithos.Interfaces; namespace Pithos.Client.WPF.Configuration { using System; using System.Collections.Generic; using System.Linq; using System.Text; [Export(typeof(IPithosSettings))] [Export] public class PithosSettings : IPithosSettings { private readonly Settings _settings = Settings.Default; public PithosSettings() { //Settings should already be upgraded by the time we reach this point Debug.Assert(!_settings.MustUpgrade); //_settings.Upgrade(); } public bool UseDefaultProxy { get { return _settings.UseDefaultProxy; } set { _settings.UseDefaultProxy = value; } } public bool UseManualProxy { get { return _settings.UseManualProxy; } set { _settings.UseManualProxy = value; } } public bool UseNoProxy { get { return _settings.UseNoProxy; } set { _settings.UseNoProxy = value; } } public string PithosPath { get { return _settings.PithosPath; } set { _settings.PithosPath = value; } } /* public string PithosSite { get { return _settings.PithosSite; } }*/ public string PithosLoginUrl { get { return _settings.PithosLoginUrl; } } public string IconsPath { get { return _settings.IconPath; } set { _settings.IconPath = value; } } public string UserName { get { return _settings.UserName; } set { _settings.UserName = value; } } public string ApiKey { get { return _settings.ApiKey; } set { _settings.ApiKey = value; } } public AccountsCollection Accounts { get { if (_settings.Accounts==null) _settings.Accounts=new AccountsCollection(); return _settings.Accounts; } set { _settings.Accounts = value; } } public string ProxyServer { get { return _settings.ProxyServer; } set { _settings.ProxyServer = value; } } public int ProxyPort { get { return _settings.ProxyPort; } set { _settings.ProxyPort = value; } } public string ProxyUsername { get { return _settings.ProxyUsername; } set { _settings.ProxyUsername = value; } } public string ProxyPassword { get { return _settings.ProxyPassword; } set { _settings.ProxyPassword = value; } } public string ProxyDomain { get { return _settings.ProxyDomain; } set { _settings.ProxyDomain = value; } } public bool ProxyAuthentication { get { return _settings.ProxyAuthentication; } set { _settings.ProxyAuthentication = value; } } public bool ExtensionsActivated { get { return _settings.ExtensionsActivated; } set { _settings.ExtensionsActivated = value; } } public bool ShowDesktopNotifications { get { return _settings.ShowDesktopNotifications; } set { _settings.ShowDesktopNotifications = value; } } public int PollingInterval { get { return _settings.PollingInterval; } set { if (value <= 0) throw new ArgumentOutOfRangeException(); _settings.PollingInterval = value; } } public TimeSpan StartupDelay { get { return _settings.StartupDelay; } set { if (value < TimeSpan.Zero) throw new ArgumentOutOfRangeException(); _settings.StartupDelay = value; } } public bool StartOnSystemStartup { get { return _settings.StartOnSystemStartup; } set { _settings.StartOnSystemStartup = value; } } public byte HashingParallelism { get { return _settings.HashingParallelism; } set { _settings.HashingParallelism = value; } } public void Save() { _settings.Save(); Proxy.SetFromSettings(this); } public void Reload() { _settings.Reload(); } } }