private void PostSerialize(string filename, ProjectXmlSerializer.Root xmlRoot, ProjectSerializer serializer) { if (xmlRoot?.Project?.Data?.SnesAddressSpace != null || xmlRoot?.Project?.Session == null) { throw new InvalidDataException( "Internal error with deserialized data, either Project, Data, Session, or SnesAddressSpace failed to load correctly."); } xmlRoot.Project.Session = new ProjectSession(xmlRoot.Project) { ProjectFileName = filename }; // at this stage, 'Data' is populated with everything EXCEPT the actual ROM bytes. // It would be easy to store the ROM bytes in the save file, but, for copyright reasons, // we leave it out. // // So now, with all our metadata loaded successfully, we now open the .smc file on disk // and marry the original rom's bytes with all of our metadata loaded from the project file. var romAddCmd = new AddRomDataCommand(xmlRoot) { GetNextRomFileToTry = RomPromptFn, MigrationRunner = serializer.MigrationRunner, }; romAddCmd.TryReadAttachedProjectRom(); }
public AddRomDataCommand(ProjectXmlSerializer.Root root) { Root = root; if (root.Project == null) { throw new InvalidDataException("Root element should contain a Project element, but none was found."); } }
private void PostSerialize(string filename, ProjectXmlSerializer.Root xmlProjectSerializedRoot, IProjectSerializer serializer) { xmlProjectSerializedRoot.Project.ProjectFileName = filename; xmlProjectSerializedRoot.Project.Session = new ProjectSession(xmlProjectSerializedRoot.Project, filename); // at this stage, 'Data' is populated with everything EXCEPT the actual ROM bytes. // It would be easy to store the ROM bytes in the save file, but, for copyright reasons, // we leave it out. // // So now, with all our metadata loaded successfully, we now open the .smc file on disk // and marry the original rom's bytes with all of our metadata loaded from the project file. var romAddCmd = addRomDataCommandCreate(); Debug.Assert(romAddCmd != null); romAddCmd.Root = xmlProjectSerializedRoot; romAddCmd.GetNextRomFileToTry = RomPromptFn; romAddCmd.MigrationRunner = serializer.MigrationRunner; romAddCmd.TryReadAttachedProjectRom(); }
private static void VerifyIntegrityDeserialized(ProjectXmlSerializer.Root xmlProjectSerializedRoot) { var data = xmlProjectSerializedRoot.Project.Data; Debug.Assert(data.Labels != null && data.Comments != null); Debug.Assert(data.RomBytes is { Count: > 0 });