#include "Command_Solve.hpp"
#include "DLT_Utilities.hpp"
#include "Global_Variables.hpp"

extern "C"
{
#include "windows.h"
}

#include "CSV_Utilities.hpp"

DLT_Log File;

// 命令行处理
void Pre_Command_Solve(void)
{
    // 获取命令行
    int argc;
    LPWSTR *argv;
    argv = CommandLineToArgvW(GetCommandLineW(), &argc);

    if (argc <= 1)
        return;

    // 输出测试用参数信息
    std::wstring cmd_string;
    for (int count = 0; count < argc; count++)
    {
        // int size_needed = WideCharToMultiByte(CP_UTF8, 0, argv[count], -1, NULL, 0, NULL, NULL);
        // char *strTo = (char *)malloc(size_needed);
        // WideCharToMultiByte(CP_UTF8, 0, argv[count], -1, strTo, size_needed, NULL, NULL);

        // printf("Arg[%d]:%s\n", count, strTo);
        // free(strTo);

        wchar_t Num_str[100] = {'\0'};
        wsprintf(Num_str, L"%d", count);
        cmd_string += std::wstring(L"Arg[") + Num_str + L"]:" + argv[count] + L"\n";
    }

    MessageBoxW(Main_Window_hWnd, (L"[Debug] Argument input:\n" + cmd_string).c_str(), L"", MB_OK);
}