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. 2
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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
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();
            }
        }
Esempio n. 5
0
 public Entry(Map m)
 {
     IsAlternativeImageEnabled = m["alt_image_enable"].AsBoolean;
     IsAutoLoop             = m["auto_loop"].AsBoolean;
     IsAutoPlay             = m["auto_play"].AsBoolean;
     IsAutoScale            = m["auto_scale"].AsBoolean;
     IsAutoZoom             = m["auto_zoom"].AsBoolean;
     Controls               = (PrimitiveMediaControls)m["controls"].AsInt;
     CurrentURL             = m["current_url"].ToString();
     IsInteractOnFirstClick = m["first_click_interact"].AsBoolean;
     Height              = m["height_pixels"].AsInt;
     HomeURL             = m["home_url"].ToString();
     ControlPermissions  = (PrimitiveMediaPermission)m["perms_control"].AsInt;
     InteractPermissions = (PrimitiveMediaPermission)m["perms_interact"].AsInt;
     if (m["whitelist"] is AnArray)
     {
         AnArray a = (AnArray)m["whitelist"];
         WhiteList = new string[a.Count];
         for (int i = 0; i < a.Count; ++i)
         {
             WhiteList[i] = a[i].ToString();
         }
     }
     IsWhiteListEnabled = m["whitelist_enable"].AsBoolean;
     Width = m["width_pixels"].AsInt;
 }
 public void SendEstateTerrainHeights(
     ScriptInstance instance,
     ViewerAgentAccessor agent,
     AnArray list)
 {
     if (list.Count % 3 != 0)
     {
         return;
     }
     lock (instance)
     {
         ViewerConnection vc;
         ViewerCircuit    viewerCircuit;
         if (m_Clients.TryGetValue(agent.AgentID, out vc) &&
             vc.ViewerCircuits.TryGetValue((uint)agent.CircuitCode, out viewerCircuit))
         {
             var msg = new EstateOwnerMessage
             {
                 AgentID   = agent.AgentID,
                 SessionID = viewerCircuit.SessionID,
                 Method    = "textureheights"
             };
             for (int i = 0; i < list.Count; i += 3)
             {
                 double lowVal  = list[i + 1].AsReal;
                 double highVal = list[i + 2].AsReal;
                 msg.ParamList.Add(string.Format(CultureInfo.InvariantCulture, "{0} {1} {2}", list[i].AsInt, lowVal, highVal).ToUTF8Bytes());
             }
             viewerCircuit.SendMessage(msg);
         }
     }
 }
        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);
                }
            }
        }
 public void SendObjectDeselect(
     ScriptInstance instance,
     ViewerAgentAccessor agent,
     AnArray objectlocalids)
 {
     lock (instance)
     {
         ViewerConnection vc;
         ViewerCircuit    viewerCircuit;
         if (m_Clients.TryGetValue(agent.AgentID, out vc) &&
             vc.ViewerCircuits.TryGetValue((uint)agent.CircuitCode, out viewerCircuit))
         {
             var msg = new ObjectDeselect
             {
                 AgentID   = viewerCircuit.AgentID,
                 SessionID = viewerCircuit.SessionID,
             };
             foreach (IValue iv in objectlocalids)
             {
                 msg.ObjectData.Add(iv.AsUInt);
             }
             viewerCircuit.SendMessage(msg);
         }
     }
 }
 public void SendEstateTerrainDetail(
     ScriptInstance instance,
     ViewerAgentAccessor agent,
     AnArray list)
 {
     if (list.Count % 2 != 0)
     {
         return;
     }
     lock (instance)
     {
         ViewerConnection vc;
         ViewerCircuit    viewerCircuit;
         if (m_Clients.TryGetValue(agent.AgentID, out vc) &&
             vc.ViewerCircuits.TryGetValue((uint)agent.CircuitCode, out viewerCircuit))
         {
             var msg = new EstateOwnerMessage
             {
                 AgentID   = agent.AgentID,
                 SessionID = viewerCircuit.SessionID,
                 Method    = "texturedetail"
             };
             for (int i = 0; i < list.Count; i += 2)
             {
                 msg.ParamList.Add($"{list[i].AsInt} {list[i + 1].AsUUID}".ToUTF8Bytes());
             }
             viewerCircuit.SendMessage(msg);
         }
     }
 }
        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. 11
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. 12
0
            public void HttpRequestHandler(HttpRequest httpreq)
            {
                if (httpreq.Method != "GET")
                {
                    httpreq.ErrorResponse(HttpStatusCode.MethodNotAllowed, "Method not allowed");
                    return;
                }
                RegionInfo info = m_Scene.GetRegionInfo();

                var resdata = new AnArray
                {
                    new Map
                    {
                        { "description", VersionInfo.ProductName },
                        { "name", info.ProductName },
                        { "sku", VersionInfo.SimulatorVersion }
                    }
                };

                using (HttpResponse res = httpreq.BeginResponse("application/llsd+xml"))
                    using (Stream s = res.GetOutputStream())
                    {
                        LlsdXml.Serialize(resdata, s);
                    }
            }
