Ejemplo n.º 1
0
        private void AddMethod(ScriptExecutionContext context, HttpMethod method, string name)
        {
            var action = new HttpJson((url, callback, headers) =>
            {
                RequestAsync(context, method, url, null, callback, headers).Forget();
            });

            context.Engine.SetValue(name, action);
        }
Ejemplo n.º 2
0
    public void Start(LogItemQueue log)
    {
        m_Logger = log;
        ServerGroupList list = Configuration.inst().ServerGroups.GetGroupsForServer(UID);

        for (int i = 0; i < list.Count; i++)
        {
            m_strGroups += ((i > 0) ? "," : "") + "\"" + list[i].Name + "\"";
        }

        if (list.Count > 0)
        {
            m_Timer = new Timer(new TimerCallback(Tick), null, 1000, 60000);

            for (int t = 0; t < ThreadCount; t++)
            {
                Connection con = null;
                if (Type == "HTTP/JSON")
                {
                    con = new HttpJson(log, this);
                }
                if (Type == "Wialon")
                {
                    con = new WialonIPSConnection(log, this);
                }
                if (Type == "Dingtek")
                {
                    con = new DingtekConnection(log, this);
                }
                if (Type == "DIMTS")
                {
                    con = new DIMTSConnection(log, this);
                }
                if (Type == "GpsGate")
                {
                    con = new GpsGateConnection(log, this);
                }
                if (Type == "Nagpur")
                {
                    con = new NagpurConnection(log, this);
                }
                if (con != null)
                {
                    connections.Add(con);
                }
            }
        }
    }