Author: gedmurphy Date: Sat Apr 19 06:03:09 2008 New Revision: 33033
URL: http://svn.reactos.org/svn/reactos?rev=33033&view=rev Log: - set autostart on boot option - add hex value to win message tab
Modified: trunk/tools/Message Translator/GUI/MainForm.Designer.cs trunk/tools/Message Translator/GUI/MainForm.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/WmCommand.cs
Modified: trunk/tools/Message Translator/GUI/MainForm.Designer.cs URL: http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/GUI/Main... ============================================================================== --- trunk/tools/Message Translator/GUI/MainForm.Designer.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/GUI/MainForm.Designer.cs [iso-8859-1] Sat Apr 19 06:03:09 2008 @@ -47,14 +47,15 @@ this.errorMessageLabel = new System.Windows.Forms.Label(); this.errorNumberLabel = new System.Windows.Forms.Label(); this.wndmsgTab = new System.Windows.Forms.TabPage(); + this.label2 = new System.Windows.Forms.Label(); + this.wndmsgHexTxtBox = new System.Windows.Forms.TextBox(); + this.wndmsgDecimalTxtBox = new System.Windows.Forms.TextBox(); this.wndmsgCodeTxtBox = new System.Windows.Forms.TextBox(); - this.wndmsgNumberTxtBox = new System.Windows.Forms.TextBox(); this.wndmsgCodeLabel = new System.Windows.Forms.Label(); this.wndmsgNumberLabel = new System.Windows.Forms.Label(); this.bugurlTab = new System.Windows.Forms.TabPage(); this.bugLinkLabel = new System.Windows.Forms.LinkLabel(); this.optionsTab = new System.Windows.Forms.TabPage(); - this.optionsOKButton = new System.Windows.Forms.Button(); this.optionsRunStartChkBox = new System.Windows.Forms.CheckBox(); this.optionsMinimizeChkBox = new System.Windows.Forms.CheckBox(); this.mainErrLabel = new System.Windows.Forms.Label(); @@ -232,8 +233,10 @@ // // wndmsgTab // + this.wndmsgTab.Controls.Add(this.label2); + this.wndmsgTab.Controls.Add(this.wndmsgHexTxtBox); + this.wndmsgTab.Controls.Add(this.wndmsgDecimalTxtBox); this.wndmsgTab.Controls.Add(this.wndmsgCodeTxtBox); - this.wndmsgTab.Controls.Add(this.wndmsgNumberTxtBox); this.wndmsgTab.Controls.Add(this.wndmsgCodeLabel); this.wndmsgTab.Controls.Add(this.wndmsgNumberLabel); this.wndmsgTab.Location = new System.Drawing.Point(4, 22); @@ -243,6 +246,31 @@ this.wndmsgTab.Text = "Window Msg"; this.wndmsgTab.UseVisualStyleBackColor = true; // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(162, 15); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(12, 13); + this.label2.TabIndex = 13; + this.label2.Text = "/"; + // + // wndmsgHexTxtBox + // + this.wndmsgHexTxtBox.Location = new System.Drawing.Point(176, 12); + this.wndmsgHexTxtBox.Name = "wndmsgHexTxtBox"; + this.wndmsgHexTxtBox.ReadOnly = true; + this.wndmsgHexTxtBox.Size = new System.Drawing.Size(104, 20); + this.wndmsgHexTxtBox.TabIndex = 12; + // + // wndmsgDecimalTxtBox + // + this.wndmsgDecimalTxtBox.Location = new System.Drawing.Point(63, 12); + this.wndmsgDecimalTxtBox.Name = "wndmsgDecimalTxtBox"; + this.wndmsgDecimalTxtBox.ReadOnly = true; + this.wndmsgDecimalTxtBox.Size = new System.Drawing.Size(98, 20); + this.wndmsgDecimalTxtBox.TabIndex = 11; + // // wndmsgCodeTxtBox // this.wndmsgCodeTxtBox.Location = new System.Drawing.Point(63, 38); @@ -250,14 +278,6 @@ this.wndmsgCodeTxtBox.ReadOnly = true; this.wndmsgCodeTxtBox.Size = new System.Drawing.Size(217, 20); this.wndmsgCodeTxtBox.TabIndex = 6; - // - // wndmsgNumberTxtBox - // - this.wndmsgNumberTxtBox.Location = new System.Drawing.Point(63, 12); - this.wndmsgNumberTxtBox.Name = "wndmsgNumberTxtBox"; - this.wndmsgNumberTxtBox.ReadOnly = true; - this.wndmsgNumberTxtBox.Size = new System.Drawing.Size(217, 20); - this.wndmsgNumberTxtBox.TabIndex = 5; // // wndmsgCodeLabel // @@ -301,7 +321,6 @@ // // optionsTab // - this.optionsTab.Controls.Add(this.optionsOKButton); this.optionsTab.Controls.Add(this.optionsRunStartChkBox); this.optionsTab.Controls.Add(this.optionsMinimizeChkBox); this.optionsTab.Location = new System.Drawing.Point(4, 22); @@ -310,16 +329,6 @@ this.optionsTab.TabIndex = 4; this.optionsTab.Text = "Options"; this.optionsTab.UseVisualStyleBackColor = true; - // - // optionsOKButton - // - this.optionsOKButton.Location = new System.Drawing.Point(220, 160); - this.optionsOKButton.Name = "optionsOKButton"; - this.optionsOKButton.Size = new System.Drawing.Size(69, 22); - this.optionsOKButton.TabIndex = 0; - this.optionsOKButton.Text = "OK"; - this.optionsOKButton.UseVisualStyleBackColor = true; - this.optionsOKButton.Click += new System.EventHandler(this.optionsOKButton_Click); // // optionsRunStartChkBox // @@ -434,7 +443,6 @@
private System.Windows.Forms.Button mainLookupButton; private System.Windows.Forms.TextBox mainErrTxtBox; - private System.Windows.Forms.Button optionsOKButton; private System.Windows.Forms.Label mainErrLabel; private System.Windows.Forms.CheckBox optionsMinimizeChkBox; private System.Windows.Forms.TextBox errorMessageTxtBox; @@ -443,7 +451,6 @@ private System.Windows.Forms.Label errorNumberLabel; private System.Windows.Forms.Label errorTypeLabel; private System.Windows.Forms.TextBox wndmsgCodeTxtBox; - private System.Windows.Forms.TextBox wndmsgNumberTxtBox; private System.Windows.Forms.Label wndmsgCodeLabel; private System.Windows.Forms.Label wndmsgNumberLabel; private System.Windows.Forms.LinkLabel bugLinkLabel; @@ -467,6 +474,9 @@ private System.Windows.Forms.Button errorForwardButton; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox errorHexTxtBox; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox wndmsgHexTxtBox; + private System.Windows.Forms.TextBox wndmsgDecimalTxtBox; } }
Modified: trunk/tools/Message Translator/GUI/MainForm.cs URL: http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/GUI/Main... ============================================================================== --- trunk/tools/Message Translator/GUI/MainForm.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/GUI/MainForm.cs [iso-8859-1] Sat Apr 19 06:03:09 2008 @@ -10,10 +10,7 @@ { public partial class MainForm : Form { - MessageTranslator msgTrans; - private Panel[] panels; private static string regPath = @"Software\ReactOS\MsgTrans"; - private string[] msgTypes = { "error", "wm", "bug" };
#region properties @@ -124,6 +121,32 @@ } } #endregion + + private void SetAutoStart(bool bStart) + { + string path = @"Software\Microsoft\Windows\CurrentVersion\Run"; + string keyName = "MsgTrans"; + + try + { + if (bStart) + { + RegistryKey rk = Registry.CurrentUser.CreateSubKey(path); + string dir = Assembly.GetEntryAssembly().Location; + rk.SetValue(keyName, dir); + } + else + { + RegistryKey rk = Registry.CurrentUser.CreateSubKey(path); + rk.DeleteValue(keyName); + } + } + catch (Exception ex) + { + MessageOutput mo = new MessageOutput(); + mo.MsgOut(null, ex.Message); + } + }
private string GetMessageType() { @@ -169,7 +192,8 @@ } else if (msgType == msgTypes[1]) // wm { - wndmsgNumberTxtBox.Text = msgTran.Number.ToString(); + wndmsgDecimalTxtBox.Text = msgTran.Number.ToString(); + wndmsgHexTxtBox.Text = "0x" + msgTran.Hex; wndmsgCodeTxtBox.Text = msgTran.Code; } else if (msgType == msgTypes[2]) // bug @@ -189,11 +213,6 @@ InitializeComponent(); }
- public void MsgOut(string message) - { - MessageBox.Show(message); - } - private void MainForm_Load(object sender, EventArgs e) { // setup error page @@ -207,8 +226,6 @@ // setup options page optionsMinimizeChkBox.Checked = HideOnMin; optionsRunStartChkBox.Checked = RunOnStart; - optionsOKButton.Enabled = false; - optionsOKButton.Text = "Done"; notifyIcon.Visible = false;
toolTip.SetToolTip(mainErrTxtBox, Properties.Resources.tooltipErrMsg); @@ -224,17 +241,6 @@ System.Diagnostics.Process.Start(e.Link.LinkData.ToString()); }
- private void optionsOKButton_Click(object sender, EventArgs e) - { - Button btn = (Button)sender; - - HideOnMin = optionsMinimizeChkBox.Checked; - RunOnStart = optionsRunStartChkBox.Checked; - - btn.Text = "Done"; - btn.Enabled = false; - } - private void MainForm_Resize(object sender, EventArgs e) { if (FormWindowState.Minimized == WindowState) @@ -275,8 +281,17 @@
private void OptionsHaveChanged(object sender, EventArgs e) { - optionsOKButton.Text = "OK"; - optionsOKButton.Enabled = true; + CheckBox cb = (CheckBox)sender; + + if (cb.Name == optionsMinimizeChkBox.Name) + { + HideOnMin = optionsMinimizeChkBox.Checked; + } + else if (cb.Name == optionsRunStartChkBox.Name) + { + SetAutoStart(cb.Checked); + RunOnStart = optionsRunStartChkBox.Checked; + } }
private void mainTabControl_SelectedIndexChanged(object sender, EventArgs e)
Modified: trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs URL: http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTrans... ============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/ErrorCommand.cs [iso-8859-1] Sat Apr 19 06:03:09 2008 @@ -6,7 +6,6 @@ { public class ErrorCommand : Command { - MessageTranslator msgTrans; private NtStatusCommand ntStatus; private WinerrorCommand winerror; private HResultCommand hresult; @@ -17,7 +16,6 @@ string hresultXml) : base(msgTrans) { - this.msgTrans = msgTrans; this.ntStatus = new NtStatusCommand(msgTrans, ntstatusXml); this.winerror = new WinerrorCommand(msgTrans, winerrorXml); this.hresult = new HResultCommand(msgTrans, hresultXml);
Modified: trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs URL: http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTrans... ============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/HresultCommand.cs [iso-8859-1] Sat Apr 19 06:03:09 2008 @@ -56,7 +56,7 @@
public override string Help() { - return "!hresult <value>"; + return "hresult <value>"; }
public string GetHresultDescription(long hresult)
Modified: trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.Library.csproj URL: http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTrans... ============================================================================== --- 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] Sat Apr 19 06:03:09 2008 @@ -44,7 +44,7 @@ </Target> --> <ItemGroup> - <Compile Include="AppSenseBugUrl.cs" /> + <Compile Include="BugUrlCommandl.cs" /> <Compile Include="BugCommand.cs" /> <Compile Include="XmlCommand.cs" /> <Compile Include="ErrorCommand.cs" />
Modified: trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs URL: http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTrans... ============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/MsgTrans.cs [iso-8859-1] Sat Apr 19 06:03:09 2008 @@ -10,12 +10,8 @@ public class MessageTranslator { private IMsgOutput msgOutput; - private string ntstatusXml; - private string winerrorXml; - private string hresultXml; - private string wmXml; + private List<Command> commands = new List<Command>(); private string bugUrl; - private List<Command> commands = new List<Command>(); private string type; private long number; private string hex; @@ -53,6 +49,14 @@ get { return bugUrl; } set { bugUrl = value; } } + public IMsgOutput MsgOutput + { + get { return msgOutput; } + } + public IList<Command> Commands + { + get { return commands; } + } #endregion
public MessageTranslator(IMsgOutput msgOutput, @@ -63,11 +67,6 @@ string bugUrl) { this.msgOutput = msgOutput; - this.ntstatusXml = ntstatusXml; - this.winerrorXml = winerrorXml; - this.hresultXml = hresultXml; - this.wmXml = wmXml; - this.bugUrl = bugUrl;
commands.Add(new ErrorCommand(this, ntstatusXml, @@ -75,16 +74,6 @@ hresultXml)); commands.Add(new WMCommand(this, wmXml)); commands.Add(new BugUrl(this, bugUrl)); - } - - public IMsgOutput MsgOutput - { - get { return msgOutput; } - } - - public IList<Command> Commands - { - get { return commands; } }
public bool ParseCommandMessage(MessageContext context,
Modified: trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs URL: http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTrans... ============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/NtStatusCommand.cs [iso-8859-1] Sat Apr 19 06:03:09 2008 @@ -56,7 +56,7 @@
public override string Help() { - return "!ntstatus <value>"; + return "ntstatus <value>"; }
public string GetNtstatusDescription(long ntstatus)
Modified: trunk/tools/Message Translator/MsgTrans.Library/WmCommand.cs URL: http://svn.reactos.org/svn/reactos/trunk/tools/Message%20Translator/MsgTrans... ============================================================================== --- trunk/tools/Message Translator/MsgTrans.Library/WmCommand.cs [iso-8859-1] (original) +++ trunk/tools/Message Translator/MsgTrans.Library/WmCommand.cs [iso-8859-1] Sat Apr 19 06:03:09 2008 @@ -48,6 +48,7 @@ if (code != null) { MsgTrans.Number = num; + MsgTrans.Hex = num.ToString("X"); MsgTrans.Code = code; return true; } @@ -62,7 +63,7 @@
public override string Help() { - return "!wm <value> or !wm <name>"; + return "wm <value> or wm <name>"; }
private string GetWmDescription(long wm)