root / trunk / Pithos.Client.WPF / Configuration / PithosSettings.cs @ 5d7b20e8
History | View | Annotate | Download (7 kB)
1 |
#region |
---|---|
2 |
/* ----------------------------------------------------------------------- |
3 |
* <copyright file="PithosSettings.cs" company="GRNet"> |
4 |
* |
5 |
* Copyright 2011-2012 GRNET S.A. All rights reserved. |
6 |
* |
7 |
* Redistribution and use in source and binary forms, with or |
8 |
* without modification, are permitted provided that the following |
9 |
* conditions are met: |
10 |
* |
11 |
* 1. Redistributions of source code must retain the above |
12 |
* copyright notice, this list of conditions and the following |
13 |
* disclaimer. |
14 |
* |
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. |
19 |
* |
20 |
* |
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. |
33 |
* |
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. |
38 |
* </copyright> |
39 |
* ----------------------------------------------------------------------- |
40 |
*/ |
41 |
#endregion |
42 |
using System.ComponentModel.Composition; |
43 |
using System.Diagnostics; |
44 |
using Pithos.Client.WPF.Properties; |
45 |
using Pithos.Interfaces; |
46 |
|
47 |
namespace Pithos.Client.WPF.Configuration |
48 |
{ |
49 |
using System; |
50 |
|
51 |
[Export(typeof(IPithosSettings))] |
52 |
[Export] |
53 |
public class PithosSettings : IPithosSettings |
54 |
{ |
55 |
private readonly Settings _settings = Settings.Default; |
56 |
|
57 |
public PithosSettings() |
58 |
{ |
59 |
//Settings should already be upgraded by the time we reach this point |
60 |
Debug.Assert(!_settings.MustUpgrade); |
61 |
//_settings.Upgrade(); |
62 |
} |
63 |
|
64 |
public bool UseDefaultProxy |
65 |
{ |
66 |
get { return _settings.UseDefaultProxy; } |
67 |
set { _settings.UseDefaultProxy = value; } |
68 |
} |
69 |
|
70 |
public bool UseManualProxy |
71 |
{ |
72 |
get { return _settings.UseManualProxy; } |
73 |
set { _settings.UseManualProxy = value; } |
74 |
} |
75 |
|
76 |
public bool UseNoProxy |
77 |
{ |
78 |
get { return _settings.UseNoProxy; } |
79 |
set { _settings.UseNoProxy = value; } |
80 |
} |
81 |
|
82 |
public string PithosPath |
83 |
{ |
84 |
get { return _settings.PithosPath; } |
85 |
set { _settings.PithosPath = value; } |
86 |
} |
87 |
|
88 |
/* public string PithosSite |
89 |
{ |
90 |
get { return _settings.PithosSite; } |
91 |
}*/ |
92 |
|
93 |
public string PithosLoginUrl |
94 |
{ |
95 |
get { return _settings.PithosLoginUrl; } |
96 |
} |
97 |
|
98 |
public string IconsPath |
99 |
{ |
100 |
get { return _settings.IconPath; } |
101 |
set { _settings.IconPath = value; } |
102 |
} |
103 |
|
104 |
public string UserName |
105 |
{ |
106 |
get { return _settings.UserName; } |
107 |
set { _settings.UserName = value; } |
108 |
} |
109 |
|
110 |
public string ApiKey |
111 |
{ |
112 |
get { return _settings.ApiKey; } |
113 |
set { _settings.ApiKey = value; } |
114 |
} |
115 |
|
116 |
public AccountsCollection Accounts |
117 |
{ |
118 |
get { return _settings.Accounts ?? (_settings.Accounts = new AccountsCollection()); } |
119 |
set { _settings.Accounts = value; } |
120 |
} |
121 |
|
122 |
public string ProxyServer |
123 |
{ |
124 |
get { return _settings.ProxyServer; } |
125 |
set { _settings.ProxyServer = value; } |
126 |
} |
127 |
|
128 |
public int ProxyPort |
129 |
{ |
130 |
get { return _settings.ProxyPort; } |
131 |
set { _settings.ProxyPort = value; } |
132 |
} |
133 |
|
134 |
public string ProxyUsername |
135 |
{ |
136 |
get { return _settings.ProxyUsername; } |
137 |
set { _settings.ProxyUsername = value; } |
138 |
} |
139 |
|
140 |
|
141 |
public string ProxyPassword |
142 |
{ |
143 |
get { return _settings.ProxyPassword; } |
144 |
set { _settings.ProxyPassword = value; } |
145 |
} |
146 |
|
147 |
public string ProxyDomain |
148 |
{ |
149 |
get { return _settings.ProxyDomain; } |
150 |
set { _settings.ProxyDomain = value; } |
151 |
} |
152 |
|
153 |
public bool ProxyAuthentication |
154 |
{ |
155 |
|
156 |
get { return _settings.ProxyAuthentication; } |
157 |
set { _settings.ProxyAuthentication = value; } |
158 |
} |
159 |
|
160 |
|
161 |
|
162 |
public bool ExtensionsActivated |
163 |
{ |
164 |
|
165 |
get { return _settings.ExtensionsActivated; } |
166 |
set { _settings.ExtensionsActivated = value; } |
167 |
} |
168 |
|
169 |
public bool ShowDesktopNotifications |
170 |
{ |
171 |
get { return _settings.ShowDesktopNotifications; } |
172 |
set { _settings.ShowDesktopNotifications = value; } |
173 |
} |
174 |
|
175 |
|
176 |
public int PollingInterval |
177 |
{ |
178 |
get { return _settings.PollingInterval; } |
179 |
set |
180 |
{ |
181 |
if (value <= 0) |
182 |
throw new ArgumentOutOfRangeException(); |
183 |
_settings.PollingInterval = value; |
184 |
} |
185 |
} |
186 |
|
187 |
public TimeSpan StartupDelay |
188 |
{ |
189 |
get { return _settings.StartupDelay; } |
190 |
set |
191 |
{ |
192 |
if (value < TimeSpan.Zero) |
193 |
throw new ArgumentOutOfRangeException(); |
194 |
_settings.StartupDelay = value; |
195 |
} |
196 |
} |
197 |
|
198 |
|
199 |
public bool StartOnSystemStartup |
200 |
{ |
201 |
get { return _settings.StartOnSystemStartup; } |
202 |
set |
203 |
{ |
204 |
_settings.StartOnSystemStartup = value; |
205 |
} |
206 |
} |
207 |
|
208 |
public byte HashingParallelism |
209 |
{ |
210 |
get { return _settings.HashingParallelism; } |
211 |
set { _settings.HashingParallelism = value; } |
212 |
} |
213 |
|
214 |
public string UpdateUrl |
215 |
{ |
216 |
get { return _settings.UpdateUrl; } |
217 |
} |
218 |
|
219 |
public bool UpdateDiagnostics |
220 |
{ |
221 |
get { return _settings.UpdateDiagnostics; } |
222 |
} |
223 |
|
224 |
public TimeSpan UpdateCheckInterval |
225 |
{ |
226 |
get { return _settings.UpdateCheckInterval; } |
227 |
} |
228 |
|
229 |
public TimeSpan FileIdleTimeout |
230 |
{ |
231 |
get { return _settings.FileIdleTimeout; } |
232 |
} |
233 |
|
234 |
public bool UpdateForceCheck |
235 |
{ |
236 |
get { return _settings.UpdateForceCheck; } |
237 |
} |
238 |
|
239 |
public void Save() |
240 |
{ |
241 |
_settings.Save(); |
242 |
Proxy.SetFromSettings(this); |
243 |
} |
244 |
|
245 |
public void Reload() |
246 |
{ |
247 |
_settings.Reload(); |
248 |
} |
249 |
|
250 |
public void Reset() |
251 |
{ |
252 |
_settings.Reset(); |
253 |
_settings.Save(); |
254 |
} |
255 |
} |
256 |
} |