Aurora.Addon.HyperGrid.GatekeeperAgentHandler.DoAgentPost C# (CSharp) 메소드

DoAgentPost() 보호된 메소드

protected DoAgentPost ( Hashtable request, Hashtable responsedata, UUID id ) : void
request System.Collections.Hashtable
responsedata System.Collections.Hashtable
id UUID
리턴 void
        protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id)
        {
            OSDMap args = WebUtils.GetOSDMap ((string)request["body"]);
            if (args == null)
            {
                responsedata["int_response_code"] = HttpStatusCode.BadRequest;
                responsedata["str_response_string"] = "Bad request";
                return;
            }

            // retrieve the input arguments
            int x = 0, y = 0;
            UUID uuid = UUID.Zero;
            string regionname = string.Empty;
            uint teleportFlags = 0;
            if (args.ContainsKey ("destination_x") && args["destination_x"] != null)
                Int32.TryParse (args["destination_x"].AsString (), out x);
            else
                MainConsole.Instance.WarnFormat ("  -- request didn't have destination_x");
            if (args.ContainsKey ("destination_y") && args["destination_y"] != null)
                Int32.TryParse (args["destination_y"].AsString (), out y);
            else
                MainConsole.Instance.WarnFormat ("  -- request didn't have destination_y");
            if (args.ContainsKey ("destination_uuid") && args["destination_uuid"] != null)
                UUID.TryParse (args["destination_uuid"].AsString (), out uuid);
            if (args.ContainsKey ("destination_name") && args["destination_name"] != null)
                regionname = args["destination_name"].ToString ();
            if (args.ContainsKey ("teleport_flags") && args["teleport_flags"] != null)
                teleportFlags = args["teleport_flags"].AsUInteger ();

            GridRegion destination = new GridRegion ();
            destination.RegionID = uuid;
            destination.RegionLocX = x;
            destination.RegionLocY = y;
            destination.RegionName = regionname;

            AgentCircuitData aCircuit = new AgentCircuitData ();
            try
            {
                aCircuit.UnpackAgentCircuitData (args);
            }
            catch (Exception ex)
            {
                MainConsole.Instance.InfoFormat ("[AGENT HANDLER]: exception on unpacking ChildCreate message {0}", ex.Message);
                responsedata["int_response_code"] = HttpStatusCode.BadRequest;
                responsedata["str_response_string"] = "Bad request";
                return;
            }

            OSDMap resp = new OSDMap (2);
            string reason = String.Empty;

            // This is the meaning of POST agent
            //m_regionClient.AdjustUserInformation(aCircuit);
            //bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
            bool result = CreateAgent (destination, aCircuit, teleportFlags, out reason);

            resp["reason"] = OSD.FromString (reason);
            resp["success"] = OSD.FromBoolean (result);
            // Let's also send out the IP address of the caller back to the caller (HG 1.5)
            resp["your_ip"] = OSD.FromString (GetCallerIP (request));

            // TODO: add reason if not String.Empty?
            responsedata["int_response_code"] = HttpStatusCode.OK;
            responsedata["str_response_string"] = OSDParser.SerializeJsonString (resp);
        }