Skip to content

Commit 73dd209

Browse files
committed
v1.1 Moved to .NET Framework 4.5, to be compatible, the encoder download functionality, with TLS 1.2 which now used by GitHub
1 parent 9d089bf commit 73dd209

File tree

8 files changed

+75
-40
lines changed

8 files changed

+75
-40
lines changed

Guietzli.sln

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11

2-
Microsoft Visual Studio Solution File, Format Version 10.00
3-
# Visual Studio 2008
4-
# SharpDevelop 3.2.1.6466
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2012
4+
# SharpDevelop 5.1
5+
VisualStudioVersion = 12.0.20827.3
6+
MinimumVisualStudioVersion = 10.0.40219.1
57
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Guietzli", "Guietzli\Guietzli.csproj", "{2BDCFD0F-0D6F-419C-A1A2-46265FF248C3}"
68
EndProject
79
Global
@@ -10,9 +12,9 @@ Global
1012
Release|x86 = Release|x86
1113
EndGlobalSection
1214
GlobalSection(ProjectConfigurationPlatforms) = postSolution
13-
{2BDCFD0F-0D6F-419C-A1A2-46265FF248C3}.Debug|x86.Build.0 = Debug|x86
1415
{2BDCFD0F-0D6F-419C-A1A2-46265FF248C3}.Debug|x86.ActiveCfg = Debug|x86
15-
{2BDCFD0F-0D6F-419C-A1A2-46265FF248C3}.Release|x86.Build.0 = Release|x86
16+
{2BDCFD0F-0D6F-419C-A1A2-46265FF248C3}.Debug|x86.Build.0 = Debug|x86
1617
{2BDCFD0F-0D6F-419C-A1A2-46265FF248C3}.Release|x86.ActiveCfg = Release|x86
18+
{2BDCFD0F-0D6F-419C-A1A2-46265FF248C3}.Release|x86.Build.0 = Release|x86
1719
EndGlobalSection
1820
EndGlobal

