Esempio n. 1
0
        private void HandleObjectMediaRequest(HttpRequest httpreq, Map reqmap)
        {
            UUID       objectID = reqmap["object_id"].AsUUID;
            ObjectPart part;

            try
            {
                part = m_Scene.Primitives[objectID];
            }
            catch
            {
                using (HttpResponse resp = httpreq.BeginResponse(HttpStatusCode.OK, "OK"))
                {
                    resp.ContentType = "text/plain";
                }
                return;
            }

            var res = new Map
            {
                ["object_id"] = objectID
            };
            var mediaList = part.Media;

            if (mediaList == null)
            {
                using (var resp = httpreq.BeginResponse(HttpStatusCode.OK, "OK"))
                {
                    resp.ContentType = "text/plain";
                }
                return;
            }
            var mediaData = new AnArray();

            foreach (var entry in part.Media)
            {
                if (entry != null)
                {
                    mediaData.Add((Map)entry);
                }
                else
                {
                    mediaData.Add(new Undef());
                }
            }
            res.Add("object_media_data", mediaData);
            res.Add("object_media_version", part.MediaURL);
            using (var resp = httpreq.BeginResponse(HttpStatusCode.OK, "OK"))
            {
                resp.ContentType = "application/llsd+xml";
                using (var o = resp.GetOutputStream())
                {
                    LlsdXml.Serialize(res, o);
                }
            }
        }
        private void GetExperiencesResponse(ViewerAgent agent, AgentCircuit circuit, HttpRequest req)
        {
            Dictionary <UEI, bool> result = circuit.Scene.ExperienceService.Permissions[agent.Owner];
            var resdata = new Map();
            var allowed = new AnArray();
            var blocked = new AnArray();

            resdata.Add("experiences", allowed);
            resdata.Add("blocked", blocked);

            foreach (KeyValuePair <UEI, bool> kvp in result)
            {
                if (kvp.Value)
                {
                    allowed.Add(kvp.Key.ID);
                }
                else
                {
                    blocked.Add(kvp.Key.ID);
                }
            }

            using (var res = req.BeginResponse("application/llsd+xml"))
            {
                using (Stream s = res.GetOutputStream())
                {
                    LlsdXml.Serialize(resdata, s);
                }
            }
        }
Esempio n. 3
0
        private void PackagesAvailableList(HttpRequest req, Map jsondata)
        {
            var res = new Map();

            try
            {
                CoreUpdater.Instance.UpdatePackageFeed();
                var pkglist = new AnArray();
                foreach (var kvp in CoreUpdater.Instance.AvailablePackages)
                {
                    var pkg = new Map
                    {
                        { "name", kvp.Key },
                        { "version", kvp.Value }
                    };
                    pkglist.Add(pkg);
                }
                res.Add("list", pkglist);
            }
            catch
            {
                m_WebIF.ErrorResponse(req, AdminWebIfErrorResult.NotPossible);
                return;
            }

            m_WebIF.SuccessResponse(req, res);
        }
        public override IValue SerializeEQG()
        {
            var location  = new AnArray();
            var agentdata = new AnArray();
            var index     = new AnArray
            {
                new MapType
                {
                    { "Prey", Prey },
                    { "You", You }
                }
            };

            foreach (AgentDataEntry d in AgentData)
            {
                location.Add(new MapType
                {
                    { "X", d.X },
                    { "Y", d.Y },
                    { "Z", d.Z }
                });

                agentdata.Add(new MapType
                {
                    ["AgentID"] = d.AgentID
                });
            }

            return(new MapType
            {
                ["Index"] = index,
                ["Location"] = location,
                ["AgentData"] = agentdata
            });
        }
Esempio n. 5
0
        public override IValue SerializeEQG()
        {
            var paramList = new AnArray();

            foreach (byte[] p in ParamList)
            {
                paramList.Add(new MapType {
                    { "Parameter", p.FromUTF8Bytes() }
                });
            }

            return(new MapType
            {
                { "AgentData",
                  new AnArray
                  {
                      new MapType
                      {
                          { "AgentID", AgentID },
                          { "SessionID", SessionID },
                          { "TransactionID", TransactionID }
                      }
                  } },
                { "MethodData",
                  new AnArray
                  {
                      new MapType
                      {
                          { "Method", Method },
                          { "Invoice", Invoice }
                      }
                  } },
                { "ParamList", paramList }
            });
        }
