Skip to content

Commit ff44db6

Browse files
committed
Few Corrections in Test App; Disable MultiThreaded Zipping that was crashing at Dispose() time
1 parent 4b6bb04 commit ff44db6

File tree

8 files changed

+192
-28
lines changed

8 files changed

+192
-28
lines changed

FabTools/FabTools/Array.prg

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
// Array.prg
2-
#using System.Collections
2+
using System.Collections
3+
using System.Collections.Generic
34

45
BEGIN NAMESPACE FabTools
56

67
CLASS FabArray Inherit ArrayList
78
protect lAtBottom as logic
89
protect wPos as word
910

11+
12+
CONSTRUCTOR ( capacity AS INT32 )
13+
Super( Capacity )
14+
15+
CONSTRUCTOR ( initList AS ICollection )
16+
Super( initList )
17+
18+
CONSTRUCTOR ( )
19+
Super( )
20+
1021
private access wSize as int
1122
return Self:Count
1223

FabTools/FabZip/FabZip.xsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
</Reference>
7979
</ItemGroup>
8080
<ItemGroup>
81+
<Compile Include="Compatibility.prg" />
8182
<Compile Include="FabZipDirEntry.prg" />
8283
<Compile Include="FabZipFile.prg" />
8384
<Compile Include="FabZipFileCtrl.prg" />

FabTools/FabZip/FabZipFile.prg

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ BEGIN NAMESPACE FabZip
7070
/// <summary>
7171
/// The List indicating all filenames inside the Zip File
7272
/// </summary>
73-
ACCESS Contents AS List<FabZipDirEntry>
74-
RETURN SELF:aContents
73+
ACCESS Contents AS FabArray //List<FabZipDirEntry>
74+
LOCAL aTemp AS FabArray
75+
//
76+
aTemp := FabArray{ SELF:aContents }
77+
RETURN aTemp
7578

7679
ACCESS FileName AS STRING
7780
RETURN SELF:cZipFile
@@ -117,6 +120,8 @@ BEGIN NAMESPACE FabZip
117120
SELF:aFilesArgs := List<STRING>{} //ArrayList{}
118121
//
119122
SELF:dwMaxVolumeSize := 0
123+
//
124+
120125

121126

