/// <summary> /// Serializes RAM bank annotations /// </summary> /// <returns></returns> private string SerializeRamBankAnnotations() { var annData = RamBankAnnotations.ToDictionary(k => k.Key, v => v.Value.ToDisassemblyDecorationData()); return(JsonConvert.SerializeObject(annData, Formatting.Indented)); }
/// <summary> /// Updates the RAM annotation file according to changes /// </summary> private void OnAnnotationFileChanged(object sender, EventArgs eventArgs) { var project = SpectNetPackage.Default.ActiveProject; var annFile = project?.DefaultAnnotationItem ?? project?.AnnotationProjectItems?.FirstOrDefault(); RamBankAnnotations.Clear(); if (annFile == null) { return; } RamBankAnnotationFile = annFile.Filename; var disAnn = File.ReadAllText(annFile.Filename); DisassemblyAnnotation.DeserializeBankAnnotations(disAnn, out var annotations); RamBankAnnotations = annotations; }
/// <summary> /// Updates the RAM annotation file according to changes /// </summary> private void OnAnnotationFileChanged(object sender, EventArgs eventArgs) { var project = SpectNetPackage.Default.ActiveProject; var annFile = project?.DefaultAnnotationItem ?? project?.AnnotationProjectItems?.FirstOrDefault(); RamBankAnnotations.Clear(); if (annFile == null) { return; } RamBankAnnotationFile = annFile.Filename; try { var disAnn = File.ReadAllText(annFile.Filename); DisassemblyAnnotation.DeserializeBankAnnotations(disAnn, out var annotations); RamBankAnnotations = annotations; } catch (Exception ex) { VsxDialogs.Show(ex.Message, "Error loading annotation file", MessageBoxButton.OK, VsxMessageBoxIcon.Error); } }