Esempio n. 13
0
        public Map WriteMap()
        {
            var w = new Map
            {
                { "AlphaMaskCutoff", AlphaMaskCutoff },
                { "DiffuseAlphaMode", DiffuseAlphaMode },
                { "EnvIntensity", EnvIntensity },
                { "NormMap", NormMap },
                { "NormOffsetX", NormOffsetX },
                { "NormOffsetY", NormOffsetY },
                { "NormRepeatX", NormRepeatX },
                { "NormRepeatY", NormRepeatY },
                { "NormRotation", NormRotation }
            };
            var spec = new AnArray
            {
                SpecColor.R_AsByte,
                SpecColor.G_AsByte,
                SpecColor.B_AsByte,
                SpecColor.A_AsByte
            };

            w.Add("SpecColor", spec);
            w.Add("SpecExp", SpecExp);
            w.Add("SpecMap", SpecMap);
            w.Add("SpecOffsetX", SpecOffsetX);
            w.Add("SpecOffsetY", SpecOffsetY);
            w.Add("SpecRepeatX", SpecRepeatX);
            w.Add("SpecRepeatY", SpecRepeatY);
            w.Add("SpecRotation", SpecRotation);
            return(w);
        }
        public void SendParcelSelectObjects(
            ScriptInstance instance,
            ViewerAgentAccessor agent,
            int localID,
            int returnType,
            AnArray returnIds)
        {
            lock (instance)
            {
                ViewerConnection vc;
                ViewerCircuit    viewerCircuit;
                if (m_Clients.TryGetValue(agent.AgentID, out vc) &&
                    vc.ViewerCircuits.TryGetValue((uint)agent.CircuitCode, out viewerCircuit))
                {
                    var msg = new ParcelSelectObjects
                    {
                        AgentID    = agent.AgentID,
                        SessionID  = viewerCircuit.SessionID,
                        LocalID    = localID,
                        ReturnType = (ObjectReturnType)returnType
                    };

                    foreach (IValue iv in returnIds)
                    {
                        msg.ReturnIDs.Add(iv.AsUUID);
                    }

                    viewerCircuit.SendMessage(msg);
                }
            }
        }
Esempio n. 15
0
        public void NotNull()
        {
            AssertPasses(new string[] { }, AnArray.NotNull <string>());
            AssertPasses(new int?[] { }, AnArray.NotNull <int?>());

            AssertFails(null, AnArray.NotNull <string>());
            AssertFails(null, AnArray.NotNull <int?>());
        }
        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. 17
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);
                }
        }
Esempio n. 18
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);
                }
            }
        }
