Complete BigTask
Sync changed files to Google Drive / sync (push) Successful in 27m26s

This commit is contained in:
admin_d committed 2026-09-17 13:18:03 +05:00
1 parent e253946fc8
commit 3d5edaa086
7 files changed
+3014 -2

No files matched your search

+37
View File
@@ -7,12 +7,49 @@ uses
function KaMResourceExists(const aReference: string): Boolean;
function KaMOpenResourceStream(const aReference: string): TStream;
function KaMResolvePackagedResource(const aRelativeIdentity: string): string;
implementation
uses
CastleUriUtils, CastleDownload;
procedure ValidatePackagedRelativeIdentity(const aRelativeIdentity: string);
var
I, ComponentStart: Integer;
begin
if (aRelativeIdentity = '') or (aRelativeIdentity[1] = '/') then
raise EDownloadError.Create('KaMResourceInput: invalid packaged resource identity');
ComponentStart := 1;
for I := 1 to Length(aRelativeIdentity) do
begin
if (aRelativeIdentity[I] = '\') or (aRelativeIdentity[I] = ':')
or (Ord(aRelativeIdentity[I]) < 32) then
raise EDownloadError.Create('KaMResourceInput: invalid packaged resource identity');
if aRelativeIdentity[I] = '/' then
begin
if (I = ComponentStart)
or ((I = ComponentStart + 1) and (aRelativeIdentity[ComponentStart] = '.'))
or ((I = ComponentStart + 2) and (aRelativeIdentity[ComponentStart] = '.')
and (aRelativeIdentity[ComponentStart + 1] = '.')) then
raise EDownloadError.Create('KaMResourceInput: invalid packaged resource identity');
ComponentStart := I + 1;
end;
end;
if (ComponentStart > Length(aRelativeIdentity))
or ((Length(aRelativeIdentity) = ComponentStart) and (aRelativeIdentity[ComponentStart] = '.'))
or ((Length(aRelativeIdentity) = ComponentStart + 1) and (aRelativeIdentity[ComponentStart] = '.')
and (aRelativeIdentity[ComponentStart + 1] = '.')) then
raise EDownloadError.Create('KaMResourceInput: invalid packaged resource identity');
end;
function KaMResolvePackagedResource(const aRelativeIdentity: string): string;
begin
ValidatePackagedRelativeIdentity(aRelativeIdentity);
Result := 'castle-data:/game/' + InternalUriEscape(aRelativeIdentity);
end;
function ResourceProtocol(const aReference: string): string;
begin
if aReference = '' then