Revision 65282d58
b/trunk/Pithos.Client.WPF/Configuration/PithosSettings.cs | ||
---|---|---|
147 | 147 |
set { _settings.ProxyPassword = value; } |
148 | 148 |
} |
149 | 149 |
|
150 |
public string ProxyDomain |
|
151 |
{ |
|
152 |
get { return _settings.ProxyDomain; } |
|
153 |
set { _settings.ProxyDomain = value; } |
|
154 |
} |
|
155 |
|
|
150 | 156 |
public bool ProxyAuthentication |
151 | 157 |
{ |
152 | 158 |
|
b/trunk/Pithos.Client.WPF/Pithos.Client.WPF.csproj | ||
---|---|---|
267 | 267 |
<DependentUpon>GroupsView.xaml</DependentUpon> |
268 | 268 |
</Compile> |
269 | 269 |
<Compile Include="Preferences\GroupsViewModel.cs" /> |
270 |
<Compile Include="Preferences\ProxyAccountView.xaml.cs"> |
|
271 |
<DependentUpon>ProxyAccountView.xaml</DependentUpon> |
|
272 |
</Compile> |
|
273 |
<Compile Include="Preferences\ProxyAccountViewModel.cs" /> |
|
270 | 274 |
<Compile Include="Shell\AboutView.xaml.cs"> |
271 | 275 |
<DependentUpon>AboutView.xaml</DependentUpon> |
272 | 276 |
</Compile> |
... | ... | |
323 | 327 |
<Generator>MSBuild:Compile</Generator> |
324 | 328 |
<SubType>Designer</SubType> |
325 | 329 |
</Page> |
330 |
<Page Include="Preferences\ProxyAccountView.xaml"> |
|
331 |
<SubType>Designer</SubType> |
|
332 |
<Generator>MSBuild:Compile</Generator> |
|
333 |
</Page> |
|
326 | 334 |
<Page Include="Shell\AboutView.xaml"> |
327 | 335 |
<SubType>Designer</SubType> |
328 | 336 |
<Generator>MSBuild:Compile</Generator> |
b/trunk/Pithos.Client.WPF/Preferences/PreferencesView.xaml | ||
---|---|---|
160 | 160 |
<CheckBox Content="Proxy requires authentication" Height="16" VerticalAlignment="Top" Name="Settings_ProxyAuthentication" /> |
161 | 161 |
</GroupBox.Header> |
162 | 162 |
<Grid > |
163 |
<Label Content="Username" Height="28" HorizontalAlignment="Left" Margin="0,6,0,0" Name="label3" VerticalAlignment="Top" /> |
|
164 |
<Label Content="Password" Height="28" HorizontalAlignment="Left" Margin="0,32,0,0" Name="label4" VerticalAlignment="Top" /> |
|
165 |
<TextBox Height="23" HorizontalAlignment="Left" Margin="65,6,0,0" Name="Settings_ProxyUsername" VerticalAlignment="Top" Width="157" IsEnabled="{Binding IsChecked,ElementName=Settings_ProxyAuthentication}"/> |
|
166 |
<TextBox Height="23" HorizontalAlignment="Left" Margin="65,37,0,0" Name="Settings_ProxyPassword" VerticalAlignment="Top" Width="157" IsEnabled="{Binding IsChecked,ElementName=Settings_ProxyAuthentication}"/> |
|
163 |
<Grid.RowDefinitions> |
|
164 |
<RowDefinition/> |
|
165 |
<RowDefinition/> |
|
166 |
<RowDefinition/> |
|
167 |
</Grid.RowDefinitions> |
|
168 |
<Grid.ColumnDefinitions> |
|
169 |
<ColumnDefinition/> |
|
170 |
<ColumnDefinition/> |
|
171 |
</Grid.ColumnDefinitions> |
|
172 |
<Label Content="Username" Height="28" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0" VerticalAlignment="Top" /> |
|
173 |
<Label Content="Password" Height="28" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="0" VerticalAlignment="Top" /> |
|
174 |
<Label Content="Domain" Height="28" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="0" VerticalAlignment="Top" /> |
|
175 |
<TextBox Height="23" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="1" Name="Settings_ProxyUsername" VerticalAlignment="Top" Width="157" IsEnabled="{Binding IsChecked,ElementName=Settings_ProxyAuthentication}"/> |
|
176 |
<TextBox Height="23" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="1" Name="Settings_ProxyPassword" VerticalAlignment="Top" Width="157" IsEnabled="{Binding IsChecked,ElementName=Settings_ProxyAuthentication}"/> |
|
177 |
<TextBox Height="23" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="1" Name="Settings_ProxyDomain" VerticalAlignment="Top" Width="157" IsEnabled="{Binding IsChecked,ElementName=Settings_ProxyAuthentication}"/> |
|
167 | 178 |
</Grid> |
168 | 179 |
</GroupBox> |
169 | 180 |
</Grid> |
b/trunk/Pithos.Client.WPF/Preferences/ProxyAccountView.xaml | ||
---|---|---|
1 |
<Window x:Class="Pithos.Client.WPF.Preferences.ProxyAccountView" |
|
2 |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|
3 |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|
4 |
xmlns:Converters="clr-namespace:Pithos.Client.WPF.Converters" Title="ProxyAccountView" Height="300" Width="400"> |
|
5 |
<Window.Resources> |
|
6 |
<ResourceDictionary> |
|
7 |
<ResourceDictionary.MergedDictionaries> |
|
8 |
<ResourceDictionary Source="..\PithosStyles.xaml" /> |
|
9 |
</ResourceDictionary.MergedDictionaries> |
|
10 |
<Converters:NullToVisibilityConverter x:Key="NullToVisible" /> |
|
11 |
</ResourceDictionary> |
|
12 |
</Window.Resources> |
|
13 |
<Grid> |
|
14 |
<Grid.RowDefinitions> |
|
15 |
<RowDefinition Height="Auto"/> |
|
16 |
<RowDefinition Height="Auto"/> |
|
17 |
<RowDefinition Height="Auto"/> |
|
18 |
<RowDefinition/> |
|
19 |
<RowDefinition Height="Auto"/> |
|
20 |
</Grid.RowDefinitions> |
|
21 |
<Grid.ColumnDefinitions> |
|
22 |
<ColumnDefinition Width="Auto"/> |
|
23 |
<ColumnDefinition /> |
|
24 |
</Grid.ColumnDefinitions> |
|
25 |
<RadioButton Name="Settings_UseDefaultProxy" Content="Use System Defaults" Margin="5,6,5,0" Height="16" VerticalAlignment="Top"/> |
|
26 |
<RadioButton Name="Settings_UseManualProxy" Content="Manual" Margin="5,28,5,0" Height="16" VerticalAlignment="Top"/> |
|
27 |
<Label Content="Server" Height="28" HorizontalAlignment="Left" Margin="5,47,0,0" Name="label2" VerticalAlignment="Top" /> |
|
28 |
<TextBox Height="23" HorizontalAlignment="Left" Margin="76,51,0,0" Name="Settings_ProxyServer" VerticalAlignment="Top" Width="162" IsEnabled="{Binding ElementName=Settings_UseManualProxy, Path=IsChecked}"/> |
|
29 |
<TextBlock Height="23" HorizontalAlignment="Left" Margin="244,51,0,0" Name="textBlock1" Text=":" VerticalAlignment="Top" /> |
|
30 |
<TextBox Height="23" HorizontalAlignment="Left" Margin="254,51,0,0" Name="Settings_ProxyPort" VerticalAlignment="Top" Width="65" IsEnabled="{Binding ElementName=Settings_UseManualProxy, Path=IsChecked}"/> |
|
31 |
|
|
32 |
<GroupBox Height="109" HorizontalAlignment="Left" Margin="5,80,0,0" Name="groupBox2" VerticalAlignment="Top" Width="373" IsEnabled="{Binding ElementName=Settings_UseManualProxy, Path=IsChecked}"> |
|
33 |
<GroupBox.Header> |
|
34 |
<CheckBox Content="Proxy requires authentication" Height="16" VerticalAlignment="Top" Name="Settings_ProxyAuthentication" /> |
|
35 |
</GroupBox.Header> |
|
36 |
<Grid > |
|
37 |
<Grid.RowDefinitions> |
|
38 |
<RowDefinition/> |
|
39 |
<RowDefinition/> |
|
40 |
<RowDefinition/> |
|
41 |
</Grid.RowDefinitions> |
|
42 |
<Grid.ColumnDefinitions> |
|
43 |
<ColumnDefinition/> |
|
44 |
<ColumnDefinition/> |
|
45 |
</Grid.ColumnDefinitions> |
|
46 |
<Label Content="Username" Height="28" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0" VerticalAlignment="Top" /> |
|
47 |
<Label Content="Password" Height="28" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="0" VerticalAlignment="Top" /> |
|
48 |
<Label Content="Domain" Height="28" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="0" VerticalAlignment="Top" /> |
|
49 |
<TextBox Height="23" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="1" Name="Settings_ProxyUsername" VerticalAlignment="Top" Width="157" IsEnabled="{Binding IsChecked,ElementName=Settings_ProxyAuthentication}"/> |
|
50 |
<TextBox Height="23" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="1" Name="Settings_ProxyPassword" VerticalAlignment="Top" Width="157" IsEnabled="{Binding IsChecked,ElementName=Settings_ProxyAuthentication}"/> |
|
51 |
<TextBox Height="23" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="1" Name="Settings_ProxyDomain" VerticalAlignment="Top" Width="157" IsEnabled="{Binding IsChecked,ElementName=Settings_ProxyAuthentication}"/> |
|
52 |
</Grid> |
|
53 |
</GroupBox> |
|
54 |
|
|
55 |
|
|
56 |
<!-- |
|
57 |
<TextBlock Text="UserName" Grid.Row="0" Grid.Column="0" Margin="5"/> |
|
58 |
<TextBox x:Name="UserName" Grid.Row="0" Grid.Column="1" Margin="5"/> |
|
59 |
<TextBlock Text="Password" Grid.Row="1" Grid.Column="0" Margin="5"/> |
|
60 |
<TextBox x:Name="Password" Grid.Row="1" Grid.Column="1" Margin="5"/> |
|
61 |
<TextBlock Text="Domain" Grid.Row="2" Grid.Column="0" Margin="5"/> |
|
62 |
<TextBox x:Name="Domain" Grid.Row="2" Grid.Column="1" Margin="5"/> |
|
63 |
--> |
|
64 |
<StackPanel Orientation="Horizontal" Grid.Row="3" Grid.ColumnSpan="2" HorizontalAlignment="Right" VerticalAlignment="Bottom"> |
|
65 |
<Button Name="SaveChanges" Content="OK" Margin="5,5,10,5" Style="{StaticResource ButtonStyle}"/> |
|
66 |
<Button Name="RejectChanges" Content="Cancel" Margin="5,5,10,5" Style="{StaticResource ButtonStyle}"/> |
|
67 |
</StackPanel> |
|
68 |
</Grid> |
|
69 |
</Window> |
b/trunk/Pithos.Client.WPF/Preferences/ProxyAccountView.xaml.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Windows; |
|
6 |
using System.Windows.Controls; |
|
7 |
using System.Windows.Data; |
|
8 |
using System.Windows.Documents; |
|
9 |
using System.Windows.Input; |
|
10 |
using System.Windows.Media; |
|
11 |
using System.Windows.Media.Imaging; |
|
12 |
using System.Windows.Shapes; |
|
13 |
|
|
14 |
namespace Pithos.Client.WPF.Preferences |
|
15 |
{ |
|
16 |
/// <summary> |
|
17 |
/// Interaction logic for ProxyAccountView.xaml |
|
18 |
/// </summary> |
|
19 |
public partial class ProxyAccountView : Window |
|
20 |
{ |
|
21 |
public ProxyAccountView() |
|
22 |
{ |
|
23 |
InitializeComponent(); |
|
24 |
} |
|
25 |
} |
|
26 |
} |
b/trunk/Pithos.Client.WPF/Preferences/ProxyAccountViewModel.cs | ||
---|---|---|
1 |
// ----------------------------------------------------------------------- |
|
2 |
// <copyright file="ProxyAccountViewModel.cs" company="Microsoft"> |
|
3 |
// TODO: Update copyright text. |
|
4 |
// </copyright> |
|
5 |
// ----------------------------------------------------------------------- |
|
6 |
|
|
7 |
using System.ComponentModel.Composition; |
|
8 |
using System.Diagnostics.Contracts; |
|
9 |
using System.Net; |
|
10 |
using Caliburn.Micro; |
|
11 |
using Pithos.Client.WPF.Configuration; |
|
12 |
|
|
13 |
namespace Pithos.Client.WPF.Preferences |
|
14 |
{ |
|
15 |
using System; |
|
16 |
using System.Collections.Generic; |
|
17 |
using System.Linq; |
|
18 |
using System.Text; |
|
19 |
|
|
20 |
[Export(typeof(ProxyAccountViewModel))] |
|
21 |
public class ProxyAccountViewModel:Screen |
|
22 |
{ |
|
23 |
public override string DisplayName |
|
24 |
{ |
|
25 |
get { return "Proxy Settings"; } |
|
26 |
set |
|
27 |
{ |
|
28 |
base.DisplayName = value; |
|
29 |
} |
|
30 |
} |
|
31 |
private string _userName; |
|
32 |
public string UserName |
|
33 |
{ |
|
34 |
get { return _userName; } |
|
35 |
set |
|
36 |
{ |
|
37 |
if (String.IsNullOrWhiteSpace(value)) |
|
38 |
throw new ArgumentNullException(); |
|
39 |
_userName = value; |
|
40 |
NotifyOfPropertyChange(()=>UserName); |
|
41 |
} |
|
42 |
} |
|
43 |
|
|
44 |
private string _password; |
|
45 |
public string Password |
|
46 |
{ |
|
47 |
get { return _password; } |
|
48 |
set |
|
49 |
{ |
|
50 |
if (String.IsNullOrWhiteSpace(value)) |
|
51 |
throw new ArgumentNullException(); |
|
52 |
_password = value; |
|
53 |
NotifyOfPropertyChange(()=>Password); |
|
54 |
} |
|
55 |
} |
|
56 |
|
|
57 |
private string _domain; |
|
58 |
public string Domain |
|
59 |
{ |
|
60 |
get { return _domain; } |
|
61 |
set |
|
62 |
{ |
|
63 |
_domain = value; |
|
64 |
NotifyOfPropertyChange(()=>Domain); |
|
65 |
} |
|
66 |
} |
|
67 |
|
|
68 |
public PithosSettings Settings |
|
69 |
{ |
|
70 |
get { return _settings; } |
|
71 |
set |
|
72 |
{ |
|
73 |
_settings = value; |
|
74 |
NotifyOfPropertyChange(()=>Settings); |
|
75 |
} |
|
76 |
} |
|
77 |
|
|
78 |
private PithosSettings _settings; |
|
79 |
|
|
80 |
public ProxyAccountViewModel(PithosSettings settings) |
|
81 |
{ |
|
82 |
if (settings == null) |
|
83 |
throw new ArgumentNullException("settings"); |
|
84 |
Contract.EndContractBlock(); |
|
85 |
|
|
86 |
Settings = settings; |
|
87 |
UserName = Settings.ProxyUsername; |
|
88 |
Password = Settings.ProxyPassword; |
|
89 |
Domain = Settings.ProxyDomain; |
|
90 |
} |
|
91 |
|
|
92 |
public void SaveChanges() |
|
93 |
{ |
|
94 |
/* |
|
95 |
Settings.ProxyUsername = UserName; |
|
96 |
Settings.ProxyPassword = Password; |
|
97 |
Settings.ProxyDomain = Domain; |
|
98 |
Settings.UseManualProxy = true; |
|
99 |
Settings.UseDefaultProxy = false; |
|
100 |
Settings.UseNoProxy = false; |
|
101 |
Settings.ProxyAuthentication = true; |
|
102 |
*/ |
|
103 |
Settings.Save(); |
|
104 |
CredentialCache.DefaultNetworkCredentials.Password = Settings.ProxyPassword; |
|
105 |
CredentialCache.DefaultNetworkCredentials.UserName = Settings.ProxyUsername; |
|
106 |
CredentialCache.DefaultNetworkCredentials.Domain= Settings.ProxyDomain; |
|
107 |
this.TryClose(true); |
|
108 |
} |
|
109 |
|
|
110 |
public void RejectChanges() |
|
111 |
{ |
|
112 |
this.TryClose(); |
|
113 |
} |
|
114 |
} |
|
115 |
} |
b/trunk/Pithos.Client.WPF/Properties/Settings.Designer.cs | ||
---|---|---|
97 | 97 |
|
98 | 98 |
[global::System.Configuration.UserScopedSettingAttribute()] |
99 | 99 |
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
100 |
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
|
100 |
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
|
101 | 101 |
public bool ProxyAuthentication { |
102 | 102 |
get { |
103 | 103 |
return ((bool)(this["ProxyAuthentication"])); |
... | ... | |
181 | 181 |
|
182 | 182 |
[global::System.Configuration.UserScopedSettingAttribute()] |
183 | 183 |
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
184 |
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
|
184 |
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
|
185 | 185 |
public bool UseDefaultProxy { |
186 | 186 |
get { |
187 | 187 |
return ((bool)(this["UseDefaultProxy"])); |
... | ... | |
193 | 193 |
|
194 | 194 |
[global::System.Configuration.UserScopedSettingAttribute()] |
195 | 195 |
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
196 |
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
|
196 |
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
|
197 | 197 |
public bool UseManualProxy { |
198 | 198 |
get { |
199 | 199 |
return ((bool)(this["UseManualProxy"])); |
... | ... | |
282 | 282 |
this["PollingInterval"] = value; |
283 | 283 |
} |
284 | 284 |
} |
285 |
|
|
286 |
[global::System.Configuration.UserScopedSettingAttribute()] |
|
287 |
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
|
288 |
[global::System.Configuration.DefaultSettingValueAttribute("")] |
|
289 |
public string ProxyDomain { |
|
290 |
get { |
|
291 |
return ((string)(this["ProxyDomain"])); |
|
292 |
} |
|
293 |
set { |
|
294 |
this["ProxyDomain"] = value; |
|
295 |
} |
|
296 |
} |
|
285 | 297 |
} |
286 | 298 |
} |
b/trunk/Pithos.Client.WPF/Properties/Settings.settings | ||
---|---|---|
21 | 21 |
<Value Profile="(Default)" /> |
22 | 22 |
</Setting> |
23 | 23 |
<Setting Name="ProxyAuthentication" Type="System.Boolean" Scope="User"> |
24 |
<Value Profile="(Default)">False</Value>
|
|
24 |
<Value Profile="(Default)">True</Value>
|
|
25 | 25 |
</Setting> |
26 | 26 |
<Setting Name="ExtensionsActivated" Type="System.Boolean" Scope="User"> |
27 | 27 |
<Value Profile="(Default)">True</Value> |
... | ... | |
42 | 42 |
<Value Profile="(Default)">False</Value> |
43 | 43 |
</Setting> |
44 | 44 |
<Setting Name="UseDefaultProxy" Type="System.Boolean" Scope="User"> |
45 |
<Value Profile="(Default)">True</Value>
|
|
45 |
<Value Profile="(Default)">False</Value>
|
|
46 | 46 |
</Setting> |
47 | 47 |
<Setting Name="UseManualProxy" Type="System.Boolean" Scope="User"> |
48 |
<Value Profile="(Default)">False</Value>
|
|
48 |
<Value Profile="(Default)">True</Value>
|
|
49 | 49 |
</Setting> |
50 | 50 |
<Setting Name="CloudfilesAuthenticationUrl" Type="System.String" Scope="Application"> |
51 | 51 |
<Value Profile="(Default)">https://auth.api.rackspacecloud.com</Value> |
... | ... | |
71 | 71 |
<Setting Name="PollingInterval" Type="System.Int32" Scope="User"> |
72 | 72 |
<Value Profile="(Default)">10</Value> |
73 | 73 |
</Setting> |
74 |
<Setting Name="ProxyDomain" Type="System.String" Scope="User"> |
|
75 |
<Value Profile="(Default)" /> |
|
76 |
</Setting> |
|
74 | 77 |
</Settings> |
75 | 78 |
</SettingsFile> |
b/trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs | ||
---|---|---|
12 | 12 |
using Hardcodet.Wpf.TaskbarNotification; |
13 | 13 |
using Pithos.Client.WPF.Configuration; |
14 | 14 |
using Pithos.Client.WPF.FileProperties; |
15 |
using Pithos.Client.WPF.Preferences; |
|
15 | 16 |
using Pithos.Client.WPF.SelectiveSynch; |
16 | 17 |
using Pithos.Client.WPF.Services; |
17 | 18 |
using Pithos.Client.WPF.Shell; |
... | ... | |
509 | 510 |
if (AbandonRetry(monitor, retries)) |
510 | 511 |
return; |
511 | 512 |
|
512 |
if (IsUnauthorized(exc)) |
|
513 |
{ |
|
514 |
var message = String.Format("API Key Expired for {0}. Starting Renewal",monitor.UserName); |
|
515 |
Log.Error(message,exc); |
|
516 |
TryAuthorize(monitor,retries).Wait(); |
|
517 |
} |
|
518 |
else |
|
519 |
{ |
|
520 |
TryLater(monitor, exc,retries); |
|
521 |
} |
|
513 |
HttpStatusCode statusCode =HttpStatusCode.OK; |
|
514 |
var response = exc.Response as HttpWebResponse; |
|
515 |
if(response!=null) |
|
516 |
statusCode = response.StatusCode; |
|
517 |
|
|
518 |
switch (statusCode) |
|
519 |
{ |
|
520 |
case HttpStatusCode.Unauthorized: |
|
521 |
var message = String.Format("API Key Expired for {0}. Starting Renewal", |
|
522 |
monitor.UserName); |
|
523 |
Log.Error(message, exc); |
|
524 |
TryAuthorize(monitor, retries).Wait(); |
|
525 |
break; |
|
526 |
case HttpStatusCode.ProxyAuthenticationRequired: |
|
527 |
TryAuthenticateProxy(monitor,retries); |
|
528 |
break; |
|
529 |
default: |
|
530 |
TryLater(monitor, exc, retries); |
|
531 |
break; |
|
532 |
} |
|
522 | 533 |
} |
523 | 534 |
catch (Exception exc) |
524 | 535 |
{ |
... | ... | |
531 | 542 |
}); |
532 | 543 |
} |
533 | 544 |
|
534 |
private bool AbandonRetry(PithosMonitor monitor, int retries) |
|
545 |
private void TryAuthenticateProxy(PithosMonitor monitor,int retries) |
|
546 |
{ |
|
547 |
Execute.OnUIThread(() => |
|
548 |
{ |
|
549 |
var proxyAccount = new ProxyAccountViewModel(this.Settings); |
|
550 |
if (true == _windowManager.ShowDialog(proxyAccount)) |
|
551 |
{ |
|
552 |
|
|
553 |
StartMonitor(monitor, retries); |
|
554 |
NotifyOfPropertyChange(() => Accounts); |
|
555 |
} |
|
556 |
}); |
|
557 |
} |
|
558 |
|
|
559 |
private bool AbandonRetry(PithosMonitor monitor, int retries) |
|
535 | 560 |
{ |
536 | 561 |
if (retries > 1) |
537 | 562 |
{ |
b/trunk/Pithos.Client.WPF/app.config | ||
---|---|---|
46 | 46 |
<value /> |
47 | 47 |
</setting> |
48 | 48 |
<setting name="ProxyAuthentication" serializeAs="String"> |
49 |
<value>False</value>
|
|
49 |
<value>True</value>
|
|
50 | 50 |
</setting> |
51 | 51 |
<setting name="ExtensionsActivated" serializeAs="String"> |
52 | 52 |
<value>True</value> |
... | ... | |
67 | 67 |
<value>False</value> |
68 | 68 |
</setting> |
69 | 69 |
<setting name="UseDefaultProxy" serializeAs="String"> |
70 |
<value>True</value>
|
|
70 |
<value>False</value>
|
|
71 | 71 |
</setting> |
72 | 72 |
<setting name="UseManualProxy" serializeAs="String"> |
73 |
<value>False</value>
|
|
73 |
<value>True</value>
|
|
74 | 74 |
</setting> |
75 | 75 |
<setting name="MustUpgrade" serializeAs="String"> |
76 | 76 |
<value>True</value> |
... | ... | |
78 | 78 |
<setting name="PollingInterval" serializeAs="String"> |
79 | 79 |
<value>10</value> |
80 | 80 |
</setting> |
81 |
<setting name="ProxyDomain" serializeAs="String"> |
|
82 |
<value /> |
|
83 |
</setting> |
|
81 | 84 |
</Pithos.Client.WPF.Properties.Settings> |
82 | 85 |
</userSettings> |
83 | 86 |
<connectionStrings> |
b/trunk/Pithos.Core.Test/MockSettings.cs | ||
---|---|---|
32 | 32 |
|
33 | 33 |
public string ProxyPassword { get; set; } |
34 | 34 |
|
35 |
public string ProxyDomain { get; set; } |
|
35 | 36 |
|
36 | 37 |
public bool ProxyAuthentication { get; set; } |
37 | 38 |
public bool ExtensionsActivated { get; set; } |
b/trunk/Pithos.Core/PithosMonitor.cs | ||
---|---|---|
6 | 6 |
using System.Diagnostics.Contracts; |
7 | 7 |
using System.IO; |
8 | 8 |
using System.Linq; |
9 |
using System.Net; |
|
9 | 10 |
using System.Net.NetworkInformation; |
10 | 11 |
using System.Security.Cryptography; |
11 | 12 |
using System.ServiceModel.Description; |
... | ... | |
168 | 169 |
|
169 | 170 |
|
170 | 171 |
CloudClient=new CloudFilesClient(UserName,ApiKey); |
171 |
var proxyUri = ProxyFromSettings();
|
|
172 |
CloudClient.Proxy = proxyUri;
|
|
172 |
var proxy = ProxyFromSettings(); |
|
173 |
CloudClient.Proxy = proxy; |
|
173 | 174 |
CloudClient.UsePithos = true; |
174 | 175 |
CloudClient.AuthenticationUrl = this.AuthenticationUrl; |
175 | 176 |
|
... | ... | |
225 | 226 |
|
226 | 227 |
public string AuthenticationUrl { get; set; } |
227 | 228 |
|
228 |
private Uri ProxyFromSettings()
|
|
229 |
private WebProxy ProxyFromSettings()
|
|
229 | 230 |
{ |
230 | 231 |
if (Settings.UseManualProxy) |
231 | 232 |
{ |
232 |
var proxyUri = new UriBuilder |
|
233 |
{ |
|
234 |
Host = Settings.ProxyServer, |
|
235 |
Port = Settings.ProxyPort |
|
236 |
}; |
|
233 |
var proxy = new WebProxy(Settings.ProxyServer, Settings.ProxyPort); |
|
234 |
//If the proxy requires specific authentication settings, use them |
|
237 | 235 |
if (Settings.ProxyAuthentication) |
238 | 236 |
{ |
239 |
proxyUri.UserName = Settings.ProxyUsername; |
|
240 |
proxyUri.Password = Settings.ProxyPassword; |
|
237 |
proxy.Credentials=new NetworkCredential(Settings.ProxyUsername,Settings.ProxyPassword,Settings.ProxyDomain); |
|
241 | 238 |
} |
242 |
return proxyUri.Uri; |
|
239 |
//Otherwise, if there are generic authentication settings, use them |
|
240 |
if (!String.IsNullOrWhiteSpace(CredentialCache.DefaultNetworkCredentials.UserName)) |
|
241 |
{ |
|
242 |
proxy.Credentials = CredentialCache.DefaultNetworkCredentials; |
|
243 |
} |
|
244 |
return proxy; |
|
243 | 245 |
} |
244 | 246 |
return null; |
245 | 247 |
} |
... | ... | |
279 | 281 |
|
280 | 282 |
private void StartWorkflowAgent() |
281 | 283 |
{ |
282 |
//On Vista and up we can check for a network connection |
|
284 |
WorkflowAgent.StatusNotification = StatusNotification; |
|
285 |
|
|
286 |
/* //On Vista and up we can check for a network connection |
|
283 | 287 |
bool connected=Environment.OSVersion.Version.Major < 6 || NetworkListManager.IsConnectedToInternet; |
284 | 288 |
//If we are not connected retry later |
285 | 289 |
if (!connected) |
286 | 290 |
{ |
287 | 291 |
Task.Factory.StartNewDelayed(10000, StartWorkflowAgent); |
288 | 292 |
return; |
289 |
} |
|
293 |
}*/
|
|
290 | 294 |
|
291 | 295 |
try |
292 | 296 |
{ |
293 |
WorkflowAgent.StatusNotification = StatusNotification; |
|
294 | 297 |
WorkflowAgent.Start(); |
295 | 298 |
} |
296 | 299 |
catch (Exception) |
b/trunk/Pithos.Interfaces/IPithosSettings.cs | ||
---|---|---|
26 | 26 |
|
27 | 27 |
|
28 | 28 |
string ProxyUsername { get; set; } |
29 |
|
|
30 |
|
|
31 | 29 |
string ProxyPassword { get; set; } |
30 |
string ProxyDomain { get; set; } |
|
32 | 31 |
|
33 | 32 |
|
34 | 33 |
bool ProxyAuthentication{ get; set; } |
b/trunk/Pithos.Interfaces/Pithos.Interfaces.csproj | ||
---|---|---|
28 | 28 |
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure> |
29 | 29 |
<CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires> |
30 | 30 |
<CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers> |
31 |
<CodeContractsRunCodeAnalysis>True</CodeContractsRunCodeAnalysis>
|
|
31 |
<CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
|
|
32 | 32 |
<CodeContractsNonNullObligations>False</CodeContractsNonNullObligations> |
33 | 33 |
<CodeContractsBoundsObligations>False</CodeContractsBoundsObligations> |
34 | 34 |
<CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations> |
b/trunk/Pithos.Interfaces/PithosSettingsData.cs | ||
---|---|---|
62 | 62 |
public int ProxyPort { get; set; } |
63 | 63 |
public string ProxyUsername { get; set; } |
64 | 64 |
public string ProxyPassword { get; set; } |
65 |
public string ProxyDomain { get; set; } |
|
65 | 66 |
public bool ProxyAuthentication { get; set; } |
66 | 67 |
public bool ExtensionsActivated { get; set; } |
67 | 68 |
public int PollingInterval { get; set; } |
... | ... | |
88 | 89 |
ProxyPort = other.ProxyPort; |
89 | 90 |
ProxyUsername = other.ProxyUsername; |
90 | 91 |
ProxyPassword = other.ProxyPassword; |
92 |
ProxyDomain = other.ProxyDomain; |
|
91 | 93 |
ProxyAuthentication = other.ProxyAuthentication; |
92 | 94 |
ExtensionsActivated = other.ExtensionsActivated; |
93 | 95 |
PollingInterval = other.PollingInterval; |
b/trunk/Pithos.Network/CloudFilesClient.cs | ||
---|---|---|
93 | 93 |
|
94 | 94 |
protected Uri RootAddressUri { get; set; } |
95 | 95 |
|
96 |
private Uri _proxy; |
|
96 |
private WebProxy _proxy; |
|
97 |
public WebProxy Proxy |
|
98 |
{ |
|
99 |
get { return _proxy; } |
|
100 |
set |
|
101 |
{ |
|
102 |
_proxy = value; |
|
103 |
if (_baseClient != null) |
|
104 |
_baseClient.Proxy = value; |
|
105 |
} |
|
106 |
} |
|
107 |
|
|
108 |
|
|
109 |
/* private Uri _proxy; |
|
97 | 110 |
public Uri Proxy |
98 | 111 |
{ |
99 | 112 |
get { return _proxy; } |
... | ... | |
103 | 116 |
if (_baseClient != null) |
104 | 117 |
_baseClient.Proxy = new WebProxy(value); |
105 | 118 |
} |
106 |
} |
|
119 |
}*/
|
|
107 | 120 |
|
108 | 121 |
public double DownloadPercentLimit { get; set; } |
109 | 122 |
public double UploadPercentLimit { get; set; } |
... | ... | |
141 | 154 |
{ |
142 | 155 |
BaseAddress = accountInfo.StorageUri.ToString(), |
143 | 156 |
Timeout = 10000, |
144 |
Retries = 3 |
|
157 |
Retries = 3, |
|
158 |
Proxy=this.Proxy |
|
145 | 159 |
}; |
146 | 160 |
StorageUrl = accountInfo.StorageUri; |
147 | 161 |
Token = accountInfo.Token; |
... | ... | |
175 | 189 |
var groups = new List<Group>(); |
176 | 190 |
|
177 | 191 |
using (var authClient = new RestClient{BaseAddress=AuthenticationUrl}) |
178 |
{ |
|
192 |
{
|
|
179 | 193 |
if (Proxy != null) |
180 |
authClient.Proxy = new WebProxy(Proxy);
|
|
194 |
authClient.Proxy = Proxy;
|
|
181 | 195 |
|
182 | 196 |
Contract.Assume(authClient.Headers!=null); |
183 | 197 |
|
... | ... | |
196 | 210 |
{ |
197 | 211 |
BaseAddress = storageUrl, |
198 | 212 |
Timeout = 10000, |
199 |
Retries = 3 |
|
213 |
Retries = 3, |
|
214 |
Proxy=Proxy |
|
200 | 215 |
}; |
201 | 216 |
|
202 | 217 |
StorageUrl = new Uri(storageUrl); |
b/trunk/Pithos.Network/ICloudClient.cs | ||
---|---|---|
1 | 1 |
using System; |
2 | 2 |
using System.Collections.Generic; |
3 | 3 |
using System.Diagnostics.Contracts; |
4 |
using System.Net; |
|
4 | 5 |
using System.Threading.Tasks; |
5 | 6 |
using Pithos.Interfaces; |
6 | 7 |
|
... | ... | |
18 | 19 |
|
19 | 20 |
bool UsePithos { get; set; } |
20 | 21 |
AccountInfo Authenticate(); |
21 |
Uri Proxy { get; set; }
|
|
22 |
WebProxy Proxy { get; set; }
|
|
22 | 23 |
double DownloadPercentLimit { get; set; } |
23 | 24 |
double UploadPercentLimit { get; set; } |
24 | 25 |
string AuthenticationUrl { get; set; } |
... | ... | |
75 | 76 |
public Uri StorageUrl { get; set; } |
76 | 77 |
public string Token { get; set; } |
77 | 78 |
|
78 |
public Uri Proxy { get; set; }
|
|
79 |
public WebProxy Proxy { get; set; }
|
|
79 | 80 |
public double DownloadPercentLimit { get; set; } |
80 | 81 |
public double UploadPercentLimit { get; set; } |
81 | 82 |
|
b/trunk/Pithos.Network/Pithos.Network.csproj | ||
---|---|---|
28 | 28 |
<CodeContractsRuntimeThrowOnFailure>True</CodeContractsRuntimeThrowOnFailure> |
29 | 29 |
<CodeContractsRuntimeCallSiteRequires>False</CodeContractsRuntimeCallSiteRequires> |
30 | 30 |
<CodeContractsRuntimeSkipQuantifiers>False</CodeContractsRuntimeSkipQuantifiers> |
31 |
<CodeContractsRunCodeAnalysis>True</CodeContractsRunCodeAnalysis>
|
|
31 |
<CodeContractsRunCodeAnalysis>False</CodeContractsRunCodeAnalysis>
|
|
32 | 32 |
<CodeContractsNonNullObligations>False</CodeContractsNonNullObligations> |
33 | 33 |
<CodeContractsBoundsObligations>False</CodeContractsBoundsObligations> |
34 | 34 |
<CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations> |
b/trunk/Pithos.Network/RestClient.cs | ||
---|---|---|
121 | 121 |
TimedOut = false; |
122 | 122 |
var webRequest = base.GetWebRequest(address); |
123 | 123 |
var request = (HttpWebRequest)webRequest; |
124 |
request.ServicePoint.ConnectionLimit = 10;
|
|
124 |
request.ServicePoint.ConnectionLimit = 50;
|
|
125 | 125 |
if (IfModifiedSince.HasValue) |
126 | 126 |
request.IfModifiedSince = IfModifiedSince.Value; |
127 | 127 |
request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip; |
... | ... | |
261 | 261 |
|
262 | 262 |
}, actualRetries); |
263 | 263 |
|
264 |
var result = task.Result; |
|
265 |
return result; |
|
264 |
try |
|
265 |
{ |
|
266 |
var result = task.Result; |
|
267 |
return result; |
|
268 |
|
|
269 |
} |
|
270 |
catch (AggregateException exc) |
|
271 |
{ |
|
272 |
//If the task fails, propagate the original exception |
|
273 |
if (exc.InnerException!=null) |
|
274 |
throw exc.InnerException; |
|
275 |
throw; |
|
276 |
} |
|
266 | 277 |
} |
267 | 278 |
|
268 | 279 |
public void Head(string address,int retries=0) |
b/trunk/Pithos.ShellExtensions.Test/TestPithosSettings.cs | ||
---|---|---|
45 | 45 |
|
46 | 46 |
public string ProxyPassword { get; set; } |
47 | 47 |
|
48 |
public string ProxyDomain { get; set; } |
|
49 |
|
|
48 | 50 |
|
49 | 51 |
public bool ProxyAuthentication { get; set; } |
50 | 52 |
|
b/trunk/Pithos.ShellExtensions/ShellSettings.cs | ||
---|---|---|
142 | 142 |
set { _settings.Value.ProxyPassword = value; } |
143 | 143 |
} |
144 | 144 |
|
145 |
public string ProxyDomain |
|
146 |
{ |
|
147 |
get { return _settings.Value.ProxyDomain; } |
|
148 |
set { _settings.Value.ProxyDomain = value; } |
|
149 |
} |
|
150 |
|
|
145 | 151 |
public bool ProxyAuthentication |
146 | 152 |
{ |
147 | 153 |
|
b/trunk/Pithos.ShellExtensions/TestPithosSettings.cs | ||
---|---|---|
46 | 46 |
|
47 | 47 |
public string ProxyPassword { get; set; } |
48 | 48 |
|
49 |
public string ProxyDomain { get; set; } |
|
50 |
|
|
49 | 51 |
public bool ExtensionsActivated { get; set; } |
50 | 52 |
|
51 | 53 |
public int PollingInterval { get; set; } |
Also available in: Unified diff