diff --git a/.gitignore b/.gitignore index 953a1e20..78b54280 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ compile.bat *.csproj *.user +*.userprefs *.sln +*.suo *.cache [Oo]bj/ diff --git a/Programs/GridProxyGUI/FilterScroller.cs b/Programs/GridProxyGUI/FilterScroller.cs new file mode 100755 index 00000000..8c5948e5 --- /dev/null +++ b/Programs/GridProxyGUI/FilterScroller.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using Gtk; +using GridProxyGUI; + +namespace GridProxyGUI +{ + public class UDPFilterItem + { + public bool Enabled; + public string Name; + } + + + public class FilterScroller : ScrolledWindow + { + ListStore store; + + public FilterScroller(Container parent, ListStore store) + { + this.store = store; + + TreeView tvFilterUDP = new TreeView(); + TreeViewColumn cbCol = new TreeViewColumn(); + TreeViewColumn udpCol = new TreeViewColumn(); + + CellRendererToggle cbCell = new CellRendererToggle(); + cbCell.Toggled += new ToggledHandler(cbCell_Toggled); + cbCell.Activatable = true; + cbCol.PackStart(cbCell, true); + cbCol.SetCellDataFunc(cbCell, renderToggleCell); + tvFilterUDP.AppendColumn(cbCol); + + CellRendererText cell = new CellRendererText(); + udpCol.PackStart(cell, true); + udpCol.SetCellDataFunc(cell, renderTextCell); + tvFilterUDP.AppendColumn(udpCol); + + tvFilterUDP.Model = store; + tvFilterUDP.HeadersVisible = false; + tvFilterUDP.Selection.Mode = SelectionMode.Single; + + foreach (var child in new List(parent.Children)) + { + parent.Remove(child); + } + + Add(tvFilterUDP); + ShadowType = ShadowType.EtchedIn; + parent.Add(this); + parent.ShowAll(); + } + + void cbCell_Toggled(object o, ToggledArgs args) + { + TreeIter iter; + if (store.GetIterFromString(out iter, args.Path)) + { + UDPFilterItem item = store.GetValue(iter, 0) as UDPFilterItem; + if (null != item) + { + item.Enabled = !item.Enabled; + store.SetValue(iter, 0, item); + } + } + } + + void renderTextCell(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) + { + var item = model.GetValue(iter, 0) as UDPFilterItem; + if (item != null) + { + ((CellRendererText)cell).Text = item.Name; + } + } + + void renderToggleCell(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) + { + var item = model.GetValue(iter, 0) as UDPFilterItem; + if (item != null) + { + ((CellRendererToggle)cell).Active = item.Enabled; + } + } + + } +} diff --git a/Programs/GridProxyGUI/MainWindow.cs b/Programs/GridProxyGUI/MainWindow.cs new file mode 100755 index 00000000..cac4de62 --- /dev/null +++ b/Programs/GridProxyGUI/MainWindow.cs @@ -0,0 +1,184 @@ +using System; +using System.Collections.Generic; +using System.Collections.Concurrent; +using Gtk; +using GridProxyGUI; +using WinGridProxy; +using OpenMetaverse.Packets; + +public partial class MainWindow : Gtk.Window +{ + ProxyManager proxy = null; + ConcurrentDictionary UDPFilterItems = new ConcurrentDictionary(); + ConcurrentDictionary CapFilterItems = new ConcurrentDictionary(); + ListStore udpStore, capStore; + FilterScroller capScroller; + + public MainWindow() + : base(Gtk.WindowType.Toplevel) + { + Build(); + SetIconFromFile("libomv.png"); + tabsMain.Page = 1; + mainSplit.Position = 600; + txtSummary.ModifyFont(Pango.FontDescription.FromString("monospace bold 9")); + + ProxyLogger.Init(); + + ProxyManager.OnCapabilityAdded += new ProxyManager.CapsAddedHandler(ProxyManager_OnCapabilityAdded); + ProxyManager.OnEventMessageLog += new ProxyManager.EventQueueMessageHandler(ProxyManager_OnEventMessageLog); + ProxyManager.OnMessageLog += new ProxyManager.MessageLogHandler(ProxyManager_OnMessageLog); + } + + void ProxyManager_OnCapabilityAdded(GridProxy.CapInfo cap) + { + Application.Invoke((sender, e) => + { + if (null == capStore) + { + capStore = new ListStore(typeof(UDPFilterItem)); + } + + if (!CapFilterItems.ContainsKey(cap.CapType)) + { + UDPFilterItem item = new UDPFilterItem() { Enabled = true, Name = cap.CapType }; + CapFilterItems[item.Name] = item; + capStore.AppendValues(item); + } + + if (null == capScroller) + { + capScroller = new FilterScroller(containerFilterCap, capStore); + } + }); + } + + void ProxyManager_OnEventMessageLog(GridProxy.CapsRequest req, GridProxy.CapsStage stage) + { + Application.Invoke((sender, e) => + { + if (null == capStore) + { + capStore = new ListStore(typeof(UDPFilterItem)); + } + + if (!CapFilterItems.ContainsKey(req.Info.CapType)) + { + UDPFilterItem item = new UDPFilterItem() { Enabled = true, Name = req.Info.CapType }; + CapFilterItems[item.Name] = item; + capStore.AppendValues(item); + } + else + { + ProxyManager_OnMessageLog(req, GridProxy.CapsStage.Response); + } + + if (null == capScroller) + { + capScroller = new FilterScroller(containerFilterCap, capStore); + } + }); + } + + void ProxyManager_OnMessageLog(GridProxy.CapsRequest req, GridProxy.CapsStage stage) + { + } + + void Logger_OnLogLine(object sender, LogEventArgs e) + { + Gtk.Application.Invoke((sx, ex) => + { + AppendLog(e.Message); + }); + } + + void AppendLog(string msg) + { + var end = txtSummary.Buffer.EndIter; + txtSummary.Buffer.Insert(ref end, msg); + } + + protected void StartPoxy() + { + AppendLog("Starting proxy..." + Environment.NewLine); + ProxyLogger.OnLogLine += new ProxyLogger.Log(Logger_OnLogLine); + proxy = new ProxyManager(txtPort.Text, cbListen.ActiveText, cbLoginURL.ActiveText); + proxy.Start(); + } + + protected void StopProxy() + { + AppendLog("Proxy stopped" + Environment.NewLine); + ProxyLogger.OnLogLine -= new ProxyLogger.Log(Logger_OnLogLine); + if (proxy != null) proxy.Stop(); + proxy = null; + foreach (var child in new List(containerFilterUDP.Children)) + { + containerFilterUDP.Remove(child); + } + } + + protected void OnDeleteEvent(object sender, DeleteEventArgs a) + { + StopProxy(); + Application.Quit(); + a.RetVal = true; + } + + protected void OnExitActionActivated(object sender, EventArgs e) + { + StopProxy(); + Application.Quit(); + } + + protected void OnBtnStartClicked(object sender, EventArgs e) + { + if (btnStart.Label.StartsWith("Start")) + { + btnStart.Label = "Stop Proxy"; + StartPoxy(); + InitProxyFilters(); + } + else if (btnStart.Label.StartsWith("Stop")) + { + btnStart.Label = "Start Proxy"; + StopProxy(); + } + } + + void InitUDPFilters() + { + if (UDPFilterItems.Count > 0) return; + + UDPFilterItems["Login Request"] = new UDPFilterItem() { Enabled = false, Name = "Login Request" }; + UDPFilterItems["Login Response"] = new UDPFilterItem() { Enabled = true, Name = "Login Response" }; + foreach (string name in Enum.GetNames(typeof(PacketType))) + { + if (!string.IsNullOrEmpty(name)) + { + UDPFilterItems[name] = new UDPFilterItem() { Enabled = false, Name = name }; + } + } + } + + void InitProxyFilters() + { + InitUDPFilters(); + + udpStore = new ListStore(typeof(UDPFilterItem)); + List keys = new List(UDPFilterItems.Keys); + keys.Sort((a, b) => { return string.Compare(a.ToLower(), b.ToLower()); }); + + udpStore.AppendValues(UDPFilterItems["Login Request"]); + udpStore.AppendValues(UDPFilterItems["Login Response"]); + + foreach (var key in keys) + { + if (key == "Login Request" || key == "Login Response") continue; + udpStore.AppendValues(UDPFilterItems[key]); + } + + new FilterScroller(containerFilterUDP, udpStore); + } + +} \ No newline at end of file diff --git a/Programs/GridProxyGUI/Program.cs b/Programs/GridProxyGUI/Program.cs new file mode 100755 index 00000000..54a3b100 --- /dev/null +++ b/Programs/GridProxyGUI/Program.cs @@ -0,0 +1,16 @@ +using System; +using Gtk; + +namespace GridProxyGUI +{ + class MainClass + { + public static void Main(string[] args) + { + Application.Init(); + MainWindow win = new MainWindow(); + win.Show(); + Application.Run(); + } + } +} diff --git a/Programs/GridProxyGUI/Properties/AssemblyInfo.cs b/Programs/GridProxyGUI/Properties/AssemblyInfo.cs new file mode 100755 index 00000000..4e11fa57 --- /dev/null +++ b/Programs/GridProxyGUI/Properties/AssemblyInfo.cs @@ -0,0 +1,23 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. +[assembly: AssemblyTitle ("GridProxyGUI")] +[assembly: AssemblyDescription("GTK Based GUI for Grid Proxy")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany("Open Metaverse Foundation")] +[assembly: AssemblyProduct("Grid Proxy GUI")] +[assembly: AssemblyCopyright("Latif Khalifa")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. +[assembly: AssemblyVersion ("1.0.*")] +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + +[assembly: AssemblyFileVersionAttribute("1.0")] diff --git a/Programs/GridProxyGUI/ProxyLogger.cs b/Programs/GridProxyGUI/ProxyLogger.cs new file mode 100755 index 00000000..3d9a4de8 --- /dev/null +++ b/Programs/GridProxyGUI/ProxyLogger.cs @@ -0,0 +1,42 @@ +using System; +using log4net; +using log4net.Appender; +using log4net.Core; +using log4net.Config; +using log4net.Layout; + +namespace GridProxyGUI +{ + public class ProxyLogger : AppenderSkeleton + { + public delegate void Log(object sender, LogEventArgs e); + public static event Log OnLogLine; + + public static void Init() + { + var appender = new ProxyLogger(); + appender.Layout = new PatternLayout("%timestamp %-5level %message%newline"); + // appender.AddFilter(new log4net.Filter.LoggerMatchFilter() { LoggerToMatch = "OpenMetaverse" }); + BasicConfigurator.Configure(appender); + } + + protected override void Append(LoggingEvent le) + { + if (OnLogLine != null && le.Level != Level.Debug) + { + OnLogLine(this, new LogEventArgs(string.Format("{0} [{1}] {2}\n", le.TimeStamp, le.Level, le.MessageObject))); + } + } + } + + public class LogEventArgs : EventArgs + { + public string Message { get; set; } + + public LogEventArgs(string msg) + { + this.Message = msg; + } + } +} + diff --git a/Programs/GridProxyGUI/ProxyManager.cs b/Programs/GridProxyGUI/ProxyManager.cs new file mode 100755 index 00000000..bc9f278b --- /dev/null +++ b/Programs/GridProxyGUI/ProxyManager.cs @@ -0,0 +1,510 @@ +/* + * Copyright (c) 2009, openmetaverse.org + * 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 openmetaverse.org 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.Net; +using System.Collections.Generic; +using System.Text; +using System.Text.RegularExpressions; +using System.Reflection; +using GridProxy; +using Nwc.XmlRpc; +using OpenMetaverse.Packets; +using OpenMetaverse.StructuredData; +using OpenMetaverse; + +namespace WinGridProxy +{ + public class ProxyManager + { + // fired when a new packet arrives + public delegate void PacketLogHandler(Packet packet, Direction direction, IPEndPoint endpoint); + public static event PacketLogHandler OnPacketLog; + + // fired when a message arrives over a known capability + public delegate void MessageLogHandler(CapsRequest req, CapsStage stage); + public static event MessageLogHandler OnMessageLog; + + // handle login request/response data + public delegate void LoginLogHandler(object request, Direction direction); + public static event LoginLogHandler OnLoginResponse; + + // fired when a new Capability is added to the KnownCaps Dictionary + public delegate void CapsAddedHandler(CapInfo cap); + public static event CapsAddedHandler OnCapabilityAdded; + + // Handle messages sent via the EventQueue + public delegate void EventQueueMessageHandler(CapsRequest req, CapsStage stage); + public static event EventQueueMessageHandler OnEventMessageLog; + + private string _Port; + private string _ListenIP; + private string _LoginURI; + + public ProxyFrame Proxy; + + private Assembly openmvAssembly; + + public ProxyManager(string port, string listenIP, string loginUri) + { + openmvAssembly = Assembly.Load("OpenMetaverse"); + if (openmvAssembly == null) throw new Exception("Assembly load exception"); + + _Port = string.Format("--proxy-login-port={0}", port); + + IPAddress remoteIP; // not used + if (IPAddress.TryParse(listenIP, out remoteIP)) + _ListenIP = String.Format("--proxy-client-facing-address={0}", listenIP); + else + _ListenIP = "--proxy-client-facing-address=127.0.0.1"; + + if (String.IsNullOrEmpty(loginUri)) + _LoginURI = "--proxy-remote-login-uri=https://login.agni.lindenlab.com/cgi-bin/login.cgi"; + else + _LoginURI = "--proxy-remote-login-uri=" + loginUri; + + + string[] args = { _Port, _ListenIP, _LoginURI }; + /* + help + proxy-help + proxy-login-port + proxy-client-facing-address + proxy-remote-facing-address + proxy-remote-login-uri + verbose + quiet + */ + + ProxyConfig pc = new ProxyConfig("WinGridProxy", "Jim Radford", args); + + Proxy = new ProxyFrame(args, pc); + + Proxy.proxy.AddLoginRequestDelegate(new XmlRpcRequestDelegate(LoginRequest)); + Proxy.proxy.AddLoginResponseDelegate(new XmlRpcResponseDelegate(LoginResponse)); + + Proxy.proxy.AddCapsDelegate("EventQueueGet", new CapsDelegate(EventQueueGetHandler)); + + // this is so we are informed of any new capabilities that are added to the KnownCaps dictionary + Proxy.proxy.KnownCaps.AddDelegate(OpenMetaverse.DictionaryEventAction.Add, new OpenMetaverse.DictionaryChangeCallback(KnownCapsAddedHandler)); + } + + public void Start() + { + Proxy.proxy.Start(); + } + + public void Stop() + { + Proxy.proxy.Stop(); + } + + public void KnownCapsAddedHandler(OpenMetaverse.DictionaryEventAction action, System.Collections.DictionaryEntry de) + { + if (OnCapabilityAdded != null) + OnCapabilityAdded((CapInfo)de.Value); + } + + private void LoginRequest(object sender, XmlRpcRequestEventArgs e) + { + if (OnLoginResponse != null) + OnLoginResponse(e.m_Request, Direction.Outgoing); + } + + private void LoginResponse(XmlRpcResponse response) + { + if (OnLoginResponse != null) + OnLoginResponse(response, Direction.Incoming); + } + + + internal OpenMetaverse.ObservableDictionary GetCapabilities() + { + return Proxy.proxy.KnownCaps; + } + + internal void AddCapsDelegate(string capsKey, bool add) + { + if (add) + Proxy.proxy.AddCapsDelegate(capsKey, new CapsDelegate(CapsHandler)); + else + Proxy.proxy.RemoveCapRequestDelegate(capsKey, new CapsDelegate(CapsHandler)); + + } + + private bool CapsHandler(CapsRequest req, CapsStage stage) + { + if (OnMessageLog != null) + OnMessageLog(req, stage); + return false; + } + + /// + /// Process individual messages that arrive via the EventQueue and convert each indvidual event into a format + /// suitable for processing by the IMessage system + /// + /// + /// + /// + private bool EventQueueGetHandler(CapsRequest req, CapsStage stage) + { + if (stage == CapsStage.Response && req.Response is OSDMap) + { + OSDMap map = (OSDMap)req.Response; + + if (map.ContainsKey("events")) + { + OSDArray eventsArray = (OSDArray)map["events"]; + + for (int i = 0; i < eventsArray.Count; i++) + { + OSDMap bodyMap = (OSDMap)eventsArray[i]; + if (OnEventMessageLog != null) + { + CapInfo capInfo = new CapInfo(req.Info.URI, req.Info.Sim, bodyMap["message"].AsString()); + CapsRequest capReq = new CapsRequest(capInfo); + capReq.RequestHeaders = req.RequestHeaders; + capReq.ResponseHeaders = req.ResponseHeaders; + capReq.Request = null;// req.Request; + capReq.RawRequest = null;// req.RawRequest; + capReq.RawResponse = OSDParser.SerializeLLSDXmlBytes(bodyMap); + capReq.Response = bodyMap; + + OnEventMessageLog(capReq, CapsStage.Response); + } + } + } + } + return false; + } + + internal void AddUDPDelegate(PacketType packetType, bool add) + { + if (add) + { + Proxy.proxy.AddDelegate(packetType, Direction.Incoming, new PacketDelegate(PacketInHandler)); + Proxy.proxy.AddDelegate(packetType, Direction.Outgoing, new PacketDelegate(PacketOutHandler)); + } + else + { + Proxy.proxy.RemoveDelegate(packetType, Direction.Incoming, new PacketDelegate(PacketInHandler)); + Proxy.proxy.RemoveDelegate(packetType, Direction.Outgoing, new PacketDelegate(PacketOutHandler)); + } + } + + private Packet PacketInHandler(Packet packet, IPEndPoint endPoint) + { + if (OnPacketLog != null) + OnPacketLog(packet, Direction.Incoming, endPoint); + + return packet; + } + + private Packet PacketOutHandler(Packet packet, IPEndPoint endPoint) + { + if (OnPacketLog != null) + OnPacketLog(packet, Direction.Outgoing, endPoint); + + return packet; + } + + internal void InjectPacket(string packetData, bool toSimulator) + { + Direction direction = Direction.Incoming; + string name = null; + string block = null; + object blockObj = null; + Type packetClass = null; + Packet packet = null; + + try + { + foreach (string line in packetData.Split(new[] { '\n' })) + { + Match match; + + if (name == null) + { + match = (new Regex(@"^\s*(in|out)\s+(\w+)\s*$")).Match(line); + if (!match.Success) + { + OpenMetaverse.Logger.Log("expecting direction and packet name, got: " + line, OpenMetaverse.Helpers.LogLevel.Error); + return; + } + + string lineDir = match.Groups[1].Captures[0].ToString(); + string lineName = match.Groups[2].Captures[0].ToString(); + + if (lineDir == "in") + direction = Direction.Incoming; + else if (lineDir == "out") + direction = Direction.Outgoing; + else + { + OpenMetaverse.Logger.Log("expecting 'in' or 'out', got: " + line, OpenMetaverse.Helpers.LogLevel.Error); + return; + } + + name = lineName; + packetClass = openmvAssembly.GetType("OpenMetaverse.Packets." + name + "Packet"); + if (packetClass == null) throw new Exception("Couldn't get class " + name + "Packet"); + ConstructorInfo ctr = packetClass.GetConstructor(new Type[] { }); + if (ctr == null) throw new Exception("Couldn't get suitable constructor for " + name + "Packet"); + packet = (Packet)ctr.Invoke(new object[] { }); + } + else + { + match = (new Regex(@"^\s*\[(\w+)\]\s*$")).Match(line); + if (match.Success) + { + block = match.Groups[1].Captures[0].ToString(); + FieldInfo blockField = packetClass.GetField(block); + if (blockField == null) throw new Exception("Couldn't get " + name + "Packet." + block); + Type blockClass = blockField.FieldType; + if (blockClass.IsArray) + { + blockClass = blockClass.GetElementType(); + ConstructorInfo ctr = blockClass.GetConstructor(new Type[] { }); + if (ctr == null) throw new Exception("Couldn't get suitable constructor for " + blockClass.Name); + blockObj = ctr.Invoke(new object[] { }); + object[] arr = (object[])blockField.GetValue(packet); + object[] narr = (object[])Array.CreateInstance(blockClass, arr.Length + 1); + Array.Copy(arr, narr, arr.Length); + narr[arr.Length] = blockObj; + blockField.SetValue(packet, narr); + //Console.WriteLine("Added block "+block); + } + else + { + blockObj = blockField.GetValue(packet); + } + if (blockObj == null) throw new Exception("Got " + name + "Packet." + block + " == null"); + //Console.WriteLine("Got block " + name + "Packet." + block); + + continue; + } + + if (block == null) + { + OpenMetaverse.Logger.Log("expecting block name, got: " + line, OpenMetaverse.Helpers.LogLevel.Error); + return; + } + + match = (new Regex(@"^\s*(\w+)\s*=\s*(.*)$")).Match(line); + if (match.Success) + { + string lineField = match.Groups[1].Captures[0].ToString(); + string lineValue = match.Groups[2].Captures[0].ToString(); + object fval; + + //FIXME: use of MagicCast inefficient + //if (lineValue == "$Value") + // fval = MagicCast(name, block, lineField, value); + if (lineValue == "$UUID") + fval = UUID.Random(); + else if (lineValue == "$AgentID") + fval = Proxy.AgentID; + else if (lineValue == "$SessionID") + fval = Proxy.SessionID; + else + fval = MagicCast(name, block, lineField, lineValue); + + MagicSetField(blockObj, lineField, fval); + continue; + } + OpenMetaverse.Logger.Log("expecting block name or field, got: " + line, OpenMetaverse.Helpers.LogLevel.Error); + return; + } + } + + if (name == null) + { + + OpenMetaverse.Logger.Log("expecting direction and packet name, got EOF", OpenMetaverse.Helpers.LogLevel.Error); + return; + } + + packet.Header.Reliable = true; + + Proxy.proxy.InjectPacket(packet, direction); + + OpenMetaverse.Logger.Log("Injected " + name, OpenMetaverse.Helpers.LogLevel.Info); + } + catch (Exception e) + { + OpenMetaverse.Logger.Log("failed to injected " + name, OpenMetaverse.Helpers.LogLevel.Error, e); + } + } + + private static void MagicSetField(object obj, string field, object val) + { + Type cls = obj.GetType(); + + FieldInfo fieldInf = cls.GetField(field); + if (fieldInf == null) + { + PropertyInfo prop = cls.GetProperty(field); + if (prop == null) throw new Exception("Couldn't find field " + cls.Name + "." + field); + prop.SetValue(obj, val, null); + //throw new Exception("FIXME: can't set properties"); + } + else + { + fieldInf.SetValue(obj, val); + } + } + + // MagicCast: given a packet/block/field name and a string, convert the string to a value of the appropriate type + private object MagicCast(string name, string block, string field, string value) + { + Type packetClass = openmvAssembly.GetType("OpenMetaverse.Packets." + name + "Packet"); + if (packetClass == null) throw new Exception("Couldn't get class " + name + "Packet"); + + FieldInfo blockField = packetClass.GetField(block); + if (blockField == null) throw new Exception("Couldn't get " + name + "Packet." + block); + Type blockClass = blockField.FieldType; + if (blockClass.IsArray) blockClass = blockClass.GetElementType(); + // Console.WriteLine("DEBUG: " + blockClass.Name); + + FieldInfo fieldField = blockClass.GetField(field); PropertyInfo fieldProp = null; + Type fieldClass = null; + if (fieldField == null) + { + fieldProp = blockClass.GetProperty(field); + if (fieldProp == null) throw new Exception("Couldn't get " + name + "Packet." + block + "." + field); + fieldClass = fieldProp.PropertyType; + } + else + { + fieldClass = fieldField.FieldType; + } + + try + { + if (fieldClass == typeof(byte)) + { + return Convert.ToByte(value); + } + else if (fieldClass == typeof(ushort)) + { + return Convert.ToUInt16(value); + } + else if (fieldClass == typeof(uint)) + { + return Convert.ToUInt32(value); + } + else if (fieldClass == typeof(ulong)) + { + return Convert.ToUInt64(value); + } + else if (fieldClass == typeof(sbyte)) + { + return Convert.ToSByte(value); + } + else if (fieldClass == typeof(short)) + { + return Convert.ToInt16(value); + } + else if (fieldClass == typeof(int)) + { + return Convert.ToInt32(value); + } + else if (fieldClass == typeof(long)) + { + return Convert.ToInt64(value); + } + else if (fieldClass == typeof(float)) + { + return Convert.ToSingle(value); + } + else if (fieldClass == typeof(double)) + { + return Convert.ToDouble(value); + } + else if (fieldClass == typeof(UUID)) + { + return new UUID(value); + } + else if (fieldClass == typeof(bool)) + { + if (value.ToLower() == "true") + return true; + else if (value.ToLower() == "false") + return false; + else + throw new Exception(); + } + else if (fieldClass == typeof(byte[])) + { + return Utils.StringToBytes(value); + } + else if (fieldClass == typeof(Vector3)) + { + Vector3 result; + if (Vector3.TryParse(value, out result)) + return result; + else + throw new Exception(); + } + else if (fieldClass == typeof(Vector3d)) + { + Vector3d result; + if (Vector3d.TryParse(value, out result)) + return result; + else + throw new Exception(); + } + else if (fieldClass == typeof(Vector4)) + { + Vector4 result; + if (Vector4.TryParse(value, out result)) + return result; + else + throw new Exception(); + } + else if (fieldClass == typeof(Quaternion)) + { + Quaternion result; + if (Quaternion.TryParse(value, out result)) + return result; + else + throw new Exception(); + } + else + { + throw new Exception("unsupported field type " + fieldClass); + } + } + catch + { + throw new Exception("unable to interpret " + value + " as " + fieldClass); + } + } + } + + + +} diff --git a/Programs/GridProxyGUI/app.config b/Programs/GridProxyGUI/app.config new file mode 100755 index 00000000..e3656033 --- /dev/null +++ b/Programs/GridProxyGUI/app.config @@ -0,0 +1,3 @@ + + + diff --git a/Programs/GridProxyGUI/gtk-gui/MainWindow.cs b/Programs/GridProxyGUI/gtk-gui/MainWindow.cs new file mode 100755 index 00000000..35fc1354 --- /dev/null +++ b/Programs/GridProxyGUI/gtk-gui/MainWindow.cs @@ -0,0 +1,422 @@ + +// This file has been generated by the GUI designer. Do not modify. + +public partial class MainWindow +{ + private global::Gtk.UIManager UIManager; + private global::Gtk.Action FileAction; + private global::Gtk.Action ExitAction; + private global::Gtk.Action EditAction; + private global::Gtk.Action HelpAction; + private global::Gtk.Action AboutAction; + private global::Gtk.Action RemoveAction; + private global::Gtk.Action SelectAction; + private global::Gtk.Action AllAction; + private global::Gtk.Action AllAction1; + private global::Gtk.Action SelectedAction; + private global::Gtk.Action FindAction; + private global::Gtk.Action OpenSessionAction; + private global::Gtk.Action SaveSessionAction; + private global::Gtk.Action SaveSessionAsAction; + private global::Gtk.VBox vbox1; + private global::Gtk.HBox boxTopMenu; + private global::Gtk.Alignment alignment2; + private global::Gtk.MenuBar menubar1; + private global::Gtk.VSeparator vseparator1; + private global::Gtk.Label label1; + private global::Gtk.ComboBoxEntry cbListen; + private global::Gtk.Label label2; + private global::Gtk.Entry txtPort; + private global::Gtk.Label label3; + private global::Gtk.ComboBoxEntry cbLoginURL; + private global::Gtk.Button btnStart; + private global::Gtk.HPaned mainSplit; + private global::Gtk.ScrolledWindow sessionLogScroller; + private global::Gtk.TreeView treeview1; + private global::Gtk.Notebook tabsMain; + private global::Gtk.ScrolledWindow logFileScroller; + private global::Gtk.TextView txtSummary; + private global::Gtk.Label label4; + private global::Gtk.VBox filterBox; + private global::Gtk.HBox hbox2; + private global::Gtk.Button btnLoadFilters; + private global::Gtk.Button btnSaveFilters; + private global::Gtk.CheckButton cbAutoCheckCaps; + private global::Gtk.HBox hbox3; + private global::Gtk.Frame frameFilterUDP; + private global::Gtk.Alignment containerFilterUDP; + private global::Gtk.Label GtkLabel7; + private global::Gtk.Frame frameFilterCap; + private global::Gtk.Alignment containerFilterCap; + private global::Gtk.Label GtkLabel8; + private global::Gtk.HBox hbox4; + private global::Gtk.CheckButton cbSelectAllUDP; + private global::Gtk.CheckButton cbSelectAllCap; + private global::Gtk.Label label5; + private global::Gtk.Label label6; + + protected virtual void Build () + { + global::Stetic.Gui.Initialize (this); + // Widget MainWindow + this.UIManager = new global::Gtk.UIManager (); + global::Gtk.ActionGroup w1 = new global::Gtk.ActionGroup ("Default"); + this.FileAction = new global::Gtk.Action ("FileAction", global::Mono.Unix.Catalog.GetString ("File"), null, null); + this.FileAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("File"); + w1.Add (this.FileAction, "f"); + this.ExitAction = new global::Gtk.Action ("ExitAction", global::Mono.Unix.Catalog.GetString ("Exit"), null, null); + this.ExitAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Exit"); + w1.Add (this.ExitAction, "q"); + this.EditAction = new global::Gtk.Action ("EditAction", global::Mono.Unix.Catalog.GetString ("Edit"), null, null); + this.EditAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Edit"); + w1.Add (this.EditAction, null); + this.HelpAction = new global::Gtk.Action ("HelpAction", global::Mono.Unix.Catalog.GetString ("Help"), null, null); + this.HelpAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Help"); + w1.Add (this.HelpAction, null); + this.AboutAction = new global::Gtk.Action ("AboutAction", global::Mono.Unix.Catalog.GetString ("About"), null, null); + this.AboutAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("About"); + w1.Add (this.AboutAction, null); + this.RemoveAction = new global::Gtk.Action ("RemoveAction", global::Mono.Unix.Catalog.GetString ("Remove"), null, null); + this.RemoveAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Remove"); + w1.Add (this.RemoveAction, null); + this.SelectAction = new global::Gtk.Action ("SelectAction", global::Mono.Unix.Catalog.GetString ("Select"), null, null); + this.SelectAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Select"); + w1.Add (this.SelectAction, null); + this.AllAction = new global::Gtk.Action ("AllAction", global::Mono.Unix.Catalog.GetString ("All"), null, null); + this.AllAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("All"); + w1.Add (this.AllAction, null); + this.AllAction1 = new global::Gtk.Action ("AllAction1", global::Mono.Unix.Catalog.GetString ("All"), null, null); + this.AllAction1.ShortLabel = global::Mono.Unix.Catalog.GetString ("All"); + w1.Add (this.AllAction1, null); + this.SelectedAction = new global::Gtk.Action ("SelectedAction", global::Mono.Unix.Catalog.GetString ("Selected"), null, null); + this.SelectedAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Selected"); + w1.Add (this.SelectedAction, null); + this.FindAction = new global::Gtk.Action ("FindAction", global::Mono.Unix.Catalog.GetString ("Find"), null, null); + this.FindAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Find (Ctrl-F)"); + w1.Add (this.FindAction, "f"); + this.OpenSessionAction = new global::Gtk.Action ("OpenSessionAction", global::Mono.Unix.Catalog.GetString ("Open Session..."), null, null); + this.OpenSessionAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Open Session..."); + w1.Add (this.OpenSessionAction, "o"); + this.SaveSessionAction = new global::Gtk.Action ("SaveSessionAction", global::Mono.Unix.Catalog.GetString ("Save Session"), null, null); + this.SaveSessionAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Save Session"); + w1.Add (this.SaveSessionAction, "s"); + this.SaveSessionAsAction = new global::Gtk.Action ("SaveSessionAsAction", global::Mono.Unix.Catalog.GetString ("Save Session As..."), null, null); + this.SaveSessionAsAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Save Session As..."); + w1.Add (this.SaveSessionAsAction, null); + this.UIManager.InsertActionGroup (w1, 0); + this.AddAccelGroup (this.UIManager.AccelGroup); + this.Name = "MainWindow"; + this.Title = global::Mono.Unix.Catalog.GetString ("Grid Proxy"); + this.WindowPosition = ((global::Gtk.WindowPosition)(4)); + this.AllowShrink = true; + // Container child MainWindow.Gtk.Container+ContainerChild + this.vbox1 = new global::Gtk.VBox (); + this.vbox1.Name = "vbox1"; + this.vbox1.Spacing = 6; + // Container child vbox1.Gtk.Box+BoxChild + this.boxTopMenu = new global::Gtk.HBox (); + this.boxTopMenu.Name = "hbox1"; + this.boxTopMenu.Spacing = 6; + this.boxTopMenu.BorderWidth = ((uint)(3)); + // Container child hbox1.Gtk.Box+BoxChild + this.alignment2 = new global::Gtk.Alignment (0.5F, 0.5F, 1F, 1F); + this.alignment2.Name = "alignment2"; + // Container child alignment2.Gtk.Container+ContainerChild + this.UIManager.AddUiFromString (@""); + this.menubar1 = ((global::Gtk.MenuBar)(this.UIManager.GetWidget ("/menubar1"))); + this.menubar1.Name = "menubar1"; + this.alignment2.Add (this.menubar1); + this.boxTopMenu.Add (this.alignment2); + global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.boxTopMenu [this.alignment2])); + w3.Position = 0; + w3.Expand = false; + w3.Fill = false; + // Container child hbox1.Gtk.Box+BoxChild + this.vseparator1 = new global::Gtk.VSeparator (); + this.vseparator1.Name = "vseparator1"; + this.boxTopMenu.Add (this.vseparator1); + global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.boxTopMenu [this.vseparator1])); + w4.Position = 1; + w4.Expand = false; + w4.Fill = false; + // Container child hbox1.Gtk.Box+BoxChild + this.label1 = new global::Gtk.Label (); + this.label1.Name = "label1"; + this.label1.LabelProp = global::Mono.Unix.Catalog.GetString ("Listen IP Address:"); + this.boxTopMenu.Add (this.label1); + global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.boxTopMenu [this.label1])); + w5.Position = 2; + w5.Expand = false; + w5.Fill = false; + // Container child hbox1.Gtk.Box+BoxChild + this.cbListen = global::Gtk.ComboBoxEntry.NewText (); + this.cbListen.AppendText (global::Mono.Unix.Catalog.GetString ("127.0.0.1")); + this.cbListen.AppendText (global::Mono.Unix.Catalog.GetString ("0.0.0.0")); + this.cbListen.WidthRequest = 100; + this.cbListen.Name = "cbListen"; + this.cbListen.Active = 0; + this.boxTopMenu.Add (this.cbListen); + global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.boxTopMenu [this.cbListen])); + w6.Position = 3; + w6.Expand = false; + w6.Fill = false; + // Container child hbox1.Gtk.Box+BoxChild + this.label2 = new global::Gtk.Label (); + this.label2.Name = "label2"; + this.label2.LabelProp = global::Mono.Unix.Catalog.GetString ("Port"); + this.boxTopMenu.Add (this.label2); + global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.boxTopMenu [this.label2])); + w7.Position = 4; + w7.Expand = false; + w7.Fill = false; + // Container child hbox1.Gtk.Box+BoxChild + this.txtPort = new global::Gtk.Entry (); + this.txtPort.WidthRequest = 50; + this.txtPort.CanFocus = true; + this.txtPort.Name = "txtPort"; + this.txtPort.Text = global::Mono.Unix.Catalog.GetString ("8080"); + this.txtPort.IsEditable = true; + this.txtPort.MaxLength = 5; + this.txtPort.InvisibleChar = '●'; + this.boxTopMenu.Add (this.txtPort); + global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.boxTopMenu [this.txtPort])); + w8.Position = 5; + w8.Expand = false; + // Container child hbox1.Gtk.Box+BoxChild + this.label3 = new global::Gtk.Label (); + this.label3.Name = "label3"; + this.label3.LabelProp = global::Mono.Unix.Catalog.GetString ("Login URL"); + this.boxTopMenu.Add (this.label3); + global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.boxTopMenu [this.label3])); + w9.Position = 6; + w9.Expand = false; + w9.Fill = false; + // Container child hbox1.Gtk.Box+BoxChild + this.cbLoginURL = global::Gtk.ComboBoxEntry.NewText (); + this.cbLoginURL.AppendText (global::Mono.Unix.Catalog.GetString ("https://login.agni.lindenlab.com/cgi-bin/login.cgi")); + this.cbLoginURL.AppendText (global::Mono.Unix.Catalog.GetString ("https://login.aditi.lindenlab.com/cgi-bin/login.cgi")); + this.cbLoginURL.AppendText (global::Mono.Unix.Catalog.GetString ("http://login.orgrid.org/")); + this.cbLoginURL.WidthRequest = 300; + this.cbLoginURL.Name = "cbLoginURL"; + this.cbLoginURL.Active = 0; + this.boxTopMenu.Add (this.cbLoginURL); + global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.boxTopMenu [this.cbLoginURL])); + w10.Position = 7; + w10.Expand = false; + w10.Fill = false; + // Container child hbox1.Gtk.Box+BoxChild + this.btnStart = new global::Gtk.Button (); + this.btnStart.CanFocus = true; + this.btnStart.Name = "btnStart"; + this.btnStart.UseUnderline = true; + this.btnStart.Label = global::Mono.Unix.Catalog.GetString ("Start Proxy"); + this.boxTopMenu.Add (this.btnStart); + global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.boxTopMenu [this.btnStart])); + w11.Position = 8; + w11.Expand = false; + w11.Fill = false; + this.vbox1.Add (this.boxTopMenu); + global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.boxTopMenu])); + w12.Position = 0; + w12.Expand = false; + w12.Fill = false; + // Container child vbox1.Gtk.Box+BoxChild + this.mainSplit = new global::Gtk.HPaned (); + this.mainSplit.CanFocus = true; + this.mainSplit.Name = "mainSplit"; + this.mainSplit.Position = 1; + // Container child mainSplit.Gtk.Paned+PanedChild + this.sessionLogScroller = new global::Gtk.ScrolledWindow (); + this.sessionLogScroller.Name = "GtkScrolledWindow1"; + this.sessionLogScroller.ShadowType = ((global::Gtk.ShadowType)(1)); + // Container child GtkScrolledWindow1.Gtk.Container+ContainerChild + this.treeview1 = new global::Gtk.TreeView (); + this.treeview1.CanFocus = true; + this.treeview1.Name = "treeview1"; + this.sessionLogScroller.Add (this.treeview1); + this.mainSplit.Add (this.sessionLogScroller); + global::Gtk.Paned.PanedChild w14 = ((global::Gtk.Paned.PanedChild)(this.mainSplit [this.sessionLogScroller])); + w14.Resize = false; + // Container child mainSplit.Gtk.Paned+PanedChild + this.tabsMain = new global::Gtk.Notebook (); + this.tabsMain.CanFocus = true; + this.tabsMain.Name = "tabsMain"; + this.tabsMain.CurrentPage = 1; + this.tabsMain.EnablePopup = true; + // Container child tabsMain.Gtk.Notebook+NotebookChild + this.logFileScroller = new global::Gtk.ScrolledWindow (); + this.logFileScroller.Name = "logFileScroller"; + this.logFileScroller.ShadowType = ((global::Gtk.ShadowType)(1)); + // Container child logFileScroller.Gtk.Container+ContainerChild + this.txtSummary = new global::Gtk.TextView (); + this.txtSummary.CanFocus = true; + this.txtSummary.Name = "txtSummary"; + this.txtSummary.Editable = false; + this.txtSummary.WrapMode = ((global::Gtk.WrapMode)(2)); + this.logFileScroller.Add (this.txtSummary); + this.tabsMain.Add (this.logFileScroller); + // Notebook tab + this.label4 = new global::Gtk.Label (); + this.label4.Name = "label4"; + this.label4.LabelProp = global::Mono.Unix.Catalog.GetString ("Summary"); + this.tabsMain.SetTabLabel (this.logFileScroller, this.label4); + this.label4.ShowAll (); + // Container child tabsMain.Gtk.Notebook+NotebookChild + this.filterBox = new global::Gtk.VBox (); + this.filterBox.Name = "filterBox"; + this.filterBox.Spacing = 6; + // Container child filterBox.Gtk.Box+BoxChild + this.hbox2 = new global::Gtk.HBox (); + this.hbox2.Name = "hbox2"; + this.hbox2.Spacing = 6; + // Container child hbox2.Gtk.Box+BoxChild + this.btnLoadFilters = new global::Gtk.Button (); + this.btnLoadFilters.CanFocus = true; + this.btnLoadFilters.Name = "btnLoadFilters"; + this.btnLoadFilters.UseUnderline = true; + this.btnLoadFilters.Label = global::Mono.Unix.Catalog.GetString ("Load"); + global::Gtk.Image w17 = new global::Gtk.Image (); + w17.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-open", global::Gtk.IconSize.Menu); + this.btnLoadFilters.Image = w17; + this.hbox2.Add (this.btnLoadFilters); + global::Gtk.Box.BoxChild w18 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.btnLoadFilters])); + w18.Position = 0; + w18.Expand = false; + w18.Fill = false; + // Container child hbox2.Gtk.Box+BoxChild + this.btnSaveFilters = new global::Gtk.Button (); + this.btnSaveFilters.CanFocus = true; + this.btnSaveFilters.Name = "btnSaveFilters"; + this.btnSaveFilters.UseUnderline = true; + this.btnSaveFilters.Label = global::Mono.Unix.Catalog.GetString ("Save"); + global::Gtk.Image w19 = new global::Gtk.Image (); + w19.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-save", global::Gtk.IconSize.Menu); + this.btnSaveFilters.Image = w19; + this.hbox2.Add (this.btnSaveFilters); + global::Gtk.Box.BoxChild w20 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.btnSaveFilters])); + w20.Position = 1; + w20.Expand = false; + w20.Fill = false; + // Container child hbox2.Gtk.Box+BoxChild + this.cbAutoCheckCaps = new global::Gtk.CheckButton (); + this.cbAutoCheckCaps.CanFocus = true; + this.cbAutoCheckCaps.Name = "cbAutoCheckCaps"; + this.cbAutoCheckCaps.Label = global::Mono.Unix.Catalog.GetString ("Auto Check New Capabilities"); + this.cbAutoCheckCaps.Active = true; + this.cbAutoCheckCaps.DrawIndicator = true; + this.cbAutoCheckCaps.UseUnderline = true; + this.hbox2.Add (this.cbAutoCheckCaps); + global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.cbAutoCheckCaps])); + w21.Position = 2; + this.filterBox.Add (this.hbox2); + global::Gtk.Box.BoxChild w22 = ((global::Gtk.Box.BoxChild)(this.filterBox [this.hbox2])); + w22.Position = 0; + w22.Expand = false; + w22.Fill = false; + // Container child filterBox.Gtk.Box+BoxChild + this.hbox3 = new global::Gtk.HBox (); + this.hbox3.Name = "hbox3"; + this.hbox3.Homogeneous = true; + this.hbox3.Spacing = 6; + // Container child hbox3.Gtk.Box+BoxChild + this.frameFilterUDP = new global::Gtk.Frame (); + this.frameFilterUDP.Name = "frameFilterUDP"; + this.frameFilterUDP.ShadowType = ((global::Gtk.ShadowType)(0)); + this.frameFilterUDP.LabelYalign = 0F; + // Container child frameFilterUDP.Gtk.Container+ContainerChild + this.containerFilterUDP = new global::Gtk.Alignment (0F, 0F, 1F, 1F); + this.containerFilterUDP.Name = "containerFilterUDP"; + this.containerFilterUDP.LeftPadding = ((uint)(12)); + this.frameFilterUDP.Add (this.containerFilterUDP); + this.GtkLabel7 = new global::Gtk.Label (); + this.GtkLabel7.Name = "GtkLabel7"; + this.GtkLabel7.LabelProp = global::Mono.Unix.Catalog.GetString ("UDP Packets & Login"); + this.frameFilterUDP.LabelWidget = this.GtkLabel7; + this.hbox3.Add (this.frameFilterUDP); + global::Gtk.Box.BoxChild w24 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.frameFilterUDP])); + w24.Position = 0; + // Container child hbox3.Gtk.Box+BoxChild + this.frameFilterCap = new global::Gtk.Frame (); + this.frameFilterCap.Name = "frameFilterCap"; + this.frameFilterCap.ShadowType = ((global::Gtk.ShadowType)(0)); + this.frameFilterCap.LabelYalign = 0F; + // Container child frameFilterCap.Gtk.Container+ContainerChild + this.containerFilterCap = new global::Gtk.Alignment (0F, 0F, 1F, 1F); + this.containerFilterCap.Name = "containerFilterCap"; + this.containerFilterCap.LeftPadding = ((uint)(12)); + this.frameFilterCap.Add (this.containerFilterCap); + this.GtkLabel8 = new global::Gtk.Label (); + this.GtkLabel8.Name = "GtkLabel8"; + this.GtkLabel8.LabelProp = global::Mono.Unix.Catalog.GetString ("Capabilities & EventQueue Messages"); + this.frameFilterCap.LabelWidget = this.GtkLabel8; + this.hbox3.Add (this.frameFilterCap); + global::Gtk.Box.BoxChild w26 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.frameFilterCap])); + w26.Position = 1; + this.filterBox.Add (this.hbox3); + global::Gtk.Box.BoxChild w27 = ((global::Gtk.Box.BoxChild)(this.filterBox [this.hbox3])); + w27.Position = 1; + // Container child filterBox.Gtk.Box+BoxChild + this.hbox4 = new global::Gtk.HBox (); + this.hbox4.Name = "hbox4"; + this.hbox4.Homogeneous = true; + this.hbox4.Spacing = 6; + // Container child hbox4.Gtk.Box+BoxChild + this.cbSelectAllUDP = new global::Gtk.CheckButton (); + this.cbSelectAllUDP.CanFocus = true; + this.cbSelectAllUDP.Name = "cbSelectAllUDP"; + this.cbSelectAllUDP.Label = global::Mono.Unix.Catalog.GetString ("Select/Uncheck All"); + this.cbSelectAllUDP.DrawIndicator = true; + this.cbSelectAllUDP.UseUnderline = true; + this.hbox4.Add (this.cbSelectAllUDP); + global::Gtk.Box.BoxChild w28 = ((global::Gtk.Box.BoxChild)(this.hbox4 [this.cbSelectAllUDP])); + w28.Position = 0; + // Container child hbox4.Gtk.Box+BoxChild + this.cbSelectAllCap = new global::Gtk.CheckButton (); + this.cbSelectAllCap.CanFocus = true; + this.cbSelectAllCap.Name = "cbSelectAllCap"; + this.cbSelectAllCap.Label = global::Mono.Unix.Catalog.GetString ("Select/Uncheck All"); + this.cbSelectAllCap.DrawIndicator = true; + this.cbSelectAllCap.UseUnderline = true; + this.hbox4.Add (this.cbSelectAllCap); + global::Gtk.Box.BoxChild w29 = ((global::Gtk.Box.BoxChild)(this.hbox4 [this.cbSelectAllCap])); + w29.Position = 1; + this.filterBox.Add (this.hbox4); + global::Gtk.Box.BoxChild w30 = ((global::Gtk.Box.BoxChild)(this.filterBox [this.hbox4])); + w30.PackType = ((global::Gtk.PackType)(1)); + w30.Position = 2; + w30.Expand = false; + w30.Fill = false; + this.tabsMain.Add (this.filterBox); + global::Gtk.Notebook.NotebookChild w31 = ((global::Gtk.Notebook.NotebookChild)(this.tabsMain [this.filterBox])); + w31.Position = 1; + // Notebook tab + this.label5 = new global::Gtk.Label (); + this.label5.Name = "label5"; + this.label5.LabelProp = global::Mono.Unix.Catalog.GetString ("Filters"); + this.tabsMain.SetTabLabel (this.filterBox, this.label5); + this.label5.ShowAll (); + // Notebook tab + global::Gtk.Label w32 = new global::Gtk.Label (); + w32.Visible = true; + this.tabsMain.Add (w32); + this.label6 = new global::Gtk.Label (); + this.label6.Name = "label6"; + this.label6.LabelProp = global::Mono.Unix.Catalog.GetString ("Inspector"); + this.tabsMain.SetTabLabel (w32, this.label6); + this.label6.ShowAll (); + this.mainSplit.Add (this.tabsMain); + this.vbox1.Add (this.mainSplit); + global::Gtk.Box.BoxChild w34 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.mainSplit])); + w34.Position = 1; + this.Add (this.vbox1); + if ((this.Child != null)) { + this.Child.ShowAll (); + } + this.DefaultWidth = 1211; + this.DefaultHeight = 552; + this.Show (); + this.DeleteEvent += new global::Gtk.DeleteEventHandler (this.OnDeleteEvent); + this.ExitAction.Activated += new global::System.EventHandler (this.OnExitActionActivated); + this.btnStart.Clicked += new global::System.EventHandler (this.OnBtnStartClicked); + } +} diff --git a/Programs/GridProxyGUI/gtk-gui/generated.cs b/Programs/GridProxyGUI/gtk-gui/generated.cs new file mode 100755 index 00000000..c8654260 --- /dev/null +++ b/Programs/GridProxyGUI/gtk-gui/generated.cs @@ -0,0 +1,67 @@ + +// This file has been generated by the GUI designer. Do not modify. +namespace Stetic +{ + internal class Gui + { + private static bool initialized; + + internal static void Initialize (Gtk.Widget iconRenderer) + { + if ((Stetic.Gui.initialized == false)) { + Stetic.Gui.initialized = true; + } + } + } + + internal class IconLoader + { + public static Gdk.Pixbuf LoadIcon (Gtk.Widget widget, string name, Gtk.IconSize size) + { + Gdk.Pixbuf res = widget.RenderIcon (name, size, null); + if ((res != null)) { + return res; + } else { + int sz; + int sy; + global::Gtk.Icon.SizeLookup (size, out sz, out sy); + try { + return Gtk.IconTheme.Default.LoadIcon (name, sz, 0); + } catch (System.Exception) { + if ((name != "gtk-missing-image")) { + return Stetic.IconLoader.LoadIcon (widget, "gtk-missing-image", size); + } else { + Gdk.Pixmap pmap = new Gdk.Pixmap (Gdk.Screen.Default.RootWindow, sz, sz); + Gdk.GC gc = new Gdk.GC (pmap); + gc.RgbFgColor = new Gdk.Color (255, 255, 255); + pmap.DrawRectangle (gc, true, 0, 0, sz, sz); + gc.RgbFgColor = new Gdk.Color (0, 0, 0); + pmap.DrawRectangle (gc, false, 0, 0, (sz - 1), (sz - 1)); + gc.SetLineAttributes (3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round); + gc.RgbFgColor = new Gdk.Color (255, 0, 0); + pmap.DrawLine (gc, (sz / 4), (sz / 4), ((sz - 1) + - (sz / 4)), ((sz - 1) + - (sz / 4))); + pmap.DrawLine (gc, ((sz - 1) + - (sz / 4)), (sz / 4), (sz / 4), ((sz - 1) + - (sz / 4))); + return Gdk.Pixbuf.FromDrawable (pmap, pmap.Colormap, 0, 0, 0, 0, sz, sz); + } + } + } + } + } + + internal class ActionGroups + { + public static Gtk.ActionGroup GetActionGroup (System.Type type) + { + return Stetic.ActionGroups.GetActionGroup (type.FullName); + } + + public static Gtk.ActionGroup GetActionGroup (string name) + { + return null; + } + } +} diff --git a/Programs/GridProxyGUI/gtk-gui/gui.stetic b/Programs/GridProxyGUI/gtk-gui/gui.stetic new file mode 100755 index 00000000..d12fba06 --- /dev/null +++ b/Programs/GridProxyGUI/gtk-gui/gui.stetic @@ -0,0 +1,532 @@ + + + + .. + + + + + + + + + Action + <Alt>f + File + File + + + Action + <Primary>q + Exit + Exit + + + + Action + Edit + Edit + + + Action + Help + Help + + + Action + About + About + + + Action + Remove + Remove + + + Action + Select + Select + + + Action + All + All + + + Action + All + All + + + Action + Selected + Selected + + + Action + <Primary>f + Find + Find (Ctrl-F) + + + Action + <Primary>o + Open Session... + Open Session... + + + Action + <Primary>s + Save Session + Save Session + + + Action + Save Session As... + Save Session As... + + + + Grid Proxy + CenterOnParent + True + + + + + 6 + + + + 6 + 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + True + False + False + + + + + + + + 1 + True + False + False + + + + + + Listen IP Address: + + + 2 + True + False + False + + + + + + 100 + True + 127.0.0.1 +0.0.0.0 + 0 + + + 3 + True + False + False + + + + + + Port + + + 4 + True + False + False + + + + + + 50 + True + 8080 + True + 5 + + + + 5 + False + False + + + + + + Login URL + + + 6 + True + False + False + + + + + + 300 + True + https://login.agni.lindenlab.com/cgi-bin/login.cgi +https://login.aditi.lindenlab.com/cgi-bin/login.cgi +http://login.orgrid.org/ + 0 + + + 7 + True + False + False + + + + + btnStart + True + TextOnly + Start Proxy + True + + + + 8 + True + False + False + + + + + 0 + True + False + False + + + + + + True + 400 + + + + True + In + + + + None + + + + + + + + False + + + + + + True + 1 + True + + + + In + + + + True + True + False + + Word + + + + + + + + Summary + + + tab + + + + + + 6 + + + + 6 + + + + True + TextAndIcon + stock:gtk-open Menu + Load + True + + + 0 + True + False + False + + + + + + True + TextAndIcon + stock:gtk-save Menu + Save + True + + + 1 + True + False + False + + + + + + True + Auto Check New Capabilities + True + True + True + True + + + 2 + True + + + + + 0 + True + False + False + + + + + + True + 6 + + + + None + 0 + + + + 0 + 0 + 12 + + + + + + + + + UDP Packets & Login + + + label_item + + + + + 0 + False + + + + + + None + 0 + + + + 0 + 0 + 12 + + + + + + + + + Capabilities & EventQueue Messages + + + label_item + + + + + 1 + False + + + + + 1 + True + + + + + + True + 6 + + + + True + Select/Uncheck All + True + True + True + + + 0 + True + + + + + + True + Select/Uncheck All + True + True + True + + + 1 + True + + + + + End + 2 + True + False + False + + + + + 1 + + + + + + Filters + + + tab + + + + + + + + + Inspector + + + tab + + + + + + + 1 + True + + + + + + \ No newline at end of file diff --git a/Programs/GridProxyGUI/libomv.ico b/Programs/GridProxyGUI/libomv.ico new file mode 100644 index 00000000..ad64d2c5 Binary files /dev/null and b/Programs/GridProxyGUI/libomv.ico differ diff --git a/Programs/GridProxyGUI/libomv.png b/Programs/GridProxyGUI/libomv.png new file mode 100644 index 00000000..df6d0e31 Binary files /dev/null and b/Programs/GridProxyGUI/libomv.png differ diff --git a/prebuild.xml b/prebuild.xml index 95bf7f72..503da113 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -34,7 +34,7 @@ - + ../bin/ @@ -56,7 +56,7 @@ - + ../bin/ @@ -77,7 +77,7 @@ - + ../bin/ @@ -99,7 +99,7 @@ - + ../bin/ @@ -129,7 +129,7 @@ - + ../bin/ @@ -154,7 +154,7 @@ - + ../bin/ @@ -179,7 +179,7 @@ - + ../../bin/ @@ -207,7 +207,7 @@ - + ../bin/ @@ -229,7 +229,7 @@ - + ../bin/ @@ -252,7 +252,7 @@ - + ../bin/ @@ -279,7 +279,7 @@ - + ../../bin/ @@ -310,7 +310,7 @@ - + ../../bin/ @@ -338,7 +338,7 @@ - + ../../bin/ @@ -361,7 +361,7 @@ - + ../../bin/ @@ -382,7 +382,7 @@ - + ../../../bin/ @@ -403,7 +403,7 @@ - + ../../../bin/ @@ -433,7 +433,7 @@ - + ../../bin/ @@ -494,7 +494,7 @@ - + ../../bin/ @@ -522,7 +522,7 @@ - + ../../bin/ @@ -546,7 +546,7 @@ - + ../../bin/ @@ -580,7 +580,7 @@ - + ../../bin/ @@ -603,7 +603,7 @@ - + ../../bin/ @@ -628,7 +628,7 @@ - + ../../../bin/ @@ -656,7 +656,7 @@ - + ../../../bin/ @@ -684,7 +684,7 @@ - + ../../../bin/ @@ -712,7 +712,7 @@ - + ../../../bin/ @@ -734,7 +734,7 @@ - + ../../../bin/