public ILSpyTreeNode CreateNode(Resource resource) { EmbeddedResource er = resource as EmbeddedResource; if (er != null) return CreateNode(er.Name, er.GetResourceStream()); return null; }
Stream LoadBaml(Resource res, string name) { EmbeddedResource er = res as EmbeddedResource; if (er != null) { Stream s = er.GetResourceStream(); s.Position = 0; ResourceReader reader; try { reader = new ResourceReader(s); } catch (ArgumentException) { return null; } foreach (DictionaryEntry entry in reader.Cast<DictionaryEntry>().OrderBy(e => e.Key.ToString())) { if (entry.Key.ToString() == name) { if (entry.Value is Stream) return (Stream)entry.Value; if (entry.Value is byte[]) return new MemoryStream((byte[])entry.Value); } } } return null; }
internal QueryableResource(Resource resource, QueryableModule module) { _assembly = module.Assembly; _module = module; _name = Utility.ToString(resource.Name); _resourceType = Utility.ConvertEnum<ResourceType>(resource.ResourceType); _isPublic = resource.IsPublic; }
public ILSpyTreeNode CreateNode(Resource resource) { EmbeddedResource er = resource as EmbeddedResource; if (er != null && er.Name.EndsWith(".resources", StringComparison.OrdinalIgnoreCase)) { return new ResourcesFileTreeNode(er); } return null; }
public static ILSpyTreeNode Create(Resource resource) { ILSpyTreeNode result = null; foreach (var factory in App.CompositionContainer.GetExportedValues<IResourceNodeFactory>()) { result = factory.CreateNode(resource); if (result != null) break; } return result ?? new ResourceTreeNode(resource); }
public ILSpyTreeNode CreateNode(Mono.Cecil.Resource resource) { EmbeddedResource er = resource as EmbeddedResource; if (er != null) { return(CreateNode(er.Name, er.GetResourceStream())); } return(null); }
static bool IsMonoTouchResource(Resource resource) { if (!(resource is EmbeddedResource)) return false; var name = resource.Name; if (name.StartsWith ("__monotouch_content_", StringComparison.OrdinalIgnoreCase)) return true; if (name.StartsWith ("__monotouch_page_", StringComparison.OrdinalIgnoreCase)) return true; return false; }
private static void ReplaceResource( ModuleDefinition module, int resIndex, Resource resource, MemoryStream memoryStream, ResourceWriter rw) { module.Resources.RemoveAt(resIndex); rw.Generate(); var array = memoryStream.ToArray(); memoryStream.Position = 0; var newEmbeded = new EmbeddedResource(resource.Name, resource.Attributes, array); module.Resources.Insert(resIndex, newEmbeded); }
public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo) { Mono.Cecil.Resource resource = (Mono.Cecil.Resource)dataObject; nodeInfo.Label = resource.Name; nodeInfo.Icon = Context.GetIcon(Stock.ResourceFileIcon); }
public void Add(Resource resource) { Contract.Requires(resource != null, "resource is null"); do { AssemblyLinkedResource alr = resource as AssemblyLinkedResource; if (alr != null) { m_resources.Add(new AssemblyResourceItem(alr)); break; } EmbeddedResource er = resource as EmbeddedResource; if (er != null) { m_resources.Add(new EmbeddedResourceItem(er)); break; } LinkedResource lr = resource as LinkedResource; if (lr != null) { m_resources.Add(new LinkedResourceItem(lr)); break; } Contract.Assert(false, "bad resource type: " + resource.GetType()); } while (false); }
public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) { Mono.Cecil.Resource resource = (Mono.Cecil.Resource)dataObject; label = resource.Name; icon = Context.GetIcon(Stock.ResourceFileIcon); }
public ResourceEventArgs(Resource item) { m_item = item; }
public void Insert (int index, Resource value) { List.Insert (index, value); }
public bool Contains (Resource value) { return m_items.Contains (value); }
partial void logRenamingResource(Resource resource, string newName);
public ResourceTreeNode(Resource r) { this.LazyLoading = true; this.r = r; }
public void InitResource(Resource r) { BaseAssemblyResolver bar = GlobalAssemblyResolver.Instance as BaseAssemblyResolver; bool savedRaiseResolveException = true; try { if (bar != null) { savedRaiseResolveException = bar.RaiseResolveException; bar.RaiseResolveException = false; } detailsTabPage.SuspendLayout(); dgResource.SuspendLayout(); _dtResource.Rows.Clear(); if (r == null) { return; } _dtResource.BeginLoadData(); ShowResource(r); if (dgResource.DataSource == null) dgResource.DataSource = _dtResource; _dtResource.EndLoadData(); } catch { throw; } finally { if (bar != null) { bar.RaiseResolveException = savedRaiseResolveException; } dgResource.ResumeLayout(); detailsTabPage.ResumeLayout(); } }
private void ShowResource(Resource r) { switch (r.ResourceType) { case ResourceType.Embedded: ShowResource((EmbeddedResource)r); break; case ResourceType.AssemblyLinked: ShowResource((AssemblyLinkedResource)r); break; case ResourceType.Linked: ShowResource((LinkedResource)r); break; default: throw new NotSupportedException("Resource type is not supported: " + r.ResourceType.ToString()); } }
public static Reflector.CodeModel.IResource Cecil2Reflector(Resource r, ModuleDefinition md) { Reflector.CodeModel.IModule m = Cecil2Reflector(md); if (m == null) return null; string erName = r.Name; foreach (Reflector.CodeModel.IResource r2 in m.Assembly.Resources) { if (r2.Name == erName) { return r2; } } return null; }
public RenameInfo(Resource resource, TypeInfo typeInfo, string newResourceName) { this.resource = resource; this.typeInfo = typeInfo; this.newResourceName = newResourceName; }
public int IndexOf (Resource value) { return m_items.IndexOf (value); }
public ResourceTreeNode(Resource r) { if (r == null) throw new ArgumentNullException("r"); this.r = r; }
public ResourceReference(Resource res) { this.res = res; }
public void Remove (Resource value) { if (OnResourceRemoved != null && this.Contains (value)) OnResourceRemoved (this, new ResourceEventArgs (value)); m_items.Remove (value); }
/// <summary> /// Rename a resource /// </summary> /// <param name="resource">Resource definition</param> /// <param name="name">new name</param> private static void RenameResource(Resource resource, string name) { resource.Name = name; }
public void Add (Resource value) { if (OnResourceAdded != null && !this.Contains (value)) OnResourceAdded (this, new ResourceEventArgs (value)); m_items.Add (value); }
public bool Contains (Resource value) { return List.Contains (value); }
public void Insert (int index, Resource value) { if (OnResourceAdded != null && !this.Contains (value)) OnResourceAdded (this, new ResourceEventArgs (value)); m_items.Insert (index, value); }
public static Resource InjectResource(this ModuleDefinition module, Resource resource) { if (!module.Resources.Contains(resource)) module.Resources.Add(resource); return resource; }
public ILSpyTreeNode FindResourceNode(Resource resource) { if (resource == null) return null; foreach (AssemblyTreeNode node in this.Children) { if (node.LoadedAssembly.IsLoaded) { node.EnsureLazyChildren(); foreach (var item in node.Children.OfType<ResourceListTreeNode>()) { var founded = item.Children.OfType<ResourceTreeNode>().Where(x => x.Resource == resource).FirstOrDefault(); if (founded != null) return founded; var foundedResEntry = item.Children.OfType<ResourceEntryNode>().Where(x => resource.Name.Equals(x.Text)).FirstOrDefault(); if (foundedResEntry != null) return foundedResEntry; } } } return null; }
public void Add (Resource value) { List.Add (value); }
private void BuildResource(DynamicModule module, Resource resource) { resource.Accept(new DynamicResourceBuilder(module)); }
public int IndexOf (Resource value) { return List.IndexOf (value); }
public override string GetNodeName(ITreeNavigator thisNode, object dataObject) { Mono.Cecil.Resource resource = (Mono.Cecil.Resource)dataObject; return(resource.Name); }
public void Remove (Resource value) { List.Remove (value); }
public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo) { Mono.Cecil.Resource resource = (Mono.Cecil.Resource)dataObject; nodeInfo.Label = Ide.TypeSystem.Ambience.EscapeText(resource.Name); nodeInfo.Icon = Context.GetIcon(Stock.ResourceFileIcon); }