Przeprawiona klasa tworzenia kontenerów. Dodano funkcję która wygodnie dobiera odpowiednie działanie dla danych
This commit is contained in:
parent
31f08e52d0
commit
8402ce1b65
7 changed files with 84 additions and 33 deletions
|
|
@ -90,6 +90,12 @@ bool CreateCargo::Create(const std::string& path, int8_t flag)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Zapisywanie klucza szyfruj¹cego
|
||||
if (flag == 2 || flag == 3)
|
||||
{
|
||||
crypt.saveKey(catalogPath);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -171,30 +177,28 @@ void CreateCargo::computingBytes(const int8_t& flag, std::vector<char>& input, s
|
|||
//Przeciwnie kompresuje dane
|
||||
CompressingManager cm;
|
||||
|
||||
// Kompresja
|
||||
if (flag == 1)
|
||||
switch (flag)
|
||||
{
|
||||
case 1:
|
||||
std::cout << "COMPRESSING" << std::endl;
|
||||
output = cm.compress(input);
|
||||
}
|
||||
break;
|
||||
|
||||
// Szyfrowanie
|
||||
if (flag == 2)
|
||||
{
|
||||
case 2:
|
||||
std::cout << "ENCRYPTION" << std::endl;
|
||||
output = crypt.encrypt(input);
|
||||
}
|
||||
break;
|
||||
|
||||
// Kompresja i szyfrowanie
|
||||
if (flag == 3)
|
||||
{
|
||||
case 3:
|
||||
std::cout << "ZIP ENC" << std::endl;
|
||||
output = crypt.encrypt(cm.compress(input));
|
||||
}
|
||||
break;
|
||||
|
||||
// Zwraca surowe dane
|
||||
std::cout << "RAW" << std::endl;
|
||||
output = std::move(input);
|
||||
default:
|
||||
std::cout << "RAW" << std::endl;
|
||||
output = std::move(input);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -478,9 +482,6 @@ bool CreateCargo::WriteCargo()
|
|||
|
||||
cargo.close();
|
||||
|
||||
// Zapisywanie klucza szyfrujšcego
|
||||
//crypt.saveKey(catalogPath);
|
||||
|
||||
std::cout << "The container was successfully created! " << cargoFile << std::endl;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue