Aurora.Addon.WebUI.WebUIHTTPHandler.GetGroups C# (CSharp) Method

GetGroups() private method

private GetGroups ( OSDMap map ) : OSDMap
map OSDMap
return OSDMap
        private OSDMap GetGroups(OSDMap map)
        {
            OSDMap resp = new OSDMap();
            uint start = map.ContainsKey("Start") ? map["Start"].AsUInteger() : 0;
            resp["Start"] = start;
            resp["Total"] = 0;

            IGroupsServiceConnector groups = DataPlugins.RequestPlugin<IGroupsServiceConnector>();
            OSDArray Groups = new OSDArray();
            if (groups != null)
            {
                Dictionary<string, bool> sort       = new Dictionary<string, bool>();
                Dictionary<string, bool> boolFields = new Dictionary<string, bool>();

                if (map.ContainsKey("Sort") && map["Sort"].Type == OSDType.Map)
                {
                    OSDMap fields = (OSDMap)map["Sort"];
                    foreach (string field in fields.Keys)
                    {
                        sort[field] = int.Parse(fields[field]) != 0;
                    }
                }
                if (map.ContainsKey("BoolFields") && map["BoolFields"].Type == OSDType.Map)
                {
                    OSDMap fields = (OSDMap)map["BoolFields"];
                    foreach (string field in fields.Keys)
                    {
                        boolFields[field] = int.Parse(fields[field]) != 0;
                    }
                }
                List<GroupRecord> reply = groups.GetGroupRecords(
                    AdminAgentID,
                    start,
                    map.ContainsKey("Count") ? map["Count"].AsUInteger() : 10,
                    sort,
                    boolFields
                );
                if (reply.Count > 0)
                {
                    foreach (GroupRecord groupReply in reply)
                    {
                        Groups.Add(GroupRecord2OSDMap(groupReply));
                    }
                }
                resp["Total"] = groups.GetNumberOfGroups(AdminAgentID, boolFields);
            }

            resp["Groups"] = Groups;
            return resp;
        }