Esempio n. 6
0
        private void UpdateMaterials()
        {
            byte[] buf;
            using (var ms = new MemoryStream())
            {
                var matArray = new AnArray();
                foreach (var kvp in m_Materials)
                {
                    matArray.Add(new Map
                    {
                        ["ID"]       = kvp.Key,
                        ["Material"] = kvp.Value.WriteMap()
                    });
                }

                using (var gz = new ZlibStream(ms, CompressionMode.Compress, CompressionLevel.BestCompression))
                {
                    LlsdBinary.Serialize(matArray, gz);
                }
                buf = ms.ToArray();
            }
            using (var ms = new MemoryStream())
            {
                using (var writer = ms.UTF8XmlTextWriter())
                {
                    writer.WriteStartElement("llsd");
                    writer.WriteStartElement("map");
                    writer.WriteNamedValue("key", "Zipped");
                    writer.WriteNamedValue("binary", buf);
                    writer.WriteEndElement();
                    writer.WriteEndElement();
                }
                m_MaterialsData = ms.ToArray();
            }
        }
        public override IValue SerializeEQG()
        {
            var llsd = new MapType
            {
                ["AgentData"] = new AnArray
                {
                    new MapType
                    {
                        ["AgentID"]   = AgentID,
                        ["SessionID"] = SessionID
                    }
                }
            };
            var folderDataArray = new AnArray();

            foreach (var folder in FolderData)
            {
                folderDataArray.Add(new MapType
                {
                    ["FolderID"] = folder,
                    ["AgentID"]  = AgentID
                });
            }
            llsd.Add("FolderData", folderDataArray);

            return(llsd);
        }
Esempio n. 8
0
        public override IValue SerializeEQG()
        {
            var llsd = new MapType
            {
                ["AgentData"] = new AnArray
                {
                    new MapType
                    {
                        ["AgentID"]   = AgentID,
                        ["SessionID"] = SessionID
                    }
                }
            };
            var itemDataArray = new AnArray();

            foreach (UUID itemID in InventoryData)
            {
                var itemData = new MapType
                {
                    ["ItemID"]  = itemID,
                    ["AgentID"] = AgentID
                };
                itemDataArray.Add(itemData);
            }
            llsd.Add("InventoryData", itemDataArray);

            return(llsd);
        }
 public void AddRemovedItem(InventoryItem item)
 {
     if (item.AssetType == AssetType.Gesture && (item.Flags & InventoryFlags.GestureActive) != 0)
     {
         m_ActiveGesturesRemoved.Add(item.ID);
     }
     m_CategoryItemsRemoved.Add(item.ID);
 }
Esempio n. 10
0
        public AnArray GetEstateManagersList(ScriptInstance instance)
        {
            var res = new AnArray();

            lock (instance)
            {
                ObjectPart             part          = instance.Part;
                ObjectGroup            grp           = part.ObjectGroup;
                SceneInterface         scene         = grp.Scene;
                EstateServiceInterface estateService = scene.EstateService;
                foreach (UGUI agent in estateService.EstateManager.All[scene.ParentEstateID])
                {
                    res.Add(new LSLKey(agent.ID));
                    res.Add(agent.HomeURI?.ToString() ?? string.Empty);
                }
            }
            return(res);
        }
