/// <summary> /// Initializes a new instance of the <see cref="T:System.Object" /> class. /// </summary> /// <param name="parent">Parent view model</param> /// <param name="romAnnotationFile">The ROM annotation file</param> /// <param name="projectAnnotationFile">The project annotation file</param> public DisassemblyAnnotationHandler(DisassemblyToolWindowViewModel parent, string romAnnotationFile, string projectAnnotationFile) { Parent = parent; RomAnnotationFile = romAnnotationFile; ProjectAnnotationFile = projectAnnotationFile; SaveRomChangesToRom = true; }
/// <summary> /// Instantiates this object with the specified set of export parameters /// </summary> /// <param name="exportParams">Export parameters collected from the dialog</param> /// <param name="parentViewModel">Disassembly parent view model</param> public DisassemblyExporter(ExportDisassemblyViewModel exportParams, DisassemblyToolWindowViewModel parentViewModel) { ExportParams = exportParams; ParentViewModel = parentViewModel; MaxLineLength = GetMaxLineLength(); InstructionIndent = new string(' ', GetIndentSpacesCount()); InitCommentProperties(); }
/// <summary> /// Initializes a new instance of the this class. /// </summary> /// <param name="parent">Parent view model</param> public DisassemblyAnnotationHandler(DisassemblyToolWindowViewModel parent) { Parent = parent; // --- Read ROM annotations var spectrumVm = Parent.MachineViewModel.SpectrumVm; RomPageAnnotations = new Dictionary <int, DisassemblyAnnotation>(); RomAnnotationFiles = new Dictionary <int, string>(); var romConfig = spectrumVm.RomConfiguration; var roms = romConfig.NumberOfRoms; for (var i = 0; i < roms; i++) { var annFile = spectrumVm.RomProvider.GetAnnotationResourceName(romConfig.RomName, roms == 1 ? -1 : i); var annData = spectrumVm.RomProvider.LoadRomAnnotations(romConfig.RomName, roms == 1 ? -1 : i); DisassemblyAnnotation.Deserialize(annData, out var annotation); RomPageAnnotations.Add(i, annotation); RomAnnotationFiles.Add(i, annFile); } // --- Read the initial RAM annotations RamBankAnnotations = new Dictionary <int, DisassemblyAnnotation>(); SpectNetPackage.Default.CodeManager.AnnotationFileChanged += OnAnnotationFileChanged; OnAnnotationFileChanged(null, EventArgs.Empty); // --- Register Disassembly providers to use if (RomPageAnnotations.TryGetValue(romConfig.Spectrum48RomIndex, out var spectrumRomAnn)) { Z80Disassembler.SetProvider <ISpectrum48RomLabelProvider>( new Spectrum48RomLabelProvider(spectrumRomAnn)); } }