2 /* -----------------------------------------------------------------------
3 * <copyright file="PithosSettings.cs" company="GRNet">
5 * Copyright 2011-2012 GRNET S.A. All rights reserved.
7 * Redistribution and use in source and binary forms, with or
8 * without modification, are permitted provided that the following
11 * 1. Redistributions of source code must retain the above
12 * copyright notice, this list of conditions and the following
15 * 2. Redistributions in binary form must reproduce the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer in the documentation and/or other materials
18 * provided with the distribution.
21 * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
22 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
25 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
28 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
34 * The views and conclusions contained in the software and
35 * documentation are those of the authors and should not be
36 * interpreted as representing official policies, either expressed
37 * or implied, of GRNET S.A.
39 * -----------------------------------------------------------------------
42 using System.ComponentModel.Composition;
43 using System.Diagnostics;
44 using Pithos.Client.WPF.Properties;
45 using Pithos.Interfaces;
47 namespace Pithos.Client.WPF.Configuration
51 [Export(typeof(IPithosSettings))]
53 public class PithosSettings : IPithosSettings
55 private readonly Settings _settings = Settings.Default;
57 public PithosSettings()
59 //Settings should already be upgraded by the time we reach this point
60 Debug.Assert(!_settings.MustUpgrade);
61 //_settings.Upgrade();
64 public bool UseDefaultProxy
66 get { return _settings.UseDefaultProxy; }
67 set { _settings.UseDefaultProxy = value; }
70 public bool UseManualProxy
72 get { return _settings.UseManualProxy; }
73 set { _settings.UseManualProxy = value; }
76 public bool UseNoProxy
78 get { return _settings.UseNoProxy; }
79 set { _settings.UseNoProxy = value; }
82 public string PithosPath
84 get { return _settings.PithosPath; }
85 set { _settings.PithosPath = value; }
88 /* public string PithosSite
90 get { return _settings.PithosSite; }
93 public string PithosLoginUrl
95 get { return _settings.PithosLoginUrl; }
98 public string IconsPath
100 get { return _settings.IconPath; }
101 set { _settings.IconPath = value; }
104 public string UserName
106 get { return _settings.UserName; }
107 set { _settings.UserName = value; }
112 get { return _settings.ApiKey; }
113 set { _settings.ApiKey = value; }
116 public AccountsCollection Accounts
118 get { return _settings.Accounts ?? (_settings.Accounts = new AccountsCollection()); }
119 set { _settings.Accounts = value; }
122 public string ProxyServer
124 get { return _settings.ProxyServer; }
125 set { _settings.ProxyServer = value; }
130 get { return _settings.ProxyPort; }
131 set { _settings.ProxyPort = value; }
134 public string ProxyUsername
136 get { return _settings.ProxyUsername; }
137 set { _settings.ProxyUsername = value; }
141 public string ProxyPassword
143 get { return _settings.ProxyPassword; }
144 set { _settings.ProxyPassword = value; }
147 public string ProxyDomain
149 get { return _settings.ProxyDomain; }
150 set { _settings.ProxyDomain = value; }
153 public bool ProxyAuthentication
156 get { return _settings.ProxyAuthentication; }
157 set { _settings.ProxyAuthentication = value; }
162 public bool ExtensionsActivated
165 get { return _settings.ExtensionsActivated; }
166 set { _settings.ExtensionsActivated = value; }
169 public bool ShowDesktopNotifications
171 get { return _settings.ShowDesktopNotifications; }
172 set { _settings.ShowDesktopNotifications = value; }
176 public int PollingInterval
178 get { return _settings.PollingInterval; }
182 throw new ArgumentOutOfRangeException();
183 _settings.PollingInterval = value;
187 public TimeSpan StartupDelay
189 get { return _settings.StartupDelay; }
192 if (value < TimeSpan.Zero)
193 throw new ArgumentOutOfRangeException();
194 _settings.StartupDelay = value;
199 public bool StartOnSystemStartup
201 get { return _settings.StartOnSystemStartup; }
204 _settings.StartOnSystemStartup = value;
208 public byte HashingParallelism
210 get { return _settings.HashingParallelism; }
211 set { _settings.HashingParallelism = value; }
214 public string UpdateUrl
216 get { return _settings.UpdateUrl; }
219 public bool UpdateDiagnostics
221 get { return _settings.UpdateDiagnostics; }
224 public TimeSpan UpdateCheckInterval
226 get { return _settings.UpdateCheckInterval; }
229 public TimeSpan FileIdleTimeout
231 get { return _settings.FileIdleTimeout; }
234 public bool UpdateForceCheck
236 get { return _settings.UpdateForceCheck; }
242 Proxy.SetFromSettings(this);