Esempio n. 11
0
        private void HandleDetailsReport(HttpRequest httpreq, UUID parcelID)
        {
            var parcels = new AnArray();

            ParcelInfo pinfo;

            if (m_Scene.Parcels.TryGetValue(parcelID, out pinfo))
            {
                var parcelobjects = new AnArray();
                var parcel        = new Map
                {
                    { "id", pinfo.ID },
                    { "local_id", pinfo.LocalID },
                    { "name", pinfo.Name },
                    { "owner_id", pinfo.Owner.ID },
                    { "objects", parcelobjects }
                };
                parcels.Add(parcel);

                foreach (ObjectGroup grp in m_Scene.ObjectGroups)
                {
                    Vector3 loc    = grp.GlobalPosition;
                    int     urls   = 0;
                    int     memory = 0;
                    if (!grp.IsAttached && pinfo.LandBitmap.ContainsLocation(loc))
                    {
                        parcelobjects.Add(new Map
                        {
                            { "id", grp.ID },
                            { "name", grp.Name },
                            { "owner_id", grp.Owner.ID },
                            { "owner_name", m_Scene.AvatarNameService.ResolveName(grp.Owner).FullName },
                            { "location", new Map
                              {
                                  { "x", loc.X },
                                  { "y", loc.Y },
                                  { "z", loc.Z }
                              } },
                            { "resources", new Map
                              {
                                  { "urls", urls },
                                  { "memory", memory }
                              } }
                        });
                    }
                }
            }

            using (HttpResponse res = httpreq.BeginResponse("applicaton/llsd+xml"))
                using (Stream s = res.GetOutputStream())
                {
                    LlsdXml.Serialize(new Map {
                        { "parcels", parcels }
                    }, s);
                }
        }
        private void HandleRegionExperiencesGet(ViewerAgent agent, AgentCircuit circuit, HttpRequest httpreq)
        {
            var allowed = new List <UEI>();
            var blocked = new List <UEI>();

            SceneInterface scene = circuit.Scene;

            if (scene == null)
            {
                httpreq.ErrorResponse(HttpStatusCode.InternalServerError, "Internal server error");
                return;
            }
            EstateServiceInterface estateService = scene.EstateService;

            foreach (EstateExperienceInfo info in estateService.Experiences[scene.ParentEstateID])
            {
                if (info.IsAllowed)
                {
                    allowed.Add(info.ExperienceID);
                }
                else
                {
                    blocked.Add(info.ExperienceID);
                }
            }
            List <UEI> trusted = estateService.TrustedExperiences[scene.ParentEstateID];

            Map     resdata = new Map();
            AnArray array   = new AnArray();

            foreach (UEI id in allowed)
            {
                array.Add(id.ID);
            }
            resdata.Add("allowed", array);
            array = new AnArray();
            foreach (UEI id in blocked)
            {
                array.Add(id.ID);
            }
            resdata.Add("blocked", array);
            array = new AnArray();
            foreach (UEI id in trusted)
            {
                array.Add(id.ID);
            }
            resdata.Add("trusted", array);

            using (HttpResponse res = httpreq.BeginResponse("application/llsd+xml"))
            {
                using (Stream o = res.GetOutputStream())
                {
                    LlsdXml.Serialize(resdata, o);
                }
            }
        }
Esempio n. 13
0
        private void HandleSummaryReport(HttpRequest httpreq, UUID parcelID)
        {
            var available = new AnArray();
            var used      = new AnArray();
            var resdata   = new Map
            {
                { "summary", new Map
                  {
                      { "available", available },
                      { "used", used }
                  } }
            };

            available.Add(new Map
            {
                { "type", "url" },
                { "amount", 5000 }
            });

            available.Add(new Map
            {
                { "type", "memory" },
                { "amount", 1048576 }
            });

            used.Add(new Map
            {
                { "type", "urls" },
                { "amount", 5000 }
            });

            used.Add(new Map
            {
                { "type", "memory" },
                { "amount", 1048576 }
            });

            using (HttpResponse res = httpreq.BeginResponse("application/llsd+xml"))
                using (Stream s = res.GetOutputStream())
                {
                    LlsdXml.Serialize(resdata, s);
                }
        }
Esempio n. 14
0
        private void HandleShowNpcs(HttpRequest req, Map jsondata)
        {
            SceneInterface scene = null;

            if (!jsondata.ContainsKey("regionid") ||
                !m_KnownScenes.TryGetValue(jsondata["regionid"].AsUUID, out scene))
            {
                m_AdminWebIF.ErrorResponse(req, AdminWebIfErrorResult.InvalidRequest);
                return;
            }

            var npcs = new AnArray();

            foreach (NpcAgent agent in m_NpcAgents.Values)
            {
                if (agent.CurrentScene != scene)
                {
                    continue;
                }
                UGUIWithName uui   = agent.NamedOwner;
                var          npcid = new Map
                {
                    { "firstname", uui.FirstName },
                    { "lastname", uui.LastName },
                    { "id", uui.ID }
                };
                uui = m_AdminWebIF.ResolveName(agent.NpcOwner);
                var npcowner = new Map
                {
                    { "fullname", uui.FullName },
                    { "firstname", uui.FirstName },
                    { "lastname", uui.LastName },
                    { "id", uui.ID }
                };
                if (uui.HomeURI != null)
                {
                    npcowner.Add("homeuri", uui.HomeURI);
                }

                var npcdata = new Map
                {
                    { "uui", npcid },
                    { "owner", npcowner },
                    { "persistent", (m_NpcPresenceService != null && m_NpcPresenceService[agent.Owner.ID].Count != 0) }
                };
                npcs.Add(npcdata);
            }
            var res = new Map
            {
                ["npcs"] = npcs
            };

            m_AdminWebIF.SuccessResponse(req, res);
        }
