示例#1
0
        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()));
            }
        }
示例#2
0
        public static ILSpyTreeNode Create(string key, object data)
        {
            ILSpyTreeNode result = null;

            foreach (var factory in App.ExportProvider.GetExportedValues <IResourceNodeFactory>())
            {
                result = factory.CreateNode(key, data);
                if (result != null)
                {
                    return(result);
                }
            }
            var streamData = data as Stream;

            if (streamData != null)
            {
                result = new ResourceEntryNode(key, data as Stream);
            }

            return(result);
        }