diff --git a/applications/json_packager/jsonpackage.lpi b/applications/json_packager/jsonpackage.lpi
index be1a8b27b..bbb064b87 100644
--- a/applications/json_packager/jsonpackage.lpi
+++ b/applications/json_packager/jsonpackage.lpi
@@ -24,7 +24,7 @@
-
+
diff --git a/applications/json_packager/jsonpackage.lps b/applications/json_packager/jsonpackage.lps
index 2300e8416..06a10f39b 100644
--- a/applications/json_packager/jsonpackage.lps
+++ b/applications/json_packager/jsonpackage.lps
@@ -3,14 +3,14 @@
-
-
+
+
-
+
-
+
@@ -20,11 +20,11 @@
-
-
-
+
+
+
-
+
@@ -32,7 +32,7 @@
-
+
@@ -96,127 +96,147 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/applications/json_packager/jsonpackage.res b/applications/json_packager/jsonpackage.res
index 68d1a6b58..2b1e7549a 100644
Binary files a/applications/json_packager/jsonpackage.res and b/applications/json_packager/jsonpackage.res differ
diff --git a/applications/json_packager/umain.lfm b/applications/json_packager/umain.lfm
index 29432c7c3..f52bacfa0 100644
--- a/applications/json_packager/umain.lfm
+++ b/applications/json_packager/umain.lfm
@@ -96,6 +96,7 @@ object frmMain: TfrmMain
RowCount = 1
TabOrder = 3
TitleStyle = tsNative
+ OnCellProcess = stringPackageFilesCellProcess
ColWidths = (
150
150
diff --git a/applications/json_packager/umain.pas b/applications/json_packager/umain.pas
index 43d3c4727..b7d39e816 100644
--- a/applications/json_packager/umain.pas
+++ b/applications/json_packager/umain.pas
@@ -82,7 +82,6 @@ type
property Package: TPackageData read FPackage write FPackage;
property PackageFiles: TPackageFilesList read FPackageFiles write FPackageFiles;
end;
-
{ TfrmMain }
TfrmMain = class(TForm)
@@ -137,6 +136,8 @@ type
procedure SaveAsItemClick(Sender: TObject);
procedure sb_editNameClick(Sender: TObject);
procedure spd_CheckURLClick(Sender: TObject);
+ procedure stringPackageFilesCellProcess(Sender: TObject; aCol,
+ aRow: Integer; processType: TCellProcessType; var aValue: string);
private
{ private declarations }
JSONPackage: TPackage;
@@ -150,6 +151,7 @@ type
procedure CtrlHidePopup(Sender: TObject);
procedure CtrlSetUpPopupHandlers;
procedure CtrlMakeDirty(Sender: TObject);
+ function IsADuplicateLPK:Boolean;
public
{ public declarations }
end;
@@ -300,6 +302,26 @@ begin
end;
+function TfrmMain.IsADuplicateLPK:Boolean;
+Var
+ TempStringList:TStrings;
+ iCount:Integer;
+begin
+ Result:=FALSE;
+ TempStringList:=TstringList.Create;
+ TRY
+ For iCount:=0 to Pred(stringPackageFiles.RowCount) do
+ begin
+ If TempStringlist.IndexOf(stringPackageFiles.Cells[0,iCount]) = -1 then
+ TempStringList.Add(stringPackageFiles.Cells[0,iCount])
+ else
+ Result:=TRUE;
+ end;
+ finally
+ TempStringList.Free;
+ end;
+end;
+
procedure TfrmMain.btnAddClick(Sender: TObject);
begin
stringPackageFiles.RowCount := stringPackageFiles.RowCount + 1;
@@ -645,6 +667,13 @@ begin
Result := True;
end;
end;
+ If IsADuplicateLPK then
+ begin
+ stringPackageFiles.Color := clYellow;
+ slErrorList.Add('- There are one or more .lpk entries with the same name.'
+ + LineEnding + '- Every .lpk entry must have a unique name.');
+ Result := True;
+ end;
end;
procedure TfrmMain.SaveAsItemClick(Sender: TObject);
@@ -742,6 +771,11 @@ begin
end;
end;
+procedure TfrmMain.stringPackageFilesCellProcess(Sender: TObject; aCol,
+ aRow: Integer; processType: TCellProcessType; var aValue: string);
+begin
+end;
+
{ TPackage }
constructor TPackage.Create;
@@ -767,11 +801,19 @@ var
s: TStringList;
begin
s := TStringList.Create;
- s.LoadFromFile(AFileName);
- DeStreamer := TJSONDeStreamer.Create(nil);
- DeStreamer.JSONToObject(s.Text, Self);
- DeStreamer.Free;
- s.Free;
+ TRY
+ s.LoadFromFile(AFileName);
+ DeStreamer := TJSONDeStreamer.Create(nil);
+ TRY
+ DeStreamer.JSONToObject(s.Text, Self);
+ EXCEPT
+ On E:Exception do
+ ShowMessage('The json file appears to be corrupted or in the wrong format');
+ end;
+ Finally
+ DeStreamer.Free;
+ s.Free;
+ end;
end;
function TPackage.SaveToFile(AFileName: string): boolean;