当前位置: 首页>>代码示例>>C#>>正文


C# UUID.ToBytes方法代码示例

本文整理汇总了C#中UUID.ToBytes方法的典型用法代码示例。如果您正苦于以下问题:C# UUID.ToBytes方法的具体用法?C# UUID.ToBytes怎么用?C# UUID.ToBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UUID的用法示例。


在下文中一共展示了UUID.ToBytes方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnInstantMessage

        private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
        {
            if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            // Group invitations
            if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
            {
                UUID inviteID = new UUID(im.imSessionID);
                GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID);

                if (inviteInfo == null)
                {
                    if (m_debugEnabled) m_log.WarnFormat("[GROUPS]: Received an Invite IM for an invite that does not exist {0}.", inviteID);
                    return;
                }

                if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Invite is for Agent {0} to Group {1}.", inviteInfo.AgentID, inviteInfo.GroupID);

                UUID fromAgentID = new UUID(im.fromAgentID);
                if ((inviteInfo != null) && (fromAgentID == inviteInfo.AgentID))
                {
                    // Accept
                    if (im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept)
                    {
                        if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Received an accept invite notice.");

                        // and the sessionid is the role
                        m_groupData.AddAgentToGroup(GetRequestingAgentID(remoteClient), inviteInfo.AgentID, inviteInfo.GroupID, inviteInfo.RoleID);

                        GridInstantMessage msg = new GridInstantMessage();
                        msg.imSessionID = UUID.Zero.Guid;
                        msg.fromAgentID = UUID.Zero.Guid;
                        msg.toAgentID = inviteInfo.AgentID.Guid;
                        msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
                        msg.fromAgentName = "Groups";
                        msg.message = string.Format("You have been added to the group.");
                        msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageBox;
                        msg.fromGroup = false;
                        msg.offline = (byte)0;
                        msg.ParentEstateID = 0;
                        msg.Position = Vector3.Zero;
                        msg.RegionID = UUID.Zero.Guid;
                        msg.binaryBucket = new byte[0];

                        OutgoingInstantMessage(msg, inviteInfo.AgentID);

                        UpdateAllClientsWithGroupInfo(inviteInfo.AgentID);

                        // TODO: If the inviter is still online, they need an agent dataupdate 
                        // and maybe group membership updates for the invitee

                        m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID);
                    }

                    // Reject
                    if (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)
                    {
                        if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Received a reject invite notice.");
                        m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID);
                    }
                }
            }

            // Group notices
            if ((im.dialog == (byte)InstantMessageDialog.GroupNotice))
            {
                if (!m_groupNoticesEnabled)
                {
                    return;
                }

                UUID GroupID = new UUID(im.toAgentID);
                if (m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), GroupID, null) != null)
                {
                    UUID NoticeID = UUID.Random();
                    string Subject = im.message.Substring(0, im.message.IndexOf('|'));
                    string Message = im.message.Substring(Subject.Length + 1);

                    byte[] bucket;

                    if ((im.binaryBucket.Length == 1) && (im.binaryBucket[0] == 0))
                    {
                        bucket = new byte[19];
                        bucket[0] = 0; //dunno
                        bucket[1] = 0; //dunno
                        GroupID.ToBytes(bucket, 2);
                        bucket[18] = 0; //dunno
                    }
                    else
                    {
                        string binBucket = OpenMetaverse.Utils.BytesToString(im.binaryBucket);
                        binBucket = binBucket.Remove(0, 14).Trim();
                        if (m_debugEnabled)
                        {
                            m_log.WarnFormat("I don't understand a group notice binary bucket of: {0}", binBucket);

                            OSDMap binBucketOSD = (OSDMap)OSDParser.DeserializeLLSDXml(binBucket);
                            
                            foreach (string key in binBucketOSD.Keys)
                            {
//.........这里部分代码省略.........
开发者ID:AkiraSonoda,项目名称:akisim,代码行数:101,代码来源:GroupsModule.cs

示例2: CreateBitBucketForGroupAttachment

 private byte[] CreateBitBucketForGroupAttachment(GroupNoticeData groupNoticeData, UUID groupID)
 {
     int i = 20;
     i += groupNoticeData.ItemName.Length;
     byte[] bitbucket = new byte[i];
     groupID.ToBytes(bitbucket, 2);
     byte[] name = Utils.StringToBytes(" " + groupNoticeData.ItemName);
     Array.ConstrainedCopy(name, 0, bitbucket, 18, name.Length);
     //Utils.Int16ToBytes((short)item.AssetType, bitbucket, 0);
     bitbucket[0] = 1; // 0 for no attachment, 1 for attachment
     bitbucket[1] = (byte)groupNoticeData.AssetType; // Asset type
     
     return bitbucket;
 }
开发者ID:KristenMynx,项目名称:Aurora-Sim,代码行数:14,代码来源:GroupsModule.cs

示例3: OnInstantMessage

        private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
        {
            if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            // Group invitations
            if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
            {
                UUID inviteID = new UUID(im.imSessionID);
                GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID);

                if (inviteInfo == null)
                {
                    if (m_debugEnabled) m_log.WarnFormat("[GROUPS]: Received an Invite IM for an invite that does not exist {0}.", inviteID);
                    return;
                }

                if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Invite is for Agent {0} to Group {1}.", inviteInfo.AgentID, inviteInfo.GroupID);

                UUID fromAgentID = new UUID(im.fromAgentID);
                if ((inviteInfo != null) && (fromAgentID == inviteInfo.AgentID))
                {
                    // Accept
                    if (im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept)
                    {
                        if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Received an accept invite notice.");

                        // and the sessionid is the role
                        m_groupData.AddAgentToGroup(GetRequestingAgentID(remoteClient), inviteInfo.AgentID, inviteInfo.GroupID, inviteInfo.RoleID);

                        GridInstantMessage msg = new GridInstantMessage();
                        msg.imSessionID = UUID.Zero.Guid;
                        msg.fromAgentID = UUID.Zero.Guid;
                        msg.toAgentID = inviteInfo.AgentID.Guid;
                        msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
                        msg.fromAgentName = "Groups";
                        msg.message = string.Format("You have been added to the group.");
                        msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageBox;
                        msg.fromGroup = false;
                        msg.offline = (byte)0;
                        msg.ParentEstateID = 0;
                        msg.Position = Vector3.Zero;
                        msg.RegionID = UUID.Zero.Guid;
                        msg.binaryBucket = new byte[0];

                        OutgoingInstantMessage(msg, inviteInfo.AgentID);

                        //WTH??? noone but the invitee needs to know
                        //UpdateAllClientsWithGroupInfo(inviteInfo.AgentID);
                        SendAgentGroupDataUpdate(remoteClient);
                        // XTODO: If the inviter is still online, they need an agent dataupdate 
                        // and maybe group membership updates for the invitee
                        // Reply: why do they need that? they will get told about the new user when they reopen the groups panel

                        m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID);
                    }

                    // Reject
                    if (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)
                    {
                        if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Received a reject invite notice.");
                        m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID);
                    }
                }
            }

            // Group notices
            if ((im.dialog == (byte)InstantMessageDialog.GroupNotice))
            {
                if (!m_groupNoticesEnabled)
                    return;

                UUID GroupID = new UUID(im.toAgentID);
                if (m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), GroupID, null) != null)
                {
                    UUID NoticeID = UUID.Random();
                    string Subject = im.message.Substring(0, im.message.IndexOf('|'));
                    string Message = im.message.Substring(Subject.Length + 1);

                    byte[] bucket;
                    UUID ItemID = UUID.Zero;
                    int AssetType = 0;
                    string ItemName = "";
                    
                    if ((im.binaryBucket.Length == 1) && (im.binaryBucket[0] == 0))
                    {
                        bucket = new byte[19];
                        bucket[0] = 0;
                        bucket[1] = 0;
                        GroupID.ToBytes(bucket, 2);
                        bucket[18] = 0;
                    }
                    else
                    {
                        bucket = im.binaryBucket;
                        string binBucket = OpenMetaverse.Utils.BytesToString(im.binaryBucket);
                        binBucket = binBucket.Remove(0, 14).Trim();

                        OSDMap binBucketOSD = (OSDMap)OSDParser.DeserializeLLSDXml(binBucket);
                        if (binBucketOSD.ContainsKey("item_id"))
                        {
//.........这里部分代码省略.........
开发者ID:KristenMynx,项目名称:Aurora-Sim,代码行数:101,代码来源:GroupsModule.cs

示例4: TransferDownload

        private void TransferDownload(LLAgent agent, UUID transferID, UUID assetID, AssetType type, Asset asset)
        {
            const int MAX_CHUNK_SIZE = 1000;

            string contentType = LLUtil.LLAssetTypeToContentType((int)type);

            if (contentType == asset.ContentType)
            {
                m_log.Debug(String.Format("Transferring asset {0} ({1})", asset.ID, asset.ContentType));

                TransferInfoPacket response = new TransferInfoPacket();
                response.TransferInfo = new TransferInfoPacket.TransferInfoBlock();
                response.TransferInfo.TransferID = transferID;

                // Set the response channel type
                response.TransferInfo.ChannelType = (int)ChannelType.Asset;

                // Params
                response.TransferInfo.Params = new byte[20];
                assetID.ToBytes(response.TransferInfo.Params, 0);
                Utils.IntToBytes((int)type, response.TransferInfo.Params, 16);

                response.TransferInfo.Size = asset.Data.Length;
                response.TransferInfo.Status = (int)StatusCode.OK;
                response.TransferInfo.TargetType = (int)TargetType.Unknown; // Doesn't seem to be used by the client

                m_udp.SendPacket(agent, response, ThrottleCategory.Asset, false);

                // Transfer system does not wait for ACKs, just sends all of the
                // packets for this transfer out
                int processedLength = 0;
                int packetNum = 0;
                while (processedLength < asset.Data.Length)
                {
                    TransferPacketPacket transfer = new TransferPacketPacket();
                    transfer.TransferData.ChannelType = (int)ChannelType.Asset;
                    transfer.TransferData.TransferID = transferID;
                    transfer.TransferData.Packet = packetNum++;

                    int chunkSize = Math.Min(asset.Data.Length - processedLength, MAX_CHUNK_SIZE);
                    transfer.TransferData.Data = new byte[chunkSize];
                    Buffer.BlockCopy(asset.Data, processedLength, transfer.TransferData.Data, 0, chunkSize);
                    processedLength += chunkSize;

                    if (processedLength >= asset.Data.Length)
                        transfer.TransferData.Status = (int)StatusCode.Done;
                    else
                        transfer.TransferData.Status = (int)StatusCode.OK;

                    m_udp.SendPacket(agent, transfer, ThrottleCategory.Asset, false);
                }
            }
            else
            {
                m_log.WarnFormat("Request for asset {0} with type {1} does not match actual asset type {2}",
                    assetID, type, asset.ContentType);

                TransferNotFound(agent, transferID, assetID, type);
            }
        }
开发者ID:thoys,项目名称:simian,代码行数:60,代码来源:Assets.cs

示例5: TransferNotFound

        private void TransferNotFound(LLAgent agent, UUID transferID, UUID assetID, AssetType type)
        {
            m_log.Info("TransferNotFound for asset " + assetID + " with type " + type);

            TransferInfoPacket response = new TransferInfoPacket();
            response.TransferInfo = new TransferInfoPacket.TransferInfoBlock();
            response.TransferInfo.TransferID = transferID;

            // Set the response channel type
            response.TransferInfo.ChannelType = (int)ChannelType.Asset;

            // Params
            response.TransferInfo.Params = new byte[20];
            assetID.ToBytes(response.TransferInfo.Params, 0);
            Utils.IntToBytes((int)type, response.TransferInfo.Params, 16);

            response.TransferInfo.Size = 0;
            response.TransferInfo.Status = (int)StatusCode.UnknownSource;
            response.TransferInfo.TargetType = (int)TargetType.Unknown;

            m_udp.SendPacket(agent, response, ThrottleCategory.Asset, false);
        }
开发者ID:thoys,项目名称:simian,代码行数:22,代码来源:Assets.cs

示例6: OnInstantMessage


//.........这里部分代码省略.........
                            //not be included with the group notice.
                            Scene scene = (Scene)remoteClient.Scene;
                            item = new InventoryItemBase(itemID, ownerID);
                            item = scene.InventoryService.GetItem(item);

                            if (item != null)
                            {
                                //Got item details so include the attachment.
                                hasAttachment = true;
                            }
                        }
                        else
                        {
                            m_log.DebugFormat("[Groups]: Received OSD with unexpected type: {0}", binBucketOSD.GetType());
                        }
                    }

                    if (hasAttachment)
                    {
                        //Bucket contains information about attachment.
                        //
                        //Byte offset and description of bucket data:
                        //0:  1 byte indicating if attachment is present
                        //1:  1 byte indicating the type of attachment
                        //2:  16 bytes - Group UUID
                        //18: 16 bytes - UUID of the attachment owner
                        //34: 16 bytes - UUID of the attachment
                        //50: variable - Name of the attachment
                        //??: NUL byte to terminate the attachment name
                        byte[] name = Encoding.UTF8.GetBytes(item.Name);
                        bucket = new byte[51 + name.Length];//3 bytes, 3 UUIDs, and name
                        bucket[0] = 1;                      //Has attachment flag
                        bucket[1] = (byte)item.InvType;     //Type of Attachment
                        GroupID.ToBytes(bucket, 2);
                        ownerID.ToBytes(bucket, 18);
                        itemID.ToBytes(bucket, 34);
                        name.CopyTo(bucket, 50);
                    }
                    else
                    {
                        bucket = new byte[19];
                        bucket[0] = 0;  //Has attachment flag
                        bucket[1] = 0;  //Type of attachment
                        GroupID.ToBytes(bucket, 2);
                        bucket[18] = 0; //NUL terminate name of attachment
                    }

                    m_groupData.AddGroupNotice(GetRequestingAgentID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket);
                    if (OnNewGroupNotice != null)
                    {
                        OnNewGroupNotice(GroupID, NoticeID);
                    }

                    if (m_debugEnabled)
                    {
                        foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), GroupID))
                        {
                            if (m_debugEnabled)
                            {
                                UserAccount targetUser
                                    = m_sceneList[0].UserAccountService.GetUserAccount(
                                        remoteClient.Scene.RegionInfo.ScopeID, member.AgentID);

                                if (targetUser != null)
                                {
                                    m_log.DebugFormat(
开发者ID:CassieEllen,项目名称:opensim,代码行数:67,代码来源:GroupsModule.cs

示例7: compressUUID

        public string compressUUID(UUID input)
        {
            byte[] compressed = new byte[16];
            char[] compressedC = new char[16];
            input.ToBytes(compressed, 0);

            for (int x = 0; x < 16; x++)
            {
                compressedC[x] = (char)compressed[x];
            }

            return (new string(compressedC, 0, 16));
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:13,代码来源:Database.cs

示例8: SaveCachedImage

        public static bool SaveCachedImage(byte[] tgaData, UUID textureID, bool hasAlpha, bool fullAlpha, bool isMask)
        {
            try
            {
                string fname = System.IO.Path.Combine(RadegastInstance.GlobalInstance.Client.Settings.ASSET_CACHE_DIR, string.Format("{0}.rzi", textureID));
                //string fname = System.IO.Path.Combine(".", string.Format("{0}.rzi", textureID));

                using (var f = File.Open(fname, FileMode.Create, FileAccess.Write, FileShare.None))
                {
                    int i = 0;
                    // magic header
                    f.Write(Utils.StringToBytes(RAD_IMG_MAGIC), 0, RAD_IMG_MAGIC.Length);
                    i += RAD_IMG_MAGIC.Length;

                    // version
                    f.WriteByte((byte)1);
                    i++;

                    // texture info
                    f.WriteByte(hasAlpha ? (byte)1 : (byte)0);
                    f.WriteByte(fullAlpha ? (byte)1 : (byte)0);
                    f.WriteByte(isMask ? (byte)1 : (byte)0);
                    i += 3;

                    // texture size
                    byte[] uncompressedSize = Utils.IntToBytes(tgaData.Length);
                    f.Write(uncompressedSize, 0, uncompressedSize.Length);
                    i += uncompressedSize.Length;

                    // texture id
                    byte[] id = new byte[16];
                    textureID.ToBytes(id, 0);
                    f.Write(id, 0, 16);
                    i += 16;

                    // compressed texture data
                    using (var compressed = new DeflateStream(f, CompressionMode.Compress))
                    {
                        compressed.Write(tgaData, 0, tgaData.Length);
                    }
                }
                return true;
            }
            catch (Exception ex)
            {
                Logger.DebugLog(string.Format("Failed to save radegast cache file {0}: {1}", textureID, ex.Message));
                return false;
            }
        }
开发者ID:niel,项目名称:radegast,代码行数:49,代码来源:RenderingHelpers.cs

示例9: OnInstantMessage

        private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
        {
            if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            // Group invitations
            if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
            {
                UUID inviteID = new UUID(im.imSessionID);
                GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetClientGroupRequestID(remoteClient), inviteID);

                if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Invite is for Agent {0} to Group {1}.", inviteInfo.AgentID, inviteInfo.GroupID);

                UUID fromAgentID = new UUID(im.fromAgentID);
                if ((inviteInfo != null) && (fromAgentID == inviteInfo.AgentID))
                {
                    // Accept
                    if (im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept)
                    {
                        if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Received an accept invite notice.");

                        // and the sessionid is the role
                        m_groupData.AddAgentToGroup(GetClientGroupRequestID(remoteClient), inviteInfo.AgentID, inviteInfo.GroupID, inviteInfo.RoleID, false);

                        GridInstantMessage msg = new GridInstantMessage();
                        msg.imSessionID = UUID.Zero.Guid;
                        msg.fromAgentID = UUID.Zero.Guid;
                        msg.toAgentID = inviteInfo.AgentID.Guid;
                        msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
                        msg.fromAgentName = "Groups";
                        msg.message = string.Format("You have been added to the group.");
                        msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageBox;
                        msg.fromGroup = false;
                        msg.offline = (byte)0;  // don't bother storing this one to fetch on login if user offline
                        msg.ParentEstateID = 0;
                        msg.Position = Vector3.Zero;
                        msg.RegionID = UUID.Zero.Guid;
                        msg.binaryBucket = new byte[0];

                        OutgoingInstantMessage(msg, inviteInfo.AgentID);

                        UpdateAllClientsWithGroupInfo(inviteInfo.AgentID);

                        // TODO: If the inviter is still online, they need an agent dataupdate 
                        // and maybe group membership updates for the invitee

                        m_groupData.RemoveAgentToGroupInvite(GetClientGroupRequestID(remoteClient), inviteID);
                    }

                    // Reject
                    if (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)
                    {
                        if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Received a reject invite notice.");
                        m_groupData.RemoveAgentToGroupInvite(GetClientGroupRequestID(remoteClient), inviteID);
                    }
                }
            }

            // Group notices
            if ((im.dialog == (byte)InstantMessageDialog.GroupNotice))
            {
                if (!m_groupNoticesEnabled)
                {
                    return;
                }
                if (im.offline != 0)
                {
                    // Delivery of stored (offline) IMs is handled by the caller
                    return;
                }

                UUID GroupID = new UUID(im.toAgentID);
                GroupRecord group = m_groupData.GetGroupRecord(GetClientGroupRequestID(remoteClient), GroupID, null);
                if (group == null)
                {
                    m_log.ErrorFormat("[GROUPS]: Failed to find notice group {0}", GroupID);
                    return;
                }

                UUID NoticeID = UUID.Random();
                string Subject = im.message.Substring(0, im.message.IndexOf('|'));
                string Message = im.message.Substring(Subject.Length + 1);

                byte[] bucket;

                if ((im.binaryBucket.Length == 1) && (im.binaryBucket[0] == 0))
                {
                    // Sending a notice without an attachment
                    bucket = new byte[19];
                    bucket[0] = 0; // HasAttachment boolean
                    bucket[1] = 0; // attachment type
                    GroupID.ToBytes(bucket, 2);
                    bucket[18] = 0; // attachment name
                }
                else
                {
                    // Sending a notice with an attachment
                    string binBucket = OpenMetaverse.Utils.BytesToString(im.binaryBucket);
                    binBucket = binBucket.Remove(0, 14).Trim();
                    OSDMap binBucketOSD = (OSDMap)OSDParser.DeserializeLLSDXml(binBucket);
                    UUID itemId = binBucketOSD["item_id"].AsUUID();
//.........这里部分代码省略.........
开发者ID:digitalmystic,项目名称:halcyon,代码行数:101,代码来源:FlexiGroupsModule.cs

示例10: SendGroupNoticeIM

        private void SendGroupNoticeIM(UUID NoticeID, UUID AgentID, OpenMetaverse.InstantMessageDialog dialog, bool checkMuted)
        {
            // Build notice IIM
            GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)dialog);
            if (msg == null)
                return;     // old bad one stored from offlines?
            UUID sender = new UUID(msg.fromAgentID);

            if (checkMuted)
            {
                m_muteListModule = m_sceneList[0].RequestModuleInterface<IMuteListModule>();
                if (m_muteListModule != null)
                    if (m_muteListModule.IsMuted(sender, AgentID))
                        return;
            }

            bool HasAttachment = (msg.binaryBucket[0] != 0);
            if (HasAttachment)  // save the notice with the session ID
            {
                lock (GroupAttachmentCache) {
                    GroupAttachmentCache[msg.imSessionID] = NoticeID;
                }
            }

            msg.toAgentID = AgentID.Guid;

            IClientAPI localClient = GetActiveClient(AgentID);
            if (localClient != null)
            {
                if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: Recipient ({0}) is local, delivering group notice directly", localClient.Name);
                localClient.SendInstantMessage(msg);
            }
            else
            {
                // send for offline storage
                if (HasAttachment)  // clean up the cache item added above
                {
                    lock (GroupAttachmentCache) {
                        GroupAttachmentCache.Remove(msg.imSessionID);
                    }
                }
                // need to reformat this with db storage bucket, not the viewer IM bucket
                // format for database storage
                int bucketLen = msg.binaryBucket.Length;
                byte[] OfflineBucket = new byte[bucketLen + 4 + 16];
                OfflineBucket[0] = 0xFF; // sign, would be 00 or 01 here in a normal viewer IM bucket
                OfflineBucket[1] = 0x00; OfflineBucket[2] = 0x00; OfflineBucket[3] = 0x00; // Spare bytes
                NoticeID.ToBytes(OfflineBucket, 4);    // 16-byte UUID
                msg.binaryBucket.CopyTo(OfflineBucket, 20);
                msg.binaryBucket = OfflineBucket;
                if (m_debugEnabled) m_log.InfoFormat("[GROUPS]: Recipient ({0}) is not local, delivering group notice via TransferModule", msg.toAgentID);
                m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: Message Sent: {0}", success ? "Succeeded" : "Failed"); });
            }
        }
开发者ID:digitalmystic,项目名称:halcyon,代码行数:54,代码来源:FlexiGroupsModule.cs

示例11: FormatBucketForIM

        // This bucket format is the NOT database-stored format for binary notice data, but rather the data sent to the viewer in the IM packet.
        public byte[] FormatBucketForIM(bool HasAttachment, byte AttType, UUID GroupID, string AttName)
        {
            byte[] nameBytes = OpenMetaverse.Utils.StringToBytes(" "+AttName);
            int nameLen = nameBytes.GetLength(0);
            byte[] bucket = new byte[18+nameLen];

            // bucket byte buffer is HasAttachment, invtype, ownerID, name
            bucket[0] = HasAttachment ? (byte)0x01 : (byte)0x00;
            bucket[1] = AttType;
            GroupID.ToBytes(bucket, 2); // 16-byte UUID
            Array.Copy(nameBytes, 0, bucket, 18, nameLen);  //  name
            return bucket;
        }
开发者ID:digitalmystic,项目名称:halcyon,代码行数:14,代码来源:FlexiGroupsModule.cs

示例12: FormatBucketForStorage

        // This bucket format is the longer database-stored format for binary notice data.
        private byte[] FormatBucketForStorage(bool HasAttachment, byte AssetType, UUID GroupID, UUID ItemID, UUID NoticeID, string AttachmentName)
        {
            byte[] bucket = null;
            if (HasAttachment)
            {
                byte[] nameBytes = OpenMetaverse.Utils.StringToBytes(AttachmentName);
                int nameLen = nameBytes.GetLength(0);

                // old bucket byte buffer is bool,invtype,[2]ownerID,[18]itemID,[34]name
                // new bucket byte buffer is bool,invtype,[2]ownerID,[18]itemID,[34]0x01,[35]version,[36]noticeID,[52]name
                bucket = new byte[1 + 1 + 16 + 16 + 16 + 1 + 1 + nameLen];
                bucket[0] = 1;                          // HasAttachment boolean
                bucket[1] = AssetType;                  // attachment asset/inventory type
                GroupID.ToBytes(bucket, 2);             // 16-byte UUID
                ItemID.ToBytes(bucket, 18);             // 16-byte UUID
                bucket[34] = (byte)1;                   // sign of new extended format
                bucket[35] = (byte)0;                   // version number of new format
                NoticeID.ToBytes(bucket, 36);           // 16-byte UUID
                Array.Copy(nameBytes, 0, bucket, ATTACH_NAME_OFFSET, nameLen);  //  name
            }
            else
            {
                bucket = new byte[1 + 1 + 16 + 16 + 16 + 1 + 1 + 1];
                bucket[0] = 0;                          // HasAttachment boolean
                bucket[1] = 0;                          // attachment type
                UUID.Zero.ToBytes(bucket, 2);           // 16-byte UUID
                UUID.Zero.ToBytes(bucket, 18);          // 16-byte UUID
                bucket[34] = (byte)1;                   // sign of new extended format
                bucket[35] = (byte)0;                   // version number of new format
                NoticeID.ToBytes(bucket, 36);           // 16-byte UUID
                bucket[ATTACH_NAME_OFFSET] = 0;         //  name
            }
            return bucket;
        }
开发者ID:digitalmystic,项目名称:halcyon,代码行数:35,代码来源:FlexiGroupsModule.cs


注:本文中的UUID.ToBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。