feat: Add Zip Tool
This commit is contained in:
parent
0ae60e679d
commit
00a52543b8
3 changed files with 59 additions and 0 deletions
10
CreateZipFolder/CreateZipFolder.csproj
Normal file
10
CreateZipFolder/CreateZipFolder.csproj
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
25
CreateZipFolder/CreateZipFolder.sln
Normal file
25
CreateZipFolder/CreateZipFolder.sln
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.8.34511.84
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CreateZipFolder", "CreateZipFolder.csproj", "{FD8868F8-3953-4A89-918D-D8425F1AE760}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{FD8868F8-3953-4A89-918D-D8425F1AE760}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FD8868F8-3953-4A89-918D-D8425F1AE760}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FD8868F8-3953-4A89-918D-D8425F1AE760}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FD8868F8-3953-4A89-918D-D8425F1AE760}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {5995513C-2C1E-4367-97C6-FC989288D411}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
24
CreateZipFolder/Program.cs
Normal file
24
CreateZipFolder/Program.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using System.IO.Compression;
|
||||
|
||||
var env = Environment.GetCommandLineArgs();
|
||||
|
||||
if (env.Length < 3)
|
||||
{
|
||||
Console.WriteLine("Arguments required: [Directory] [OutputFile]");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!new DirectoryInfo(env[1]).Exists)
|
||||
{
|
||||
Console.WriteLine($"'{env[1]}' does not exist.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (new FileInfo(env[2]).Exists)
|
||||
{
|
||||
Console.WriteLine($"'{env[2]}' already exists.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
ZipFile.CreateFromDirectory(env[1], env[2]);
|
||||
return 0;
|
||||
Loading…
Add table
Add a link
Reference in a new issue