コード例 #1
0
        private void Setup_Packet_Capture()
        {
            // ---------------------------

            treeView.Items.Add(
                new MenuItem {
                Title = String.Format(
                    "This only works with Administrator, do we have it? .. [{0}]",
                    AppElevation.CheckForAdministrator() ? "YES" : "NO")
            });
            // TODO: if we don't have administrator, we should put up an error dialog...

            // setup info log hooks
            captureManager.PacketEvent_Info     += CaptureManager_UDPPacket_Info;
            photonDecoder.Event_Photon_Info     += PhotonDecoder_Event_Photon_Info;
            photonDecoder.Event_Photon_Cmd_Info += PhotonDecoder_Event_Photon_Cmd_Info;
            albionDecoder.Event_Albion_Info     += AlbionDecoder_Event_Albion_Info;


            // setup "real" packet processing hooks
            captureManager.PacketEvent_UDP += CaptureManager_PacketEvent_UDP;
            photonDecoder.Event_Photon_ReliableResponse += PhotonDecoder_Event_Photon_ReliableResponse;
            photonDecoder.Event_Photon_ReliableEvent    += PhotonDecoder_Event_Photon_ReliableEvent;

            Console.WriteLine("Start Capturing Packets...");
            captureManager.StartCapture();
        }