Esempio n. 1
0
        public PyObject Encode()
        {
            PyTuple args = new PyTuple();
            args.Items.Add(new PyToken("dbutil.CRowset"));

            PyDict dict = new PyDict();
            dict.Set("header", descriptor.Encode());

            PyObjectEx res = new PyObjectEx();
            res.IsType2 = true;

            args.Items.Add(dict);
            res.List = items.Items;

            return res;
        }
Esempio n. 2
0
        public PyDict EncodeChanges()
        {
            PyDict res = new PyDict();
            PyDict tmp = new PyDict();

            // Iterate through the session data
            foreach (PyString s in session.Dictionary.Keys)
            {
                PyTuple value = session[s].As<PyTuple>();

                PyObject last = value.Items[0];
                PyObject current = value.Items[1];

                // Check if they have the same type and value
                if (last != current)
                {
                    // Add the change to the dict
                    PyTuple change = new PyTuple();

                    change.Items.Add(last);
                    change.Items.Add(current);

                    res.Set(s.Value, change);

                    // Update the session with the new last value
                    PyTuple update = new PyTuple();

                    update.Items.Add(current);
                    update.Items.Add(current);

                    // We cant modify the session here, just store it on something temporal
                    tmp[s] = update;
                }
                else
                {
                    // We havent updated anything, but this would be later set as the session
                    // This will prevent the loss of session data
                    tmp[s] = value;
                }
            }

            // Send back the session from temporal to the final storage
            session = tmp;

            return res;
        }
        public PyObject Encode()
        {
            PyTuple header = new PyTuple();
            PyTuple args = new PyTuple();
            PyToken exception = new PyToken(exception_type);
            PyDict keywords = new PyDict();

            args.Items.Add(new PyString(reason));

            keywords.Set("reasonArgs", reasonArgs);
            keywords.Set("clock", new PyLongLong(clock));
            keywords.Set("region", new PyString(region));
            keywords.Set("reason", new PyString(reason));
            keywords.Set("version", new PyFloat(version));
            keywords.Set("build", new PyInt(build));
            keywords.Set("codename", new PyString(codename));
            keywords.Set("machoVersion", new PyInt(machoVersion));

            header.Items.Add(exception);
            header.Items.Add(args);
            header.Items.Add(keywords);

            return new PyObjectEx(false, header);
        }
