Skip to content

Commit

Permalink
Merge pull request #50 from GeneralLibrary/dev
Browse files Browse the repository at this point in the history
Organize the code of the compressed components
  • Loading branch information
JusterZhu committed Feb 6, 2024
2 parents 9f06607 + dd6f881 commit 1554d81
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 44 deletions.
16 changes: 3 additions & 13 deletions src/c#/GeneralUpdate.ClientCore/GeneralUpdate.ClientCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@
<None Remove="WillMessage\.gitkeep" />
<None Remove="ZipFactory\Events\.gitkeep" />
<None Remove="ZipFactory\Factory\.gitkeep" />
<None Remove="ZipFactory\G7z\.gitkeep" />
<None Remove="ZipFactory\GZip\.gitkeep" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -141,7 +139,6 @@
<Compile Include="..\GeneralUpdate.Core\Pipelines\Attributes\DynamicallyAccessedMemberTypes.cs" Link="Pipelines\Attributes\DynamicallyAccessedMemberTypes.cs" />
<Compile Include="..\GeneralUpdate.Core\Pipelines\Context\BaseContext.cs" Link="Pipelines\Context\BaseContext.cs" />
<Compile Include="..\GeneralUpdate.Core\Pipelines\MiddlewareResolver\ActivatorMiddlewareResolver.cs" Link="Pipelines\MiddlewareResolver\ActivatorMiddlewareResolver.cs" />
<Compile Include="..\GeneralUpdate.Core\Pipelines\Middleware\ConfigMiddleware.cs" Link="Pipelines\Middleware\ConfigMiddleware.cs" />
<Compile Include="..\GeneralUpdate.Core\Pipelines\Middleware\DriveMiddleware.cs" Link="Pipelines\Middleware\DriveMiddleware.cs" />
<Compile Include="..\GeneralUpdate.Core\Pipelines\Middleware\HashMiddleware.cs" Link="Pipelines\Middleware\HashMiddleware.cs" />
<Compile Include="..\GeneralUpdate.Core\Pipelines\Middleware\IMiddleware.cs" Link="Pipelines\Middleware\IMiddleware.cs" />
Expand Down Expand Up @@ -175,16 +172,16 @@
<Compile Include="..\GeneralUpdate.Differential\GStream\BZip2OutputStream.cs" Link="Differential\GStream\BZip2OutputStream.cs" />
<Compile Include="..\GeneralUpdate.Differential\GStream\IChecksum.cs" Link="Differential\GStream\IChecksum.cs" />
<Compile Include="..\GeneralUpdate.Differential\GStream\StrangeCRC.cs" Link="Differential\GStream\StrangeCRC.cs" />
<Compile Include="..\GeneralUpdate.Zip\CompressProvider\Compress7z.cs" Link="ZipFactory\CompressProvider\Compress7z.cs" />
<Compile Include="..\GeneralUpdate.Zip\CompressProvider\CompressZip.cs" Link="ZipFactory\CompressProvider\CompressZip.cs" />
<Compile Include="..\GeneralUpdate.Zip\Events\BaseCompleteEventArgs.cs" Link="ZipFactory\Events\BaseCompleteEventArgs.cs" />
<Compile Include="..\GeneralUpdate.Zip\Events\BaseCompressProgressEventArgs.cs" Link="ZipFactory\Events\BaseCompressProgressEventArgs.cs" />
<Compile Include="..\GeneralUpdate.Zip\Events\BaseUnZipProgressEventArgs.cs" Link="ZipFactory\Events\BaseUnZipProgressEventArgs.cs" />
<Compile Include="..\GeneralUpdate.Zip\Factory\BaseCompress.cs" Link="ZipFactory\Factory\BaseCompress.cs" />
<Compile Include="..\GeneralUpdate.Zip\Factory\IFactory.cs" Link="ZipFactory\Factory\IFactory.cs" />
<Compile Include="..\GeneralUpdate.Zip\Factory\IOperation.cs" Link="ZipFactory\Factory\IOperation.cs" />
<Compile Include="..\GeneralUpdate.Zip\Factory\OperationType.cs" Link="ZipFactory\Factory\OperationType.cs" />
<Compile Include="..\GeneralUpdate.Zip\G7z\General7z.cs" Link="ZipFactory\G7z\General7z.cs" />
<Compile Include="..\GeneralUpdate.Zip\GeneralZipFactory.cs" Link="ZipFactory\GeneralZipFactory.cs" />
<Compile Include="..\GeneralUpdate.Zip\GZip\GeneralZip.cs" Link="ZipFactory\GZip\GeneralZip.cs" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -254,27 +251,20 @@
<Folder Include="Pipelines\Pipeline\" />
<Folder Include="ZipFactory\Events\" />
<Folder Include="ZipFactory\Factory\" />
<Folder Include="ZipFactory\G7z\" />
<Folder Include="ZipFactory\GZip\" />
<Folder Include="CustomAwaiter\" />
<Folder Include="Download\" />
<Folder Include="ZipFactory\Events\" />
<Folder Include="ZipFactory\Factory\" />
<Folder Include="ZipFactory\G7z\" />
<Folder Include="ZipFactory\GZip\" />
<Folder Include="CustomAwaiter\" />
<Folder Include="Download\" />
<Folder Include="ZipFactory\Events\" />
<Folder Include="ZipFactory\Factory\" />
<Folder Include="ZipFactory\G7z\" />
<Folder Include="ZipFactory\GZip\" />
<Folder Include="CustomAwaiter\" />
<Folder Include="Download\" />
<Folder Include="ZipFactory\Events\" />
<Folder Include="ZipFactory\Factory\" />
<Folder Include="ZipFactory\G7z\" />
<Folder Include="ZipFactory\GZip\" />
<Folder Include="WillMessage\" />
<Folder Include="ZipFactory\CompressProvider\" />
</ItemGroup>

