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


C# LLUUID.GetBytes方法代码示例

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


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

示例1: LLUUIDs

        public void LLUUIDs()
        {
            // Creation
            LLUUID a = new LLUUID();
            byte[] bytes = a.GetBytes();
            for (int i = 0; i < 16; i++)
                Assert.IsTrue(bytes[i] == 0x00);

            // Comparison
            a = new LLUUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
                0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0xFF, 0xFF }, 0);
            LLUUID b = new LLUUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
                0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, 0);

            Assert.IsTrue(a == b, "LLUUID comparison operator failed, " + a.ToString() + " should equal " + 
                b.ToString());

            // From string
            a = new LLUUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
                0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, 0);
            string zeroonetwo = "00010203-0405-0607-0809-0a0b0c0d0e0f";
            b = new LLUUID(zeroonetwo);

            Assert.IsTrue(a == b, "LLUUID hyphenated string constructor failed, should have " + a.ToString() + 
                " but we got " + b.ToString());

            // ToString()
            string one = a.ToString();
            string two = b.ToString();
            Assert.IsTrue(a == b);
            one = a.ToString();
            two = b.ToString();
            Assert.IsTrue(a == b);
            Assert.IsTrue(a == zeroonetwo);

            // TODO: CRC test
        }
开发者ID:chrbayer84,项目名称:SLAgentCSServer,代码行数:37,代码来源:TypeTests.cs

示例2: GiveItem

        public void GiveItem(LLUUID itemID, string itemName, AssetType assetType, LLUUID recipient, bool doEffect)
        {
            byte[] bucket = new byte[17];
            bucket[0] = (byte)assetType;
            Buffer.BlockCopy(itemID.GetBytes(), 0, bucket, 1, 16);

            _Client.Self.InstantMessage(
                _Client.Self.Name,
                recipient,
                itemName,
                LLUUID.Random(),
                InstantMessageDialog.InventoryOffered,
                InstantMessageOnline.Online,
                _Client.Self.SimPosition,
                _Client.Network.CurrentSim.ID,
                bucket);

            if (doEffect)
            {
                _Client.Self.BeamEffect(_Client.Self.AgentID, recipient, LLVector3d.Zero,
                    _Client.Settings.DEFAULT_EFFECT_COLOR, 1f, LLUUID.Random());
            }
        }
开发者ID:Belxjander,项目名称:Asuna,代码行数:23,代码来源:InventoryManager.cs