122127
METHOD UpdateContents() AS VOID
@@ -329,7 +334,9 @@ BEGIN NAMESPACE FabZip
329334
oZipFile := ZipFile.Read( TmpZipName )
330335
ELSE
331336
oZipFile := ZipFile{ TmpZipName }
332-
ENDIF
337+
ENDIF
338+
// No Multi Thread to Compress
339+
oZipFile:ParallelDeflateThreshold := -1
333340
//
334341
IF ( SELF:SaveHandler != NULL )
335342
oZipFile:SaveProgress += SELF:SaveHandler
@@ -340,7 +347,7 @@ BEGIN NAMESPACE FabZip
340347
IF ( SELF:aFilesArgs:Count == 0 )
341348
// If we have a Freshen Flag, then we must check what files are inside
342349
// and outside to update them
343-
FOREACH oZDir AS FabZipDirEntry IN SELF:Contents
350+
FOREACH oZDir AS FabZipDirEntry IN SELF:aContents
344351
// Convert FileName from Unix to DOS
345352
// We can only Freshen existing file !
346353
SELF:FilesArg:Add( StrTran( oZDir:FileName, "/", "\" ) )
@@ -349,9 +356,15 @@ BEGIN NAMESPACE FabZip
349356
// Recurse subdir ?
350357
lRecurse := SELF:AddOptions:RecurseDirs
351358
// The password and Encryption must be set BEFORE !!!!
352-
oZipFile:Password := SELF:cPassword
353-
// TODO : Check for Encryption...
354-
oZipFile:Encryption := SELF:HowToEncrypt
359+
IF !Empty( SELF:cPassword )
360+
oZipFile:Password := SELF:cPassword
361+
// TODO : Check for Encryption...
362+
oZipFile:Encryption := SELF:HowToEncrypt
363+
ELSE
364+
oZipFile:Password := NULL
365+
oZipFile:Encryption := IOnic.Zip.EncryptionAlgorithm.None
366+
ENDIF
367+
355368
// Now, Add Files ...
356369
FOREACH cTmp AS STRING IN SELF:aFilesArgs
357370
// Try to handle Wildcards
@@ -395,8 +408,9 @@ BEGIN NAMESPACE FabZip
395408
// How many segment files ?
396409
SELF:nDiskNr := oZipFile:NumberOfSegmentsForMostRecentSave
397410
398-
CATCH //Err AS Exception
411+
CATCH Err AS Exception
399412
// Handle here trouble with Save operation
413+
THROW Err
400414
FINALLY
401415
IF oZipFile != NULL
402416
oZipFile:Dispose()
@@ -435,6 +449,8 @@ BEGIN NAMESPACE FabZip
435449
//
436450
SELF:lProcessing := TRUE
437451
oZipFile := ZipFile.Read( SELF:cZipFile )
452+
// No Multi Thread to Compress
453+
oZipFile:ParallelDeflateThreshold := -1
438454
//
439455
Max := SELF:aFilesArgs:Count
440456
FOR Cpt := 1 TO Max

FabTools/FabZip/FabZipFileCtrl.prg

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ BEGIN NAMESPACE FabZip.WinForms
2727
return SELF:oZipFile
2828

2929
PRIVATE METHOD ExtractHandler( sender AS System.Object, e AS ExtractProgressEventArgs ) AS System.Void
30-
local Params as Object[]
30+
local zipParams as Object[]
3131
local symEvent as FabZipEvent
3232
local cFile as string
3333
local nSize as int64
@@ -54,31 +54,31 @@ BEGIN NAMESPACE FabZip.WinForms
5454
RETURN
5555
ENDCASE
5656
//
57-
Params := <Object>{ self, symEvent, cFile, nSize }
57+
zipParams := <Object>{ self, symEvent, cFile, nSize }
5858
//
5959
//Send( Self:Owner, "OnFabZipProgress", Self, symEvent, cFile, nSize )
60-
ReflectionLib.InvokeMethod( SELF:Parent, "OnFabZipProgress", Params )
60+
ReflectionLib.InvokeMethod( SELF:Parent, "OnFabZipProgress", zipParams )
6161
endif
6262
RETURN
6363

6464
METHOD OnFabZipDirUpdate( ) as void
65-
local Params as Object[]
65+
local zipParams as Object[]
6666
//
67-
Params := <Object>{ SELF }
68-
ReflectionLib.InvokeMethod( SELF:Parent, "OnFabZipDirUpdate", Params )
67+
zipParams := <Object>{ SELF }
68+
ReflectionLib.InvokeMethod( SELF:Parent, "OnFabZipDirUpdate", zipParams )
6969
//
7070
return
7171

7272
METHOD OnFabOperationSize( nTotalFiles as Int64, nTotalSize as Int64 ) as VOID
73-
local Params as Object[]
73+
local zipParams as Object[]
7474
//
7575
if ( SELF:Parent != NULL )
7676
//
77-
Params := <Object>{ Self, FabZipEvent.TotalFiles, "", nTotalFiles }
78-
ReflectionLib.InvokeMethod( SELF:Parent, "OnFabZipProgress", Params )
77+
zipParams := <Object>{ Self, FabZipEvent.TotalFiles, "", nTotalFiles }
78+
ReflectionLib.InvokeMethod( SELF:Parent, "OnFabZipProgress", zipParams )
7979
//
80-
Params := <Object>{ Self, FabZipEvent.TotalSize, "", nTotalSize }
81-
ReflectionLib.InvokeMethod( SELF:Parent, "OnFabZipProgress", Params )
80+
zipParams := <Object>{ Self, FabZipEvent.TotalSize, "", nTotalSize }
81+
ReflectionLib.InvokeMethod( SELF:Parent, "OnFabZipProgress", zipParams )
8282
ENDIF
8383
RETURN
8484

FabTools/FabZipVo/FabZipFileCtrl.prg

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ BEGIN NAMESPACE FabZip
6161
RETURN
6262

6363
PRIVATE METHOD SaveHandler( sender AS System.Object, e AS SaveProgressEventArgs ) AS System.Void
64-
LOCAL Params AS OBJECT[]
64+
LOCAL zipParams AS OBJECT[]
6565
LOCAL symEvent AS SYMBOL
6666
LOCAL cFile AS STRING
6767
LOCAL nSize AS INT64
@@ -89,28 +89,28 @@ BEGIN NAMESPACE FabZip
8989
RETURN
9090
END SWITCH
9191
//
92-
PARAMS := <OBJECT>{ SELF, symEvent, cFile, nSize }
92+
zipParams := <OBJECT>{ SELF, symEvent, cFile, nSize }
9393
//
9494
//Send( Self:Owner, "OnFabZipProgress", Self, symEvent, cFile, nSize )
95-
ReflectionLib.InvokeMethod( SELF:Owner, "OnFabZipProgress", PARAMS )
95+
ReflectionLib.InvokeMethod( SELF:Owner, "OnFabZipProgress", zipParams )
9696
ENDIF
9797
RETURN
9898

9999
METHOD OnFabOperationSize( nTotalFiles AS INT64, nTotalSize AS INT64 ) AS VOID
100100
//
101101
IF ( SELF:Owner != NULL )
102102
//
103-
Send( SELF:Owner, "OnFSWITCHrogress", SELF, #TotalFiles, "", nTotalFiles )
103+
Send( SELF:Owner, "OnFabZipProgress", SELF, #TotalFiles, "", nTotalFiles )
104104
//
105105
Send( SELF:Owner, "OnFabZipProgress", SELF, #TotalSize, "", nTotalSize )
106106
ENDIF
107107
RETURN
108108

109109
METHOD OnFabZipDirUpdate( ) AS VOID
110-
LOCAL Params AS OBJECT[]
110+
LOCAL zipParams AS OBJECT[]
111111
//
112-
PARAMS := <OBJECT>{ SELF }
113-
ReflectionLib.InvokeMethod( SELF:Owner, "OnFabZipDirUpdate", PARAMS )
112+
zipParams := <OBJECT>{ SELF }
113+
ReflectionLib.InvokeMethod( SELF:Owner, "OnFabZipDirUpdate", zipParams )
114114
//
115115
RETURN
116116

FabTools/FabZipVo/FabZipVo.backup

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\XSharp\XSharp.Default.props" />
4+
<PropertyGroup>
5+
<ProjectGuid>4dd08a41-2945-4ddd-9821-4bf8a301fa9b</ProjectGuid>
6+
<OutputType>Library</OutputType>
7+
<AppDesignerFolder>Properties</AppDesignerFolder>
8+
<RootNamespace>FabZipVo</RootNamespace>
9+
<AssemblyName>FabZipVo</AssemblyName>
10+
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
11+
<Name>FabZipVo</Name>
12+
<Nologo>true</Nologo>
13+
<GenerateFullPaths>true</GenerateFullPaths>
14+
<Dialect>VO</Dialect>
15+
<na>false</na>
16+
<az>false</az>
17+
<nostddef>false</nostddef>
18+
<ins>true</ins>
19+
<unsafe>true</unsafe>
20+
<vo2>true</vo2>
21+
<vo3>true</vo3>
22+
<vo4>true</vo4>
23+
<vo6>true</vo6>
24+
<vo7>true</vo7>
25+
<vo9>true</vo9>
26+
<vo10>true</vo10>
27+
<vo13>true</vo13>
28+
<vo14>true</vo14>
29+
<vo15>true</vo15>
30+
<vo16>true</vo16>
31+
<lb>false</lb>
32+
<OutputName>FabZipVo</OutputName>
33+
<StartupObject />
34+
<ApplicationIcon />
35+
<VulcanCompatibleResources>False</VulcanCompatibleResources>
36+
<NoWin32Manifest>False</NoWin32Manifest>
37+
<TargetFrameworkProfile />
38+
</PropertyGroup>
39+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" Label="Configuration">
40+
<PlatformTarget>AnyCPU</PlatformTarget>
41+
<EmitDebugInformation>true</EmitDebugInformation>
42+
<DebugType>full</DebugType>
43+
<Optimize>false</Optimize>
44+
<OutputPath>bin\Debug\</OutputPath>
45+
<DefineConstants>DEBUG;TRACE</DefineConstants>
46+
<ErrorReport>prompt</ErrorReport>
47+
<WarningLevel>4</WarningLevel>
48+
</PropertyGroup>
49+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" Label="Configuration">
50+
<PlatformTarget>AnyCPU</PlatformTarget>
51+
<EmitDebugInformation>false</EmitDebugInformation>
52+
<DebugType>pdbonly</DebugType>
53+
<Optimize>true</Optimize>
54+
<OutputPath>bin\Release\</OutputPath>
55+
<DefineConstants>TRACE</DefineConstants>
56+
<ErrorReport>prompt</ErrorReport>
57+
<WarningLevel>4</WarningLevel>
58+
</PropertyGroup>
59+
<Import Project="$(MSBuildExtensionsPath)\XSharp\XSharp.targets" />
60+
<ItemGroup>
61+
<Reference Include="DotNetZip, Version=1.13.6.0, Culture=neutral, PublicKeyToken=6583c7c814667745">
62+
<Name>DotNetZip</Name>
63+
<AssemblyName>DotNetZip.dll</AssemblyName>
64+
<SpecificVersion>False</SpecificVersion>
65+
<Private>True</Private>
66+
<HintPath>..\packages\DotNetZip.1.13.6\lib\net40\DotNetZip.dll</HintPath>
67+
</Reference>
68+
<Reference Include="mscorlib" />
69+
<Reference Include="System" />
70+
<Reference Include="System.Core" />
71+
<Reference Include="System.Data" />
72+
<Reference Include="System.Data.DataSetExtensions" />
73+
<Reference Include="System.Xml" />
74+
<Reference Include="System.Xml.Linq" />
75+
<Reference Include="VOGUIClasses, Version=2.1.0.0, Culture=neutral, PublicKeyToken=a967d8055360a7b9">
76+
<Name>VOGUIClasses</Name>
77+
<AssemblyName>VOGUIClasses.dll</AssemblyName>
78+
<SpecificVersion>False</SpecificVersion>
79+
<Private>True</Private>
80+
<HintPath>..\..\..\..\Program Files (x86)\XSharp\Redist\VOGUIClasses.dll</HintPath>
81+
</Reference>
82+
<Reference Include="VOSystemClasses, Version=2.1.0.0, Culture=neutral, PublicKeyToken=a967d8055360a7b9">
83+
<Name>VOSystemClasses</Name>
84+
<AssemblyName>VOSystemClasses.dll</AssemblyName>
85+
<SpecificVersion>False</SpecificVersion>
86+
<Private>True</Private>
87+
<HintPath>..\..\..\..\Program Files (x86)\XSharp\Redist\VOSystemClasses.dll</HintPath>
88+
</Reference>
89+
<Reference Include="VOWin32APILibrary, Version=2.1.0.0, Culture=neutral, PublicKeyToken=a967d8055360a7b9">
90+
<Name>VOWin32APILibrary</Name>
91+
<AssemblyName>VOWin32APILibrary.dll</AssemblyName>
92+
<SpecificVersion>False</SpecificVersion>
93+
<Private>True</Private>
94+
<HintPath>..\..\..\..\Program Files (x86)\XSharp\Redist\VOWin32APILibrary.dll</HintPath>
95+
</Reference>
96+
<Reference Include="XSharp.Core" />
97+
<Reference Include="XSharp.Rt" />
98+
<Reference Include="XSharp.VO" />
99+
</ItemGroup>
100+
<ItemGroup>
101+
<Compile Include="FabZipFileCtrl.prg" />
102+
<Compile Include="Properties\AssemblyInfo.prg">
103+
<SubType>Code</SubType>
104+
</Compile>
105+
</ItemGroup>
106+
<ItemGroup>
107+
<Folder Include="Properties\" />
108+
</ItemGroup>
109+
<ItemGroup>
110+
<ProjectReference Include="..\FabZip\FabZip.xsproj">
111+
<Name>FabZip</Name>
112+
<Project>{bf4092de-ca8d-4ebe-b4e2-8fa9660845aa}</Project>
113+
<Private>True</Private>
114+
</ProjectReference>
115+
</ItemGroup>
116+
<ItemGroup>
117+
<None Include="packages.config" />
118+
</ItemGroup>
119+
<!-- This next bit is required unless the macro used to Import your targets is defined in an MSBuild toolset. -->
120+
<ProjectExtensions>
121+
<ProjectCapabilities>
122+
<ProjectConfigurationsDeclaredAsItems />
123+
</ProjectCapabilities>
124+
</ProjectExtensions>
125+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
126+
<PreBuildEvent />
127+
<PostBuildEvent />
128+
<RunPostBuildEvent />
129+
</PropertyGroup>
130+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
131+
<PreBuildEvent />
132+
<PostBuildEvent />
133+
<RunPostBuildEvent />
134+
</PropertyGroup>
135+
</Project>

FabTools/FabZipVo/FabZipVo.xsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<VulcanCompatibleResources>False</VulcanCompatibleResources>
3636
<NoWin32Manifest>False</NoWin32Manifest>
3737
<TargetFrameworkProfile />
38+
<XSharpProjectversion>2.3.1.0</XSharpProjectversion>
3839
</PropertyGroup>
3940
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" Label="Configuration">
4041
<PlatformTarget>AnyCPU</PlatformTarget>

FabTools/Fab_Zip_1_52j_Test/About.prg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ CONSTRUCTOR(oParent,uExtra)
3939
SELF:oCCDLLInfoPB:HyperLabel := HyperLabel{#DLLInfoPB , "DLL Info" , NULL_STRING , NULL_STRING}
4040

4141
SELF:oDCFixedText2 := FIXEDTEXT{SELF , ResourceID{ HELPABOUT_FIXEDTEXT2 , _GetInst() } }
42-
SELF:oDCFixedText2:HyperLabel := HyperLabel{#FixedText2 , "fabrice@fabtoys.net" , NULL_STRING , NULL_STRING}
42+
SELF:oDCFixedText2:HyperLabel := HyperLabel{#FixedText2 , "fabrice@xsharp.eu" , NULL_STRING , NULL_STRING}
4343

4444
SELF:oDCFixedText3 := FIXEDTEXT{SELF , ResourceID{ HELPABOUT_FIXEDTEXT3 , _GetInst() } }
4545
SELF:oDCFixedText3:HyperLabel := HyperLabel{#FixedText3 , "© 1997-2020 Fabrice Foray" , NULL_STRING , NULL_STRING}

0 commit comments

Comments
 (0)