Skip to content

Commit

Permalink
Merge branch 'bugLocale' (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
rpottsoh committed Apr 11, 2018
2 parents 1b9d764 + eaae4b1 commit 4ea3e50
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
8 changes: 4 additions & 4 deletions Delphi/Project/ExercismCLIInstaller.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@
<VerInfo_Debug>true</VerInfo_Debug>
<VerInfo_PreRelease>true</VerInfo_PreRelease>
<VerInfo_AutoIncVersion>true</VerInfo_AutoIncVersion>
<VerInfo_Keys>CompanyName=Exercism;FileDescription=$(MSBuildProjectName);FileVersion=2.0.1.15;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=2.0.1.0;Comments=</VerInfo_Keys>
<VerInfo_Build>15</VerInfo_Build>
<VerInfo_Keys>CompanyName=Exercism;FileDescription=$(MSBuildProjectName);FileVersion=2.0.1.17;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=2.0.1.0;Comments=</VerInfo_Keys>
<VerInfo_Build>17</VerInfo_Build>
<VerInfo_Release>1</VerInfo_Release>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
Expand All @@ -109,9 +109,9 @@
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_MajorVer>2</VerInfo_MajorVer>
<VerInfo_AutoIncVersion>true</VerInfo_AutoIncVersion>
<VerInfo_Keys>CompanyName=Exercism;FileDescription=$(MSBuildProjectName);FileVersion=2.0.2.14;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=2.0.2.0;Comments=</VerInfo_Keys>
<VerInfo_Keys>CompanyName=Exercism;FileDescription=$(MSBuildProjectName);FileVersion=2.0.2.18;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=2.0.2.0;Comments=</VerInfo_Keys>
<Icon_MainIcon>img\ExercismCLIInstaller_Icon.ico</Icon_MainIcon>
<VerInfo_Build>14</VerInfo_Build>
<VerInfo_Build>18</VerInfo_Build>
<VerInfo_Release>2</VerInfo_Release>
</PropertyGroup>
<ItemGroup>
Expand Down
7 changes: 7 additions & 0 deletions Delphi/Project/Source/uInstallLocationFrm.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,11 @@ object frmInstallLocation: TfrmInstallLocation
Left = 416
Top = 48
end
object tmrCheckTLS: TTimer
Enabled = False
Interval = 200
OnTimer = tmrCheckTLSTimer
Left = 76
Top = 200
end
end
35 changes: 24 additions & 11 deletions Delphi/Project/Source/uInstallLocationFrm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ TfrmInstallLocation = class(TForm)
rrCheckTLSVersion: TRESTRequest;
rResponseCheckTLSVersion: TRESTResponse;
lblUpdateTLS: TOvcURL;
tmrCheckTLS: TTimer;
procedure btnCancelClick(Sender: TObject);
procedure btnNextClick(Sender: TObject);
procedure btnBrowseClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure tmrCheckTLSTimer(Sender: TObject);
private
{ Private declarations }
public
Expand Down Expand Up @@ -150,9 +152,21 @@ procedure TfrmInstallLocation.btnNextClick(Sender: TObject);
end;

procedure TfrmInstallLocation.FormActivate(Sender: TObject);
begin
tmrCheckTLS.Enabled := true;
end;

procedure TfrmInstallLocation.FormCreate(Sender: TObject);
begin
NextClicked := false;
SetWindowLong(Handle, GWL_EXSTYLE, WS_EX_APPWINDOW);
end;

procedure TfrmInstallLocation.tmrCheckTLSTimer(Sender: TObject);
var
CheckTLS: ICheckTLS;
begin
tmrCheckTLS.Enabled := false;
CheckTLS := TCheckTLS.Create(rrCheckTLSVersion, rResponseCheckTLSVersion);
btnNext.Enabled := CheckTLS.TLSok;
if not btnNext.Enabled then
Expand All @@ -162,18 +176,12 @@ procedure TfrmInstallLocation.FormActivate(Sender: TObject);
end;
end;

procedure TfrmInstallLocation.FormCreate(Sender: TObject);
begin
NextClicked := false;
SetWindowLong(Handle, GWL_EXSTYLE, WS_EX_APPWINDOW);
end;

{ TCheckTLS }

constructor TCheckTLS.Create(aRESTRequest: TRestRequest; aRESTResponse: TRESTResponse);
var
splitVersion: TArray<string>;
actualVersion: double;
lFormatSettings: TFormatSettings;
begin
aRESTRequest.Execute;
fStatusCode := aRESTResponse.StatusCode;
Expand All @@ -182,14 +190,19 @@ constructor TCheckTLS.Create(aRESTRequest: TRestRequest; aRESTResponse: TRESTRes
fTLSVersion := '';
if fStatusCode = 200 then
begin
fTLSVersion := aRESTResponse.JSONText.Replace('"','');
splitVersion := fTLSVersion.Split([' ']);
actualVersion := splitVersion[1].ToDouble;
lFormatSettings := TFormatSettings.Create;
lFormatSettings.ThousandSeparator := ',';
lFormatSettings.DecimalSeparator := '.';
fTLSVersion := aRESTResponse.JSONText.Replace('"TLS ','');
fTLSVersion := fTLSVersion
.Replace('"','')
.Replace(' ','');
actualVersion := StrToFloat(fTLSVersion, lFormatSettings);
fTLSOK := actualVersion >= cDesiredVersion;
if not fTLSOK then
fMessageStr := format('TLS Version = %s, must be %0.1f or greater.'+#13#10+
'GitHub requires at least version 1.2'+#13#10+
'Please follow the link to Microsoft for instructions on updating Windows.',[splitVersion[1],cDesiredVersion]);
'Please follow the link to Microsoft for instructions on updating Windows.',[fTLSVersion,cDesiredVersion]);
end
else
begin
Expand Down

0 comments on commit 4ea3e50

Please sign in to comment.