Skip to content

Commit dfd8a85

Browse files
committed
v1.5, Added Web Proxy
1 parent ab07c6a commit dfd8a85

15 files changed

+346
-50
lines changed

IMDbAPI_Client/App.config

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,18 @@ DownloadSiteName2</value>
3838
<setting name="OperationType" serializeAs="String">
3939
<value>Movies</value>
4040
</setting>
41+
<setting name="UseProxy" serializeAs="String">
42+
<value>False</value>
43+
</setting>
44+
<setting name="ProxyServer" serializeAs="String">
45+
<value />
46+
</setting>
47+
<setting name="ProxyUsername" serializeAs="String">
48+
<value />
49+
</setting>
50+
<setting name="ProxyPassword" serializeAs="String">
51+
<value />
52+
</setting>
4153
</IMDbAPI_Client.Properties.Settings>
4254
</userSettings>
4355
</configuration>

IMDbAPI_Client/IMDbAPI_Client.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
<ApplicationIcon>ProjectIcon.ico</ApplicationIcon>
3737
</PropertyGroup>
3838
<ItemGroup>
39-
<Reference Include="IMDbApiLib, Version=1.4.0.0, Culture=neutral, processorArchitecture=MSIL">
40-
<HintPath>..\packages\IMDbApiLib.1.4.0\lib\net45\IMDbApiLib.dll</HintPath>
39+
<Reference Include="IMDbApiLib, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
40+
<HintPath>..\packages\IMDbApiLib.1.5.0\lib\net45\IMDbApiLib.dll</HintPath>
4141
</Reference>
4242
<Reference Include="MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
4343
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.dll</HintPath>

IMDbAPI_Client/MainForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public MainForm()
1616
InitializeComponent();
1717

1818
var assembly = System.Reflection.Assembly.GetExecutingAssembly();
19-
var fileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
19+
var fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
2020
var version = new Version(fileVersionInfo.ProductVersion);
2121
_version = btnVersion.Text = $"v{version.ToString(2)}";
2222
}

IMDbAPI_Client/MoreInfoForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public MoreInfoForm(string id)
2020
_id = id;
2121

2222
string apiKey = Properties.Settings.Default.ApiKey;
23-
_apiLib = new ApiLib(apiKey);
23+
_apiLib = new ApiLib(apiKey, Program.GetWebProxy());
2424
}
2525

2626
private readonly ApiLib _apiLib;

IMDbAPI_Client/Program.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Net;
23
using System.Windows.Forms;
34

45
namespace IMDbAPI_Client
@@ -15,5 +16,21 @@ private static void Main()
1516
Application.SetCompatibleTextRenderingDefault(false);
1617
Application.Run(new MainForm());
1718
}
19+
20+
public static WebProxy GetWebProxy()
21+
{
22+
if (!Properties.Settings.Default.UseProxy)
23+
return null;
24+
25+
var webProxy = new WebProxy();
26+
webProxy.Address = new Uri(Properties.Settings.Default.ProxyServer);
27+
webProxy.Credentials = new NetworkCredential(
28+
Properties.Settings.Default.ProxyUsername,
29+
Properties.Settings.Default.ProxyPassword);
30+
webProxy.UseDefaultCredentials = false;
31+
webProxy.BypassProxyOnLocal = false;
32+
33+
return webProxy;
34+
}
1835
}
1936
}

IMDbAPI_Client/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// set of attributes. Change these attribute values to modify the information
66
// associated with an assembly.
77
[assembly: AssemblyTitle("IMDbAPI Client")]
8-
[assembly: AssemblyDescription("For manage and organize movies and serials")]
8+
[assembly: AssemblyDescription("For manage and organize movies and series")]
99
[assembly: AssemblyConfiguration("")]
1010
[assembly: AssemblyCompany("IMDb-API")]
1111
[assembly: AssemblyProduct("IMDbAPI Client")]
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("1.4.0.0")]
35-
[assembly: AssemblyFileVersion("1.4.0.0")]
34+
[assembly: AssemblyVersion("1.5.0.0")]
35+
[assembly: AssemblyFileVersion("1.5.0.0")]

