From fc63457d8e425b7fa1013af6d4e9c56a89ce15da Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Tue, 16 Sep 2014 02:04:27 -0400 Subject: [PATCH] Fix key collision crash in some searches. Add version to About dialog. --- NBTExplorer.Installer/Product.wxs | 2 +- NBTExplorer/Properties/AssemblyInfo.cs | 4 ++-- NBTExplorer/SearchWorker.cs | 5 +++-- NBTExplorer/Windows/About.Designer.cs | 12 ++++-------- NBTExplorer/Windows/About.cs | 8 ++++++++ NBTExplorer/Windows/About.resx | 10 ++++++++++ NBTModel/Data/TagKey.cs | 2 +- NBTModel/Properties/AssemblyInfo.cs | 4 ++-- 8 files changed, 31 insertions(+), 16 deletions(-) diff --git a/NBTExplorer.Installer/Product.wxs b/NBTExplorer.Installer/Product.wxs index 2822ab6..e906838 100644 --- a/NBTExplorer.Installer/Product.wxs +++ b/NBTExplorer.Installer/Product.wxs @@ -3,7 +3,7 @@ diff --git a/NBTExplorer/Properties/AssemblyInfo.cs b/NBTExplorer/Properties/AssemblyInfo.cs index 6a84a42..9685374 100644 --- a/NBTExplorer/Properties/AssemblyInfo.cs +++ b/NBTExplorer/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.7.4.0")] -[assembly: AssemblyFileVersion("2.7.4.0")] +[assembly: AssemblyVersion("2.7.5.0")] +[assembly: AssemblyFileVersion("2.7.5.0")] diff --git a/NBTExplorer/SearchWorker.cs b/NBTExplorer/SearchWorker.cs index 645fea5..f0e6e71 100644 --- a/NBTExplorer/SearchWorker.cs +++ b/NBTExplorer/SearchWorker.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Diagnostics; +using System.Globalization; using NBTExplorer.Model; namespace NBTExplorer @@ -52,12 +53,12 @@ namespace NBTExplorer if (SearchName != null) { string tagName = node.NodeName; if (tagName != null) - mName = tagName.Contains(SearchName); + mName = CultureInfo.InvariantCulture.CompareInfo.IndexOf(tagName, SearchName, CompareOptions.IgnoreCase) >= 0; } if (SearchValue != null) { string tagValue = node.NodeDisplay; if (tagValue != null) - mValue = tagValue.Contains(SearchValue); + mValue = CultureInfo.InvariantCulture.CompareInfo.IndexOf(tagValue, SearchValue, CompareOptions.IgnoreCase) >= 0; } if (mName && mValue) { diff --git a/NBTExplorer/Windows/About.Designer.cs b/NBTExplorer/Windows/About.Designer.cs index 185521e..5fc66aa 100644 --- a/NBTExplorer/Windows/About.Designer.cs +++ b/NBTExplorer/Windows/About.Designer.cs @@ -35,17 +35,14 @@ // // linkLabel1 // - this.linkLabel1.AutoSize = true; this.linkLabel1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.linkLabel1.LinkArea = new System.Windows.Forms.LinkArea(165, 31); + this.linkLabel1.LinkArea = new System.Windows.Forms.LinkArea(171, 31); this.linkLabel1.Location = new System.Drawing.Point(96, 12); this.linkLabel1.Name = "linkLabel1"; - this.linkLabel1.Size = new System.Drawing.Size(256, 133); + this.linkLabel1.Size = new System.Drawing.Size(272, 133); this.linkLabel1.TabIndex = 0; this.linkLabel1.TabStop = true; - this.linkLabel1.Text = "NBTExplorer\r\nCopyright ©2011-2014 Justin Aquadro\r\n\r\nNBTExplorer is based on NBTEd" + - "it by copyboy\r\nFugue icon set: p.yusukekamiyamane.com\r\n\r\nEmail: jaquadro@gmail.c" + - "om\r\nNBTExplorer Github Project Page"; + this.linkLabel1.Text = resources.GetString("linkLabel1.Text"); this.linkLabel1.UseCompatibleTextRendering = true; this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); // @@ -63,7 +60,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(350, 144); + this.ClientSize = new System.Drawing.Size(380, 144); this.Controls.Add(this.pictureBox1); this.Controls.Add(this.linkLabel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; @@ -73,7 +70,6 @@ this.Text = "About NBTExplorer"; ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); - this.PerformLayout(); } diff --git a/NBTExplorer/Windows/About.cs b/NBTExplorer/Windows/About.cs index 2b9d416..ca99ab8 100644 --- a/NBTExplorer/Windows/About.cs +++ b/NBTExplorer/Windows/About.cs @@ -7,6 +7,14 @@ namespace NBTExplorer.Windows public About () { InitializeComponent(); + + int len = linkLabel1.Text.Length; + System.Version version = typeof(About).Assembly.GetName().Version; + + linkLabel1.Text = linkLabel1.Text.Replace("{ver}", version.Major + "." + version.Minor + "." + version.Build); + + int adj = linkLabel1.Text.Length - len; + linkLabel1.LinkArea = new LinkArea(linkLabel1.LinkArea.Start + adj, linkLabel1.LinkArea.Length); } private void linkLabel1_LinkClicked (object sender, LinkLabelLinkClickedEventArgs e) diff --git a/NBTExplorer/Windows/About.resx b/NBTExplorer/Windows/About.resx index 9caa316..0271be4 100644 --- a/NBTExplorer/Windows/About.resx +++ b/NBTExplorer/Windows/About.resx @@ -117,6 +117,16 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + NBTExplorer {ver} +Copyright ©2011-2014 Justin Aquadro + +NBTExplorer is based on NBTEdit by copyboy +Fugue icon set: p.yusukekamiyamane.com + +Email: jaquadro@gmail.com +NBTExplorer Github Project Page + diff --git a/NBTModel/Data/TagKey.cs b/NBTModel/Data/TagKey.cs index a6f73bb..6d7cc78 100644 --- a/NBTModel/Data/TagKey.cs +++ b/NBTModel/Data/TagKey.cs @@ -22,7 +22,7 @@ namespace NBTExplorer.Model if (typeDiff != 0) return typeDiff; - return String.Compare(x.Name, y.Name, true); + return String.Compare(x.Name, y.Name, false); } #endregion diff --git a/NBTModel/Properties/AssemblyInfo.cs b/NBTModel/Properties/AssemblyInfo.cs index d8b807b..8c803aa 100644 --- a/NBTModel/Properties/AssemblyInfo.cs +++ b/NBTModel/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.2.0")] -[assembly: AssemblyFileVersion("1.0.2.0")] +[assembly: AssemblyVersion("1.0.3.0")] +[assembly: AssemblyFileVersion("1.0.3.0")]