Anul 3 Semestrul 2
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../FileCompression/FileCompression.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,34 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
using System;
|
||||
using FileCompression.Interfaces;
|
||||
using FileCompression.Services.Strategies;
|
||||
using FileCompression.Services.Composites;
|
||||
using FileCompression;
|
||||
using FileCompression.Enums;
|
||||
|
||||
// dotnet run --project FileCompressionCLI/ /home/danielcujba/Pictures/Screenshots/ /home/danielcujba/Downloads/destination.zip Zip
|
||||
// dotnet run --project FileCompressionCLI/ /home/danielcujba/Pictures/Screenshots/ /home/danielcujba/Downloads/destination.tar Tar
|
||||
// dotnet run --project FileCompressionCLI/ /home/danielcujba/Pictures/Screenshots/ /home/danielcujba/Downloads/destination.tar.gz TarGz
|
||||
namespace FileCompressionCLI
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (args.Length < 3)
|
||||
{
|
||||
Console.WriteLine("Usage: FileCompressionCLI <sourcePath> <destinationPath> <compressionMode>");
|
||||
return;
|
||||
}
|
||||
string sourcePath = args[0];
|
||||
string destinationPath = args[1];
|
||||
if (!Enum.TryParse(args[2], true, out CompressionMode mode))
|
||||
{
|
||||
Console.WriteLine($"Invalid compression mode: {args[2]}");
|
||||
return;
|
||||
}
|
||||
|
||||
Compressor.Instance.Compress(sourcePath, destinationPath, mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user