Esempio n. 15
0
        private void RequestHandler(HttpRequest httpreq)
        {
            IValue req;

            if (httpreq.Method != "POST")
            {
                httpreq.ErrorResponse(HttpStatusCode.MethodNotAllowed, "Method not allowed");
                return;
            }

            IValue  res;
            Map     reqmap;
            AnArray reqarr;

            try
            {
                req = Json.Deserialize(httpreq.Body);
            }
            catch
            {
                req = null;
            }

            if ((reqmap = req as Map) != null)
            {
                res = ProcessJsonRequest(reqmap);
            }
            else if ((reqarr = req as AnArray) != null)
            {
                var o = new AnArray();
                foreach (IValue v in reqarr)
                {
                    reqmap = v as Map;
                    if (reqmap != null)
                    {
                        o.Add(ProcessJsonRequest(reqmap));
                    }
                }
                res = o;
            }
            else
            {
                res = FaultResponse(-32700, "Invalid JSON20 RPC Request", string.Empty);
            }

            using (var httpres = httpreq.BeginResponse("application/json-rpc"))
            {
                using (var o = httpres.GetOutputStream())
                {
                    Json.Serialize(res, o);
                }
            }
        }
Esempio n. 16
0
        private void HandleNotice(HttpRequest req, Map jsondata)
        {
            uint   estateID;
            string message;

            if (!jsondata.TryGetValue("id", out estateID) || !jsondata.TryGetValue("message", out message))
            {
                m_WebIF.ErrorResponse(req, AdminWebIfErrorResult.InvalidRequest);
            }
            else
            {
                var regionIds = m_EstateService.RegionMap[estateID];

                if (regionIds.Count == 0)
                {
                    if (m_EstateService.ContainsKey(estateID))
                    {
                        var m = new Map
                        {
                            ["noticed_regions"] = new AnArray()
                        };
                        m_WebIF.SuccessResponse(req, m);
                    }
                    else
                    {
                        m_WebIF.ErrorResponse(req, AdminWebIfErrorResult.NotFound);
                    }
                }
                else
                {
                    var regions = new AnArray();

                    foreach (var regionId in regionIds)
                    {
                        SceneInterface si;
                        if (m_Scenes.TryGetValue(regionId, out si))
                        {
                            regions.Add(regionId);
                            var regionOwner = si.Owner;
                            foreach (var agent in si.RootAgents)
                            {
                                agent.SendRegionNotice(regionOwner, message, regionId);
                            }
                        }
                    }
                    var m = new Map
                    {
                        ["noticed_regions"] = regions
                    };
                    m_WebIF.SuccessResponse(req, m);
                }
            }
        }
        void IInventoryFolderServiceInterface.Add(InventoryFolder folder)
        {
            var m          = new Map();
            var categories = new AnArray();

            m.Add("categories", categories);
            var category = new Map();

            categories.Add(category);
            category.Add("name", folder.Name);
            category.Add("type_default", (int)folder.DefaultType);

            byte[] reqdata;
            using (var ms = new MemoryStream())
            {
                LlsdXml.Serialize(m, ms);
                reqdata = ms.ToArray();
            }

            IValue         res;
            HttpStatusCode statuscode;

            using (Stream sres = new HttpClient.Post(
                       $"{m_CapabilityUri}category/{folder.ParentFolderID}",
                       "application/llsd+xml",
                       reqdata.Length,
                       (Stream s) => s.Write(reqdata, 0, reqdata.Length))
            {
                TimeoutMs = TimeoutMs
            }.ExecuteStreamRequest(out statuscode))
            {
                if (statuscode != HttpStatusCode.Created)
                {
                    throw new InventoryFolderNotFoundException(folder.ParentFolderID);
                }
                res = LlsdXml.Deserialize(sres);
            }
            var resmap = res as Map;

            if (resmap == null)
            {
                throw new InvalidDataException();
            }

            var created_items = resmap["_created_categories"] as AnArray;

            if (created_items == null)
            {
                throw new InvalidDataException();
            }
            folder.ID = created_items[0].AsUUID;
        }
