diff --git a/trunk/CHANGELOG.txt b/trunk/CHANGELOG.txt index d9949dfc5..3502d6583 100644 --- a/trunk/CHANGELOG.txt +++ b/trunk/CHANGELOG.txt @@ -2,6 +2,7 @@ Process Hacker 1.6 * NEW/IMPROVED: + * Update system * FIXED: * Critical KProcessHacker denial-of-service security issues * Incorrect menu items for System threads diff --git a/trunk/ProcessHacker/Common/IWin32ForegroundWindow.cs b/trunk/ProcessHacker/Common/IWin32ForegroundWindow.cs deleted file mode 100644 index 6d68b5481..000000000 --- a/trunk/ProcessHacker/Common/IWin32ForegroundWindow.cs +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Process Hacker - - * ThreadSafe IWin32Window for obtaining ForegroundWindow Handle - * - * Copyright (C) 2009 dmex - * - * This file is part of Process Hacker. - * - * Process Hacker is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Process Hacker is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Process Hacker. If not, see . - */ - - -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; -using System.Runtime.InteropServices; - -public class IWin32ForegroundWindow : IWin32Window -{ - private static IWin32ForegroundWindow _window = new IWin32ForegroundWindow(); - private IWin32ForegroundWindow() { } - - public static IWin32Window Instance - { - get { return _window; } - } - - [DllImport("user32.dll")] - private static extern IntPtr GetForegroundWindow(); - - IntPtr IWin32Window.Handle - { - get - { - return GetForegroundWindow(); - } - } -} diff --git a/trunk/ProcessHacker/Forms/AboutWindow.Designer.cs b/trunk/ProcessHacker/Forms/AboutWindow.Designer.cs index ea51cdad4..8ea4acca3 100644 --- a/trunk/ProcessHacker/Forms/AboutWindow.Designer.cs +++ b/trunk/ProcessHacker/Forms/AboutWindow.Designer.cs @@ -48,6 +48,7 @@ this.label7 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.linkGamingMasteR = new System.Windows.Forms.LinkLabel(); this.linkKerem = new System.Windows.Forms.LinkLabel(); @@ -61,7 +62,6 @@ this.labelFiller = new System.Windows.Forms.Label(); this.buttonChangelog = new System.Windows.Forms.Button(); this.buttonDiagnostics = new System.Windows.Forms.Button(); - this.label12 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); this.flowCredits.SuspendLayout(); this.SuspendLayout(); @@ -207,13 +207,13 @@ this.flowCredits.AutoScroll = true; this.flowCredits.Controls.Add(this.label8); this.flowCredits.Controls.Add(this.label5); + this.flowCredits.Controls.Add(this.label12); + this.flowCredits.Controls.Add(this.label1); this.flowCredits.Controls.Add(this.label6); this.flowCredits.Controls.Add(this.label10); this.flowCredits.Controls.Add(this.label9); this.flowCredits.Controls.Add(this.label7); - this.flowCredits.Controls.Add(this.label1); this.flowCredits.Controls.Add(this.label11); - this.flowCredits.Controls.Add(this.label12); this.flowCredits.Controls.Add(this.label2); this.flowCredits.Controls.Add(this.linkGamingMasteR); this.flowCredits.Controls.Add(this.linkKerem); @@ -261,7 +261,7 @@ // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(6, 29); + this.label6.Location = new System.Drawing.Point(6, 55); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(91, 13); this.label6.TabIndex = 18; @@ -270,7 +270,7 @@ // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(6, 42); + this.label10.Location = new System.Drawing.Point(6, 68); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(89, 13); this.label10.TabIndex = 23; @@ -279,7 +279,7 @@ // label9 // this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(6, 55); + this.label9.Location = new System.Drawing.Point(6, 81); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(127, 13); this.label9.TabIndex = 22; @@ -288,7 +288,7 @@ // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(6, 68); + this.label7.Location = new System.Drawing.Point(6, 94); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(142, 13); this.label7.TabIndex = 18; @@ -297,7 +297,7 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(6, 81); + this.label1.Location = new System.Drawing.Point(6, 42); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(188, 13); this.label1.TabIndex = 13; @@ -307,12 +307,21 @@ // this.label11.AutoSize = true; this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label11.Location = new System.Drawing.Point(6, 94); + this.label11.Location = new System.Drawing.Point(6, 107); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(68, 13); this.label11.TabIndex = 17; this.label11.Text = "Thanks to:"; // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(6, 29); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(90, 13); + this.label12.TabIndex = 29; + this.label12.Text = "dmex - Developer"; + // // label2 // this.label2.AutoSize = true; @@ -457,15 +466,6 @@ this.buttonDiagnostics.UseVisualStyleBackColor = true; this.buttonDiagnostics.Click += new System.EventHandler(this.buttonDiagnostics_Click); // - // label12 - // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(6, 107); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(161, 13); - this.label12.TabIndex = 29; - this.label12.Text = "dmex - Inspiration for x64 version"; - // // AboutWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/trunk/ProcessHacker/Forms/HackerWindow.Designer.cs b/trunk/ProcessHacker/Forms/HackerWindow.Designer.cs index 73d277476..daecee353 100644 --- a/trunk/ProcessHacker/Forms/HackerWindow.Designer.cs +++ b/trunk/ProcessHacker/Forms/HackerWindow.Designer.cs @@ -115,7 +115,7 @@ this.windowMenuItem = new System.Windows.Forms.MenuItem(); this.helpMenu = new System.Windows.Forms.MenuItem(); this.freeMemoryMenuItem = new System.Windows.Forms.MenuItem(); - this.UpdateCheckMenuItem = new System.Windows.Forms.MenuItem(); + this.checkForUpdatesMenuItem = new System.Windows.Forms.MenuItem(); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.logMenuItem = new System.Windows.Forms.MenuItem(); this.helpMenuItem = new System.Windows.Forms.MenuItem(); @@ -129,8 +129,11 @@ this.timerMessages = new System.Windows.Forms.Timer(this.components); this.tabControl = new System.Windows.Forms.TabControl(); this.tabProcesses = new System.Windows.Forms.TabPage(); + this.treeProcesses = new ProcessHacker.ProcessTree(); this.tabServices = new System.Windows.Forms.TabPage(); + this.listServices = new ProcessHacker.Components.ServiceList(); this.tabNetwork = new System.Windows.Forms.TabPage(); + this.listNetwork = new ProcessHacker.Components.NetworkList(); this.toolStrip = new System.Windows.Forms.ToolStrip(); this.refreshToolStripButton = new System.Windows.Forms.ToolStripButton(); this.optionsToolStripButton = new System.Windows.Forms.ToolStripButton(); @@ -172,9 +175,6 @@ this.menuNetwork = new System.Windows.Forms.ContextMenu(); this.menuItem6 = new System.Windows.Forms.MenuItem(); this.selectAllNetworkMenuItem = new System.Windows.Forms.MenuItem(); - this.treeProcesses = new ProcessHacker.ProcessTree(); - this.listServices = new ProcessHacker.Components.ServiceList(); - this.listNetwork = new ProcessHacker.Components.NetworkList(); this.vistaMenu = new wyDay.Controls.VistaMenu(this.components); ((System.ComponentModel.ISupportInitialize)(this.statusGeneral)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.statusCPU)).BeginInit(); @@ -282,7 +282,7 @@ // terminatorProcessMenuItem // this.terminatorProcessMenuItem.Index = 10; - this.terminatorProcessMenuItem.Text = "Terminator..."; + this.terminatorProcessMenuItem.Text = "Terminator"; this.terminatorProcessMenuItem.Click += new System.EventHandler(this.terminatorProcessMenuItem_Click); // // miscellaneousProcessMenuItem @@ -305,7 +305,7 @@ // heapsProcessMenuItem // this.heapsProcessMenuItem.Index = 1; - this.heapsProcessMenuItem.Text = "Heaps..."; + this.heapsProcessMenuItem.Text = "Heaps"; this.heapsProcessMenuItem.Click += new System.EventHandler(this.heapsProcessMenuItem_Click); // // injectDllProcessMenuItem @@ -317,7 +317,7 @@ // protectionProcessMenuItem // this.protectionProcessMenuItem.Index = 3; - this.protectionProcessMenuItem.Text = "Protection..."; + this.protectionProcessMenuItem.Text = "Protection"; this.protectionProcessMenuItem.Click += new System.EventHandler(this.protectionProcessMenuItem_Click); // // setTokenProcessMenuItem @@ -453,7 +453,7 @@ this.propertiesProcessMenuItem.DefaultItem = true; this.vistaMenu.SetImage(this.propertiesProcessMenuItem, global::ProcessHacker.Properties.Resources.application_form_magnify); this.propertiesProcessMenuItem.Index = 15; - this.propertiesProcessMenuItem.Text = "&Properties..."; + this.propertiesProcessMenuItem.Text = "&Properties"; this.propertiesProcessMenuItem.Click += new System.EventHandler(this.propertiesProcessMenuItem_Click); // // menuItem7 @@ -465,7 +465,7 @@ // this.searchProcessMenuItem.Index = 17; this.searchProcessMenuItem.Shortcut = System.Windows.Forms.Shortcut.CtrlM; - this.searchProcessMenuItem.Text = "&Search Online..."; + this.searchProcessMenuItem.Text = "&Search Online"; this.searchProcessMenuItem.Click += new System.EventHandler(this.searchProcessMenuItem_Click); // // reanalyzeProcessMenuItem @@ -674,7 +674,7 @@ // this.sysInfoMenuItem.Index = 1; this.sysInfoMenuItem.Shortcut = System.Windows.Forms.Shortcut.CtrlI; - this.sysInfoMenuItem.Text = "System &Information..."; + this.sysInfoMenuItem.Text = "System &Information"; this.sysInfoMenuItem.Click += new System.EventHandler(this.sysInfoMenuItem_Click); // // trayIconsMenuItem @@ -761,7 +761,7 @@ // hiddenProcessesMenuItem // this.hiddenProcessesMenuItem.Index = 1; - this.hiddenProcessesMenuItem.Text = "&Hidden Processes..."; + this.hiddenProcessesMenuItem.Text = "&Hidden Processes"; this.hiddenProcessesMenuItem.Click += new System.EventHandler(this.hiddenProcessesMenuItem_Click); // // verifyFileSignatureMenuItem @@ -785,7 +785,7 @@ this.helpMenu.Index = 5; this.helpMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.freeMemoryMenuItem, - this.UpdateCheckMenuItem, + this.checkForUpdatesMenuItem, this.menuItem1, this.logMenuItem, this.helpMenuItem, @@ -798,11 +798,11 @@ this.freeMemoryMenuItem.Text = "Free Memory"; this.freeMemoryMenuItem.Click += new System.EventHandler(this.freeMemoryMenuItem_Click); // - // UpdateCheckMenuItem + // checkForUpdatesMenuItem // - this.UpdateCheckMenuItem.Index = 1; - this.UpdateCheckMenuItem.Text = "Check for Update"; - this.UpdateCheckMenuItem.Click += new System.EventHandler(this.UpdateCheckMenuItem_Click); + this.checkForUpdatesMenuItem.Index = 1; + this.checkForUpdatesMenuItem.Text = "Check for Updates"; + this.checkForUpdatesMenuItem.Click += new System.EventHandler(this.UpdateCheckMenuItem_Click); // // menuItem1 // @@ -814,7 +814,7 @@ this.vistaMenu.SetImage(this.logMenuItem, global::ProcessHacker.Properties.Resources.page_white_text); this.logMenuItem.Index = 3; this.logMenuItem.Shortcut = System.Windows.Forms.Shortcut.CtrlL; - this.logMenuItem.Text = "&Log..."; + this.logMenuItem.Text = "&Log"; this.logMenuItem.Click += new System.EventHandler(this.logMenuItem_Click); // // helpMenuItem @@ -822,19 +822,19 @@ this.vistaMenu.SetImage(this.helpMenuItem, global::ProcessHacker.Properties.Resources.help); this.helpMenuItem.Index = 4; this.helpMenuItem.Shortcut = System.Windows.Forms.Shortcut.F1; - this.helpMenuItem.Text = "&Help..."; + this.helpMenuItem.Text = "&Help"; this.helpMenuItem.Click += new System.EventHandler(this.helpMenuItem_Click); // // aboutMenuItem // this.vistaMenu.SetImage(this.aboutMenuItem, global::ProcessHacker.Properties.Resources.information); this.aboutMenuItem.Index = 5; - this.aboutMenuItem.Text = "&About..."; + this.aboutMenuItem.Text = "&About"; this.aboutMenuItem.Click += new System.EventHandler(this.aboutMenuItem_Click); // // statusBar // - this.statusBar.Location = new System.Drawing.Point(0, 320); + this.statusBar.Location = new System.Drawing.Point(0, 404); this.statusBar.Name = "statusBar"; this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { this.statusGeneral, @@ -908,28 +908,65 @@ this.tabProcesses.Text = "Processes"; this.tabProcesses.UseVisualStyleBackColor = true; // + // treeProcesses + // + this.treeProcesses.Dock = System.Windows.Forms.DockStyle.Fill; + this.treeProcesses.Draw = true; + this.treeProcesses.Location = new System.Drawing.Point(3, 3); + this.treeProcesses.Name = "treeProcesses"; + this.treeProcesses.Provider = null; + this.treeProcesses.Size = new System.Drawing.Size(784, 344); + this.treeProcesses.TabIndex = 4; + this.treeProcesses.SelectionChanged += new System.EventHandler(this.treeProcesses_SelectionChanged); + this.treeProcesses.NodeMouseDoubleClick += new System.EventHandler(this.treeProcesses_NodeMouseDoubleClick); + this.treeProcesses.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeProcesses_KeyDown); + // // tabServices // this.tabServices.Controls.Add(this.listServices); this.tabServices.Location = new System.Drawing.Point(4, 22); this.tabServices.Name = "tabServices"; this.tabServices.Padding = new System.Windows.Forms.Padding(3); - this.tabServices.Size = new System.Drawing.Size(790, 348); + this.tabServices.Size = new System.Drawing.Size(790, 350); this.tabServices.TabIndex = 1; this.tabServices.Text = "Services"; this.tabServices.UseVisualStyleBackColor = true; // + // listServices + // + this.listServices.Dock = System.Windows.Forms.DockStyle.Fill; + this.listServices.DoubleBuffered = true; + this.listServices.Location = new System.Drawing.Point(3, 3); + this.listServices.Name = "listServices"; + this.listServices.Provider = null; + this.listServices.Size = new System.Drawing.Size(784, 344); + this.listServices.TabIndex = 0; + this.listServices.DoubleClick += new System.EventHandler(this.listServices_DoubleClick); + this.listServices.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listServices_KeyDown); + // // tabNetwork // this.tabNetwork.Controls.Add(this.listNetwork); this.tabNetwork.Location = new System.Drawing.Point(4, 22); this.tabNetwork.Name = "tabNetwork"; this.tabNetwork.Padding = new System.Windows.Forms.Padding(3); - this.tabNetwork.Size = new System.Drawing.Size(790, 348); + this.tabNetwork.Size = new System.Drawing.Size(790, 350); this.tabNetwork.TabIndex = 2; this.tabNetwork.Text = "Network"; this.tabNetwork.UseVisualStyleBackColor = true; // + // listNetwork + // + this.listNetwork.Dock = System.Windows.Forms.DockStyle.Fill; + this.listNetwork.DoubleBuffered = true; + this.listNetwork.Location = new System.Drawing.Point(3, 3); + this.listNetwork.Name = "listNetwork"; + this.listNetwork.Provider = null; + this.listNetwork.Size = new System.Drawing.Size(784, 344); + this.listNetwork.TabIndex = 0; + this.listNetwork.DoubleClick += new System.EventHandler(this.listNetwork_DoubleClick); + this.listNetwork.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listNetwork_KeyDown); + // // toolStrip // this.toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; @@ -1066,7 +1103,7 @@ this.propertiesServiceMenuItem.DefaultItem = true; this.vistaMenu.SetImage(this.propertiesServiceMenuItem, global::ProcessHacker.Properties.Resources.application_form_magnify); this.propertiesServiceMenuItem.Index = 6; - this.propertiesServiceMenuItem.Text = "&Properties..."; + this.propertiesServiceMenuItem.Text = "&Properties"; this.propertiesServiceMenuItem.Click += new System.EventHandler(this.propertiesServiceMenuItem_Click); // // menuItem8 @@ -1107,7 +1144,7 @@ // sysInformationIconMenuItem // this.sysInformationIconMenuItem.Index = 1; - this.sysInformationIconMenuItem.Text = "System &Information..."; + this.sysInformationIconMenuItem.Text = "System &Information"; this.sysInformationIconMenuItem.Click += new System.EventHandler(this.sysInformationIconMenuItem_Click); // // notificationsMenuItem @@ -1241,43 +1278,6 @@ this.selectAllNetworkMenuItem.Text = "Select &All"; this.selectAllNetworkMenuItem.Click += new System.EventHandler(this.selectAllNetworkMenuItem_Click); // - // treeProcesses - // - this.treeProcesses.Dock = System.Windows.Forms.DockStyle.Fill; - this.treeProcesses.Draw = true; - this.treeProcesses.Location = new System.Drawing.Point(3, 3); - this.treeProcesses.Name = "treeProcesses"; - this.treeProcesses.Provider = null; - this.treeProcesses.Size = new System.Drawing.Size(784, 260); - this.treeProcesses.TabIndex = 4; - this.treeProcesses.SelectionChanged += new System.EventHandler(this.treeProcesses_SelectionChanged); - this.treeProcesses.NodeMouseDoubleClick += new System.EventHandler(this.treeProcesses_NodeMouseDoubleClick); - this.treeProcesses.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeProcesses_KeyDown); - // - // listServices - // - this.listServices.Dock = System.Windows.Forms.DockStyle.Fill; - this.listServices.DoubleBuffered = true; - this.listServices.Location = new System.Drawing.Point(3, 3); - this.listServices.Name = "listServices"; - this.listServices.Provider = null; - this.listServices.Size = new System.Drawing.Size(784, 281); - this.listServices.TabIndex = 0; - this.listServices.DoubleClick += new System.EventHandler(this.listServices_DoubleClick); - this.listServices.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listServices_KeyDown); - // - // listNetwork - // - this.listNetwork.Dock = System.Windows.Forms.DockStyle.Fill; - this.listNetwork.DoubleBuffered = true; - this.listNetwork.Location = new System.Drawing.Point(3, 3); - this.listNetwork.Name = "listNetwork"; - this.listNetwork.Provider = null; - this.listNetwork.Size = new System.Drawing.Size(784, 281); - this.listNetwork.TabIndex = 0; - this.listNetwork.DoubleClick += new System.EventHandler(this.listNetwork_DoubleClick); - this.listNetwork.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listNetwork_KeyDown); - // // vistaMenu // this.vistaMenu.ContainerControl = this; @@ -1466,7 +1466,7 @@ private System.Windows.Forms.MenuItem maximizeProcessMenuItem; private System.Windows.Forms.MenuItem menuItem15; private System.Windows.Forms.MenuItem closeProcessMenuItem; - private System.Windows.Forms.MenuItem UpdateCheckMenuItem; + private System.Windows.Forms.MenuItem checkForUpdatesMenuItem; } } diff --git a/trunk/ProcessHacker/Forms/HackerWindow.cs b/trunk/ProcessHacker/Forms/HackerWindow.cs index 2d9f99955..fdb6f315d 100644 --- a/trunk/ProcessHacker/Forms/HackerWindow.cs +++ b/trunk/ProcessHacker/Forms/HackerWindow.cs @@ -524,6 +524,23 @@ namespace ProcessHacker createServiceWindow.ShowDialog(); } + private void UpdateCheckMenuItem_Click(object sender, EventArgs e) + { + updateNowMenuItem.Enabled = false; + + Thread t = new Thread(new ThreadStart(this.UpdateProgram)); + t.IsBackground = true; + t.Start(); + } + + private void UpdateProgram() + { + this.QueueMessage("Starting update check"); + Updater.Update(); + this.QueueMessage("Finished update check"); + this.Invoke(new MethodInvoker(() => updateNowMenuItem.Enabled = true)); + } + #region View private void cpuHistoryMenuItem_Click(object sender, EventArgs e) @@ -3192,186 +3209,5 @@ namespace ProcessHacker catch { } } } - - - #region "Update Check" - - String _AppUpdateVers; - String _AppUpdateMSG; - String _AppUpdateURL; - - private void UpdateCheckMenuItem_Click(object sender, EventArgs e) - { - this.updateProcessesMenuItem.Enabled = false; - - Thread t = new Thread(new ThreadStart(this.UpdateJob)); - t.IsBackground = true; - t.Start(); - } - - /// - /// Lock around UpdateXML target - /// - private readonly object stateLock = new object(); - - private void UpdateJob() - { - this.QueueMessage("Starting Update Check"); - - lock (this.stateLock) - { - this.AppUpdateCheckXML(); - } - - this.QueueMessage("Finished Update Check"); - - this.Invoke(new MethodInvoker(this.EnableButton)); - } - - private void EnableButton() - { - this.updateProcessesMenuItem.Enabled = true; - } - - private void UpdateDownloadBegin() - { - try - { - Process.Start(this._AppUpdateURL); - } - catch (Exception ex) - { Logging.Log(ex); } - } - - private void AppUpdateCheckXML() - { - XmlDocument xDoc = new XmlDocument(); - - try - { xDoc.Load("http://processhacker.sourceforge.net/AppUpdate.xml"); } - catch (Exception ex) - { - Logging.Log(ex); - return; - } - - XmlNodeList items = xDoc.SelectNodes("//update"); - foreach (XmlNode xn in items) - { - if (DateTime.Parse(xn["released"].InnerText) > this.AssemblyBuildDate() & new Version(xn["version"].InnerText) > new Version(Application.ProductVersion) & xn["type"].InnerText == "release") - { - this.QueueMessage("Found New Release Version: " + xn["version"].InnerText + " - Current Version: " + Application.ProductVersion.ToString()); - - this._AppUpdateVers = xn["version"].InnerText; - this._AppUpdateMSG = xn["description"].InnerText; - this._AppUpdateURL = xn["updateurl"].InnerText; - } - else if (Properties.Settings.Default.AppUpdateBeta) - { - if (DateTime.Parse(xn["released"].InnerText) > this.AssemblyBuildDate() & new Version(xn["version"].InnerText) > new Version(Application.ProductVersion) & xn["type"].InnerText == "beta") - { - this.QueueMessage("Found New Beta Version: " + xn["version"].InnerText + " - Current Version: " + Application.ProductVersion.ToString()); - - this._AppUpdateVers = xn["version"].InnerText; - this._AppUpdateMSG = xn["description"].InnerText; - this._AppUpdateURL = xn["updateurl"].InnerText; - } - } - else if (Properties.Settings.Default.AppUpdateAlpha) - { - if (DateTime.Parse(xn["released"].InnerText) > this.AssemblyBuildDate() & new Version(xn["version"].InnerText) > new Version(Application.ProductVersion) & xn["type"].InnerText == "alpha") - { - this.QueueMessage("Found New Alpha Version: " + xn["version"].InnerText + " - Current Version: " + Application.ProductVersion.ToString()); - - this._AppUpdateVers = xn["version"].InnerText; - this._AppUpdateMSG = xn["description"].InnerText; - this._AppUpdateURL = xn["updateurl"].InnerText; - } - } - } - - if (this._AppUpdateVers != null & this._AppUpdateMSG != null) - { - if (OSVersion.HasTaskDialogs) - { - TaskDialog td = new TaskDialog(); - td.PositionRelativeToWindow = true; - td.Content = "Your Version: " + Application.ProductVersion + Environment.NewLine + "Server Version: " + this._AppUpdateVers + Environment.NewLine + Environment.NewLine + this._AppUpdateMSG; - td.MainInstruction = "Process Hacker Update Available"; - td.WindowTitle = "Update Available!"; - td.MainIcon = TaskDialogIcon.SecurityWarning; - td.Buttons = new TaskDialogButton[] - { - new TaskDialogButton((int)DialogResult.Yes, "Yes, Begin Downloading Update"), - new TaskDialogButton((int)DialogResult.No, "No, I will Update Later"), - }; - - DialogResult dr = (DialogResult)td.Show(IWin32ForegroundWindow.Instance); - if (dr == DialogResult.Yes) - { - this.Invoke(new MethodInvoker(this.UpdateDownloadBegin)); - } - } - else - { - DialogResult dr = MessageBox.Show(IWin32ForegroundWindow.Instance, "Your Version: " + Application.ProductVersion + Environment.NewLine + "Server Version: " + this._AppUpdateVers + Environment.NewLine + Environment.NewLine + this._AppUpdateMSG + Environment.NewLine + Environment.NewLine + "Do you want to download the update now?", "Update Available", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); - if (dr == DialogResult.Yes) - { - this.Invoke(new MethodInvoker(this.UpdateDownloadBegin)); - } - } - } - else - { - this.QueueMessage("No Updates Available!"); - - if (OSVersion.HasTaskDialogs) - { - TaskDialog td = new TaskDialog(); - td.PositionRelativeToWindow = true; - td.Content = "Your Version: " + Application.ProductVersion + Environment.NewLine + Environment.NewLine + "Server Version: " + this._AppUpdateVers; - td.MainInstruction = "Process Hacker is Update2Date"; - td.WindowTitle = "No Updates Available!"; - td.MainIcon = TaskDialogIcon.SecuritySuccess; - td.CommonButtons = TaskDialogCommonButtons.Ok; - td.Show(IWin32ForegroundWindow.Instance); - } - else - { - MessageBox.Show(IWin32ForegroundWindow.Instance, "Process Hacker is Update2Date", "No Updates Available!", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - } - } - - private DateTime AssemblyBuildDate() - { - const int PeHeaderOffset = 60; - const int LinkerTimestampOffset = 8; - - byte[] b = new byte[2048]; - System.IO.Stream s = default(System.IO.Stream); - try - { - s = new System.IO.FileStream(System.Reflection.Assembly.GetExecutingAssembly().Location, System.IO.FileMode.Open, System.IO.FileAccess.Read); - s.Read(b, 0, 2048); - } - finally - { - if ((s != null)) - s.Close(); - } - - int i = BitConverter.ToInt32(b, PeHeaderOffset); - - int SecondsSince1970 = BitConverter.ToInt32(b, i + LinkerTimestampOffset); - DateTime dt = new DateTime(1970, 1, 1, 0, 0, 0); - dt = dt.AddSeconds(SecondsSince1970); - dt = dt.AddHours(TimeZone.CurrentTimeZone.GetUtcOffset(dt).Hours); - return dt; - - } - - #endregion - } } diff --git a/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs b/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs index 1e0f6eeae..0e15c9882 100644 --- a/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs +++ b/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs @@ -99,9 +99,11 @@ this.toolTipProvider = new System.Windows.Forms.ToolTip(this.components); this.buttonCancel = new System.Windows.Forms.Button(); this.buttonApply = new System.Windows.Forms.Button(); - this.UpdateStableRadioBtn = new System.Windows.Forms.RadioButton(); - this.UpdateBetaRadioBtn = new System.Windows.Forms.RadioButton(); - this.UpdateAlphaRadioBtn = new System.Windows.Forms.RadioButton(); + this.tabUpdates = new System.Windows.Forms.TabPage(); + this.optUpdateAlpha = new System.Windows.Forms.RadioButton(); + this.optUpdateBeta = new System.Windows.Forms.RadioButton(); + this.optUpdateStable = new System.Windows.Forms.RadioButton(); + this.label5 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.textUpdateInterval)).BeginInit(); this.tabControl.SuspendLayout(); this.tabGeneral.SuspendLayout(); @@ -113,6 +115,7 @@ this.tabPlotting.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.textStep)).BeginInit(); this.tabSymbols.SuspendLayout(); + this.tabUpdates.SuspendLayout(); this.SuspendLayout(); // // label1 @@ -222,6 +225,7 @@ this.tabControl.Controls.Add(this.tabHighlighting); this.tabControl.Controls.Add(this.tabPlotting); this.tabControl.Controls.Add(this.tabSymbols); + this.tabControl.Controls.Add(this.tabUpdates); this.tabControl.Location = new System.Drawing.Point(12, 12); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; @@ -230,9 +234,6 @@ // // tabGeneral // - this.tabGeneral.Controls.Add(this.UpdateAlphaRadioBtn); - this.tabGeneral.Controls.Add(this.UpdateBetaRadioBtn); - this.tabGeneral.Controls.Add(this.UpdateStableRadioBtn); this.tabGeneral.Controls.Add(this.checkFloatChildWindows); this.tabGeneral.Controls.Add(this.checkScrollDownProcessTree); this.tabGeneral.Controls.Add(this.checkAllowOnlyOneInstance); @@ -994,37 +995,60 @@ this.buttonApply.UseVisualStyleBackColor = true; this.buttonApply.Click += new System.EventHandler(this.buttonApply_Click); // - // UpdateStableRadioBtn + // tabUpdates // - this.UpdateStableRadioBtn.AutoSize = true; - this.UpdateStableRadioBtn.Checked = true; - this.UpdateStableRadioBtn.Location = new System.Drawing.Point(168, 261); - this.UpdateStableRadioBtn.Name = "UpdateStableRadioBtn"; - this.UpdateStableRadioBtn.Size = new System.Drawing.Size(102, 17); - this.UpdateStableRadioBtn.TabIndex = 18; - this.UpdateStableRadioBtn.TabStop = true; - this.UpdateStableRadioBtn.Text = "Stable Releases"; - this.UpdateStableRadioBtn.UseVisualStyleBackColor = true; + this.tabUpdates.Controls.Add(this.label5); + this.tabUpdates.Controls.Add(this.optUpdateAlpha); + this.tabUpdates.Controls.Add(this.optUpdateBeta); + this.tabUpdates.Controls.Add(this.optUpdateStable); + this.tabUpdates.Location = new System.Drawing.Point(4, 22); + this.tabUpdates.Name = "tabUpdates"; + this.tabUpdates.Padding = new System.Windows.Forms.Padding(3); + this.tabUpdates.Size = new System.Drawing.Size(481, 289); + this.tabUpdates.TabIndex = 5; + this.tabUpdates.Text = "Updates"; + this.tabUpdates.UseVisualStyleBackColor = true; // - // UpdateBetaRadioBtn + // optUpdateAlpha // - this.UpdateBetaRadioBtn.AutoSize = true; - this.UpdateBetaRadioBtn.Location = new System.Drawing.Point(276, 261); - this.UpdateBetaRadioBtn.Name = "UpdateBetaRadioBtn"; - this.UpdateBetaRadioBtn.Size = new System.Drawing.Size(94, 17); - this.UpdateBetaRadioBtn.TabIndex = 19; - this.UpdateBetaRadioBtn.Text = "Beta Releases"; - this.UpdateBetaRadioBtn.UseVisualStyleBackColor = true; + this.optUpdateAlpha.AutoSize = true; + this.optUpdateAlpha.Location = new System.Drawing.Point(68, 52); + this.optUpdateAlpha.Name = "optUpdateAlpha"; + this.optUpdateAlpha.Size = new System.Drawing.Size(99, 17); + this.optUpdateAlpha.TabIndex = 23; + this.optUpdateAlpha.Text = "Alpha Releases"; + this.optUpdateAlpha.UseVisualStyleBackColor = true; // - // UpdateAlphaRadioBtn + // optUpdateBeta // - this.UpdateAlphaRadioBtn.AutoSize = true; - this.UpdateAlphaRadioBtn.Location = new System.Drawing.Point(376, 261); - this.UpdateAlphaRadioBtn.Name = "UpdateAlphaRadioBtn"; - this.UpdateAlphaRadioBtn.Size = new System.Drawing.Size(99, 17); - this.UpdateAlphaRadioBtn.TabIndex = 20; - this.UpdateAlphaRadioBtn.Text = "Alpha Releases"; - this.UpdateAlphaRadioBtn.UseVisualStyleBackColor = true; + this.optUpdateBeta.AutoSize = true; + this.optUpdateBeta.Location = new System.Drawing.Point(68, 29); + this.optUpdateBeta.Name = "optUpdateBeta"; + this.optUpdateBeta.Size = new System.Drawing.Size(94, 17); + this.optUpdateBeta.TabIndex = 22; + this.optUpdateBeta.Text = "Beta Releases"; + this.optUpdateBeta.UseVisualStyleBackColor = true; + // + // optUpdateStable + // + this.optUpdateStable.AutoSize = true; + this.optUpdateStable.Checked = true; + this.optUpdateStable.Location = new System.Drawing.Point(68, 6); + this.optUpdateStable.Name = "optUpdateStable"; + this.optUpdateStable.Size = new System.Drawing.Size(102, 17); + this.optUpdateStable.TabIndex = 21; + this.optUpdateStable.TabStop = true; + this.optUpdateStable.Text = "Stable Releases"; + this.optUpdateStable.UseVisualStyleBackColor = true; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(6, 8); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(56, 13); + this.label5.TabIndex = 24; + this.label5.Text = "Check for:"; // // OptionsWindow // @@ -1062,6 +1086,8 @@ ((System.ComponentModel.ISupportInitialize)(this.textStep)).EndInit(); this.tabSymbols.ResumeLayout(false); this.tabSymbols.PerformLayout(); + this.tabUpdates.ResumeLayout(false); + this.tabUpdates.PerformLayout(); this.ResumeLayout(false); } @@ -1138,8 +1164,10 @@ private System.Windows.Forms.Label label11; private System.Windows.Forms.CheckBox checkScrollDownProcessTree; private System.Windows.Forms.CheckBox checkFloatChildWindows; - private System.Windows.Forms.RadioButton UpdateAlphaRadioBtn; - private System.Windows.Forms.RadioButton UpdateBetaRadioBtn; - private System.Windows.Forms.RadioButton UpdateStableRadioBtn; + private System.Windows.Forms.TabPage tabUpdates; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.RadioButton optUpdateAlpha; + private System.Windows.Forms.RadioButton optUpdateBeta; + private System.Windows.Forms.RadioButton optUpdateStable; } } \ No newline at end of file diff --git a/trunk/ProcessHacker/Forms/OptionsWindow.cs b/trunk/ProcessHacker/Forms/OptionsWindow.cs index 0df1772c0..bbe85a7f5 100644 --- a/trunk/ProcessHacker/Forms/OptionsWindow.cs +++ b/trunk/ProcessHacker/Forms/OptionsWindow.cs @@ -2,6 +2,7 @@ * Process Hacker - * options window * + * Copyright (C) 2009 dmex * Copyright (C) 2008 Dean * Copyright (C) 2008-2009 wj32 * @@ -340,15 +341,15 @@ namespace ProcessHacker if (Properties.Settings.Default.AppUpdateStable) { - this.UpdateStableRadioBtn.Checked = true; + optUpdateStable.Checked = true; } - else if (Properties.Settings.Default.AppUpdateBeta ) + else if (Properties.Settings.Default.AppUpdateBeta) { - this.UpdateBetaRadioBtn.Checked = true; + optUpdateBeta.Checked = true; } - else if (Properties.Settings.Default.AppUpdateAlpha ) + else if (Properties.Settings.Default.AppUpdateAlpha) { - this.UpdateAlphaRadioBtn.Checked = true; + optUpdateAlpha.Checked = true; } } @@ -400,19 +401,19 @@ namespace ProcessHacker Properties.Settings.Default.DbgHelpSearchPath = textSearchPath.Text; Properties.Settings.Default.DbgHelpUndecorate = checkUndecorate.Checked; - if (this.UpdateStableRadioBtn.Checked) + if (optUpdateStable.Checked) { Properties.Settings.Default.AppUpdateStable = true; Properties.Settings.Default.AppUpdateBeta = false; Properties.Settings.Default.AppUpdateAlpha = false; } - else if (this.UpdateBetaRadioBtn.Checked) + else if (optUpdateBeta.Checked) { Properties.Settings.Default.AppUpdateStable = false; Properties.Settings.Default.AppUpdateBeta = true; Properties.Settings.Default.AppUpdateAlpha = false; } - else if (this.UpdateAlphaRadioBtn.Checked) + else if (optUpdateAlpha.Checked) { Properties.Settings.Default.AppUpdateStable = false; Properties.Settings.Default.AppUpdateBeta = false; diff --git a/trunk/ProcessHacker/ProcessHacker.csproj b/trunk/ProcessHacker/ProcessHacker.csproj index 2171267b6..264269453 100644 --- a/trunk/ProcessHacker/ProcessHacker.csproj +++ b/trunk/ProcessHacker/ProcessHacker.csproj @@ -410,7 +410,6 @@ Component - UserControl @@ -478,6 +477,7 @@ SessionInformationWindow.cs + diff --git a/trunk/ProcessHacker/Program/Updater.cs b/trunk/ProcessHacker/Program/Updater.cs new file mode 100644 index 000000000..816fad6bd --- /dev/null +++ b/trunk/ProcessHacker/Program/Updater.cs @@ -0,0 +1,167 @@ +using System; +using System.Windows.Forms; +using System.Xml; +using ProcessHacker.Common; +using ProcessHacker.Components; +using ProcessHacker.Native; + +namespace ProcessHacker +{ + public static class Updater + { + public static void Update() + { + XmlDocument xDoc = new XmlDocument(); + + try + { + xDoc.Load("http://processhacker.sourceforge.net/AppUpdate.xml"); + } + catch (Exception ex) + { + Logging.Log(ex); + return; + } + + XmlNodeList items = xDoc.SelectNodes("//update"); + string appUpdateMessage = null; + string appUpdateUrl = null; + string appUpdateVersion = null; + + foreach (XmlNode xn in items) + { + if ( + DateTime.Parse(xn["released"].InnerText) > GetAssemblyBuildDate() && + new Version(xn["version"].InnerText) > new Version(Application.ProductVersion) && + xn["type"].InnerText == "release" + ) + { + Program.HackerWindow.QueueMessage("Found New Release Version: " + xn["version"].InnerText + + " - Current Version: " + Application.ProductVersion.ToString()); + + appUpdateVersion = xn["version"].InnerText; + appUpdateMessage = xn["description"].InnerText; + appUpdateUrl = xn["updateurl"].InnerText; + } + else if (Properties.Settings.Default.AppUpdateBeta) + { + if ( + DateTime.Parse(xn["released"].InnerText) > GetAssemblyBuildDate() && + new Version(xn["version"].InnerText) > new Version(Application.ProductVersion) && + xn["type"].InnerText == "release" || xn["type"].InnerText == "beta" + ) + { + Program.HackerWindow.QueueMessage("Found New Beta Version: " + xn["version"].InnerText + + " - Current Version: " + Application.ProductVersion.ToString()); + + appUpdateVersion = xn["version"].InnerText; + appUpdateMessage = xn["description"].InnerText; + appUpdateUrl = xn["updateurl"].InnerText; + } + } + else if (Properties.Settings.Default.AppUpdateAlpha) + { + if ( + DateTime.Parse(xn["released"].InnerText) > GetAssemblyBuildDate() && + new Version(xn["version"].InnerText) > new Version(Application.ProductVersion) && + xn["type"].InnerText == "release" || xn["type"].InnerText == "beta" || xn["type"].InnerText == "alpha" + ) + { + Program.HackerWindow.QueueMessage("Found New Alpha Version: " + xn["version"].InnerText + " - Current Version: " + Application.ProductVersion.ToString()); + + appUpdateVersion = xn["version"].InnerText; + appUpdateMessage = xn["description"].InnerText; + appUpdateUrl = xn["updateurl"].InnerText; + } + } + } + + if (appUpdateVersion != null && appUpdateMessage != null) + { + DialogResult dialogResult; + + if (OSVersion.HasTaskDialogs) + { + TaskDialog td = new TaskDialog(); + + td.PositionRelativeToWindow = true; + td.Content = "Your Version: " + Application.ProductVersion + Environment.NewLine + + "Server Version: " + appUpdateVersion + Environment.NewLine + Environment.NewLine + + appUpdateMessage; + td.MainInstruction = "Process Hacker Update Available"; + td.WindowTitle = "Update Available"; + td.MainIcon = TaskDialogIcon.SecurityWarning; + td.Buttons = new TaskDialogButton[] + { + new TaskDialogButton((int)DialogResult.Yes, "Download"), + new TaskDialogButton((int)DialogResult.No, "Cancel"), + }; + + dialogResult = (DialogResult)td.Show(Form.ActiveForm); + } + else + { + dialogResult = MessageBox.Show( + Form.ActiveForm, + "Your Version: " + Application.ProductVersion + Environment.NewLine + + "Server Version: " + appUpdateVersion + Environment.NewLine + Environment.NewLine + + appUpdateMessage + Environment.NewLine + Environment.NewLine + + "Do you want to download the update now?", + "Update Available", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation + ); + } + + if (dialogResult == DialogResult.Yes) + Program.TryStart(appUpdateUrl); + } + else + { + if (OSVersion.HasTaskDialogs) + { + TaskDialog td = new TaskDialog(); + td.PositionRelativeToWindow = true; + td.Content = "Your Version: " + Application.ProductVersion + Environment.NewLine + Environment.NewLine + + "Server Version: " + appUpdateVersion; + td.MainInstruction = "Process Hacker is up-to-date"; + td.WindowTitle = "No Updates Available"; + td.MainIcon = TaskDialogIcon.SecuritySuccess; + td.CommonButtons = TaskDialogCommonButtons.Ok; + td.Show(Form.ActiveForm); + } + else + { + MessageBox.Show(Form.ActiveForm, "Process Hacker is up-to-date", + "No Updates Available", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + } + + private static DateTime GetAssemblyBuildDate() + { + const int PeHeaderOffset = 60; + const int LinkerTimestampOffset = 8; + + byte[] b = new byte[2048]; + System.IO.Stream s = default(System.IO.Stream); + try + { + s = new System.IO.FileStream(System.Reflection.Assembly.GetExecutingAssembly().Location, System.IO.FileMode.Open, System.IO.FileAccess.Read); + s.Read(b, 0, 2048); + } + finally + { + if ((s != null)) + s.Close(); + } + + int i = BitConverter.ToInt32(b, PeHeaderOffset); + + int SecondsSince1970 = BitConverter.ToInt32(b, i + LinkerTimestampOffset); + DateTime dt = new DateTime(1970, 1, 1, 0, 0, 0); + dt = dt.AddSeconds(SecondsSince1970); + dt = dt.AddHours(TimeZone.CurrentTimeZone.GetUtcOffset(dt).Hours); + return dt; + + } + } +} diff --git a/trunk/README.txt b/trunk/README.txt index 6f6ee241e..8b4e01a01 100644 --- a/trunk/README.txt +++ b/trunk/README.txt @@ -32,6 +32,7 @@ Hacker > Help). Process Hacker is brought to you by the Process Hacker team: * wj32 (Project Manager) + * dmex (Developer) * XhmikosR (Installer Developer, Tester) Inactive: * Dean (Developer) diff --git a/trunk/XmlUpdateEditor/AssemblyInfo.cs b/trunk/XmlUpdateEditor/AssemblyInfo.cs index 4be78f06a..ca89a8cf7 100644 --- a/trunk/XmlUpdateEditor/AssemblyInfo.cs +++ b/trunk/XmlUpdateEditor/AssemblyInfo.cs @@ -7,13 +7,13 @@ using System.Runtime.InteropServices; // set of attributes. Change these attribute values to modify the information // associated with an assembly. // -[assembly: AssemblyTitle("XMLUpdateEditor")] -[assembly: AssemblyDescription("XMLUpdateEditor")] +[assembly: AssemblyTitle("XML Update Editor")] +[assembly: AssemblyDescription("XML Update Editor")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("ProcessHacker")] -[assembly: AssemblyProduct("XMLUpdateEditor")] -[assembly: AssemblyCopyright("dmex ProcessHacker")] -[assembly: AssemblyTrademark("ProcessHacker")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Process Hacker")] +[assembly: AssemblyCopyright("Licensed under the GNU GPL, v3.")] +[assembly: AssemblyTrademark("Process Hacker")] [assembly: AssemblyCulture("")] // diff --git a/trunk/XmlUpdateEditor/Form1.cs b/trunk/XmlUpdateEditor/EditorWindow.cs similarity index 97% rename from trunk/XmlUpdateEditor/Form1.cs rename to trunk/XmlUpdateEditor/EditorWindow.cs index f8dafbe4f..058b30be7 100644 --- a/trunk/XmlUpdateEditor/Form1.cs +++ b/trunk/XmlUpdateEditor/EditorWindow.cs @@ -1,601 +1,601 @@ -/* - * Process Hacker - - * XML Editor for editing ProcessHacker UpdateSystem description files - * - * Copyright (C) 2009 dmex - * - * This file is part of Process Hacker. - * - * Process Hacker is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Process Hacker is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Process Hacker. If not, see . - */ - -using System; -using System.Drawing; -using System.Collections; -using System.ComponentModel; -using System.Windows.Forms; -using System.Data; -using System.Xml; -using System.Xml.XPath; -using System.IO; -using System.Diagnostics; -using System.Text.RegularExpressions; -using System.Collections.Generic; - -namespace XPath -{ - /// - /// Summary description for Form1. - /// - public class Form1 : System.Windows.Forms.Form - { - #region Windows Form Designer generated code - - private System.Windows.Forms.Button refreshItemsBtn; - private System.Windows.Forms.Label label1; - private Label label4; - private TextBox hashtxtBox; - private ComboBox titlecomboBox; - private Button removeItemBtn; - private Button insertItemBtn; - private Button updateItemBtn; - private Label timelbl; - private TextBox versiontxtbox; - private TextBox msgtxtbox; - private Label label3; - private Label label5; - private Button openXML_FileBtn; - private DateTimePicker dateTimePicker1; - private Label label2; - private TextBox updateURLtxtBox; - private TextBox textBox1; - private RadioButton radioIsbeta; - private RadioButton radioIsAlpha; - private RadioButton radioIsRelease; - private Label label6; - - /// - /// - /// - public Form1() - { - InitializeComponent(); - } - - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.refreshItemsBtn = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.hashtxtBox = new System.Windows.Forms.TextBox(); - this.titlecomboBox = new System.Windows.Forms.ComboBox(); - this.removeItemBtn = new System.Windows.Forms.Button(); - this.insertItemBtn = new System.Windows.Forms.Button(); - this.updateItemBtn = new System.Windows.Forms.Button(); - this.timelbl = new System.Windows.Forms.Label(); - this.versiontxtbox = new System.Windows.Forms.TextBox(); - this.msgtxtbox = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.openXML_FileBtn = new System.Windows.Forms.Button(); - this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker(); - this.label2 = new System.Windows.Forms.Label(); - this.updateURLtxtBox = new System.Windows.Forms.TextBox(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.radioIsbeta = new System.Windows.Forms.RadioButton(); - this.radioIsAlpha = new System.Windows.Forms.RadioButton(); - this.radioIsRelease = new System.Windows.Forms.RadioButton(); - this.SuspendLayout(); - // - // refreshItemsBtn - // - this.refreshItemsBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.refreshItemsBtn.Location = new System.Drawing.Point(244, 430); - this.refreshItemsBtn.Name = "refreshItemsBtn"; - this.refreshItemsBtn.Size = new System.Drawing.Size(72, 24); - this.refreshItemsBtn.TabIndex = 12; - this.refreshItemsBtn.Text = "Refresh"; - this.refreshItemsBtn.Click += new System.EventHandler(this.refreshItemsBtn_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(13, 14); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(45, 13); - this.label1.TabIndex = 20; - this.label1.Text = "Source:"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(12, 123); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(36, 13); - this.label4.TabIndex = 26; - this.label4.Text = "Hash:"; - // - // hashtxtBox - // - this.hashtxtBox.Location = new System.Drawing.Point(67, 120); - this.hashtxtBox.Name = "hashtxtBox"; - this.hashtxtBox.Size = new System.Drawing.Size(249, 22); - this.hashtxtBox.TabIndex = 4; - // - // titlecomboBox - // - this.titlecomboBox.Location = new System.Drawing.Point(67, 42); - this.titlecomboBox.Name = "titlecomboBox"; - this.titlecomboBox.Size = new System.Drawing.Size(249, 21); - this.titlecomboBox.TabIndex = 1; - this.titlecomboBox.SelectedIndexChanged += new System.EventHandler(this.titlecomboBox_SelectedIndexChanged); - // - // removeItemBtn - // - this.removeItemBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.removeItemBtn.Location = new System.Drawing.Point(168, 430); - this.removeItemBtn.Name = "removeItemBtn"; - this.removeItemBtn.Size = new System.Drawing.Size(72, 24); - this.removeItemBtn.TabIndex = 11; - this.removeItemBtn.Text = "Remove"; - this.removeItemBtn.Click += new System.EventHandler(this.removeItemBtn_Click); - // - // insertItemBtn - // - this.insertItemBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.insertItemBtn.Location = new System.Drawing.Point(90, 430); - this.insertItemBtn.Name = "insertItemBtn"; - this.insertItemBtn.Size = new System.Drawing.Size(72, 24); - this.insertItemBtn.TabIndex = 10; - this.insertItemBtn.Text = "Insert"; - this.insertItemBtn.Click += new System.EventHandler(this.insertItemBtn_Click); - // - // updateItemBtn - // - this.updateItemBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.updateItemBtn.Location = new System.Drawing.Point(12, 430); - this.updateItemBtn.Name = "updateItemBtn"; - this.updateItemBtn.Size = new System.Drawing.Size(72, 24); - this.updateItemBtn.TabIndex = 9; - this.updateItemBtn.Text = "Update"; - this.updateItemBtn.Click += new System.EventHandler(this.updateItemBtn_Click); - // - // timelbl - // - this.timelbl.AutoSize = true; - this.timelbl.Location = new System.Drawing.Point(12, 72); - this.timelbl.Name = "timelbl"; - this.timelbl.Size = new System.Drawing.Size(49, 13); - this.timelbl.TabIndex = 40; - this.timelbl.Text = "Version:"; - // - // versiontxtbox - // - this.versiontxtbox.Location = new System.Drawing.Point(67, 69); - this.versiontxtbox.Name = "versiontxtbox"; - this.versiontxtbox.Size = new System.Drawing.Size(249, 22); - this.versiontxtbox.TabIndex = 2; - // - // msgtxtbox - // - this.msgtxtbox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.msgtxtbox.Location = new System.Drawing.Point(12, 190); - this.msgtxtbox.Multiline = true; - this.msgtxtbox.Name = "msgtxtbox"; - this.msgtxtbox.Size = new System.Drawing.Size(301, 211); - this.msgtxtbox.TabIndex = 6; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 98); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(34, 13); - this.label3.TabIndex = 35; - this.label3.Text = "Date:"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(13, 174); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(96, 13); - this.label5.TabIndex = 38; - this.label5.Text = "Update Message:"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(13, 45); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(31, 13); - this.label6.TabIndex = 39; - this.label6.Text = "Title:"; - // - // openXML_FileBtn - // - this.openXML_FileBtn.Location = new System.Drawing.Point(244, 12); - this.openXML_FileBtn.Name = "openXML_FileBtn"; - this.openXML_FileBtn.Size = new System.Drawing.Size(72, 24); - this.openXML_FileBtn.TabIndex = 0; - this.openXML_FileBtn.Text = "Open XML"; - this.openXML_FileBtn.Click += new System.EventHandler(this.openXML_FileBtn_Click); - // - // dateTimePicker1 - // - this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom; - this.dateTimePicker1.Location = new System.Drawing.Point(67, 95); - this.dateTimePicker1.Name = "dateTimePicker1"; - this.dateTimePicker1.Size = new System.Drawing.Size(249, 22); - this.dateTimePicker1.TabIndex = 3; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(13, 151); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(30, 13); - this.label2.TabIndex = 32; - this.label2.Text = "URL:"; - // - // updateURLtxtBox - // - this.updateURLtxtBox.Location = new System.Drawing.Point(67, 148); - this.updateURLtxtBox.Name = "updateURLtxtBox"; - this.updateURLtxtBox.Size = new System.Drawing.Size(249, 22); - this.updateURLtxtBox.TabIndex = 5; - // - // textBox1 - // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox1.Location = new System.Drawing.Point(322, 11); - this.textBox1.Multiline = true; - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(450, 439); - this.textBox1.TabIndex = 13; - // - // radioIsbeta - // - this.radioIsbeta.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.radioIsbeta.AutoSize = true; - this.radioIsbeta.Location = new System.Drawing.Point(90, 407); - this.radioIsbeta.Name = "radioIsbeta"; - this.radioIsbeta.Size = new System.Drawing.Size(56, 17); - this.radioIsbeta.TabIndex = 7; - this.radioIsbeta.Text = "IsBeta"; - this.radioIsbeta.UseVisualStyleBackColor = true; - // - // radioIsAlpha - // - this.radioIsAlpha.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.radioIsAlpha.AutoSize = true; - this.radioIsAlpha.Location = new System.Drawing.Point(152, 407); - this.radioIsAlpha.Name = "radioIsAlpha"; - this.radioIsAlpha.Size = new System.Drawing.Size(63, 17); - this.radioIsAlpha.TabIndex = 8; - this.radioIsAlpha.Text = "IsAlpha"; - this.radioIsAlpha.UseVisualStyleBackColor = true; - // - // radioIsRelease - // - this.radioIsRelease.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.radioIsRelease.AutoSize = true; - this.radioIsRelease.Checked = true; - this.radioIsRelease.Location = new System.Drawing.Point(12, 407); - this.radioIsRelease.Name = "radioIsRelease"; - this.radioIsRelease.Size = new System.Drawing.Size(72, 17); - this.radioIsRelease.TabIndex = 41; - this.radioIsRelease.TabStop = true; - this.radioIsRelease.Text = "IsRelease"; - this.radioIsRelease.UseVisualStyleBackColor = true; - // - // Form1 - // - this.AutoScaleBaseSize = new System.Drawing.Size(5, 15); - this.ClientSize = new System.Drawing.Size(784, 462); - this.Controls.Add(this.radioIsRelease); - this.Controls.Add(this.radioIsAlpha); - this.Controls.Add(this.radioIsbeta); - this.Controls.Add(this.textBox1); - this.Controls.Add(this.label2); - this.Controls.Add(this.updateURLtxtBox); - this.Controls.Add(this.dateTimePicker1); - this.Controls.Add(this.openXML_FileBtn); - this.Controls.Add(this.label4); - this.Controls.Add(this.hashtxtBox); - this.Controls.Add(this.titlecomboBox); - this.Controls.Add(this.removeItemBtn); - this.Controls.Add(this.insertItemBtn); - this.Controls.Add(this.updateItemBtn); - this.Controls.Add(this.timelbl); - this.Controls.Add(this.versiontxtbox); - this.Controls.Add(this.msgtxtbox); - this.Controls.Add(this.label3); - this.Controls.Add(this.label5); - this.Controls.Add(this.label6); - this.Controls.Add(this.label1); - this.Controls.Add(this.refreshItemsBtn); - this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Name = "Form1"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "XML Update Editor"; - this.Load += new System.EventHandler(this.Form1_Load); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - String _xmlfile; - XPathDocument _doc; - XPathNavigator _nav; - XPathExpression _expr; - XPathNodeIterator _iterator; - - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.Run(new Form1()); - } - - private void Form1_Load(object sender, EventArgs e) - { - this.dateTimePicker1.CustomFormat = "dd/MM/yyyy hh:mm tt"; - - //// Add the keywords to the list - //SyntaxRichTextBox1.Settings.Keywords.Add("xml"); - //SyntaxRichTextBox1.Settings.Keywords.Add("schema"); - //SyntaxRichTextBox1.Settings.Keywords.Add("simpleType"); - //SyntaxRichTextBox1.Settings.Keywords.Add("restriction"); - //SyntaxRichTextBox1.Settings.Keywords.Add("complexType"); - //SyntaxRichTextBox1.Settings.Keywords.Add("element"); - //SyntaxRichTextBox1.Settings.Keywords.Add("encoding"); - //SyntaxRichTextBox1.Settings.Keywords.Add("version"); - //SyntaxRichTextBox1.Settings.Keywords.Add("xmlns"); - //SyntaxRichTextBox1.Settings.Keywords.Add("xs"); - //SyntaxRichTextBox1.Settings.Keywords.Add("xmlns"); - //SyntaxRichTextBox1.Settings.Keywords.Add("xsd"); - //SyntaxRichTextBox1.Settings.Keywords.Add("name"); - //SyntaxRichTextBox1.Settings.Keywords.Add("base"); - //SyntaxRichTextBox1.Settings.Keywords.Add("type"); - //SyntaxRichTextBox1.Settings.Keywords.Add("value"); - //// Set the comment identifier - //SyntaxRichTextBox1.Settings.Comment = " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/trunk/XmlUpdateEditor/XMLUpdateEditor.csproj b/trunk/XmlUpdateEditor/XMLUpdateEditor.csproj index e11a7c5ff..f2c87c46d 100644 --- a/trunk/XmlUpdateEditor/XMLUpdateEditor.csproj +++ b/trunk/XmlUpdateEditor/XMLUpdateEditor.csproj @@ -24,7 +24,7 @@ 0.0 - v3.5 + v2.0 publish\ true @@ -41,6 +41,8 @@ false false true + + bin\Debug\ @@ -86,9 +88,6 @@ System - - 3.5 - System.Data @@ -106,14 +105,14 @@ Code - + Form Component - - Form1.cs + + EditorWindow.cs @@ -128,6 +127,9 @@ true + + + diff --git a/trunk/XmlUpdateEditor/XMLUpdateEditor.csproj.user b/trunk/XmlUpdateEditor/XMLUpdateEditor.csproj.user deleted file mode 100644 index 625bd6635..000000000 --- a/trunk/XmlUpdateEditor/XMLUpdateEditor.csproj.user +++ /dev/null @@ -1,52 +0,0 @@ - - - - 7.10.3077 - Debug - AnyCPU - - - - 0 - ProjectFiles - 0 - publish\ - - - - - - en-US - false - - - false - false - false - false - false - - Project - - - - - - false - - - false - false - false - false - false - - Project - - - - - - false - - \ No newline at end of file diff --git a/trunk/XmlUpdateEditor/XMLUpdateEditor.suo b/trunk/XmlUpdateEditor/XMLUpdateEditor.suo deleted file mode 100644 index 280bb6566..000000000 Binary files a/trunk/XmlUpdateEditor/XMLUpdateEditor.suo and /dev/null differ