From 04212c8420bc2f425648aee47c3af1610119782d Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Tue, 23 May 2006 17:43:21 +0000 Subject: [PATCH] Turned off overflow checks,Component Inspector error dialog now sends the user to the SharpDevelop bug reporting forum, and removed unused files. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1416 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../ComponentInspector.Core.csproj | 2 +- .../Src/Controls/ErrorDialog.cs | 43 ++-- .../Src/ObjectBrowser/HookJunk.cs.save | 62 ------ .../Src/ObjectBrowser/TestDriver.cs.nobuild | 187 ------------------ .../Src/ObjectBrowser/Version.template | 11 -- 5 files changed, 26 insertions(+), 279 deletions(-) delete mode 100644 src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/HookJunk.cs.save delete mode 100644 src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/TestDriver.cs.nobuild delete mode 100644 src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/Version.template diff --git a/src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/ComponentInspector.Core.csproj b/src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/ComponentInspector.Core.csproj index 4d2d29781f..595033d57c 100644 --- a/src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/ComponentInspector.Core.csproj +++ b/src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/ComponentInspector.Core.csproj @@ -25,7 +25,7 @@ DEBUG;TRACE true Full - True + False obj\ diff --git a/src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/Controls/ErrorDialog.cs b/src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/Controls/ErrorDialog.cs index cbd8a6ae51..44f5e6759e 100644 --- a/src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/Controls/ErrorDialog.cs +++ b/src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/Controls/ErrorDialog.cs @@ -5,6 +5,7 @@ // $Revision$ // +using ICSharpCode.Core; using System; using System.Collections; using System.ComponentModel; @@ -275,28 +276,12 @@ namespace NoGoop.Controls SetText(); } - protected const int MAX_URI_TEXT_SIZE = 1500; - protected void BugClickedHandler(object sender, EventArgs e) { try { - String body = "Please enter what you were doing or any other descriptive information here: \n\n\n" - + _title + "\n\n"; - if (_exception != null) - body += _exception; - else - body += _summary; - String uriText = "mailto:support@oaklandsoftware.com?" - + "subject=BR - " - /*+ ObjectBrowser.License.ProductName */ - + " - " + ObjectBrowser.CODEBASE_VERSION - + "&body=" + body; - // Make sure its not too big for the email client - if (uriText.Length > MAX_URI_TEXT_SIZE) - uriText = uriText.Substring(0, MAX_URI_TEXT_SIZE); + CopyInfoToClipboard(); + string uriText = "http://www.icsharpcode.net/OpenSource/SD/BugReporting.aspx"; Uri uri = new Uri(uriText); - // Send using local email client so the user - // has control over the content Utils.InvokeBrowser(uri, !Utils.SHOW_WINDOW); } catch (Exception ex) { TraceUtil.WriteLineWarning(this, "Error sending bug report: " + ex); @@ -307,5 +292,27 @@ namespace NoGoop.Controls { Utils.InvokeBrowser(e.LinkText); } + + void CopyInfoToClipboard() + { + ClipboardWrapper.SetText(GetClipboardString()); + } + + string GetClipboardString() + { + string str = String.Empty; + str += ".NET Version : " + Environment.Version.ToString() + Environment.NewLine; + str += "OS Version : " + Environment.OSVersion.ToString() + Environment.NewLine; + System.Version v = Assembly.GetEntryAssembly().GetName().Version; + str += "Component Inspector Version : " + v.Major + "." + v.Minor + "." + v.Build + "." + v.Revision + Environment.NewLine; + str += Environment.NewLine; + + if (_exception != null) { + str += _exception + Environment.NewLine; + } else { + str += _summary + Environment.NewLine; + } + return str; + } } } diff --git a/src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/HookJunk.cs.save b/src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/HookJunk.cs.save deleted file mode 100644 index 3e5d881783..0000000000 --- a/src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/HookJunk.cs.save +++ /dev/null @@ -1,62 +0,0 @@ - // Button for adding a hook to the selected form - Button b1 = new Button(); - b1.Location = new Point(400, 200); - b1.Text = "Add Hook"; - b1.Click += new System.EventHandler(this.AddHookButton_Click); - this.Controls.Add(b1); - - - - - // CallWndProc callback = new CallWndProc(HookProc); - // GetMsgProc callback = new GetMsgProc(HookProc); - MessageProc callback = new MessageProc(HookProc); - int modHandle = Windows.GetModuleHandle(null); - DebugMessage("Module handle: " + modHandle); - // int ret = Windows.SetWindowsHookEx(Windows.WH_CALLWNDPROC, callback, - // int ret = Windows.SetWindowsHookEx(Windows.WH_GETMESSAGE, callback, - int ret = Windows.SetWindowsHookEx(Windows.WH_MSGFILTER, callback, - modHandle, 0); - if (ret == 0) - DebugMessage("Error adding hook: " + Windows.GetLastErrorText()); - else - DebugMessage("Added hook " + ret); - } - - - // public int HookProc(int nCode, int wParam, Windows.CWPSTRUCT lParam) - public int HookProc(int nCode, int wParam, int lParam) - { - // for (int i = 0; i < HookedWindows.Count; i++) - { - // if ((int)HookedWindows[i] == lParam.hWnd) - { - //HookedMessages.Enqueue(lParam); - // DebugMessage("Hook Called: hWnd: " + lParam.hWnd - DebugMessage("Hook Called: hWnd: " - + " code: " + nCode - + " wParam: " + wParam - + " lParam: " + lParam); - } - } - - if (nCode < 0) - return Windows.CallNextHookEx(0, nCode, wParam, lParam); - return 0; - } - - - protected void AddHookButton_Click (object sender, System.EventArgs e) - { - MainTreeNode node = (MainTreeNode)this.MainTree.SelectedNode; - - DebugMessage("add hook " + node); - - HookedMessages = new Queue(); - if (node.WindowInfo != null) - { - HookedWindows.Add(node.WindowInfo.hWnd); - } - - } - diff --git a/src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/TestDriver.cs.nobuild b/src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/TestDriver.cs.nobuild deleted file mode 100644 index d2e67be04c..0000000000 --- a/src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/TestDriver.cs.nobuild +++ /dev/null @@ -1,187 +0,0 @@ -using System; -using System.Collections; -using System.Diagnostics; -using System.Runtime.InteropServices; -using System.Reflection; -using System.Text; -using System.Threading; -using System.Windows.Forms; - -using NoGoop.win32; -using Access; - -namespace NoGoop.objb -{ - - - public class FormInfo - { - public Access.Form Form; - public int WindowHandle; - public string WindowName; - - public override String ToString() - { - return Form.Name + " win: 0x" - + WindowHandle.ToString("X") + ":" + WindowName; - } - } - - - public class TestDriver - { - - private Access.Application AccessApp; - - private static ArrayList WindowList; - - // For locking at the class level - private static Object Lock; - - static TestDriver() - { - Lock = new Object(); - } - - - public TestDriver() - { - } - - public IList GetForms() - { - ArrayList forms = new ArrayList(); - IEnumerator en = AccessApp.Forms.GetEnumerator(); - - while (en.MoveNext()) - { - forms.Add(System.Runtime.InteropServices.Marshal. - CreateWrapperOfType(en.Current, typeof(Access.Form))); - // forms.Add(en.Current); - } - return forms; - } - - public IList GetFormInfoList() - { - ArrayList forms = new ArrayList(); - IEnumerator en = GetForms().GetEnumerator(); - - while (en.MoveNext()) - { - FormInfo fi = new FormInfo(); - fi.Form = (Access.Form)en.Current; - fi.WindowHandle = fi.Form.Hwnd; - fi.WindowName = Windows.GetWindowText(fi.WindowHandle); - forms.Add(fi); - } - return forms; - } - - public int GetTopWindow() - { - return AccessApp.hWndAccessApp(); - } - - - public Object GetTopObject() - { - return AccessApp; - } - - public IList GetChildWindows() - { - return GetChildWindows(GetTopWindow()); - } - - - public IList GetChildWindows(int hWnd) - { - ArrayList winList = new ArrayList(); - GetChildWindows(hWnd, winList); - return winList; - } - - - public void GetChildWindows(int hWnd, ArrayList winList) - { - ArrayList SaveList = WindowList; - - // Since WindowList is an class variable, required because - // its updated with a callback - lock (Lock) - { - WindowList = winList; - EnumChildProc callback = new EnumChildProc(TestDriver.ChildWindow); - Windows.EnumChildWindows(hWnd, callback, 0); - - WindowList.Sort(null); - - // Now get all of the children - foreach (Windows.WindowInfo wi in winList) - { - wi.Children = new ArrayList(); - GetChildWindows(wi.hWnd, wi.Children); - } - - WindowList = SaveList; - } - } - - // This is the callback function, called by windows for each child - private static bool ChildWindow(int hwnd, int lParam) - { - WindowList.Add(Windows.GetWindowInfo(hwnd)); - return true; - } - - - public bool CheckIfRunning() - { - try - { - - // This is the same as a VB GetObject, more or less - /*** - Object o = - System.Runtime.InteropServices.Marshal.GetActiveObject("Access.Application.9"); - AccessApp = (Access.Application) - System.Runtime.InteropServices.Marshal. - CreateWrapperOfType(o, typeof(Access.Application)); - - Console.WriteLine("Found current access: " + AccessApp); - - ****/ - return true; - } - catch (Exception) - { - Console.WriteLine("No current access running"); - AccessApp = null; - return false; - } - } - - - public void CreateNewAccess(string fileName) - { - AccessApp = new Access.Application(); - AccessApp.OpenCurrentDatabase(fileName, false); - AccessApp.Visible = true; - AccessApp.DoCmd.OpenForm("People", - Access.AcFormView.acNormal, - null, - null, - Access.AcFormOpenDataMode.acFormEdit, - Access.AcWindowMode.acWindowNormal, ""); - } - - [STAThread] - public static void Main(string[] args) - { - TestDriver td = new TestDriver(); - td.CheckIfRunning(); - } - } -} - diff --git a/src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/Version.template b/src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/Version.template deleted file mode 100644 index c1b605a771..0000000000 --- a/src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/Version.template +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace NoGoop.ObjBrowser -{ - - internal class Version - { - internal const String VERSION = - "@CompInspVersion@"; - } -}