public void LoadSettingsFromConfiguration(IServiceProvider services, Platform platform) { platform.Name = this.Name; if (!string.IsNullOrEmpty(MemoryMapFile)) { platform.MemoryMap = MemoryMap_v1.LoadMemoryMapFromFile(services, MemoryMapFile, platform); } platform.Description = this.Description; platform.Heuristics = LoadHeuristics(this.Heuristics); }
/// <summary> /// Creates an empty imagemap based on the absolute memory map. It is /// the caller's responsibility to fill in the MemoryArea properties /// of each resulting ImageSegment. /// </summary> /// <returns></returns> public virtual SegmentMap CreateAbsoluteMemoryMap() { if (this.MemoryMap == null || this.MemoryMap.Segments == null) { return(null); } var diagSvc = Services.RequireService <IDiagnosticsService>(); var segs = MemoryMap.Segments.Select(s => MemoryMap_v1.LoadSegment(s, this, diagSvc)) .Where(s => s != null) .ToSortedList(s => s.Address); return(new SegmentMap( segs.Values.First().Address, segs.Values.ToArray())); }
public IPlatform Load(IServiceProvider services, IProcessorArchitecture arch) { var type = Type.GetType(TypeName); if (type == null) { throw new TypeLoadException( string.Format("Unable to load {0} environment.", Description)); } var platform = (Platform)Activator.CreateInstance(type, services, arch); platform.Name = this.Name; if (!string.IsNullOrEmpty(MemoryMapFile)) { platform.MemoryMap = MemoryMap_v1.LoadMemoryMapFromFile(services, MemoryMapFile, platform); } platform.Description = this.Description; return(platform); }
public void LoadSettingsFromConfiguration(IServiceProvider services, Platform platform) { platform.Name = this.Name !; if (!string.IsNullOrEmpty(MemoryMapFile)) { var cfgSvc = services.RequireService <IConfigurationService>(); var fsSvc = services.RequireService <IFileSystemService>(); var listener = services.RequireService <DecompilerEventListener>(); try { var filePath = cfgSvc.GetInstallationRelativePath(MemoryMapFile !); using var stm = fsSvc.CreateFileStream(filePath, FileMode.Open, FileAccess.Read); platform.MemoryMap = MemoryMap_v1.Deserialize(stm); } catch (Exception ex) { listener.Error(ex, "Unable to open memory map file '{0}.", MemoryMapFile !); } } platform.PlatformProcedures = LoadPlatformProcedures(platform); platform.Description = this.Description !; platform.Heuristics = LoadHeuristics(this.Heuristics); }