<ItemGroup>
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
using System.Linq;
using System.Text;

namespace GeneralUpdate.Zip.G7z
namespace GeneralUpdate.Zip.CompressProvider
{
/// <summary>
/// Source address : https://github.com/adamhathcock/sharpcompress/blob/master/tests/SharpCompress.Test/WriterTests.cs
/// Author : Adam hathcock .
/// Tribute to the original author .
/// Secondary developer : Juster Z
/// </summary>
public class General7z : BaseCompress
public class Compress7z : BaseCompress
{
private string _destinationPath;
private Encoding _encoding;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
using System.Text;
using System.Text.RegularExpressions;

namespace GeneralUpdate.Zip.GZip
namespace GeneralUpdate.Zip.CompressProvider
{
/// <summary>
/// Source address : https://www.cnblogs.com/Chary/p/No0000DF.html
/// Author :Chary Gao .
/// Tribute to the original author .
/// Secondary developer : Juster Z
/// </summary>
public class GeneralZip : BaseCompress
public class CompressZip : BaseCompress
{
private string _destinationPath;
private bool _includeBaseDirectory;
Expand Down
6 changes: 0 additions & 6 deletions src/c#/GeneralUpdate.Zip/GeneralUpdate.Zip.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@
<PackageProjectUrl>https://github.com/JusterZhu/GeneralUpdate</PackageProjectUrl>
</PropertyGroup>

<ItemGroup>
<Compile Remove="G7z\Events\**" />
<EmbeddedResource Remove="G7z\Events\**" />
<None Remove="G7z\Events\**" />
</ItemGroup>

<ItemGroup>
<None Remove="GeneralUpdate.ico" />
<None Remove="GeneralUpdate.Zip.1.0.0.nupkg" />
Expand Down
27 changes: 6 additions & 21 deletions src/c#/GeneralUpdate.Zip/GeneralZipFactory.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using GeneralUpdate.Zip.Events;
using GeneralUpdate.Zip.CompressProvider;
using GeneralUpdate.Zip.Events;
using GeneralUpdate.Zip.Factory;
using GeneralUpdate.Zip.G7z;
using GeneralUpdate.Zip.GZip;
using System;
using System.Text;

Expand Down Expand Up @@ -47,12 +46,12 @@ public IFactory CreateOperate(OperationType type, string name, string sourcePath
switch (type)
{
case OperationType.GZip:
_operation = new GeneralZip();
_operation = new CompressZip();
_operation.Configs(name, sourcePath, destinationPath, encoding, includeBaseDirectory);
break;

case OperationType.G7z:
_operation = new General7z();
_operation = new Compress7z();
_operation.Configs(name, sourcePath, destinationPath, encoding, includeBaseDirectory);
break;
}
Expand Down Expand Up @@ -84,27 +83,13 @@ private void OnCompressProgress(object sender, BaseCompressProgressEventArgs e)

public IFactory CreateZip()
{
try
{
_operation.CreateZip();
}
catch (Exception ex)
{
throw new Exception($"'CreateZip' exception : {ex.Message} .", ex.InnerException);
}
_operation.CreateZip();
return this;
}

public IFactory UnZip()
{
try
{
_operation.UnZip();
}
catch (Exception ex)
{
throw new Exception($"'CreateOperate' exception : {ex.Message} .", ex.InnerException);
}
_operation.UnZip();
return this;
}
}
Expand Down

0 comments on commit 1554d81

Please sign in to comment.