IMDbAPI_Client/Properties/Settings.Designer.cs

Lines changed: 49 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

IMDbAPI_Client/Properties/Settings.settings

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,17 @@ DownloadSiteName2</Value>
3333
<Setting Name="OperationType" Type="IMDbAPI_Client.OperationType" Scope="User">
3434
<Value Profile="(Default)">Movies</Value>
3535
</Setting>
36+
<Setting Name="UseProxy" Type="System.Boolean" Scope="User">
37+
<Value Profile="(Default)">False</Value>
38+
</Setting>
39+
<Setting Name="ProxyServer" Type="System.String" Scope="User">
40+
<Value Profile="(Default)" />
41+
</Setting>
42+
<Setting Name="ProxyUsername" Type="System.String" Scope="User">
43+
<Value Profile="(Default)" />
44+
</Setting>
45+
<Setting Name="ProxyPassword" Type="System.String" Scope="User">
46+
<Value Profile="(Default)" />
47+
</Setting>
3648
</Settings>
3749
</SettingsFile>

IMDbAPI_Client/SearchForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public SearchForm(SearchData searchData)
2424
_searchData = searchData;
2525

2626
string apiKey = Properties.Settings.Default.ApiKey;
27-
_apiLib = new ApiLib(apiKey);
27+
_apiLib = new ApiLib(apiKey, Program.GetWebProxy());
2828
}
2929

3030
private readonly ApiLib _apiLib;

IMDbAPI_Client/SettingsForm.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ public SettingsForm()
1313
{
1414
InitializeComponent();
1515
txtRemoveSiteName.Text = Properties.Settings.Default.RemoveSites;
16+
chkUseProxy.Checked = Properties.Settings.Default.UseProxy;
17+
txtProxyServer.Text = Properties.Settings.Default.ProxyServer;
18+
txtProxyUsername.Text = Properties.Settings.Default.ProxyUsername;
19+
txtProxyPassword.Text = Properties.Settings.Default.ProxyPassword;
20+
chkUseProxy_CheckedChanged(null, null);
1621

1722
ddlTheme.DataSource = Enum.GetValues(typeof(MetroThemeStyle));
1823
ddlTheme.SelectedItem = Properties.Settings.Default.Theme;
@@ -41,6 +46,9 @@ private void btnOK_Click(object sender, EventArgs e)
4146
_settingsUC.SaveSettings();
4247

4348
Properties.Settings.Default.RemoveSites = txtRemoveSiteName.Text;
49+
Properties.Settings.Default.ProxyServer = txtProxyServer.Text;
50+
Properties.Settings.Default.ProxyUsername = txtProxyUsername.Text;
51+
Properties.Settings.Default.ProxyPassword = txtProxyPassword.Text;
4452

4553
Properties.Settings.Default.Theme = (MetroThemeStyle)Enum.Parse(typeof(MetroThemeStyle), ddlTheme.Text);
4654
Properties.Settings.Default.Style = (MetroColorStyle)Enum.Parse(typeof(MetroColorStyle), ddlStyle.Text);
@@ -70,5 +78,15 @@ private void DdlTheme_SelectedIndexChanged(object sender, EventArgs e)
7078
lblStyleTitle.ForeColor = Color.FromName(colorName);
7179
lblStyleContent.ForeColor = Color.FromName(colorName);
7280
}
81+
82+
private void chkUseProxy_CheckedChanged(object sender, EventArgs e)
83+
{
84+
lblProxyServer.Enabled =
85+
txtProxyServer.Enabled =
86+
lblProxyUsername.Enabled =
87+
txtProxyUsername.Enabled =
88+
lblProxyPassword.Enabled =
89+
txtProxyPassword.Enabled = chkUseProxy.Checked;
90+
}
7391
}
7492
}

0 commit comments

Comments
 (0)