From 3892bc7a9d1fbab34f2d3bb38c9c2aaedc5ec7ae Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sat, 23 Dec 2006 14:13:02 +0000 Subject: [PATCH] Initial import of the SLProxy GUI, Second Glance git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@764 52acb1d6-8a22-11de-b505-999d5b087335 --- .../SecondGlance/Properties/AssemblyInfo.cs | 33 +++ .../Properties/Resources.Designer.cs | 71 ++++++ .../SecondGlance/Properties/Resources.resx | 117 +++++++++ .../Properties/Settings.Designer.cs | 30 +++ .../SecondGlance/Properties/Settings.settings | 7 + applications/SecondGlance/SecondGlance.cs | 20 ++ applications/SecondGlance/SecondGlance.csproj | 88 +++++++ .../SecondGlance/frmSecondGlance.Designer.cs | 232 ++++++++++++++++++ applications/SecondGlance/frmSecondGlance.cs | 154 ++++++++++++ .../SecondGlance/frmSecondGlance.resx | 123 ++++++++++ 10 files changed, 875 insertions(+) create mode 100644 applications/SecondGlance/Properties/AssemblyInfo.cs create mode 100644 applications/SecondGlance/Properties/Resources.Designer.cs create mode 100644 applications/SecondGlance/Properties/Resources.resx create mode 100644 applications/SecondGlance/Properties/Settings.Designer.cs create mode 100644 applications/SecondGlance/Properties/Settings.settings create mode 100644 applications/SecondGlance/SecondGlance.cs create mode 100644 applications/SecondGlance/SecondGlance.csproj create mode 100644 applications/SecondGlance/frmSecondGlance.Designer.cs create mode 100644 applications/SecondGlance/frmSecondGlance.cs create mode 100644 applications/SecondGlance/frmSecondGlance.resx diff --git a/applications/SecondGlance/Properties/AssemblyInfo.cs b/applications/SecondGlance/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..d19e7829 --- /dev/null +++ b/applications/SecondGlance/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SecondGlance")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SecondGlance")] +[assembly: AssemblyCopyright("Copyright © 2006")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("02456c47-f074-4302-a3a3-01a719de9d20")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/applications/SecondGlance/Properties/Resources.Designer.cs b/applications/SecondGlance/Properties/Resources.Designer.cs new file mode 100644 index 00000000..6d95029e --- /dev/null +++ b/applications/SecondGlance/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.308 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SecondGlance.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SecondGlance.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/applications/SecondGlance/Properties/Resources.resx b/applications/SecondGlance/Properties/Resources.resx new file mode 100644 index 00000000..ffecec85 --- /dev/null +++ b/applications/SecondGlance/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/applications/SecondGlance/Properties/Settings.Designer.cs b/applications/SecondGlance/Properties/Settings.Designer.cs new file mode 100644 index 00000000..805ab6e7 --- /dev/null +++ b/applications/SecondGlance/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.308 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SecondGlance.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/applications/SecondGlance/Properties/Settings.settings b/applications/SecondGlance/Properties/Settings.settings new file mode 100644 index 00000000..abf36c5d --- /dev/null +++ b/applications/SecondGlance/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/applications/SecondGlance/SecondGlance.cs b/applications/SecondGlance/SecondGlance.cs new file mode 100644 index 00000000..e19fe9b4 --- /dev/null +++ b/applications/SecondGlance/SecondGlance.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace SecondGlance +{ + static class SecondGlance + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new frmSecondGlance()); + } + } +} \ No newline at end of file diff --git a/applications/SecondGlance/SecondGlance.csproj b/applications/SecondGlance/SecondGlance.csproj new file mode 100644 index 00000000..daa5476d --- /dev/null +++ b/applications/SecondGlance/SecondGlance.csproj @@ -0,0 +1,88 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {D72C92D1-559A-48A7-93F5-99F4E99F3F98} + WinExe + Properties + SecondGlance + SecondGlance + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\bin\ + TRACE + prompt + 4 + + + + + + + + + + + + Form + + + frmSecondGlance.cs + + + + + Designer + frmSecondGlance.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {D9CDEDFB-8169-4B03-B57F-0DF638F044EC} + libsecondlife + + + {E4115DC9-FC88-47D6-B3B6-2400AD19B80D} + SLProxy + + + + + \ No newline at end of file diff --git a/applications/SecondGlance/frmSecondGlance.Designer.cs b/applications/SecondGlance/frmSecondGlance.Designer.cs new file mode 100644 index 00000000..46c3c349 --- /dev/null +++ b/applications/SecondGlance/frmSecondGlance.Designer.cs @@ -0,0 +1,232 @@ +namespace SecondGlance +{ + partial class frmSecondGlance + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.panel1 = new System.Windows.Forms.Panel(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); + this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.cboToLog = new System.Windows.Forms.ComboBox(); + this.cmdAddLogger = new System.Windows.Forms.Button(); + this.cmdDontLog = new System.Windows.Forms.Button(); + this.cboLogged = new System.Windows.Forms.ComboBox(); + this.lstPackets = new System.Windows.Forms.ListBox(); + this.panel1.SuspendLayout(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.menuStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // panel1 + // + this.panel1.Controls.Add(this.splitContainer1); + this.panel1.Location = new System.Drawing.Point(29, 100); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(664, 333); + this.panel1.TabIndex = 0; + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.lstPackets); + this.splitContainer1.Size = new System.Drawing.Size(664, 333); + this.splitContainer1.SplitterDistance = 294; + this.splitContainer1.TabIndex = 0; + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.aboutToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(705, 24); + this.menuStrip1.TabIndex = 1; + this.menuStrip1.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.newToolStripMenuItem, + this.openToolStripMenuItem, + this.toolStripMenuItem1, + this.saveToolStripMenuItem, + this.toolStripMenuItem2, + this.exitToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "File"; + // + // newToolStripMenuItem + // + this.newToolStripMenuItem.Name = "newToolStripMenuItem"; + this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); + this.newToolStripMenuItem.Size = new System.Drawing.Size(188, 22); + this.newToolStripMenuItem.Text = "New Session"; + // + // openToolStripMenuItem + // + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); + this.openToolStripMenuItem.Size = new System.Drawing.Size(188, 22); + this.openToolStripMenuItem.Text = "Open Session"; + // + // toolStripMenuItem1 + // + this.toolStripMenuItem1.Name = "toolStripMenuItem1"; + this.toolStripMenuItem1.Size = new System.Drawing.Size(185, 6); + // + // saveToolStripMenuItem + // + this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); + this.saveToolStripMenuItem.Size = new System.Drawing.Size(188, 22); + this.saveToolStripMenuItem.Text = "Save Session"; + // + // toolStripMenuItem2 + // + this.toolStripMenuItem2.Name = "toolStripMenuItem2"; + this.toolStripMenuItem2.Size = new System.Drawing.Size(185, 6); + // + // exitToolStripMenuItem + // + this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; + this.exitToolStripMenuItem.Size = new System.Drawing.Size(188, 22); + this.exitToolStripMenuItem.Text = "Exit"; + // + // aboutToolStripMenuItem + // + this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(52, 20); + this.aboutToolStripMenuItem.Text = "About"; + // + // cboToLog + // + this.cboToLog.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cboToLog.FormattingEnabled = true; + this.cboToLog.Location = new System.Drawing.Point(12, 27); + this.cboToLog.Name = "cboToLog"; + this.cboToLog.Size = new System.Drawing.Size(150, 21); + this.cboToLog.TabIndex = 4; + // + // cmdAddLogger + // + this.cmdAddLogger.Location = new System.Drawing.Point(168, 25); + this.cmdAddLogger.Name = "cmdAddLogger"; + this.cmdAddLogger.Size = new System.Drawing.Size(75, 23); + this.cmdAddLogger.TabIndex = 5; + this.cmdAddLogger.Text = "Log"; + this.cmdAddLogger.UseVisualStyleBackColor = true; + this.cmdAddLogger.Click += new System.EventHandler(this.cmdAddLogger_Click); + // + // cmdDontLog + // + this.cmdDontLog.Location = new System.Drawing.Point(430, 25); + this.cmdDontLog.Name = "cmdDontLog"; + this.cmdDontLog.Size = new System.Drawing.Size(75, 23); + this.cmdDontLog.TabIndex = 7; + this.cmdDontLog.Text = "Don\'t Log"; + this.cmdDontLog.UseVisualStyleBackColor = true; + this.cmdDontLog.Click += new System.EventHandler(this.cmdDontLog_Click); + // + // cboLogged + // + this.cboLogged.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cboLogged.FormattingEnabled = true; + this.cboLogged.Location = new System.Drawing.Point(274, 27); + this.cboLogged.Name = "cboLogged"; + this.cboLogged.Size = new System.Drawing.Size(150, 21); + this.cboLogged.TabIndex = 6; + // + // lstPackets + // + this.lstPackets.FormattingEnabled = true; + this.lstPackets.Location = new System.Drawing.Point(26, 40); + this.lstPackets.Name = "lstPackets"; + this.lstPackets.Size = new System.Drawing.Size(243, 277); + this.lstPackets.TabIndex = 1; + // + // frmSecondGlance + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(705, 498); + this.Controls.Add(this.cmdDontLog); + this.Controls.Add(this.cboLogged); + this.Controls.Add(this.cmdAddLogger); + this.Controls.Add(this.cboToLog); + this.Controls.Add(this.panel1); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.Name = "frmSecondGlance"; + this.Text = "Second Glance"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmSecondGlance_FormClosing); + this.panel1.ResumeLayout(false); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.ResumeLayout(false); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1; + private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2; + private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; + private System.Windows.Forms.ComboBox cboToLog; + private System.Windows.Forms.Button cmdAddLogger; + private System.Windows.Forms.Button cmdDontLog; + private System.Windows.Forms.ComboBox cboLogged; + private System.Windows.Forms.ListBox lstPackets; + } +} + diff --git a/applications/SecondGlance/frmSecondGlance.cs b/applications/SecondGlance/frmSecondGlance.cs new file mode 100644 index 00000000..cfe6c6ed --- /dev/null +++ b/applications/SecondGlance/frmSecondGlance.cs @@ -0,0 +1,154 @@ +/* + * + * Copyright (c) 2007 John Hurliman + * All rights reserved. + * + * - Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * - Neither the name of the Second Life Reverse Engineering Team nor the names + * of its contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Net; +using System.Windows.Forms; +using libsecondlife; +using libsecondlife.Packets; +using SLProxy; + +namespace SecondGlance +{ + public partial class frmSecondGlance : Form + { + private Proxy Proxy; + private Queue Inbox = new Queue(); + private System.Timers.Timer DisplayTimer = new System.Timers.Timer(200); + + public frmSecondGlance() + { + InitializeComponent(); + + PacketType[] types = (PacketType[])Enum.GetValues(typeof(PacketType)); + + // Fill up the "To Log" combo box with options + foreach (PacketType type in types) + { + if (type != PacketType.Default) cboToLog.Items.Add(type); + } + + // Set the default selection to the first entry + cboToLog.SelectedIndex = 0; + + // Setup the proxy + ProxyConfig proxyConfig = new ProxyConfig("Second Glance", "John Hurliman ", + new string[0]); + Proxy = new Proxy(proxyConfig); + + Proxy.Start(); + + // Start the timer that moves packets from the queue and displays them + DisplayTimer.Elapsed += new System.Timers.ElapsedEventHandler(DisplayTimer_Elapsed); + DisplayTimer.Start(); + } + + void DisplayTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) + { + this.BeginInvoke(new MethodInvoker(UpdateDisplay)); + } + + void UpdateDisplay() + { + lock (Inbox) + { + while (Inbox.Count > 0) + { + lstPackets.Items.Add(Inbox.Dequeue()); + } + } + } + + private void frmSecondGlance_FormClosing(object sender, FormClosingEventArgs e) + { + DisplayTimer.Stop(); + Proxy.Stop(); + } + + private void cmdAddLogger_Click(object sender, EventArgs e) + { + if (!cboLogged.Items.Contains(cboToLog.SelectedItem)) + { + PacketType type = (PacketType)cboToLog.SelectedItem; + + cboLogged.Items.Add(type); + + Proxy.AddDelegate(type, Direction.Incoming, new PacketDelegate(IncomingPacketHandler)); + Proxy.AddDelegate(type, Direction.Outgoing, new PacketDelegate(OutgoingPacketHandler)); + } + } + + private void cmdDontLog_Click(object sender, EventArgs e) + { + ; + } + + private Packet IncomingPacketHandler(Packet packet, IPEndPoint sim) + { + return PacketHandler(packet, sim, Direction.Incoming); + } + + private Packet OutgoingPacketHandler(Packet packet, IPEndPoint sim) + { + return PacketHandler(packet, sim, Direction.Outgoing); + } + + private Packet PacketHandler(Packet packet, IPEndPoint sim, Direction direction) + { + LoggedPacket logged = new LoggedPacket(); + logged.Packet = packet; + logged.Sim = sim; + logged.Direction = direction; + + lock (Inbox) + Inbox.Enqueue(logged); + + // TODO: Packet modifications + + return packet; + } + } + + public class LoggedPacket + { + public Packet Packet; + public IPEndPoint Sim; + public Direction Direction; + + public override string ToString() + { + string text = (Direction == Direction.Incoming) ? "<-- " : "--> "; + text += Sim.ToString() + " " + Packet.Type.ToString(); + + return text; + } + } +} diff --git a/applications/SecondGlance/frmSecondGlance.resx b/applications/SecondGlance/frmSecondGlance.resx new file mode 100644 index 00000000..69c56499 --- /dev/null +++ b/applications/SecondGlance/frmSecondGlance.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file