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


C# Packets.Packet类代码示例

本文整理汇总了C#中OpenMetaverse.Packets.Packet的典型用法代码示例。如果您正苦于以下问题:C# Packet类的具体用法?C# Packet怎么用?C# Packet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Packet类属于OpenMetaverse.Packets命名空间,在下文中一共展示了Packet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessAnimationsPacket

        private void ProcessAnimationsPacket(Packet packet, Simulator simulator)
        {
            if (!(packet is AvatarAnimationPacket))
                return;

            AvatarAnimationPacket animation = (AvatarAnimationPacket)packet;

            SimData simData;
            if (!Ox.DataStore.World.SimCollection.TryGet(simulator.ID.ToString(), out simData))
                return;

            ObjectData objectData;
            if (!simData.TryGet(animation.Sender.ID.ToString(), out objectData))
                return;

            if (!(objectData is AvatarData))
                return;

            AvatarData avatarData = objectData as AvatarData;

            List<AvatarData.Animation> anims = new List<AvatarData.Animation>();
            foreach (AvatarAnimationPacket.AnimationListBlock block in animation.AnimationList)
                anims.Add(new AvatarData.Animation(block.AnimID.ToString(), block.AnimSequenceID));
            avatarData.UpdateAnimation(anims.ToArray());

            string msg = JsonUtil.SerializeMessage(JsonType.ObjectUpdated, new JsonObjectUpdated(
                simulator.ID.ToString(),
                animation.Sender.ID.ToString(),
                (int)JsonObjectUpdated.PrimType.Avatar,
                (int)JsonObjectUpdated.Type.UpdateAnimation
                ));
            Ox.EventFire(msg, true);
        }
开发者ID:yooyke,项目名称:work,代码行数:33,代码来源:Protocol_process.cs

