You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
2.0 KiB
C++
106 lines
2.0 KiB
C++
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Project: agstools
|
|
// Program: archive_tool
|
|
// Purpose:
|
|
|
|
#include <iostream>
|
|
#include <fstream>
|
|
#include <filesystem>
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Function: archive_info
|
|
// Purpose: Displays info about provided archive.
|
|
void archive_info(std::string& input_path)
|
|
{
|
|
//Struct --NOTE: May move to global if other functions use it or create overall archive class
|
|
struct file_node
|
|
{
|
|
std::string name;
|
|
int size = 0;
|
|
int location = 0;
|
|
};
|
|
|
|
//Local Variables
|
|
std::ifstream input_file;
|
|
char* p_buffer = NULL;
|
|
file_node* p_files_array = NULL;
|
|
|
|
|
|
//Assumes exists --NOTE: Replace with check to check if exists, then what type.
|
|
input_file.open(input_path);
|
|
p_buffer = new char[8];
|
|
|
|
input_file.read(p_buffer, 8);
|
|
|
|
/*
|
|
if (p_buffer == MAGIC)
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
//Not correct format!
|
|
}
|
|
|
|
|
|
*/
|
|
;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Function: main
|
|
// Purpose: Program entry point
|
|
int main(int arg_count, char* p_arg_array[])
|
|
{
|
|
//Initial argument debug
|
|
#ifdef _DEBUG
|
|
printf("\nDEBUG: Number of arguments: %i\n", arg_count);
|
|
for (int a = 0; a < arg_count; a++)
|
|
{
|
|
printf("DEBUG: [%i] %s\n", a, p_arg_array[a]);
|
|
}
|
|
#endif
|
|
|
|
//Local Variables
|
|
std::string temp;
|
|
std::string input_path;
|
|
std::string output_path;
|
|
|
|
//Start program
|
|
if (arg_count > 1)
|
|
{
|
|
if (arg_count < 5)
|
|
{
|
|
temp = p_arg_array[1];
|
|
|
|
if (temp == "-info" || temp == "-i")
|
|
{
|
|
input_path = p_arg_array[2];
|
|
if (arg_count >= 3)
|
|
{
|
|
//Set output path
|
|
}
|
|
archive_info(input_path);
|
|
|
|
return 0; //We good?
|
|
}
|
|
else
|
|
{
|
|
printf("\nError! Unknown argument!");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
printf("\nError! Too many arguments!");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
printf("\nError! Not enough arguments!");
|
|
}
|
|
|
|
//Usage branding
|
|
printf("\n\nUsage: <operation> <target> <option>\n\n");
|
|
|
|
return 0;
|
|
} |