Microsoft.Protocols.TestSuites.MS_OXCPERM.MS_OXCPERMAdapter.ParseUserListFromRawData C# (CSharp) Method

ParseUserListFromRawData() private method

Parse the values from server
private ParseUserListFromRawData ( List &permissionUserList, byte &rawData ) : bool
permissionUserList List Permission user list
rawData byte The values from server
return bool
        private bool ParseUserListFromRawData(out List<PermissionUserInfo> permissionUserList, ref byte[] rawData)
        {
            permissionUserList = new List<PermissionUserInfo>();

            // Don't need to get the RopId(1byte) InputHandleIndex(1byte).
            int index = 0x0c;

            // Get the ReturnValue, ReturnValue 4 byte.     
            uint returnValue = (uint)BitConverter.ToInt32(rawData, index);
            if (returnValue != UINT32SUCCESS)
            {
                return false;
            }

            // Ignore Origin(1 byte)
            index += 5;

            // RowCout 
            int rowCount = BitConverter.ToInt16(rawData, index);
            index += 2;
            while (rowCount > 0)
            {
                // Flag 1 byte
                ++index;
                PermissionUserInfo permissionUserInfo = new PermissionUserInfo
                {
                    PidTagMemberId = (ulong)BitConverter.ToInt64(rawData, index)
                };

                // PT_I8  PidTagMemberId               
                index += 8;

                // PT_UNICODE  PidTagMemberName
                int countString = index;
                for (; countString < rawData.Length;)
                {
                    if (rawData[countString] == 0x00 && rawData[countString + 1] == 0x00)
                    {
                        break;
                    }

                    countString += 2;
                }

                byte[] byteTemp = new byte[countString - index];
                Array.Copy(rawData, index, byteTemp, 0x00, countString - index);
                string strTemp = Encoding.Unicode.GetString(byteTemp);
                permissionUserInfo.PidTagMemberName = strTemp; // BitConverter.(rawData, nIndex, nCountString - nIndex+1);
                index = countString + 2;

                // PT_LONG  PidTagMemberRights
                byte[] nrights = new byte[4];
                Array.Copy(rawData, index, nrights, 0x00, 0x0004);
                permissionUserInfo.PidTagMemberRights = this.GetRightsByByteArray(ref nrights);
                index += 4;

                // PT_BINARY PidTagEntryId               
                int ncount = 0x02; // COUNT: 16 bits wide
                byte[] countValue = new byte[0x02];
                Array.Copy(rawData, index, countValue, 0x00, ncount);
                int nwide = BitConverter.ToInt16(countValue, 0x0000);
                byte[] nvalue = new byte[nwide];
                index += 2;
                if (nwide > 0)
                {
                    Array.Copy(rawData, index, nvalue, 0x00, nwide - 1);
                }

                index += nwide;
                permissionUserInfo.PidTagEntryId = nvalue;
                permissionUserList.Add(permissionUserInfo);
                --rowCount;
            }

            return true;
        }
MS_OXCPERMAdapter