mirror of
https://github.com/copyrighttxt/watrbx-game-engine.git
synced 2026-09-06 05:37:48 +00:00
GEEKING
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "v8datamodel/CookiesEngineService.h"
|
||||
#include "CookiesEngine.h"
|
||||
#include "format_string.h"
|
||||
|
||||
namespace RBX
|
||||
{
|
||||
const char* const sCookiesService = "CookiesService";
|
||||
|
||||
REFLECTION_BEGIN();
|
||||
static Reflection::BoundFuncDesc<CookiesService, void(std::string, std::string)> setValue(&CookiesService::SetValue, "SetCookieValue", "key", "value", Security::Roblox);
|
||||
static Reflection::BoundFuncDesc<CookiesService, std::string(std::string)> getValue(&CookiesService::GetValue, "GetCookieValue", "key", Security::Roblox);
|
||||
static Reflection::BoundFuncDesc<CookiesService, void(std::string)> deleteValue(&CookiesService::DeleteValue, "DeleteCookieValue", "key", Security::Roblox);
|
||||
REFLECTION_END();
|
||||
|
||||
|
||||
static void sleep(int duration)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
Sleep(duration);
|
||||
#else
|
||||
::usleep(1000*duration);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
CookiesService::CookiesService()
|
||||
{
|
||||
setName(sCookiesService);
|
||||
path = convert_w2s(CookiesEngine::getCookiesFilePath());
|
||||
}
|
||||
|
||||
void CookiesService::SetValue(std::string key, std::string value)
|
||||
{
|
||||
CookiesEngine engine(convert_s2w(path));
|
||||
engine.SetValue(key, value);
|
||||
}
|
||||
|
||||
std::string CookiesService::GetValue(std::string key)
|
||||
{
|
||||
CookiesEngine engine(convert_s2w(path));
|
||||
|
||||
bool valid = false;
|
||||
int result = 0;
|
||||
std::string value = engine.GetValue(key, &result, &valid);
|
||||
if (result == 0 && valid)
|
||||
return value;
|
||||
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
void CookiesService::DeleteValue(std::string key)
|
||||
{
|
||||
CookiesEngine engine(convert_s2w(path));
|
||||
engine.DeleteValue(key);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user