Esempio n. 18
0
        public AnArray GetLandBanList(ScriptInstance instance)
        {
            var res = new AnArray();

            lock (instance)
            {
                ObjectPart     part  = instance.Part;
                ObjectGroup    grp   = part.ObjectGroup;
                SceneInterface scene = grp.Scene;
                ParcelInfo     pInfo;
                if (scene.Parcels.TryGetValue(grp.GlobalPosition, out pInfo))
                {
                    foreach (ParcelAccessEntry pae in scene.Parcels.BlackList[scene.ID, pInfo.ID])
                    {
                        res.Add(new LSLKey(pae.Accessor.ID));
                        res.Add(pae.Accessor.HomeURI?.ToString() ?? string.Empty);
                        res.Add(new LongInteger(pae.ExpiresAt?.AsLong ?? 0));
                    }
                }
            }
            return(res);
        }
Esempio n. 19
0
        private void HandleUserAccountSearch(HttpRequest req, Map jsondata)
        {
            var    res         = new Map();
            var    accountsRes = new AnArray();
            int    start       = 0;
            int    count       = 1000;
            string query;

            if (!jsondata.TryGetValue("query", out query))
            {
                m_WebIF.ErrorResponse(req, AdminWebIfErrorResult.InvalidRequest);
                return;
            }
            int ival;

            if (jsondata.TryGetValue("start", out ival))
            {
                start = ival;
            }
            if (jsondata.TryGetValue("count", out ival))
            {
                count = ival;
            }
            if (count > 1000 || count < 0)
            {
                count = 1000;
            }
            foreach (var acc in m_UserAccountService.GetAccounts(query))
            {
                if (start > 0)
                {
                    --start;
                }
                else
                {
                    if (count-- == 0)
                    {
                        break;
                    }
                    var accountData = new Map
                    {
                        { "id", acc.Principal.ID },
                        { "firstname", acc.Principal.FirstName },
                        { "lastname", acc.Principal.LastName }
                    };
                    accountsRes.Add(accountData);
                }
            }
            res.Add("accounts", accountsRes);
            m_WebIF.SuccessResponse(req, res);
        }
        protected void ProcessReadOfflineMsgs(UUID ownerID, HttpRequest req, OfflineIMServiceInterface offlineIMService)
        {
            if (req.Method != "GET")
            {
                req.ErrorResponse(HttpStatusCode.MethodNotAllowed, "Method not allowed");
                return;
            }

            var resmap = new Map();
            var msgs   = new AnArray();

            resmap.Add("messages", msgs);
            if (offlineIMService != null)
            {
                try
                {
                    foreach (GridInstantMessage gim in offlineIMService.GetOfflineIMs(ownerID))
                    {
                        msgs.Add(new Map
                        {
                            { "binary_bucket", new BinaryData(gim.BinaryBucket) },
                            { "parent_estate_id", gim.ParentEstateID },
                            { "from_agent_id", gim.FromAgent.ID },
                            { "from_group", gim.IsFromGroup },
                            { "dialog", (int)gim.Dialog },
                            { "session_id", gim.IMSessionID },
                            { "timestamp", gim.Timestamp.AsInt },
                            { "from_agent_name", gim.FromAgent.FullName },
                            { "message", gim.Message },
                            { "region_id", gim.RegionID },
                            { "local_x", gim.Position.X },
                            { "local_y", gim.Position.Y },
                            { "local_z", gim.Position.Z },
                            { "asset_id", gim.FromGroup.ID } /* probably this gets changed in feature */
                        });
                    }
                }
                catch
                {
                    /* do not pass exceptions to caller */
                }
            }
            using (HttpResponse res = req.BeginResponse("application/llsd+xml"))
            {
                using (Stream s = res.GetOutputStream())
                {
                    LlsdXml.Serialize(resmap, s);
                }
            }
        }
