#pragma once

#include <list>
#include <string>
#include <map>
#include "cmd_opr.h"

struct DllInfo {
    int index{};
    std::string name{};
    std::string full_path{};
};

class DllHandle {
public:
    DllHandle() = default;
    ~DllHandle() = default;

public:
    // 读取配置文件
    bool read_ini(const std::string& purpose_dir);
    // 获取一个二进制文件的依赖(参数为全路径)
    std::list<std::string> get_dependents(const std::string& binary);
    // 查找配置文件中配置的目录中指定名称的dll的信息
    bool find_dll(const std::string& name, DllInfo& info);
    // 是否在容器中
    static bool is_have(const std::list<DllInfo>& vec, const std::string& name);
    // 处理dll复制
    static void copy_dll(const std::string&        purpose_dir,
                         const std::list<DllInfo>& tasks);
    // 手动筛选多个dll的情况
    void handle_multi_dll();

private:
    std::list<DllInfo>                        no_dlls_{};
    std::list<DllInfo>                        exe_dlls_{};
    std::map<std::string, std::list<DllInfo>> simple_dlls{};
};