Skip to content

Commit

Permalink
fixed redundant and slow filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
matortheeternal committed Jan 13, 2019
1 parent a276082 commit 095b6e0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions XEditLib.dproj
Expand Up @@ -91,10 +91,10 @@
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=0.5.1.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=0.5;Comments=</VerInfo_Keys>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=0.5.2.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=0.5;Comments=</VerInfo_Keys>
<VerInfo_AutoGenVersion>false</VerInfo_AutoGenVersion>
<VerInfo_MinorVer>5</VerInfo_MinorVer>
<VerInfo_Release>1</VerInfo_Release>
<VerInfo_Release>2</VerInfo_Release>
<ILINK_MapFileType>DetailedSegments</ILINK_MapFileType>
</PropertyGroup>
<ItemGroup>
Expand Down
Binary file modified XEditLib.res
Binary file not shown.
6 changes: 6 additions & 0 deletions XEditLibTests.dpr
Expand Up @@ -14,6 +14,8 @@ uses
xeMeta in 'src\xeMeta.pas',
xeSetup in 'src\xeSetup.pas',
xeFiles in 'src\xeFiles.pas',
xeArchives in 'src\xeArchives.pas',
xeTextures in 'src\xeTextures.pas',
xeMasters in 'src\xeMasters.pas',
xeElements in 'src\xeElements.pas',
xeElementValues in 'src\xeElementValues.pas',
Expand All @@ -39,6 +41,8 @@ uses
txMessages in 'tests\txMessages.pas',
txSetup in 'tests\txSetup.pas',
txFiles in 'tests\txFiles.pas',
txTextures in 'tests\txTextures.pas',
txArchives in 'tests\txArchives.pas',
txMasters in 'tests\txMasters.pas',
txElements in 'tests\txElements.pas',
txElementValues in 'tests\txElementValues.pas',
Expand All @@ -63,6 +67,8 @@ begin
BuildMetaTests;
BuildMessageTests;
BuildFileHandlingTests;
BuildTextureTests;
BuildArchiveTests;
BuildMasterHandlingTests;
BuildElementHandlingTests;
BuildElementValueTests;
Expand Down
5 changes: 5 additions & 0 deletions XEditLibTests.dproj
Expand Up @@ -184,6 +184,7 @@
<DCC_Define>SKYRIM;SKIP_BENCHMARKS;$(DCC_Define)</DCC_Define>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<Manifest_File>(None)</Manifest_File>
<ILINK_MapFileType>DetailedSegments</ILINK_MapFileType>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
Expand Down Expand Up @@ -218,6 +219,8 @@
<DCCReference Include="src\xeMeta.pas"/>
<DCCReference Include="src\xeSetup.pas"/>
<DCCReference Include="src\xeFiles.pas"/>
<DCCReference Include="src\xeArchives.pas"/>
<DCCReference Include="src\xeTextures.pas"/>
<DCCReference Include="src\xeMasters.pas"/>
<DCCReference Include="src\xeElements.pas"/>
<DCCReference Include="src\xeElementValues.pas"/>
Expand All @@ -242,6 +245,8 @@
<DCCReference Include="tests\txMessages.pas"/>
<DCCReference Include="tests\txSetup.pas"/>
<DCCReference Include="tests\txFiles.pas"/>
<DCCReference Include="tests\txTextures.pas"/>
<DCCReference Include="tests\txArchives.pas"/>
<DCCReference Include="tests\txMasters.pas"/>
<DCCReference Include="tests\txElements.pas"/>
<DCCReference Include="tests\txElementValues.pas"/>
Expand Down
13 changes: 1 addition & 12 deletions src/xeArchives.pas
Expand Up @@ -21,16 +21,6 @@ implementation
SysUtils,
xeMessages, xeMeta;

procedure FilterStringList(var sl: TStringList; filter: String);
var
i: Integer;
begin
if filter = '' then exit;
for i := Pred(sl.Count) downto 0 do
if not sl[i].StartsWith(filter, true) then
sl.Delete(i);
end;

function ExtractContainer(name, destination: PWideChar; replace: WordBool): WordBool; cdecl;
var
ResourceList: TStringList;
Expand Down Expand Up @@ -78,8 +68,7 @@ function GetContainerFiles(name, path: PWideChar; len: PInteger): WordBool; cdec
raise Exception.Create(name + ' not loaded.');
ResourceList := TStringList.Create;
try
wbContainerHandler.ContainerResourceList(name, ResourceList);
FilterStringList(ResourceList, path);
wbContainerHandler.ContainerResourceList(name, ResourceList, path);
SetResultFromList(ResourceList, len);
finally
ResourceList.Free;
Expand Down

0 comments on commit 095b6e0

Please sign in to comment.