Esempio n. 21
0
        private void HandleList(HttpRequest req, Map jsondata)
        {
            var estates = m_EstateService.All;

            var res       = new Map();
            var estateRes = new AnArray();

            foreach (EstateInfo estate in estates)
            {
                estateRes.Add(estate.ToJsonMap(m_WebIF));
            }
            res.Add("estates", estateRes);
            m_WebIF.SuccessResponse(req, res);
        }
        public void HandleGroupExperiencesCapability(ViewerAgent agent, AgentCircuit circuit, HttpRequest httpreq)
        {
            if (httpreq.CallerIP != circuit.RemoteIP)
            {
                httpreq.ErrorResponse(HttpStatusCode.Forbidden, "Forbidden");
                return;
            }
            if (httpreq.Method != "GET")
            {
                httpreq.ErrorResponse(HttpStatusCode.MethodNotAllowed, "Method not allowed");
                return;
            }

            SceneInterface scene = circuit.Scene;

            if (scene == null)
            {
                httpreq.ErrorResponse(HttpStatusCode.NotFound, "Not Found");
                return;
            }

            ExperienceServiceInterface experienceService = scene.ExperienceService;

            if (experienceService == null)
            {
                httpreq.ErrorResponse(HttpStatusCode.NotFound, "Not Found");
                return;
            }

            List <UEI> experienceids = experienceService.GetGroupExperiences(agent.Group);
            var        ids           = new AnArray();

            foreach (UEI id in experienceids)
            {
                ids.Add(id.ID);
            }
            var resdata = new Map
            {
                ["experience_ids"] = ids
            };

            using (HttpResponse res = httpreq.BeginResponse("application/llsd+xml"))
            {
                using (Stream o = res.GetOutputStream())
                {
                    LlsdXml.Serialize(resdata, o);
                }
            }
        }
Esempio n. 23
0
 public AnArray GetAgentTextures(ScriptInstance instance, LSLKey agentid)
 {
     lock (instance)
     {
         AnArray res = new AnArray();
         IAgent  agent;
         if (instance.Part.ObjectGroup.Scene.RootAgents.TryGetValue(agentid.AsUUID, out agent))
         {
             foreach (UUID texid in agent.Textures.All)
             {
                 res.Add(texid);
             }
         }
         return(res);
     }
 }
Esempio n. 24
0
        private static AnArray ParseArray(StreamReader io)
        {
            var array = new AnArray();
            var c     = (char)io.Peek();

            if (']' == c)
            {
                c = (char)io.Read();
                return(array);
            }

            for (; ;)
            {
                array.Add(ParseValue(io));
                do
                {
                    c = (char)io.Read();
                } while (char.IsWhiteSpace(c));

                if (c == ']')
                {
                    return(array);
                }
                else if (c == ',')
                {
                    int bc = io.Peek();
                    if (bc == -1)
                    {
                        throw new InvalidJsonSerializationException();
                    }
                    c = (char)bc;

                    if (char.IsWhiteSpace(c))
                    {
                        do
                        {
                            io.Read();
                            c = (char)io.Peek();
                        } while (char.IsWhiteSpace(c));
                    }
                }
                else
                {
                    throw new InvalidJsonSerializationException();
                }
            }
        }
Esempio n. 25
0
        private void PackagesInstalledList(HttpRequest req, Map jsondata)
        {
            var res  = new Map();
            var pkgs = new AnArray();

            foreach (var kvp in CoreUpdater.Instance.InstalledPackages)
            {
                var pkg = new Map
                {
                    { "name", kvp.Key },
                    { "version", kvp.Value }
                };
                pkgs.Add(pkg);
            }
            res.Add("list", pkgs);
            m_WebIF.SuccessResponse(req, res);
        }
Esempio n. 26
0
        public override IValue SerializeEQG()
        {
            var agentDataMap = new MapType
            {
                ["AgentID"] = AgentID
            };
            var agentDataArray = new AnArray
            {
                agentDataMap
            };
            var body = new MapType
            {
                ["AgentData"] = agentDataArray
            };
            var groupDataArray    = new AnArray();
            var newGroupDataArray = new AnArray();

            foreach (GroupDataEntry e in GroupData)
            {
                byte[] groupPowers = BitConverter.GetBytes((ulong)e.GroupPowers);
                if (BitConverter.IsLittleEndian)
                {
                    Array.Reverse(groupPowers);
                }
                groupDataArray.Add(new MapType
                {
                    { "GroupID", e.GroupID },
                    { "GroupInsigniaID", e.GroupInsigniaID },
                    { "Contribution", e.Contribution },
                    { "GroupPowers", new BinaryData(groupPowers) },
                    { "GroupName", e.GroupName },
                    { "AcceptNotices", e.AcceptNotices }
                });
                newGroupDataArray.Add(new MapType
                {
                    { "ListInProfile", e.ListInProfile },
                });
            }
            body.Add("GroupData", groupDataArray);
            body.Add("NewGroupData", newGroupDataArray);

            return(body);
        }
