Author: gedmurphy
Date: Tue Apr 22 07:45:18 2008
New Revision: 33097
URL:
http://svn.reactos.org/svn/reactos?rev=33097&view=rev
Log:
- Add functionality to the GUI to handle navigating multiple error messages
- Fix a few bugs in the assembly
Modified:
trunk/tools/Message Translator/GUI/MainForm.Designer.cs
trunk/tools/Message Translator/GUI/MainForm.cs
trunk/tools/Message Translator/MsgTrans.Library/CustomCommand.cs
trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs
trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs
trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.Library.csproj
trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs
trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs
trunk/tools/Message Translator/MsgTrans.Library/WinerrorCommand.cs
Modified: trunk/tools/Message Translator/GUI/MainForm.Designer.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/GUI/Mai…
==============================================================================
--- trunk/tools/Message Translator/GUI/MainForm.Designer.cs [iso-8859-1] (original)
+++ trunk/tools/Message Translator/GUI/MainForm.Designer.cs [iso-8859-1] Tue Apr 22
07:45:18 2008
@@ -152,6 +152,7 @@
this.errorBackButton.TabIndex = 8;
this.errorBackButton.Text = "<";
this.errorBackButton.UseVisualStyleBackColor = true;
+ this.errorBackButton.Click += new
System.EventHandler(this.NavigateErrorPage);
//
// errorForwardButton
//
@@ -161,6 +162,7 @@
this.errorForwardButton.TabIndex = 7;
this.errorForwardButton.Text = ">";
this.errorForwardButton.UseVisualStyleBackColor = true;
+ this.errorForwardButton.Click += new
System.EventHandler(this.NavigateErrorPage);
//
// errorTypeValueLabel
//
Modified: trunk/tools/Message Translator/GUI/MainForm.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/GUI/Mai…
==============================================================================
--- trunk/tools/Message Translator/GUI/MainForm.cs [iso-8859-1] (original)
+++ trunk/tools/Message Translator/GUI/MainForm.cs [iso-8859-1] Tue Apr 22 07:45:18 2008
@@ -1,6 +1,7 @@
using System;
using System.Windows.Forms;
using System.Configuration;
+using System.Collections.Generic;
using MsgTrans.Library;
using System.Resources;
using System.Reflection;
@@ -12,6 +13,8 @@
{
private static string regPath = @"Software\ReactOS\MsgTrans";
private string[] msgTypes = { "error", "wm", "bug"
};
+ private List<Command> errMessages;
+ private int curErrorPage;
#region properties
private static bool HideOnMin
@@ -173,6 +176,30 @@
bugLinkLabel.Location = new System.Drawing.Point(wCenter, hCenter);
}
+ private void UpdateErrorPage(int pageNum)
+ {
+ if (errMessages != null && errMessages.Count > 1)
+ {
+ if (pageNum > errMessages.Count || pageNum < 0)
+ return;
+
+ errorTypeValueLabel.Text = errMessages[pageNum - 1].MsgType.ToString();
+ errorDecimalTxtBox.Text = errMessages[pageNum - 1].Number.ToString();
+ errorHexTxtBox.Text = "0x" + errMessages[pageNum - 1].Hex;
+ errorCodeTxtBox.Text = errMessages[pageNum - 1].Code;
+ errorMessageTxtBox.Text = errMessages[pageNum - 1].Message;
+
+ curErrorPage = pageNum;
+
+ // set navigation buttons
+ errorBackButton.Enabled = errorForwardButton.Enabled = false;
+ if (curErrorPage < errMessages.Count)
+ errorForwardButton.Enabled = true;
+ if (curErrorPage > 1)
+ errorBackButton.Enabled = true;
+ }
+ }
+
private void GetMessage()
{
string msgType = GetMessageType();
@@ -188,11 +215,22 @@
string message = msgType + " " + mainErrTxtBox.Text;
if (msgTran.ParseCommandMessage(null, message))
{
- foreach (Command cmd in msgTran.Messages)
+ if (msgTran.Messages.Count > 1)
{
+ // if we have more than one, they must be error messages
+ errMessages = msgTran.Messages;
+ UpdateErrorPage(1);
+ }
+ else
+ {
+ if (errMessages != null)
+ errMessages.Clear();
+
+ Command cmd = msgTran.Messages[0];
+
if (cmd.MsgType == MessageType.WinError ||
- cmd.MsgType == MessageType.HResult ||
- cmd.MsgType == MessageType.NTStatus ||
+ cmd.MsgType == MessageType.HRESULT ||
+ cmd.MsgType == MessageType.NTSTATUS ||
cmd.MsgType == MessageType.Custom)
{
errorTypeValueLabel.Text = cmd.MsgType.ToString();
@@ -228,6 +266,7 @@
private void MainForm_Load(object sender, EventArgs e)
{
// setup error page
+ curErrorPage = 1;
errorBackButton.Enabled = false;
errorForwardButton.Enabled = false;
@@ -335,6 +374,20 @@
}
}
}
+
+ private void NavigateErrorPage(object sender, EventArgs e)
+ {
+ Button btn = (Button)sender;
+
+ if (btn.Name == "errorForwardButton")
+ {
+ UpdateErrorPage(curErrorPage + 1);
+ }
+ else if (btn.Name == "errorBackButton")
+ {
+ UpdateErrorPage(curErrorPage - 1);
+ }
+ }
}
public class MessageOutput : IMsgOutput
Modified: trunk/tools/Message Translator/MsgTrans.Library/CustomCommand.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
==============================================================================
--- trunk/tools/Message Translator/MsgTrans.Library/CustomCommand.cs [iso-8859-1]
(original)
+++ trunk/tools/Message Translator/MsgTrans.Library/CustomCommand.cs [iso-8859-1] Tue Apr
22 07:45:18 2008
@@ -71,8 +71,6 @@
string originalErrorText = parameters.Trim();
if (originalErrorText.Equals(String.Empty))
{
- MsgTrans.MsgOutput.MsgOut(context,
- "Please provide an Error Code.");
return false;
}
@@ -81,13 +79,8 @@
NumberParser np = new NumberParser();
if (!np.Parse(errorText))
{
- MsgTrans.MsgOutput.MsgOut(context,
- String.Format("{0} is not a valid Error
Code.",
- originalErrorText));
return false;
}
-
- //ArrayList descriptions = new ArrayList();
// Error is out of bounds
if ((ulong)np.Decimal > uint.MaxValue)
Modified: trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
==============================================================================
--- trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs [iso-8859-1]
(original)
+++ trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs [iso-8859-1] Tue Apr
22 07:45:18 2008
@@ -7,10 +7,6 @@
{
public class ErrorCommand : Command
{
- private NtStatusCommand ntStatus;
- private WinerrorCommand winerror;
- private HResultCommand hresult;
- private CustomCommand custom;
private List<Command> errorCommands = new List<Command>();
public ErrorCommand(MessageTranslator msgTrans,
@@ -19,8 +15,8 @@
string hresultXml)
: base(msgTrans)
{
+ errorCommands.Add(new WinerrorCommand(msgTrans, winerrorXml));
errorCommands.Add(new NtStatusCommand(msgTrans, ntstatusXml));
- errorCommands.Add(new WinerrorCommand(msgTrans, winerrorXml));
errorCommands.Add(new HResultCommand(msgTrans, hresultXml));
errorCommands.Add(new CustomCommand(msgTrans));
}
@@ -55,7 +51,7 @@
}
MsgTrans.MsgOutput.MsgOut(context,
- String.Format("I don't know about
Error Code {0}.",
+ String.Format("[{0}] is not a valid error
code",
parameters.Trim()));
return false;
}
Modified: trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
==============================================================================
--- trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs [iso-8859-1]
(original)
+++ trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs [iso-8859-1] Tue Apr
22 07:45:18 2008
@@ -21,39 +21,27 @@
string commandName,
string parameters)
{
- /*
- string hresultDescription =
hresult.GetHresultDescription(np.Decimal);
- if (hresultDescription != null)
- {
- AddErrorCommand(MessageType.HResult,
- np.Decimal,
- np.Hex,
- hresultDescription,
- null);
- }
- */
string hresultText = parameters;
if (hresultText.Equals(String.Empty))
{
- MsgTrans.MsgOutput.MsgOut(context,
- "Please provide a valid HRESULT
value.");
return false;
}
NumberParser np = new NumberParser();
if (!np.Parse(hresultText))
{
- MsgTrans.MsgOutput.MsgOut(context,
- String.Format("{0} is not a valid HRESULT
value.",
- hresultText));
return false;
}
string description = GetHresultDescription(np.Decimal);
if (description != null)
{
- Number = np.Decimal;
- Code = description;
+ AddMessage(MessageType.HRESULT,
+ np.Decimal,
+ np.Hex,
+ description,
+ null);
+
return true;
}/*
else
Modified: trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.Library.csproj
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
==============================================================================
--- trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.Library.csproj [iso-8859-1]
(original)
+++ trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.Library.csproj [iso-8859-1]
Tue Apr 22 07:45:18 2008
@@ -44,7 +44,6 @@
</Target>
-->
<ItemGroup>
- <Compile Include="BugUrlCommandl.cs" />
<Compile Include="BugCommand.cs" />
<Compile Include="CustomCommand.cs" />
<Compile Include="XmlCommand.cs" />
Modified: trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
==============================================================================
--- trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs [iso-8859-1] (original)
+++ trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs [iso-8859-1] Tue Apr 22
07:45:18 2008
@@ -17,11 +17,11 @@
//
// Summary:
// A HRESULT status code.
- HResult = 1,
+ HRESULT = 1,
//
// Summary:
// An NTSTATUS status code
- NTStatus = 2,
+ NTSTATUS = 2,
//
// Summary:
// a STOP/Bug Check code
Modified: trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
==============================================================================
--- trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs [iso-8859-1]
(original)
+++ trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs [iso-8859-1] Tue
Apr 22 07:45:18 2008
@@ -23,24 +23,19 @@
string ntstatusText = parameters;
if (ntstatusText.Equals(String.Empty))
{
- MsgTrans.MsgOutput.MsgOut(context,
- "Please provide a valid NTSTATUS
value.");
return false;
}
NumberParser np = new NumberParser();
if (!np.Parse(ntstatusText))
{
- MsgTrans.MsgOutput.MsgOut(context,
- String.Format("{0} is not a valid NTSTATUS
value.",
- ntstatusText));
return false;
}
string description = GetNtstatusDescription(np.Decimal);
if (description != null)
{
- AddMessage(MessageType.NTStatus,
+ AddMessage(MessageType.NTSTATUS,
np.Decimal,
np.Hex,
description,
Modified: trunk/tools/Message Translator/MsgTrans.Library/WinerrorCommand.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTran…
==============================================================================
--- trunk/tools/Message Translator/MsgTrans.Library/WinerrorCommand.cs [iso-8859-1]
(original)
+++ trunk/tools/Message Translator/MsgTrans.Library/WinerrorCommand.cs [iso-8859-1] Tue
Apr 22 07:45:18 2008
@@ -24,17 +24,12 @@
string winerrorText = parameters;
if (winerrorText.Equals(String.Empty))
{
- MsgTrans.MsgOutput.MsgOut(context,
- "Please provide a valid System Error Code
value.");
return false;
}
NumberParser np = new NumberParser();
if (!np.Parse(winerrorText))
{
- MsgTrans.MsgOutput.MsgOut(context,
- String.Format("{0} is not a valid System
Error Code value.",
- winerrorText));
return false;
}