示例2: SendPacket

 public void SendPacket(Packet packet, Simulator sim)
 {
     if (OnPacketSent != null)
     {
         OnPacketSent(packet, sim);
     }
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:7,代码来源:MockNetworkManager.cs

示例3: AgentDataUpdateHandler

 private void AgentDataUpdateHandler(Packet packet, Simulator sim)
 {
     AgentDataUpdatePacket p = (AgentDataUpdatePacket)packet;
     if (p.AgentData.AgentID == Client.Self.AgentID)
     {
         activeGroup = Utils.BytesToString(p.AgentData.GroupName) + " ( " + Utils.BytesToString(p.AgentData.GroupTitle) + " )";
         GroupsEvent.Set();
     }
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:9,代码来源:ActivateGroupCommand.cs

示例4: AgentDataUpdateHandler

 private void AgentDataUpdateHandler(Packet packet, Simulator sim)
 {
     AgentDataUpdatePacket p = (AgentDataUpdatePacket)packet;
     if (p.AgentData.AgentID == Client.Self.AgentID)
     {
         activeGroup = Helpers.FieldToUTF8String(p.AgentData.GroupName) + " ( " + Helpers.FieldToUTF8String(p.AgentData.GroupTitle) + " )";
         GroupsEvent.Set();
     }
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:9,代码来源:ActivateGroupCommand.cs

示例5: AvatarPropertiesRequestHandler

        void AvatarPropertiesRequestHandler(Packet packet, Agent agent)
        {
            AvatarPropertiesRequestPacket request = (AvatarPropertiesRequestPacket)packet;

            lock (Server.Agents)
            {
                foreach (Agent agt in Server.Agents.Values)
                {
                    if (agent.AgentID == request.AgentData.AvatarID)
                    {
                        AvatarPropertiesReplyPacket reply = new AvatarPropertiesReplyPacket();
                        reply.AgentData.AgentID = agt.AgentID;
                        reply.AgentData.AvatarID = request.AgentData.AvatarID;
                        reply.PropertiesData.AboutText = Utils.StringToBytes("Profile info unavailable");
                        reply.PropertiesData.BornOn = Utils.StringToBytes("Unknown");
                        reply.PropertiesData.CharterMember = Utils.StringToBytes("Test User");
                        reply.PropertiesData.FLAboutText = Utils.StringToBytes("First life info unavailable");
                        reply.PropertiesData.Flags = 0;
                        //TODO: at least generate static image uuids based on name.
                        //this will prevent re-caching the default image for the same av name.
                        reply.PropertiesData.FLImageID = agent.AgentID; //temporary hack
                        reply.PropertiesData.ImageID = agent.AgentID; //temporary hack
                        reply.PropertiesData.PartnerID = UUID.Zero;
                        reply.PropertiesData.ProfileURL = Utils.StringToBytes(String.Empty);

                        agent.SendPacket(reply);

                        break;
                    }
                }
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:32,代码来源:AvatarPropertiesReply.cs

示例6: AssetUploadRequestHandler

        void AssetUploadRequestHandler(Packet packet, Agent agent)
        {
            AssetUploadRequestPacket request = (AssetUploadRequestPacket)packet;
            UUID assetID = UUID.Combine(request.AssetBlock.TransactionID, agent.SecureSessionID);

            // Check if the asset is small enough to fit in a single packet
            if (request.AssetBlock.AssetData.Length != 0)
            {
                // Create a new asset from the completed upload
                Asset asset = CreateAsset((AssetType)request.AssetBlock.Type, assetID, request.AssetBlock.AssetData);
                if (asset == null)
                {
                    Logger.Log("Failed to create asset from uploaded data", Helpers.LogLevel.Warning);
                    return;
                }

                Logger.DebugLog(String.Format("Storing uploaded asset {0} ({1})", assetID, asset.AssetType));

                asset.Temporary = (request.AssetBlock.Tempfile | request.AssetBlock.StoreLocal);

                // Store the asset
                scene.Server.Assets.StoreAsset(asset);

                // Send a success response
                AssetUploadCompletePacket complete = new AssetUploadCompletePacket();
                complete.AssetBlock.Success = true;
                complete.AssetBlock.Type = request.AssetBlock.Type;
                complete.AssetBlock.UUID = assetID;
                scene.UDP.SendPacket(agent.ID, complete, PacketCategory.Inventory);
            }
            else
            {
                // Create a new (empty) asset for the upload
                Asset asset = CreateAsset((AssetType)request.AssetBlock.Type, assetID, null);
                if (asset == null)
                {
                    Logger.Log("Failed to create asset from uploaded data", Helpers.LogLevel.Warning);
                    return;
                }

                Logger.DebugLog(String.Format("Starting upload for {0} ({1})", assetID, asset.AssetType));

                asset.Temporary = (request.AssetBlock.Tempfile | request.AssetBlock.StoreLocal);

                RequestXferPacket xfer = new RequestXferPacket();
                xfer.XferID.DeleteOnCompletion = request.AssetBlock.Tempfile;
                xfer.XferID.FilePath = 0;
                xfer.XferID.Filename = Utils.EmptyBytes;
                xfer.XferID.ID = request.AssetBlock.TransactionID.GetULong();
                xfer.XferID.UseBigPackets = false;
                xfer.XferID.VFileID = asset.AssetID;
                xfer.XferID.VFileType = request.AssetBlock.Type;

                // Add this asset to the current upload list
                lock (CurrentUploads)
                    CurrentUploads[xfer.XferID.ID] = asset;

                scene.UDP.SendPacket(agent.ID, xfer, PacketCategory.Inventory);
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:60,代码来源:PeriscopeTransferManager.cs

示例7: UseCircuitCodeHandler

        void UseCircuitCodeHandler(Packet packet, Agent agent)
        {
            RegionHandshakePacket handshake = new RegionHandshakePacket();
            handshake.RegionInfo.BillableFactor = 0f;
            handshake.RegionInfo.CacheID = UUID.Random();
            handshake.RegionInfo.IsEstateManager = false;
            handshake.RegionInfo.RegionFlags = 1;
            handshake.RegionInfo.SimOwner = UUID.Random();
            handshake.RegionInfo.SimAccess = 1;
            handshake.RegionInfo.SimName = Utils.StringToBytes("Simian");
            handshake.RegionInfo.WaterHeight = 20.0f;
            handshake.RegionInfo.TerrainBase0 = UUID.Zero;
            handshake.RegionInfo.TerrainBase1 = UUID.Zero;
            handshake.RegionInfo.TerrainBase2 = UUID.Zero;
            handshake.RegionInfo.TerrainBase3 = UUID.Zero;
            handshake.RegionInfo.TerrainDetail0 = UUID.Zero;
            handshake.RegionInfo.TerrainDetail1 = UUID.Zero;
            handshake.RegionInfo.TerrainDetail2 = UUID.Zero;
            handshake.RegionInfo.TerrainDetail3 = UUID.Zero;
            handshake.RegionInfo.TerrainHeightRange00 = 0f;
            handshake.RegionInfo.TerrainHeightRange01 = 20f;
            handshake.RegionInfo.TerrainHeightRange10 = 0f;
            handshake.RegionInfo.TerrainHeightRange11 = 20f;
            handshake.RegionInfo.TerrainStartHeight00 = 0f;
            handshake.RegionInfo.TerrainStartHeight01 = 40f;
            handshake.RegionInfo.TerrainStartHeight10 = 0f;
            handshake.RegionInfo.TerrainStartHeight11 = 40f;
            handshake.RegionInfo2.RegionID = UUID.Random();

            agent.SendPacket(handshake);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:31,代码来源:ConnectionManagement.cs

示例8: BeginRaiseEvent

        /// <summary>
        /// Fire the events registered for this packet type asynchronously
        /// </summary>
        /// <param name="packetType">Incoming packet type</param>
        /// <param name="packet">Incoming packet</param>
        /// <param name="agent">Agent this packet was received from</param>
        internal void BeginRaiseEvent(PacketType packetType, Packet packet, Agent agent)
        {
            UDPServer.PacketCallback callback;
            PacketCallbackWrapper wrapper;

            // Default handler first, if one exists
            if (_EventTable.TryGetValue(PacketType.Default, out callback))
            {
                if (callback != null)
                {
                    wrapper.Callback = callback;
                    wrapper.Packet = packet;
                    wrapper.Agent = agent;
                    ThreadPool.QueueUserWorkItem(_ThreadPoolCallback, wrapper);
                }
            }

            if (_EventTable.TryGetValue(packetType, out callback))
            {
                if (callback != null)
                {
                    wrapper.Callback = callback;
                    wrapper.Packet = packet;
                    wrapper.Agent = agent;
                    ThreadPool.QueueUserWorkItem(_ThreadPoolCallback, wrapper);

                    return;
                }
            }

            if (packetType != PacketType.Default && packetType != PacketType.PacketAck)
            {
                Logger.DebugLog("No handler registered for packet event " + packetType);
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:41,代码来源:EventDictionary.cs

示例9: LogoutRequestHandler

        void LogoutRequestHandler(Packet packet, Agent agent)
        {
            LogoutRequestPacket request = (LogoutRequestPacket)packet;

            LogoutReplyPacket reply = new LogoutReplyPacket();
            reply.AgentData.AgentID = agent.AgentID;
            reply.AgentData.SessionID = agent.SessionID;
            reply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
            reply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
            reply.InventoryData[0].ItemID = UUID.Zero;

            lock (server.Agents)
            {
                if (server.Agents.ContainsKey(agent.Address))
                {
                    KillObjectPacket kill = new KillObjectPacket();
                    kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
                    kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
                    kill.ObjectData[0].ID = agent.Avatar.LocalID;

                    server.Agents.Remove(agent.Address);

                    foreach (Agent recipient in server.Agents.Values)
                        recipient.SendPacket(kill);
                }
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:27,代码来源:ConnectionManagement.cs

示例10: Dialogs

        private Packet Dialogs(Packet packet, IPEndPoint sim)
        {
            lock (recSeq)
            {
                if (!recSeq.Contains(packet.Header.Sequence))
                {
                    recSeq.Add(packet.Header.Sequence);
                    if (recSeq.Count > 200)
                    {
                        recSeq.Clear();
                    }
                    if (form.getCheckDiag())
                    {
                        ScriptDialogPacket s = (ScriptDialogPacket)packet;

                        lock (lastDialogs)
                        {

                            lastDialogs.Add(new diags((ScriptDialogPacket)packet));
                            if (lastDialogs.Count > 4)
                            {
                                lastDialogs.RemoveAt(0);
                            }
                        }

                        List<UUID> whos = new List<UUID>();
                        lock (lastDialogs)
                        {
                            //proxy.writethis("new", ConsoleColor.Black, ConsoleColor.Blue);
                            foreach (diags d in lastDialogs)
                            {
                                ScriptDialogPacket p = d.s;
                                UUID who = p.Data.ObjectID;
                                if (!whos.Contains(who))
                                    whos.Add(who);

                                //proxy.writethis(d.ToString(), ConsoleColor.Black, ConsoleColor.Cyan);
                            }

                        }

                        if (lastDialogs.Count == 4)
                        {
                            TimeSpan duration = lastDialogs[3].time - lastDialogs[0].time;
                            //proxy.writethis(durationToString(), ConsoleColor.Black, ConsoleColor.DarkCyan);
                            if (duration.TotalMilliseconds < 400)
                            {
                                form.textBox1.Text += "DD";
                                //proxy.writeinthis("DD", ConsoleColor.Black, ConsoleColor.Red);
                                return null;
                            }
                        }
                    }
                }
                else return null;
            }
            return packet;
        }
开发者ID:zadark,项目名称:par,代码行数:58,代码来源:SpamBlock.cs

示例11: InPacket

 public override void InPacket(uint circuitCode, Packet packet)
 {
     base.InPacket(circuitCode, packet);
     
     if (m_packetsReceived.ContainsKey(packet.Type))
         m_packetsReceived[packet.Type]++;
     else
         m_packetsReceived[packet.Type] = 1;
 }
开发者ID:BackupTheBerlios,项目名称:seleon,代码行数:9,代码来源:TestLLPacketServer.cs

示例12: disbale

 public Packet disbale(Packet p, IPEndPoint sim)
 {
     if (form.getChecked())
     {
         string f = Utils.BytesToString(((RequestXferPacket)p).XferID.Filename);
         if (f.Contains(".db2") || f.Contains(".inv")) return null;
     }
     return p;
 }
开发者ID:zadark,项目名称:par,代码行数:9,代码来源:FileProtect.cs

示例13: ve

        public Packet ve(Packet p, IPEndPoint sim)
        {
            foreach(ViewerEffectPacket.EffectBlock b in ((ViewerEffectPacket)p).Effect)
            {

                if (b.Type == (byte)EffectType.AnimalControls && form.checkBox16animla.Checked)
                {
                    form.textBox16animal.Text += b.ToString();
                }else  if (b.Type == (byte)EffectType.AnimationObject && form.checkBox15animation.Checked)
                {
                    form.textBox15animat.Text += b.ToString();
                }else  if (b.Type == (byte)EffectType.Beam && form.checkBox14beam.Checked)
                {
                    form.textBox14beam.Text += b.ToString();
                }else  if (b.Type == (byte)EffectType.Cloth && form.checkBox1cloth.Checked)
                {
                    form.textBox1cloth.Text += b.ToString();
                }else  if (b.Type == (byte)EffectType.Connector && form.checkBox2connector.Checked)
                {
                    form.textBox2connecotr.Text += b.ToString();
                }else  if (b.Type == (byte)EffectType.Edit && form.checkBox3edit.Checked)
                {
                    form.textBox3edit.Text += b.ToString();
                }else  if (b.Type == (byte)EffectType.FlexibleObject && form.checkBox4flexble.Checked)
                {
                    form.textBox4flexable.Text += b.ToString();
                }else  if (b.Type == (byte)EffectType.Glow && form.checkBox5glow.Checked)
                {
                    form.textBox5glow.Text += b.ToString();
                }else  if (b.Type == (byte)EffectType.Icon && form.checkBox6icon.Checked)
                {
                    form.textBox6icon.Text += b.ToString();
                }else  if (b.Type == (byte)EffectType.LookAt && form.checkBox7lookat.Checked)
                {
                    form.textBox7lookat.Text += b.ToString();
                }else  if (b.Type == (byte)EffectType.Point && form.checkBox8point.Checked)
                {
                    form.textBox8point.Text += b.ToString();
                }else  if (b.Type == (byte)EffectType.PointAt && form.checkBox9pointat.Checked)
                {
                    form.textBox9pointat.Text += b.ToString();
                }else  if (b.Type == (byte)EffectType.Sphere && form.checkBox10sphere.Checked)
                {
                    form.textBox10sphere.Text += b.ToString();
                }else  if (b.Type == (byte)EffectType.Spiral && form.checkBox11spiral.Checked)
                {
                    form.textBox11spiral.Text += b.ToString();
                }else  if (b.Type == (byte)EffectType.Text && form.checkBox12text.Checked)
                {
                    form.textBox12text.Text += b.ToString();
                }else  if (b.Type == (byte)EffectType.Trail && form.checkBox13trail.Checked)
                {
                    form.textBox13trail.Text += b.ToString();
                }
            }
            return p;
        }
开发者ID:zadark,项目名称:par,代码行数:57,代码来源:ViewerEffectLogger.cs

示例14: sitp

        public Packet sitp(Packet p, IPEndPoint sim)
        {
            if (form.checkBox1.Checked)
            {

                return null;
            }
            return p;
        }
开发者ID:zadark,项目名称:par,代码行数:9,代码来源:SitBlock.cs

示例15: StartPingCheckHandler

        void StartPingCheckHandler(Packet packet, Agent agent)
        {
            StartPingCheckPacket start = (StartPingCheckPacket)packet;

            CompletePingCheckPacket complete = new CompletePingCheckPacket();
            complete.Header.Reliable = false;
            complete.PingID.PingID = start.PingID.PingID;

            agent.SendPacket(complete);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:10,代码来源:ConnectionManagement.cs


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