Browse Source

Fix #1261: Sort resources

pull/1305/head
Siegfried Pammer 7 years ago
parent
commit
84fadd2ae4
  1. 1
      ILSpy/TreeNodes/NaturalStringComparer.cs
  2. 2
      ILSpy/TreeNodes/ResourceListTreeNode.cs
  3. 5
      ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs

1
ILSpy/TreeNodes/NaturalStringComparer.cs

@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;

2
ILSpy/TreeNodes/ResourceListTreeNode.cs

@ -51,7 +51,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -51,7 +51,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
protected override void LoadChildren()
{
foreach (Resource r in module.Resources.OrderBy(m => m.Name))
foreach (Resource r in module.Resources.OrderBy(m => m.Name, NaturalStringComparer.Instance))
this.Children.Add(ResourceTreeNode.Create(r));
}

5
ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs

@ -21,6 +21,7 @@ using System.Collections.Generic; @@ -21,6 +21,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using ICSharpCode.Decompiler;
using ICSharpCode.Decompiler.Util;
using ICSharpCode.Decompiler.Metadata;
@ -68,7 +69,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -68,7 +69,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
if (s == null) return;
s.Position = 0;
try {
foreach (var entry in new ResourcesFile(s)) {
foreach (var entry in new ResourcesFile(s).OrderBy(e => e.Key, NaturalStringComparer.Instance)) {
ProcessResourceEntry(entry);
}
} catch (BadImageFormatException) {
@ -78,7 +79,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -78,7 +79,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
private void ProcessResourceEntry(KeyValuePair<string, object> entry)
{
if (entry.Value is String) {
if (entry.Value is string) {
stringTableEntries.Add(new KeyValuePair<string, string>(entry.Key, (string)entry.Value));
return;
}

Loading…
Cancel
Save