34 lines
719 B
C++
34 lines
719 B
C++
#pragma once
|
|
|
|
#include "../vendor/json.hpp"
|
|
#include <windows.h>
|
|
#include <functional>
|
|
#include <memory>
|
|
#include <string_view>
|
|
|
|
namespace ks::files
|
|
{
|
|
inline constexpr UINT filesMcpQueryMessage=WM_APP+274;
|
|
|
|
class FilesMcpServer
|
|
{
|
|
public:
|
|
using Json=nlohmann::json;
|
|
using ReadTool=std::function<Json(std::string_view,const Json &)>;
|
|
FilesMcpServer();
|
|
~FilesMcpServer();
|
|
FilesMcpServer(const FilesMcpServer &)=delete;
|
|
FilesMcpServer &operator=(const FilesMcpServer &)=delete;
|
|
|
|
void start(HWND owner);
|
|
void stop();
|
|
unsigned port() const;
|
|
std::string_view token() const;
|
|
void answer(const ReadTool &read);
|
|
|
|
private:
|
|
struct Session;
|
|
std::unique_ptr<Session> session;
|
|
};
|
|
}
|