Exemple #1
0
void FromJSObject(std::vector<std::map<gcString, gcString>> &args, JSObjHandle& arg)
{
    if (arg->isArray() == false)
        return;

    for (int x=0; x<arg->getArrayLength(); x++)
    {
        JSObjHandle a = arg->getValue(x);

        std::map<gcString, gcString> m;
        FromJSObject(m, a);

        args.push_back(m);
    }
}
void FromJSObject(ServiceItem* &jsItem, JSObjHandle& arg)
{
	if (arg->isObject())
		jsItem = dynamic_cast<ServiceItem*>(arg->getUserObject<ScriptCoreItemI>());
	else
		jsItem = NULL;
}
void FromJSObject<UserItem*>(UserItem* &jsItem, JSObjHandle& arg)
{
	if (arg->isObject())
		jsItem = dynamic_cast<UserItem*>(arg->getUserObject<ScriptCoreItemI>());
	else
		jsItem = nullptr;
}
void FromJSObject<gcRefPtr<UserCore::Misc::UploadInfoThreadI>>(gcRefPtr<UserCore::Misc::UploadInfoThreadI> &upload, JSObjHandle& arg)
{
	if (arg->isObject())
		upload = arg->getUserObject<UserCore::Misc::UploadInfoThreadI>();
	else
		upload = nullptr;
}
Exemple #5
0
void FromJSObject(UserCore::Item::BranchInfoI* &branch, JSObjHandle& arg)
{
	if (arg->isObject())
		branch = arg->getUserObject<UserCore::Item::BranchInfoI>();
	else
		branch = NULL;
}
void FromJSObject<gcRefPtr<UserCore::Item::BranchInfoI>>(gcRefPtr<UserCore::Item::BranchInfoI> &branch, JSObjHandle& arg)
{
	if (arg->isObject())
		branch = arg->getUserObject<UserCore::Item::BranchInfoI>();
	else
		branch = nullptr;
}
Exemple #7
0
void FromJSObject(UserCore::Misc::UploadInfoThreadI* &upload, JSObjHandle& arg)
{
	if (arg->isObject())
		upload = arg->getUserObject<UserCore::Misc::UploadInfoThreadI>();
	else
		upload = NULL;
}
Exemple #8
0
void FromJSObject<UTIL::FS::FileHandle*>(UTIL::FS::FileHandle* &jsItem, JSObjHandle& arg)
{
	if (arg->isObject())
		jsItem = arg->getUserObject<UTIL::FS::FileHandle>();
	else
		jsItem = nullptr;
}
void FromJSObject<gcRefPtr<UserCore::Item::ItemInfoI>>(gcRefPtr<UserCore::Item::ItemInfoI> &item, JSObjHandle& arg)
{
	if (arg->isObject() == false)
		return;

	item = arg->getUserObject<UserCore::Item::ItemInfoI>();
}
Exemple #10
0
JSObjHandle ItemJSBinding::execute(ChromiumDLL::JavaScriptFunctionArgs* args)
{
	JSObjHandle ret =  DesuraJSBase<ItemJSBinding>::execute(args);
	
	if (!ret->isException() || g_vExtenderList.empty())
		return ret;

	g_ItemLock.lock();

	for (size_t x=0; x<g_vExtenderList.size(); x++)
	{
		ret = g_vExtenderList[x]->execute(args);

		if (!ret->isException())
			break;
	}

	g_ItemLock.unlock();
	return ret;
}
Exemple #11
0
void FromJSObject(std::map<gcString, gcString> &map, JSObjHandle& arg)
{
    if (arg->isArray() == false && arg->isObject() == false)
        return;

    for (int y=0; y<arg->getNumberOfKeys(); y++)
    {
        char key[255] = {0};
        gcString val;

        arg->getKey(y, key, 255);

        try
        {
            JSObjHandle jObj = arg->getValue(key);
            FromJSObject(val, jObj);
            map[gcString(key)] = val;
        }
        catch (...) // TODO
        {
        }
    }
}