Esempio n. 27
0
        public void GetPrimitiveParams(IEnumerator <IValue> enumerator, AnArray paramList)
        {
            PrimitiveParamsType paramtype = ParamsHelper.GetPrimParamType(enumerator);

            switch (paramtype)
            {
            case PrimitiveParamsType.Name:
                paramList.Add(Name);
                break;

            case PrimitiveParamsType.Desc:
                paramList.Add(Description);
                break;

            case PrimitiveParamsType.Position:
                paramList.Add(Position);
                break;

            case PrimitiveParamsType.PosLocal:
                paramList.Add(LocalPosition);
                break;

            case PrimitiveParamsType.Rotation:
                paramList.Add(GlobalRotation);
                break;

            case PrimitiveParamsType.RotLocal:
                paramList.Add(LocalRotation);
                break;

            case PrimitiveParamsType.Size:
                paramList.Add(Size);
                break;

            default:
                if (Enum.IsDefined(typeof(PrimitiveParamsType), (int)paramtype))
                {
                    throw new LocalizedScriptErrorException(this, "PRIM0NotAllowedForAgents", "{0} not allowed for agents", paramtype.GetLslName());
                }
                else
                {
                    throw new LocalizedScriptErrorException(this, "PRIMInvalidParameterType0", "Invalid primitive parameter type {0}", paramtype.GetLslName());
                }
            }
        }
Esempio n. 28
0
        private void HandleGet(HttpRequest req, Map jsondata)
        {
            EstateInfo estateInfo;
            string     estateName;
            uint       estateID;

            if ((jsondata.TryGetValue("name", out estateName) &&
                 m_EstateService.TryGetValue(estateName, out estateInfo)) ||
                (jsondata.TryGetValue("id", out estateID) &&
                 m_EstateService.TryGetValue(estateID, out estateInfo)))
            {
                /* found estate via name or via id */
            }
            else
            {
                m_WebIF.ErrorResponse(req, AdminWebIfErrorResult.NotFound);
                return;
            }

            var res = new Map();

            res.Add("estate", estateInfo.ToJsonMap(m_WebIF));
            var regionMap   = m_EstateService.RegionMap[estateInfo.ID];
            var regionsdata = new AnArray();

            foreach (UUID regionid in regionMap)
            {
                RegionInfo rInfo;
                var        regiondata = new Map
                {
                    ["ID"] = regionid
                };
                if (m_RegionStorageService.TryGetValue(regionid, out rInfo))
                {
                    regiondata.Add("Name", rInfo.Name);
                }
                regionsdata.Add(regiondata);
            }
            res.Add("regions", regionsdata);

            m_WebIF.SuccessResponse(req, res);
        }
Esempio n. 29
0
        public void Serialize(Stream o)
        {
            AnArray pos       = null;
            AnArray rot       = null;
            var     durations = new AnArray();
            var     r         = new Map
            {
                { "durations", durations },
                { "mode", (int)PlayMode },
                { "currentframe", CurrentFrame },
                { "currenttimeposition", CurrentTimePosition },
                { "running", IsRunning },
                { "runningreverse", IsRunningReverse }
            };

            if ((DataFlags.Rotation & Flags) != 0)
            {
                rot = new AnArray();
                r.Add("rotations", rot);
            }

            if ((DataFlags.Translation & Flags) != 0)
            {
                pos = new AnArray();
                r.Add("positions", pos);
            }

            foreach (Keyframe frame in this)
            {
                if ((DataFlags.Rotation & Flags) != 0)
                {
                    rot.Add(frame.TargetRotation);
                }
                if ((DataFlags.Translation & Flags) != 0)
                {
                    pos.Add(frame.TargetPosition);
                }
                durations.Add(frame.Duration);
            }
            LlsdBinary.Serialize(r, o);
        }
        public override IValue SerializeEQG()
        {
            var objectdata = new AnArray();

            foreach (ObjectDataEntry e in ObjectData)
            {
                objectdata.Add(new MapType
                {
                    { "LocalID", (int)e.LocalID },
                    { "PhysicsShapeType", (int)e.PhysicsShapeType },
                    { "Density", e.Density },
                    { "Friction", e.Friction },
                    { "Restitution", e.Restitution },
                    { "GravityMultiplier", e.GravityMultiplier }
                });
            }

            return(new MapType
            {
                ["ObjectData"] = objectdata
            });
        }