Guietzli/GuetzliRelease.cs

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ namespace Guietzli{
1717
/// </summary>
1818
public class GuetzliRelease {
1919

20-
private readonly string EXE_NAME = "guetzli.exe" ;
20+
private const string PROJECT_PAGE = "https://github.com/google/guetzli/releases/latest" ;
21+
private const string LOCAL_X64_SYS_FOLDER = "SysWOW64" ;
22+
private const string REMOTE_X86_NAME = "/guetzli_windows_x86.exe" ;
23+
private const string REMOTE_X64_NAME = "/guetzli_windows_x86-64.exe" ;
24+
private readonly string LOCAL_EXE_NAME = "guetzli.exe" ;
2125

2226
/// <summary>
2327
/// Empty class contructor
@@ -26,7 +30,7 @@ public GuetzliRelease(){ }
2630

2731
public string ExeName{
2832
get{
29-
return this.EXE_NAME ;
33+
return this.LOCAL_EXE_NAME ;
3034
}
3135
}
3236

@@ -38,30 +42,32 @@ public enum ReleaseInfo{
3842
/// <summary>
3943
/// Find the latest Guetzli's release URL or version tag.
4044
/// </summary>
41-
/// <param name="returnDownloadUrl">True to return download url, false to return version tag only</param>
45+
/// <param name="info">What to retrieve. URL or latest version string.</param>
4246
/// <returns>Download url (without filename), or version tag (x.y.z)</returns>
4347
public string GetLatestRelease(ReleaseInfo info){
48+
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 ;
4449
//the github.com/usr/project/releases/latest redirects always to the latest release page, which contains the
4550
//version tag and the download url (partial). Capturing the HTTP Header location we can find these info.
46-
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://github.com/google/guetzli/releases/latest");
51+
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(PROJECT_PAGE);
4752
request.AllowAutoRedirect = false;
4853
HttpWebResponse response ;
4954
string redirUrl ;
5055
try {
5156
response = (HttpWebResponse)request.GetResponse();
52-
redirUrl = response.Headers["Location"];
57+
redirUrl = response.Headers["Location"];
5358
response.Close();
5459
} catch (Exception) {
5560
return "" ;
5661
}
5762

58-
if(info == ReleaseInfo.DownloadUrl)
63+
if(info == ReleaseInfo.DownloadUrl){
5964
return redirUrl.Replace("tag", "download") ;
60-
61-
//split the url, get the last part (wich contains the ver. tag), remove the v from the begin & return the version
62-
string[] redirUrlParts = redirUrl.Split('/') ;
63-
string latestVer = redirUrlParts[redirUrlParts.Length - 1] ;
64-
return latestVer.Substring(1) ;
65+
}else{
66+
//split the url, get the last part (wich contains the ver. tag), remove the v from the begin & return the version
67+
string[] redirUrlParts = redirUrl.Split('/') ;
68+
string latestVer = redirUrlParts[redirUrlParts.Length - 1] ;
69+
return latestVer.Substring(1) ;
70+
}
6571
}
6672

6773
/// <summary>
@@ -123,14 +129,14 @@ public bool DownloadLatestRelease(){
123129
WebClient client = new WebClient() ;
124130
string downloadUrl = GetLatestRelease(ReleaseInfo.DownloadUrl) ;
125131
//if %WINDIR%/SysWOW64 exist that discloses x64 OS installation
126-
string syswow64 = Path.Combine(Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.System)).ToString(), "SysWOW64") ;
132+
string syswow64 = Path.Combine(Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.System)).ToString(), LOCAL_X64_SYS_FOLDER) ;
127133
if(Directory.Exists(syswow64)){
128-
downloadUrl += "/guetzli_windows_x86-64.exe" ;
134+
downloadUrl += REMOTE_X64_NAME ;
129135
}else{
130-
downloadUrl += "/guetzli_windows_x86.exe" ;
136+
downloadUrl += REMOTE_X86_NAME ;
131137
}
132-
try {
133-
client.DownloadFile(downloadUrl, "guetzli.exe") ;
138+
try {
139+
client.DownloadFile(downloadUrl, LOCAL_EXE_NAME) ;
134140
return true ;
135141
} catch (Exception) {
136142
return false ;

Guietzli/Guietzli.csproj

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
23
<PropertyGroup>
34
<ProjectGuid>{2BDCFD0F-0D6F-419C-A1A2-46265FF248C3}</ProjectGuid>
45
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
56
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
67
<OutputType>WinExe</OutputType>
78
<RootNamespace>Guietzli</RootNamespace>
89
<AssemblyName>Guietzli</AssemblyName>
9-
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
10+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1011
<AppDesignerFolder>Properties</AppDesignerFolder>
1112
<SourceAnalysisOverrideSettingsFile>C:\Users\petros\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile>
1213
<ApplicationIcon>img\icon.ico</ApplicationIcon>
14+
<TargetFrameworkProfile />
1315
</PropertyGroup>
1416
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
1517
<PlatformTarget>x86</PlatformTarget>
@@ -32,6 +34,9 @@
3234
</PropertyGroup>
3335
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
3436
<ItemGroup>
37+
<Reference Include="Microsoft.CSharp">
38+
<RequiredTargetFramework>4.0</RequiredTargetFramework>
39+
</Reference>
3540
<Reference Include="Multipetros.Config">
3641
<HintPath>Multipetros.Config.dll</HintPath>
3742
</Reference>
@@ -62,4 +67,7 @@
6267
<DependentUpon>MainForm.cs</DependentUpon>
6368
</EmbeddedResource>
6469
</ItemGroup>
70+
<ItemGroup>
71+
<None Include="app.config" />
72+
</ItemGroup>
6573
</Project>

Guietzli/MainForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ void ExitToolStripMenuItemClick(object sender, EventArgs e){
378378
}
379379

380380
void AboutToolStripMenuItemClick(object sender, EventArgs e){
381-
MessageBox.Show("Guietzli v1.0\nA Graphic front-end for Guetzli JPEG Encoder\n\nCopyright (c) 2017, Petros Kyladitis\n<http://www.multipetros.gr/>\n\nThis program is free software distributed under the GNU GPL 3, for license details see at 'license.txt' file, distributed with this program, or see at <http://www.gnu.org/licenses/>.", "About this program", MessageBoxButtons.OK, MessageBoxIcon.Information) ;
381+
MessageBox.Show("Guietzli v1.1\nA Graphic front-end for Guetzli JPEG Encoder\n\nCopyright (c) 2017-2018, Petros Kyladitis\n<http://www.multipetros.gr/>\n\nThis program is free software distributed under the GNU GPL 3, for license details see at 'license.txt' file, distributed with this program, or see at <http://www.gnu.org/licenses/>.", "About this program", MessageBoxButtons.OK, MessageBoxIcon.Information) ;
382382
}
383383
}
384384
}

