/* * This file is part of VoidArchiveTool. * * Copyright (C) 2025 Yanczi * * Void Archive Toolis free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ //============================================================================ // Name : Void Archive Tool // Author : Yanczi // Version : 1.1 // Copyright : Yanczi 19-06-2025 // Description : Void Archive Tool. Packing and extract files //============================================================================ #include #include #include #include "CreateCargo.h" #include "ExtractCargo.h" #include "ViewCargo.h" #include "Tui.h" void RenderHelp() { const std::string HelpTitle = "< Manual >"; const std::string HelpInstruction = "pakcmd \n" " \n" " -c Compressing \n" " -r Raw files \n" " -e Encrypted \n" " -s Compressing and Encrypted \n" " -f Pack the files according to the guidelines given in the .json \n" " \n" "Extracting: \n" " -x Extract files from the specified container \n" " \n" "Others: \n" " -ls List files stored in a container \n" " \n" ".json \n" " \n" "Keys: \n" " \n" " {compress} - Compressing files \n" " {crypt} - Encrypted files \n" " {ignore} - Ignoring concrete files \n" " \n" " /path/to/file.ext - Concrete file \n" " *.ext - All files with concrete extension \n" " *.* - All files !NOT WORKING WITH {ignore} KEY! \n"; //Interface tui; //tui.TextBorder(HelpTitle, HelpInstruction); } static bool EmptyPath(std::string path) { if (path == "") { std::cerr << "Error: Nie podano sciezki!" << std::endl; return false; } return true; } int main(int argc, char* argv[]) { std::cout << ui::title << std::endl << "ver. " << ui::ver << std::endl; std::cout << "Author: Yanczi" << std::endl; std::cout << "License: GNU LGPL v3" << "\n" << std::endl; CreateCargo cargo; ExtractCargo extract; ViewCargo viewCargo; std::string path = ""; for (int i = 0; i < argc; ++i) { std::string arg = argv[i]; if (arg == "-c" && i + 1 < argc) { path = argv[i + 1]; if (!EmptyPath(path)) { return 1; } if (!cargo.Create(path, 0x0F)) { return 1; } i++; } if (arg == "-r" && i + 1 < argc) { path = argv[i + 1]; if (!cargo.Create(path, 0x00)) { return 1; } i++; } if (arg == "-e" && i + 1 < argc) { path = argv[i + 1]; if (!cargo.Create(path, 0xF0)) { return 1; } i++; } if (arg == "-s" && i + 1 < argc) { path = argv[i + 1]; if (!cargo.Create(path, 0xFF)) { return 1; } i++; } if (arg == "-f" && i + 1 < argc) { path = argv[i + 1]; if (!EmptyPath(path)) { return 1; } if (!cargo.Create(path, 0xAB)) { return 1; } i++; } if (arg == "-x" && i + 1 < argc) { path = argv[i + 1]; if (!EmptyPath(path)) { return 1; } if (!extract.Extract(path)) { return 1; } i++; } if (arg == "-ls" && i + 1 < argc) { path = argv[i + 1]; if (!EmptyPath(path)) { return 1; } if (!viewCargo.View(path)) { return 1; } i++; } if (arg == "-help") { //std::cout << helpText << std::endl; RenderHelp(); return 0; i++; } } return 0; }