コード例 #1
0
        /// <summary>
        /// Extract the avatar UUID encoded in a SIP URI
        /// </summary>
        /// <param name="inName"></param>
        /// <returns></returns>
        public static UUID IDFromName(string inName)
        {
            // The "name" may actually be a SIP URI such as: "sip:[email protected]"
            // If it is, convert to a bare name before doing the transform.
            string name = nameFromsipURI(inName) ?? inName;

            // Doesn't look like a SIP URI, assume it's an actual name.

            // This will only work if the name is of the proper form.
            // As an example, the account name for Monroe Linden (UUID 1673cfd3-8229-4445-8d92-ec3570e5e587) is:
            // "xFnPP04IpREWNkuw1cOXlhw=="

            if ((name.Length == 25) && (name[0] == 'x') && (name[23] == '=') && (name[24] == '='))
            {
                // The name appears to have the right form.

                // Reverse the transforms done by nameFromID
                string temp = name.Replace('-', '+');
                temp = temp.Replace('_', '/');

                byte[] binary = Convert.FromBase64String(temp.Substring(1));
                UUID   u      = UUID.Zero;
                u.FromBytes(binary, 0);
                return(u);
            }

            return(UUID.Zero);
        }
コード例 #2
0
 public override void FromBytes(byte[] bytes, ref int i)
 {
     try {
         ObjectID.FromBytes(bytes, i); i += 16;
     } catch (Exception) {
         throw new MalformedDataException();
     }
 }
コード例 #3
0
            public override void FromBytes(byte[] bytes, ref int i)
            {
                try {
                    Position.FromBytes(bytes, i); i      += sizeof(float) * 3;
                    PositionDelta.FromBytes(bytes, i); i += sizeof(float) * 3;
                    LookAt.FromBytes(bytes, i); i        += sizeof(float) * 3;
                    LookAtDelta.FromBytes(bytes, i); i   += sizeof(float) * 3;
                    Up.FromBytes(bytes, i); i            += sizeof(float) * 3;

                    TickLength = Utils.BytesToUInt(bytes, i); i += sizeof(int);

                    Source.FromBytes(bytes, i);
                } catch (Exception) {
                    throw new MalformedDataException();
                }
            }