Ejemplo n.º 1
0
    // Token: 0x060000B5 RID: 181 RVA: 0x000058E8 File Offset: 0x00003AE8
    public int load(int msValidity)
    {
        YAPI.YDevice dev    = null;
        string       errmsg = "";

        YAPI.TJsonParser apires = null;
        string           errbuf = "";
        string           funcId = "";
        int    devdesc          = 0;
        string serial           = "";
        string funcName         = "";
        string funcVal          = "";

        YAPI.TJSONRECORD?node = null;
        int res = this._getDevice(ref dev, ref errmsg);

        if (YAPI.YISERR(res))
        {
            this._throw(res, errmsg);
            return(res);
        }
        res = dev.requestAPI(out apires, ref errmsg);
        if (YAPI.YISERR(res))
        {
            this._throw(res, errmsg);
            return(res);
        }
        int fundescr = YAPI.yapiGetFunction(this._className, this._func, ref errmsg);

        if (YAPI.YISERR(fundescr))
        {
            this._throw(res, errmsg);
            return(fundescr);
        }
        devdesc = 0;
        res     = YAPI.yapiGetFunctionInfo(fundescr, ref devdesc, ref serial, ref funcId, ref funcName, ref funcVal, ref errbuf);
        if (YAPI.YISERR(res))
        {
            this._throw(res, errmsg);
            return(res);
        }
        node = apires.GetChildNode(null, funcId);
        if (node == null)
        {
            this._throw(-8, "unexpected JSON structure: missing function " + funcId);
            return(-8);
        }
        this._parse(node.GetValueOrDefault());
        this._cacheExpiration = YAPI.GetTickCount() + (long)msValidity;
        return(0);
    }
Ejemplo n.º 2
0
    // Token: 0x060000B4 RID: 180 RVA: 0x0000589C File Offset: 0x00003A9C
    public bool isOnline()
    {
        YAPI.YDevice dev    = null;
        string       errmsg = "";

        YAPI.TJsonParser apires;
        return(this._cacheExpiration > YAPI.GetTickCount() || (!YAPI.YISERR(this._getDevice(ref dev, ref errmsg)) && !YAPI.YISERR(dev.requestAPI(out apires, ref errmsg))));
    }