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.Configuration;
44 using System.Diagnostics;
46 using Pithos.Client.WPF.Properties;
47 using Pithos.Interfaces;
49 namespace Pithos.Client.WPF.Configuration
52 using System.Collections.Generic;
56 [Export(typeof(IPithosSettings))]
58 public class PithosSettings : IPithosSettings
60 private readonly Settings _settings = Settings.Default;
62 public PithosSettings()
64 //Settings should already be upgraded by the time we reach this point
65 Debug.Assert(!_settings.MustUpgrade);
66 //_settings.Upgrade();
69 public bool UseDefaultProxy
71 get { return _settings.UseDefaultProxy; }
72 set { _settings.UseDefaultProxy = value; }
75 public bool UseManualProxy
77 get { return _settings.UseManualProxy; }
78 set { _settings.UseManualProxy = value; }
81 public bool UseNoProxy
83 get { return _settings.UseNoProxy; }
84 set { _settings.UseNoProxy = value; }
87 public string PithosPath
89 get { return _settings.PithosPath; }
90 set { _settings.PithosPath = value; }
93 /* public string PithosSite
95 get { return _settings.PithosSite; }
98 public string PithosLoginUrl
100 get { return _settings.PithosLoginUrl; }
103 public string IconsPath
105 get { return _settings.IconPath; }
106 set { _settings.IconPath = value; }
109 public string UserName
111 get { return _settings.UserName; }
112 set { _settings.UserName = value; }
117 get { return _settings.ApiKey; }
118 set { _settings.ApiKey = value; }
121 public AccountsCollection Accounts
123 get { return _settings.Accounts ?? (_settings.Accounts = new AccountsCollection()); }
124 set { _settings.Accounts = value; }
127 public string ProxyServer
129 get { return _settings.ProxyServer; }
130 set { _settings.ProxyServer = value; }
135 get { return _settings.ProxyPort; }
136 set { _settings.ProxyPort = value; }
139 public string ProxyUsername
141 get { return _settings.ProxyUsername; }
142 set { _settings.ProxyUsername = value; }
146 public string ProxyPassword
148 get { return _settings.ProxyPassword; }
149 set { _settings.ProxyPassword = value; }
152 public string ProxyDomain
154 get { return _settings.ProxyDomain; }
155 set { _settings.ProxyDomain = value; }
158 public bool ProxyAuthentication
161 get { return _settings.ProxyAuthentication; }
162 set { _settings.ProxyAuthentication = value; }
167 public bool ExtensionsActivated
170 get { return _settings.ExtensionsActivated; }
171 set { _settings.ExtensionsActivated = value; }
174 public bool ShowDesktopNotifications
176 get { return _settings.ShowDesktopNotifications; }
177 set { _settings.ShowDesktopNotifications = value; }
181 public int PollingInterval
183 get { return _settings.PollingInterval; }
187 throw new ArgumentOutOfRangeException();
188 _settings.PollingInterval = value;
192 public TimeSpan StartupDelay
194 get { return _settings.StartupDelay; }
197 if (value < TimeSpan.Zero)
198 throw new ArgumentOutOfRangeException();
199 _settings.StartupDelay = value;
204 public bool StartOnSystemStartup
206 get { return _settings.StartOnSystemStartup; }
209 _settings.StartOnSystemStartup = value;
213 public byte HashingParallelism
215 get { return _settings.HashingParallelism; }
216 set { _settings.HashingParallelism = value; }
219 public string UpdateUrl
221 get { return _settings.UpdateUrl; }
224 public bool UpdateDiagnostics
226 get { return _settings.UpdateDiagnostics; }
229 public TimeSpan UpdateCheckInterval
231 get { return _settings.UpdateCheckInterval; }
237 Proxy.SetFromSettings(this);