Exemplo n.º 1
0
        //return list of all groups at given server and success state too
        public List <CIMTConGroup> GetAllGroups(out MTRetCode requestResult)
        {
            List <CIMTConGroup> result = new List <CIMTConGroup>();

            requestResult = MTRetCode.MT_RET_ERROR;
            if (!CheckIfMannagerWorks())
            {
                return(result);
            }

            try
            {
                var serverGroupCount = m_manager.GroupTotal();
                for (uint i = 0; i < serverGroupCount; i++)
                {
                    var actGroup = m_manager.GroupCreate();
                    requestResult = m_manager.GroupNext(i, actGroup);

                    if (requestResult == MTRetCode.MT_RET_OK)
                    {
                        result.Add(actGroup);
                    }
                    else
                    {
                        LogOut($"Error getting group: group_id={i} error msg={requestResult}");
                    }
                }
            }
            catch (Exception ex)
            {
                LogOut($"Error getting group:  error={ex}");
            }

            return(result);
        }