示例#1
0
 /// <summary>
 /// Execute loading and processing the file
 /// </summary>
 /// <param name="fileName">The name of the file to load</param>
 protected override void LoadFile(string fileName)
 {
     // --- Read the .disann file
     _contents = File.ReadAllText(fileName);
     if (DisassemblyAnnotation.DeserializeBankAnnotations(_contents, out var anns))
     {
         _annotations = anns;
     }
     else
     {
         _annotations = new Dictionary <int, DisassemblyAnnotation>();
         if (DisassemblyAnnotation.Deserialize(_contents, out var single))
         {
             _annotations.Add(0, single);
         }
     }
 }
        /// <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);
            }
        }