private void ProcessResourceEntry(DictionaryEntry entry) { var keyString = entry.Key.ToString(); if (entry.Value is String) { stringTableEntries.Add(new KeyValuePair <string, string>(keyString, (string)entry.Value)); return; } if (entry.Value is byte[]) { Children.Add(ResourceEntryNode.Create(keyString, new MemoryStream((byte[])entry.Value))); return; } var node = ResourceEntryNode.Create(keyString, entry.Value); if (node != null) { Children.Add(node); return; } string entryType = entry.Value.GetType().FullName; if (entry.Value is System.Globalization.CultureInfo) { otherEntries.Add(new SerializedObjectRepresentation(keyString, entryType, ((System.Globalization.CultureInfo)entry.Value).DisplayName)); } else { otherEntries.Add(new SerializedObjectRepresentation(keyString, entryType, entry.Value.ToString())); } }
private void ProcessResourceEntry(KeyValuePair <string, object> entry) { if (entry.Value is string) { stringTableEntries.Add(new KeyValuePair <string, string>(entry.Key, (string)entry.Value)); return; } if (entry.Value is byte[]) { Children.Add(ResourceEntryNode.Create(entry.Key, new MemoryStream((byte[])entry.Value))); return; } var node = ResourceEntryNode.Create(entry.Key, entry.Value); if (node != null) { Children.Add(node); return; } if (entry.Value == null) { otherEntries.Add(new SerializedObjectRepresentation(entry.Key, "null", "")); } else if (entry.Value is ResourceSerializedObject so) { otherEntries.Add(new SerializedObjectRepresentation(entry.Key, so.TypeName, "<serialized>")); } else { otherEntries.Add(new SerializedObjectRepresentation(entry.Key, entry.Value.GetType().FullName, entry.Value.ToString())); } }
protected override void LoadChildren() { EmbeddedResource er = this.Resource as EmbeddedResource; if (er != null) { Stream s = er.GetResourceStream(); s.Position = 0; ResourceReader reader; try { reader = new ResourceReader(s); } catch (ArgumentException) { return; } foreach (DictionaryEntry entry in reader.Cast <DictionaryEntry>().OrderBy(e => e.Key.ToString())) { if (entry.Value is String) { filteredEntries.Add(new KeyValuePair <string, string>(entry.Key.ToString(), (string)entry.Value)); } else if (entry.Value is byte[]) { Children.Add(ResourceEntryNode.Create(entry.Key.ToString(), new MemoryStream((byte[])entry.Value))); } else { Children.Add(ResourceEntryNode.Create(entry.Key.ToString(), entry.Value)); } } } }
protected override void LoadChildren() { int i = 0; foreach (Image image in this.data.Images) { var node = ResourceEntryNode.Create("Image" + i.ToString(), image); if (node != null) { Children.Add(node); } ++i; } }
protected override void LoadChildren() { int i = 0; foreach (Image image in this.data.Images) { using var s = new MemoryStream(); image.Save(s, System.Drawing.Imaging.ImageFormat.Bmp); var node = ResourceEntryNode.Create("Image" + i.ToString(), s.ToArray()); if (node != null) { Children.Add(node); } ++i; } }
protected override void LoadChildren() { EmbeddedResource er = this.Resource as EmbeddedResource; if (er != null) { Stream s = er.GetResourceStream(); s.Position = 0; ResourceReader reader; try { reader = new ResourceReader(s); } catch (ArgumentException) { return; } foreach (DictionaryEntry entry in reader.Cast <DictionaryEntry>().OrderBy(e => e.Key.ToString())) { if (entry.Value is Stream) { Children.Add(ResourceEntryNode.Create(entry.Key.ToString(), (Stream)entry.Value)); } } } }
public static ILSpyTreeNode Create(Resource resource) { return(ResourceEntryNode.Create(resource)); }