Esempio n. 19
0
        public void EmptyOrNull()
        {
            AssertPasses(new string[] {}, AnArray.EmptyOrNull <string>());
            AssertPasses(new int?[] {}, AnArray.EmptyOrNull <int?>());

            AssertPasses(null, AnArray.EmptyOrNull <string>());
            AssertPasses(null, AnArray.EmptyOrNull <int?>());

            AssertFails(new string[] { "1" }, AnArray.EmptyOrNull <string>());
            AssertFails(new int?[] { 1 }, AnArray.EmptyOrNull <int?>());
        }
Esempio n. 20
0
        public void NotEmpty()
        {
            AssertPasses(new string[] { "1" }, AnArray.NotEmpty <string>());
            AssertPasses(new int?[] { 1 }, AnArray.NotEmpty <int?>());

            AssertFails(null, AnArray.NotEmpty <string>());
            AssertFails(null, AnArray.NotEmpty <int?>());

            AssertFails(new string[] {}, AnArray.NotEmpty <string>());
            AssertFails(new int?[] {}, AnArray.NotEmpty <int?>());
        }
Esempio n. 21
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. 22
0
        public static Message DeserializeEQG(IValue value)
        {
            MapType mapType = (MapType)value;
            AnArray array   = (AnArray)mapType["AgentData"];
            MapType dataMap = (MapType)array[0];

            return(new AgentDropGroup
            {
                AgentID = dataMap["AgentID"].AsUUID,
                GroupID = dataMap["GroupID"].AsUUID
            });
        }
Esempio n. 23
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);
                }
            }
        }
Esempio n. 24
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);
                }
            }
        }
        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. 26
0
        public static KeyframedMotion Deserialize(Stream input)
        {
            var     data = (Map)LlsdBinary.Deserialize(input);
            var     m    = new KeyframedMotion();
            AnArray pos  = null;
            AnArray rot  = null;
            AnArray durations;

            m.PlayMode         = (Mode)data["mode"].AsInt;
            m.IsRunning        = data["running"].AsBoolean;
            m.IsRunningReverse = data["runningreverse"].AsBoolean;

            durations = (AnArray)data["durations"];
            if (data.ContainsKey("positions"))
            {
                pos      = data["positions"] as AnArray;
                m.Flags |= DataFlags.Translation;
                if (durations.Count != pos.Count)
                {
                    throw new KeyframeFormatException("Positions.Count does not match Durations.Count");
                }
            }

            if (data.ContainsKey("rotations"))
            {
                rot      = data["rotations"] as AnArray;
                m.Flags |= DataFlags.Rotation;
                if (durations.Count != rot.Count)
                {
                    throw new KeyframeFormatException("Rotations.Count does not match Durations.Count");
                }
            }

            for (int i = 0; i < durations.Count; ++i)
            {
                var frame = new Keyframe
                {
                    Duration = durations[i].AsReal
                };
                if (rot != null)
                {
                    frame.TargetRotation = rot[i].AsQuaternion;
                }
                if (pos != null)
                {
                    frame.TargetPosition = pos[i].AsVector3;
                }
                m.Add(frame);
            }

            return(m);
        }
Esempio n. 27
0
        public static Message DeserializeEQG(IValue value)
        {
            Types.Map map   = (Types.Map)value;
            AnArray   array = (AnArray)map["Script"];

            Types.Map script = (Types.Map)array[0];
            return(new ScriptRunningReply
            {
                ObjectID = script["ObjectID"].AsUUID,
                ItemID = script["ItemID"].AsUUID,
                IsRunning = script["Running"].AsBoolean
            });
        }
Esempio n. 28
0
        private static void SerializeArray(TextWriter io, AnArray arr)
        {
            io.Write('[');
            string needcomma = string.Empty;

            foreach (var val in arr)
            {
                io.Write(needcomma);
                SerializeData(io, val);
                needcomma = ",";
            }
            io.Write("]");
        }
Esempio n. 29
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);
        }
Esempio n. 30
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);
        }