Esempio n. 4
0
        public PyObject GetInitVals(PyTuple args, object client)
        {
            Log.Debug("machoNet", "Called GetInitVals stub");

            if (Cache.LoadCacheFor("machoNet.serviceInfo") == false)
            {
                // Cache does not exists, create it
                PyDict dict = new PyDict();

                dict.Set("trademgr", new PyString("station"));
                dict.Set("tutorialSvc", new PyString("station"));
                dict.Set("bookmark", new PyString("station"));
                dict.Set("slash", new PyString("station"));
                dict.Set("wormholeMgr", new PyString("station"));
                dict.Set("account", new PyString("station"));
                dict.Set("gangSvc", new PyString("station"));
                dict.Set("contractMgr", new PyString("station"));

                dict.Set("LSC", new PyString("location"));
                dict.Set("station", new PyString("location"));
                dict.Set("config", new PyString("locationPreferred"));

                dict.Set("scanMgr", new PyString("solarsystem"));
                dict.Set("keeper", new PyString("solarsystem"));

                dict.Set("stationSvc", new PyNone());
                dict.Set("zsystem", new PyNone());
                dict.Set("invbroker", new PyNone());
                dict.Set("droneMgr", new PyNone());
                dict.Set("userSvc", new PyNone());
                dict.Set("map", new PyNone());
                dict.Set("beyonce", new PyNone());
                dict.Set("standing2", new PyNone());
                dict.Set("ram", new PyNone());
                dict.Set("DB", new PyNone());
                dict.Set("posMgr", new PyNone());
                dict.Set("voucher", new PyNone());
                dict.Set("entity", new PyNone());
                dict.Set("damageTracker", new PyNone());
                dict.Set("agentMgr", new PyNone());
                dict.Set("dogmaIM", new PyNone());
                dict.Set("machoNet", new PyNone());
                dict.Set("dungeonExplorationMgr", new PyNone());
                dict.Set("watchdog", new PyNone());
                dict.Set("ship", new PyNone());
                dict.Set("DB2", new PyNone());
                dict.Set("market", new PyNone());
                dict.Set("dungeon", new PyNone());
                dict.Set("npcSvc", new PyNone());
                dict.Set("sessionMgr", new PyNone());
                dict.Set("allianceRegistry", new PyNone());
                dict.Set("cache", new PyNone());
                dict.Set("character", new PyNone());
                dict.Set("factory", new PyNone());
                dict.Set("facWarMgr", new PyNone());
                dict.Set("corpStationMgr", new PyNone());
                dict.Set("authentication", new PyNone());
                dict.Set("effectCompiler", new PyNone());
                dict.Set("charmgr", new PyNone());
                dict.Set("BSD", new PyNone());
                dict.Set("reprocessingSvc", new PyNone());
                dict.Set("billingMgr", new PyNone());
                dict.Set("billMgr", new PyNone());
                dict.Set("lookupSvc", new PyNone());
                dict.Set("emailreader", new PyNone());
                dict.Set("lootSvc", new PyNone());
                dict.Set("http", new PyNone());
                dict.Set("repairSvc", new PyNone());
                dict.Set("gagger", new PyNone());
                dict.Set("dataconfig", new PyNone());
                dict.Set("lien", new PyNone());
                dict.Set("i2", new PyNone());
                dict.Set("pathfinder", new PyNone());
                dict.Set("alert", new PyNone());
                dict.Set("director", new PyNone());
                dict.Set("dogma", new PyNone());
                dict.Set("aggressionMgr", new PyNone());
                dict.Set("corporationSvc", new PyNone());
                dict.Set("certificateMgr", new PyNone());
                dict.Set("clones", new PyNone());
                dict.Set("jumpCloneSvc", new PyNone());
                dict.Set("insuranceSvc", new PyNone());
                dict.Set("corpmgr", new PyNone());
                dict.Set("warRegistry", new PyNone());
                dict.Set("corpRegistry", new PyNone());
                dict.Set("objectCaching", new PyNone());
                dict.Set("counter", new PyNone());
                dict.Set("petitioner", new PyNone());
                dict.Set("LPSvc", new PyNone());
                dict.Set("clientStatsMgr", new PyNone());
                dict.Set("jumpbeaconsvc", new PyNone());
                dict.Set("debug", new PyNone());
                dict.Set("languageSvc", new PyNone());
                dict.Set("skillMgr", new PyNone());
                dict.Set("voiceMgr", new PyNone());
                dict.Set("onlineStatus", new PyNone());
                dict.Set("gangSvcObjectHandler", new PyNone());

                Cache.SaveCacheFor("machoNet.serviceInfo", dict, DateTime.Now.ToFileTimeUtc());
            }

            PyObject srvInfo = Cache.GetCacheData("machoNet.serviceInfo");
            PyTuple res = new PyTuple();
            PyDict initvals = new PyDict();

            res.Items.Add(srvInfo);
            res.Items.Add(initvals); // Rest of the cache data

            return res;
        }
Esempio n. 5
0
        public static PyObject DBResultToRowset(ref MySqlDataReader dat)
        {
            int column = dat.FieldCount;
            if (column == 0)
            {
                return new PyObjectData("util.Rowset", new PyDict());
            }

            PyDict args = new PyDict();

            PyList header = new PyList();
            for (int i = 0; i < column; i++)
            {
                header.Items.Add(new PyString(dat.GetName(i)));
            }

            args.Set("header", header);

            args.Set("RowClass", new PyToken("util.Row"));

            PyList rowlist = new PyList();

            while (dat.Read())
            {
                PyList linedata = new PyList();
                for (int r = 0; r < column; r++)
                {
                    linedata.Items.Add(DBColumnToPyObject(r, ref dat));
                }

                rowlist.Items.Add(linedata);
            }

            dat.Close();

            return new PyObjectData("util.Rowset", args);
        }
Esempio n. 6
0
        public static PyDict GetCacheHints()
        {
            PyDict result = new PyDict();

            for(int i = 0; i < LoginCacheTableSize; i ++)
            {
                result.Set(LoginCacheTable[i], GetCacheData(LoginCacheTable[i]));
            }

            return result;
        }