示例3: RequestInventoryAsset

        /// <summary>
        /// 
        /// </summary>
        /// <param name="assetID">Use LLUUID.Zero if you do not have the 
        /// asset ID but have all the necessary permissions</param>
        /// <param name="itemID">The item ID of this asset in the inventory</param>
        /// <param name="taskID">Use LLUUID.Zero if you are not requesting an 
        /// asset from an object inventory</param>
        /// <param name="ownerID">The owner of this asset</param>
        /// <param name="type">Asset type</param>
        /// <param name="priority">Whether to prioritize this asset download or not</param>
        public LLUUID RequestInventoryAsset(LLUUID assetID, LLUUID itemID, LLUUID taskID, LLUUID ownerID, AssetType type, bool priority)
        {
            AssetDownload transfer = new AssetDownload();
            transfer.ID = LLUUID.Random();
            transfer.AssetID = assetID;
            //transfer.AssetType = type; // Set in TransferInfoHandler.
            transfer.Priority = 100.0f + (priority ? 1.0f : 0.0f);
            transfer.Channel = ChannelType.Asset;
            transfer.Source = SourceType.SimInventoryItem;
            transfer.Simulator = Client.Network.CurrentSim;

            // Add this transfer to the dictionary
            lock (Transfers) Transfers[transfer.ID] = transfer;

            // Build the request packet and send it
            TransferRequestPacket request = new TransferRequestPacket();
            request.TransferInfo.ChannelType = (int)transfer.Channel;
            request.TransferInfo.Priority = transfer.Priority;
            request.TransferInfo.SourceType = (int)transfer.Source;
            request.TransferInfo.TransferID = transfer.ID;

            byte[] paramField = new byte[100];
            Buffer.BlockCopy(Client.Self.AgentID.GetBytes(), 0, paramField, 0, 16);
            Buffer.BlockCopy(Client.Self.SessionID.GetBytes(), 0, paramField, 16, 16);
            Buffer.BlockCopy(ownerID.GetBytes(), 0, paramField, 32, 16);
            Buffer.BlockCopy(taskID.GetBytes(), 0, paramField, 48, 16);
            Buffer.BlockCopy(itemID.GetBytes(), 0, paramField, 64, 16);
            Buffer.BlockCopy(assetID.GetBytes(), 0, paramField, 80, 16);
            Buffer.BlockCopy(Helpers.IntToBytes((int)type), 0, paramField, 96, 4);
            request.TransferInfo.Params = paramField;

            Client.Network.SendPacket(request, transfer.Simulator);
            return transfer.ID;
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:45,代码来源:AssetManager.cs

示例4: PackUUID

        /// <summary>
        /// 
        /// </summary>
        /// <param name="data"></param>
        public void PackUUID(LLUUID data)
        {
            byte[] bytes = data.GetBytes();

            // Not sure if our PackBitArray function can handle 128-bit byte
            //arrays, so using this for now
            for (int i = 0; i < 16; i++)
                PackBits(bytes[i], 8);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:13,代码来源:BitPack.cs

示例5: BeamEffect

        /// <summary>
        /// Create a particle beam between an avatar and an primitive
        /// </summary>
        /// <param name="sourceAvatar"><seealso cref="T:libsecondlife.LLUUID"/> of sources avatar</param>
        /// <param name="targetObject"><seealso cref="T:libsecondlife.LLUUID"/> of the target</param>
        /// <param name="globalOffset"><seealso cref="T:libsecondlife.LLVector3d"/>global offset</param>
        /// <param name="color"><seealso cref="T:libsecondlife.LLColor"/>Color values of beam</param>
        /// <param name="duration">a float representing the duration the beam will last</param>
        /// <param name="effectID"><seealso cref="T:libsecondlife.LLUUID"/> of the Effect</param>
        public void BeamEffect(LLUUID sourceAvatar, LLUUID targetObject, LLVector3d globalOffset, LLColor color, 
            float duration, LLUUID effectID)
        {
            ViewerEffectPacket effect = new ViewerEffectPacket();

            effect.AgentData.AgentID = Client.Self.AgentID;
            effect.AgentData.SessionID = Client.Self.SessionID;

            effect.Effect = new ViewerEffectPacket.EffectBlock[1];
            effect.Effect[0] = new ViewerEffectPacket.EffectBlock();
            effect.Effect[0].AgentID = Client.Self.AgentID;
            effect.Effect[0].Color = color.GetFloatBytes();
            effect.Effect[0].Duration = duration;
            effect.Effect[0].ID = effectID;
            effect.Effect[0].Type = (byte)EffectType.Beam;

            byte[] typeData = new byte[56];
            Buffer.BlockCopy(sourceAvatar.GetBytes(), 0, typeData, 0, 16);
            Buffer.BlockCopy(targetObject.GetBytes(), 0, typeData, 16, 16);
            Buffer.BlockCopy(globalOffset.GetBytes(), 0, typeData, 32, 24);

            effect.Effect[0].TypeData = typeData;

            Client.Network.SendPacket(effect);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:34,代码来源:AgentManager.cs

示例6: LookAtEffect

        /// <summary>
        /// Start a particle stream between an agent and an object
        /// </summary>
        /// <param name="sourceAvatar"><seealso cref="LLUUID"/> Key of the source agent</param>
        /// <param name="targetObject"><seealso cref="LLUUID"/> Key of the target object</param>
        /// <param name="globalOffset">A <seealso cref="T:libsecondlife.LLVector3d"/> representing the beams offset from the source</param>
        /// <param name="type">A <seealso cref="T:PointAtType"/> which sets the avatars lookat animation</param>
        /// <param name="effectID"><seealso cref="T:libsecondlife.LLUUID"/> of the Effect</param>
        public void LookAtEffect(LLUUID sourceAvatar, LLUUID targetObject, LLVector3d globalOffset, LookAtType type,
            LLUUID effectID)
        {
            ViewerEffectPacket effect = new ViewerEffectPacket();

            effect.AgentData.AgentID = Client.Self.AgentID;
            effect.AgentData.SessionID = Client.Self.SessionID;

            float duration;

            switch (type)
            {
                case LookAtType.Clear:
                    duration = 0.0f;
                    break;
                case LookAtType.Hover:
                    duration = 1.0f;
                    break;
                case LookAtType.FreeLook:
                    duration = 2.0f;
                    break;
                case LookAtType.Idle:
                    duration = 3.0f;
                    break;
                case LookAtType.AutoListen:
                case LookAtType.Respond:
                    duration = 4.0f;
                    break;
                case LookAtType.None:
                case LookAtType.Select:
                case LookAtType.Focus:
                case LookAtType.Mouselook:
                    duration = Single.MaxValue / 2.0f;
                    break;
                default:
                    duration = 0.0f;
                    break;
            }

            effect.Effect = new ViewerEffectPacket.EffectBlock[1];
            effect.Effect[0] = new ViewerEffectPacket.EffectBlock();
            effect.Effect[0].AgentID = Client.Self.AgentID;
            effect.Effect[0].Color = new byte[4];
            effect.Effect[0].Duration = duration;
            effect.Effect[0].ID = effectID;
            effect.Effect[0].Type = (byte)EffectType.LookAt;

            byte[] typeData = new byte[57];
            if (sourceAvatar != LLUUID.Zero)
                Buffer.BlockCopy(sourceAvatar.GetBytes(), 0, typeData, 0, 16);
            if (targetObject != LLUUID.Zero)
                Buffer.BlockCopy(targetObject.GetBytes(), 0, typeData, 16, 16);
            typeData[56] = (byte)type;

            effect.Effect[0].TypeData = typeData;

            Client.Network.SendPacket(effect);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:66,代码来源:AgentManager.cs

示例7: PointAtEffect

        /// <summary>
        /// Start a particle stream between an agent and an object
        /// </summary>
        /// <param name="sourceAvatar"><seealso cref="LLUUID"/> Key of the source agent</param>
        /// <param name="targetObject"><seealso cref="LLUUID"/> Key of the target object</param>
        /// <param name="globalOffset"></param>
        /// <param name="type"><seealso cref="T:PointAtType"/></param>
        /// <param name="effectID"></param>
        public void PointAtEffect(LLUUID sourceAvatar, LLUUID targetObject, LLVector3d globalOffset, PointAtType type,
            LLUUID effectID)
        {
            ViewerEffectPacket effect = new ViewerEffectPacket();

            effect.AgentData.AgentID = Client.Self.AgentID;
            effect.AgentData.SessionID = Client.Self.SessionID;

            effect.Effect = new ViewerEffectPacket.EffectBlock[1];
            effect.Effect[0] = new ViewerEffectPacket.EffectBlock();
            effect.Effect[0].AgentID = Client.Self.AgentID;
            effect.Effect[0].Color = new byte[4];
            effect.Effect[0].Duration = (type == PointAtType.Clear) ? 0.0f : Single.MaxValue / 4.0f;
            effect.Effect[0].ID = effectID;
            effect.Effect[0].Type = (byte)EffectType.PointAt;

            byte[] typeData = new byte[57];
            if (sourceAvatar != LLUUID.Zero)
                Buffer.BlockCopy(sourceAvatar.GetBytes(), 0, typeData, 0, 16);
            if (targetObject != LLUUID.Zero)
                Buffer.BlockCopy(targetObject.GetBytes(), 0, typeData, 16, 16);
            Buffer.BlockCopy(globalOffset.GetBytes(), 0, typeData, 32, 24);
            typeData[56] = (byte)type;

            effect.Effect[0].TypeData = typeData;

            Client.Network.SendPacket(effect);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:36,代码来源:AgentManager.cs

示例8: VoiceAccountFromUUID

 public string VoiceAccountFromUUID(LLUUID id)
 {
     string result = "x" + Convert.ToBase64String(id.GetBytes());
     return result.Replace('+', '-').Replace('/', '_');
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:5,代码来源:VoiceManager.cs

示例9: Combine

        /// <summary>
        /// Combine two UUIDs together by taking the MD5 hash of a byte array
        /// containing both UUIDs
        /// </summary>
        /// <param name="first">First LLUUID to combine</param>
        /// <param name="second">Second LLUUID to combine</param>
        /// <returns>The UUID product of the combination</returns>
        public static LLUUID Combine(LLUUID first, LLUUID second)
        {
            // Construct the buffer that MD5ed
            byte[] input = new byte[32];
            Buffer.BlockCopy(first.GetBytes(), 0, input, 0, 16);
            Buffer.BlockCopy(second.GetBytes(), 0, input, 16, 16);

            return new LLUUID(Helpers.MD5Builder.ComputeHash(input), 0);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:16,代码来源:Types.cs

示例10: GiveFolder

        /// <summary>
        /// Give an inventory Folder with contents to another avatar
        /// </summary>
        /// <param name="folderID">The <seealso cref="LLUUID"/> of the Folder to give</param>
        /// <param name="folderName">The name of the folder</param>
        /// <param name="assetType">The type of the item from the <seealso cref="AssetType"/> enum</param>
        /// <param name="recipient">The <seealso cref="LLUUID"/> of the recipient</param>
        /// <param name="doEffect">true to generate a beameffect during transfer</param>
        public void GiveFolder(LLUUID folderID, string folderName, AssetType assetType, LLUUID recipient,
            bool doEffect)
        {
            byte[] bucket;

                List<InventoryItem> folderContents = new List<InventoryItem>();

                _Client.Inventory.FolderContents(folderID, _Client.Self.AgentID, false, true, InventorySortOrder.ByDate, 1000 * 15).ForEach(
                    delegate(InventoryBase ib)
                    {
                        folderContents.Add(_Client.Inventory.FetchItem(ib.UUID, _Client.Self.AgentID, 1000 * 10));
                    });
                bucket = new byte[17 * (folderContents.Count + 1)];

                //Add parent folder (first item in bucket)
                bucket[0] = (byte)assetType;
                Buffer.BlockCopy(folderID.GetBytes(), 0, bucket, 1, 16);

                //Add contents to bucket after folder
                for (int i = 1; i <= folderContents.Count; ++i)
                {
                    bucket[i * 17] = (byte)folderContents[i - 1].AssetType;
                    Buffer.BlockCopy(folderContents[i - 1].UUID.GetBytes(), 0, bucket, i * 17 + 1, 16);
                }

            _Client.Self.InstantMessage(
                    _Client.Self.Name,
                    recipient,
                    folderName,
                    LLUUID.Random(),
                    InstantMessageDialog.InventoryOffered,
                    InstantMessageOnline.Online,
                    _Client.Self.SimPosition,
                    _Client.Network.CurrentSim.ID,
                    bucket);

            if (doEffect)
            {
                _Client.Self.BeamEffect(_Client.Self.AgentID, recipient, LLVector3d.Zero,
                    _Client.Settings.DEFAULT_EFFECT_COLOR, 1f, LLUUID.Random());
            }
        }
开发者ID:chrbayer84,项目名称:SLAgentCSServer,代码行数:50,代码来源:InventoryManager.cs

示例11: RequestAsset

        /// <summary>
        /// 
        /// </summary>
        /// <param name="assetID"></param>
        /// <param name="type"></param>
        /// <param name="priority"></param>
        public void RequestAsset(LLUUID assetID, AssetType type, bool priority)
        {
            AssetDownload transfer = new AssetDownload();
            transfer.ID = LLUUID.Random();
            transfer.AssetID = assetID;
            transfer.Priority = 100.0f + (priority ? 1.0f : 0.0f);
            transfer.Channel = ChannelType.Asset;
            transfer.Source = SourceType.Asset;
            transfer.Simulator = Client.Network.CurrentSim;

            // Add this transfer to the dictionary
            lock (Transfers) Transfers[transfer.ID] = transfer;

            // Build the request packet and send it
            TransferRequestPacket request = new TransferRequestPacket();
            request.TransferInfo.ChannelType = (int)transfer.Channel;
            request.TransferInfo.Priority = transfer.Priority;
            request.TransferInfo.SourceType = (int)transfer.Source;
            request.TransferInfo.TransferID = transfer.ID;

            byte[] paramField = new byte[20];
            Array.Copy(assetID.GetBytes(), 0, paramField, 0, 16);
            Array.Copy(Helpers.IntToBytes((int)type), 0, paramField, 16, 4);
            request.TransferInfo.Params = paramField;

            Client.Network.SendPacket(request, transfer.Simulator);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:33,代码来源:AssetManager.cs


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