/// <summary>Converts the path to a resource into bitmap image which can be used as the 'Source' of an Image.</summary> /// <param name="resourcePath"> /// The path to the resource from the root of the project or the root of the ClientBin (depending on 'location').<BR/> /// </param> /// <param name="location">Flag indicating whether the image is packaged in the XAP on the client, or is in the ClientBin on the server.</param> /// <returns></returns> public static BitmapImage ToImageSource(this string resourcePath, ImageLocation location) { switch (location) { case ImageLocation.Client: return resourcePath.ToImageSource(Assembly.GetCallingAssembly()); case ImageLocation.Server: return new BitmapImage { UriSource = new Uri(resourcePath, UriKind.Relative) }; default: throw new ArgumentOutOfRangeException(location.ToString()); } }
public XCoff64Loader(IServiceProvider services, ImageLocation imageUri, byte[] rawImage) : base(services, imageUri, rawImage) { this.PreferredBaseAddress = Address.Ptr64(0x0010_0000); }
public T64Loader(IServiceProvider services, ImageLocation imageUri, byte[] bytes) : base(services, imageUri, bytes) { }
public XbeLoader(IServiceProvider services, ImageLocation imageUri, byte[] rawImage) : base(services, imageUri, rawImage) { rdr = new LeImageReader(rawImage); ctx = null !; }
public WasmLoader(IServiceProvider services, ImageLocation imageLocation, byte[] imgRaw) : base(services, imageLocation, imgRaw) { PreferredBaseAddress = Address.Ptr32(0); }
public ProgramImageLoader(IServiceProvider services, ImageLocation imageLocation, byte[] imgRaw) : base(services, imageLocation, imgRaw) { }
private void Decompile(Dictionary <string, object> pArgs) { pArgs.TryGetValue("--loader", out object imgLoader); var addrLoad = ParseAddress(pArgs, "--base"); try { var fileName = (string)pArgs["filename"]; var filePath = Path.GetFullPath(fileName); var imageLocation = ImageLocation.FromUri(filePath); var loadedImage = ldr.Load(imageLocation, (string)imgLoader, addrLoad); Project project; switch (loadedImage) { case Program loadedProgram: project = Project.FromSingleProgram(loadedProgram); break; case Project loadedProject: project = loadedProject; break; default: this.listener.Error("Cannot decompile {0}.", fileName); return; } var decompiler = new Decompiler(project, services); dcSvc.Decompiler = decompiler; var program = decompiler.Project.Programs[0]; program.User.ExtractResources = ShouldExtractResources(program, pArgs); if (pArgs.TryGetValue("heuristics", out var oHeur)) { decompiler.Project.Programs[0].User.Heuristics = ((string[])oHeur).ToSortedSet(); } if (pArgs.TryGetValue("metadata", out var oMetadata)) { decompiler.Project.MetadataFiles.Add(new MetadataFile { Location = ImageLocation.FromUri((string)oMetadata) }); } if (pArgs.ContainsKey("dasm-address")) { decompiler.Project.Programs[0].User.ShowAddressesInDisassembly = true; } if (pArgs.ContainsKey("dasm-bytes")) { decompiler.Project.Programs[0].User.ShowBytesInDisassembly = true; } if (pArgs.TryGetValue("aggressive-branch-removal", out object oAggressiveBranchRemoval)) { decompiler.Project.Programs[0].User.AggressiveBranchRemoval = oAggressiveBranchRemoval is bool flag && flag; } if (pArgs.TryGetValue("debug-types", out var oProcRange)) { decompiler.Project.Programs[0].DebugProcedureRange = ((int, int))oProcRange; } if (pArgs.TryGetValue("debug-trace-proc", out object oTraceProcs)) { decompiler.Project.Programs[0].User.DebugTraceProcedures = (HashSet <string>)oTraceProcs; } decompiler.ExtractResources(); decompiler.ScanPrograms(); if (!pArgs.ContainsKey("scan-only")) { decompiler.AnalyzeDataFlow(); decompiler.ReconstructTypes(); decompiler.StructureProgram(); decompiler.WriteDecompilerProducts(); } } catch (Exception ex) { listener.Error(ex, "An error occurred during decompilation."); } }
public FakeArchiveLoader(IServiceProvider services, ImageLocation uri, byte[] bytes) : base(services, uri, bytes) { }
public Blob(ImageLocation location, byte[] image) { this.Image = image; this.Location = location; }
public static SimpleButton InitWithImage(this SimpleButton button, ApplicationIcon applicationIcon, IconSize iconSize, string text = null, ImageLocation imageLocation = ImageLocation.MiddleLeft, string toolTip = null) { button.Image = applicationIcon.ToImage(iconSize); button.ImageLocation = imageLocation; if (text != null) { button.Text = text; } if (toolTip != null) { button.ToolTip = toolTip; } return(button); }
public static SimpleButton InitWithImage(this SimpleButton button, ApplicationIcon applicationIcon, string text = null, ImageLocation imageLocation = ImageLocation.MiddleLeft, string toolTip = null) { return(button.InitWithImage(applicationIcon, IconSizes.Size16x16, text: text, imageLocation: imageLocation, toolTip: toolTip)); }
public OmfLoader(IServiceProvider services, ImageLocation imageLocation, byte[] rawImage) : base(services, imageLocation, rawImage) { this.rawImage = rawImage; }
/// <summary> /// Finds the given image file in the given location and returns it as a <see cref="BitmapImage"/>. /// </summary> /// <param name="imageLocation">Where is the image.</param> /// <param name="imageName">Image name without file extension.</param> /// <returns>Return with a <see cref="BitmapImage"/></returns> public BitmapImage GetBitmapImageByName(ImageLocation imageLocation, string imageName) { string imagePath = GetAbsoluteImagePath(_imageLocationMap[imageLocation], imageName); return(new BitmapImage(new Uri(@$ "pack://application:,,,/{imagePath}", UriKind.Absolute))); }
public SavFileLoader(IServiceProvider services, ImageLocation imageUri, byte[] imgRaw) : base(services, imageUri, imgRaw) { this.PreferredBaseAddress = Address.Ptr16(0); }
public MpwPascalInterfaceLoader(IServiceProvider services, ImageLocation imageUri, byte[] bytes) : base(services, imageUri, bytes) { this.bytes = bytes; }
private void Given_ExeLoader() { this.exeLoader = new ExeImageLoader(null, ImageLocation.FromUri("file:FOO.EXE"), writer.ToArray()); this.exeLoader.ReadCommonExeFields(); }
public TarLoader(IServiceProvider services, ImageLocation location, byte[] imgRaw) : base(services, location, imgRaw) { }
public SnesParser(IServiceProvider services, ImageLocation imageUri, byte[] imgRaw) : base(services, imageUri, imgRaw) { }
public NSO0Loader(IServiceProvider services, ImageLocation imageUri, byte[] rawBytes) : base(services, imageUri, rawBytes) { }
public void SetImageLocation(ImageLocation pImageLocation) { ImageLocation = pImageLocation; }
private void Given_PeLoader() { peldr = new PeImageLoader(sc, ImageLocation.FromUri("file:test.exe"), fileImage, RvaPeHdr); }
public ImageLoader(IServiceProvider services, ImageLocation imageLocation, byte[] imgRaw) { this.Services = services; this.ImageLocation = imageLocation; this.RawImage = imgRaw; }
public HexLoader(IServiceProvider services, ImageLocation imageLocation, byte[] imgRaw) : base(services, imageLocation, imgRaw) { listener = null !; }
public void ImLoc_CreateFromFileUri() { var imloc = ImageLocation.FromUri(@"file:///c:/This is plus+hash#.so"); Assert.AreEqual(@"c:/This is plus+hash#.so", imloc.FilesystemPath); }
public D64Archive(IServiceProvider services, ImageLocation archiveUri, List <ArchiveDirectoryEntry> entries) { this.services = services; this.Location = archiveUri; this.RootEntries = entries; }
private void When_CreateLoader() { ldr = new MachOLoader(sc, ImageLocation.FromUri("file:foo.o"), writer.Bytes); }
public T64Archive(ImageLocation archiveUri, List <ArchiveDirectoryEntry> entries) { this.Location = archiveUri; this.RootEntries = entries; }
public ArLoader(IServiceProvider services, ImageLocation location, byte[] imgRaw) : base(services, location, imgRaw) { symbols = new Dictionary <string, uint>(); }
public ArArchive(ImageLocation archLocation) : base(archLocation, '/', StringComparer.InvariantCulture) { }
public ScriptFile(IServiceProvider services, ImageLocation scriptLocation, byte[] bytes) { this.Location = scriptLocation; }
private string GetCaps(ImageLocation location) { return String.Concat(Enum.GetName(typeof(ImageLocation), location).Where(l => char.IsUpper(l))); }
public LeLoader(IServiceProvider services, ImageLocation imageLocation, byte[] rawImage) : base(services, imageLocation, rawImage) { this.PreferredBaseAddress = Address.Ptr32(0x0010_0000); }