Guietzli/MainForm.resx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,21 @@
112112
<value>2.0</value>
113113
</resheader>
114114
<resheader name="reader">
115-
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
115+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116116
</resheader>
117117
<resheader name="writer">
118-
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
118+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119
</resheader>
120-
<metadata name="folderBrowserDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
120+
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
121+
<data name="folderBrowserDialog.TrayLocation" type="System.Drawing.Point, System.Drawing">
121122
<value>17, 17</value>
122-
</metadata>
123-
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
123+
</data>
124+
<data name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing">
124125
<value>177, 17</value>
125-
</metadata>
126-
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
126+
</data>
127+
<data name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing">
127128
<value>310, 17</value>
128-
</metadata>
129-
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
129+
</data>
130130
<data name="addFilesToolStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
131131
<value>
132132
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH
@@ -515,12 +515,12 @@
515515
+x0w/wF5i112j/SDAAAAAABJRU5ErkJggg==
516516
</value>
517517
</data>
518-
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
518+
<data name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing">
519519
<value>419, 17</value>
520-
</metadata>
521-
<metadata name="backgroundWorker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
520+
</data>
521+
<data name="backgroundWorker.TrayLocation" type="System.Drawing.Point, System.Drawing">
522522
<value>530, 17</value>
523-
</metadata>
523+
</data>
524524
<data name="buttonRemoveFiles.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
525525
<value>
526526
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH

Guietzli/app.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
5+
</startup>
6+
</configuration>

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Guietzli
2-
## v1.0
3-
Copyright (C) 2017, Petros Kyladitis
2+
## v1.1
3+
Copyright (C) 2017-2018, Petros Kyladitis
44

55
## Description
66
An MS Windows graphic front-end for the [Google Guetzli JPEG Encoder](https://github.com/google/guetzli).
@@ -12,7 +12,10 @@ Google provide a command line tool for the Guetzli encoder, although with this W
1212
For updates and more info see at <http://multipetros.gr/>
1313

1414
## Requirements
15-
This program is designed for MS Windows with [.NET Framework 3.5](http://www.microsoft.com/el-gr/download/details.aspx?id=22) installed.
15+
This program is designed for MS Windows with [.NET Framework 4.5](https://www.microsoft.com/en-us/download/details.aspx?id=30653) installed.
16+
17+
## Screenshots
18+
![Screenshot](https://raw.githubusercontent.com/multipetros/Guietzli/master/screenshot.png)
1619

1720
## Usage
1821
- Starting, add images files to the queue list by pressing the __Add Files__ button, __Drag-n-drop__ files from Desktop or Windows Explorer.
@@ -23,6 +26,16 @@ This program is designed for MS Windows with [.NET Framework 3.5](http://www.mic
2326
- Please be patient. The Guetzli encoder gets a significant lot of time _(and memory)_ to do the encoding.
2427
- If you want to interrupt the process, you can press the __Stop__ button.
2528

29+
## Download
30+
* [Setup package](https://github.com/multipetros/Guietzli/releases/download/v1.1/guietzli_1.1-setup.exe)
31+
* [Portable in zip archive](https://github.com/multipetros/Guietzli/releases/download/v1.1/guietzli_1.1-bin.zip)
32+
33+
## Change Log
34+
### v1.1
35+
* Moved to .NET Framework 4.5, to be compatible, the encoder download functionality, with TLS 1.2 which now used by GitHub
36+
### v1.0
37+
* Initial release
38+
2639
## License
2740
This program is free software distributed under the GNU GPL 3, for license details see at `license.txt` file, distributed with this program, or see at <http://www.gnu.org/licenses/>.
2841

screenshot.png

25.5 KB
Loading

0 commit comments

Comments
 (0)