1
0
This repository has been archived on 2025-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
Files
siadrive/include/siadrive_dokan_api/siadokandrive.h
Scott E. Graves e82081fd41 Renter settings
2017-03-25 12:25:45 -05:00

151 lines
2.8 KiB
C++

#ifndef _SIADOKANDRIVE_H
#define _SIADOKANDRIVE_H
#ifdef _WIN32
// Import or export functions and/or classes
#ifdef SIADRIVE_DOKAN_EXPORT_SYMBOLS
#define SIADRIVE_DOKAN_EXPORTABLE __declspec(dllexport)
#else
#define SIADRIVE_DOKAN_EXPORTABLE __declspec(dllimport)
#endif //SIADRIVE_DOKAN_EXPORT_SYMBOLS
#else
#define SIADRIVE_DOKAN_EXPORTABLE
#endif
#include <siaapi.h>
#include <mutex>
#include <eventsystem.h>
NS_BEGIN(Sia)
NS_BEGIN(Api)
NS_BEGIN(Dokan)
class SIADRIVE_DOKAN_EXPORTABLE SiaDokanDriveException :
std::exception
{
public:
SiaDokanDriveException(char* message) :
std::exception(message)
{
}
};
class SIADRIVE_DOKAN_EXPORTABLE CSiaDokanDrive
{
public:
// throws SiaDokenDriveException
CSiaDokanDrive(CSiaApi& siaApi, CSiaDriveConfig* siaDriveConfig);
public:
~CSiaDokanDrive();
private:
CSiaApi& _siaApi;
CSiaDriveConfig* _siaDriveConfig;
Property(bool, Mounted, public, private)
public:
void Mount(const wchar_t& driveLetter, const SString& cacheLocation, const std::uint64_t& maxCacheSizeBytes);
void Unmount(const bool& clearCache = false);
void ClearCache();
};
class SIADRIVE_DOKAN_EXPORTABLE DriveMountEnded :
public CEvent
{
public:
DriveMountEnded(const SString mountLocation, const NTSTATUS& mountStatus) :
_mountLocation(mountLocation),
_mountStatus(mountStatus)
{
}
public:
virtual ~DriveMountEnded()
{
}
private:
const SString _mountLocation;
const NTSTATUS _mountStatus;
public:
virtual std::shared_ptr<CEvent> Clone() const override
{
return std::shared_ptr<CEvent>(new DriveMountEnded(_mountLocation, _mountStatus));
}
virtual SString GetSingleLineMessage() const override
{
return L"DriveMountEnded|LOC|" + _mountLocation + L"|STATUS|" + SString::FromInt32(_mountStatus);
}
};
class SIADRIVE_DOKAN_EXPORTABLE DriveUnMounted :
public CEvent
{
public:
DriveUnMounted(const SString& mountLocation) :
_mountLocation(mountLocation)
{
}
public:
virtual ~DriveUnMounted()
{
}
private:
const SString _mountLocation;
public:
virtual std::shared_ptr<CEvent> Clone() const override
{
return std::shared_ptr<CEvent>(new DriveUnMounted(_mountLocation));
}
virtual SString GetSingleLineMessage() const override
{
return L"DriveUnMounted|LOC|" + _mountLocation;
}
};
class SIADRIVE_DOKAN_EXPORTABLE DriveMounted :
public CEvent
{
public:
DriveMounted(const SString& mountLocation) :
_mountLocation(mountLocation)
{
}
public:
virtual ~DriveMounted()
{
}
private:
const SString _mountLocation;
public:
virtual std::shared_ptr<CEvent> Clone() const override
{
return std::shared_ptr<CEvent>(new DriveMounted(_mountLocation));
}
virtual SString GetSingleLineMessage() const override
{
return L"DriveMounted|LOC|" + _mountLocation;
}
};
NS_END(3)
#endif //_SIADOKANDRIVE_H