@@ -253,8 +253,6 @@ public static class Builder
253253 /// <param name="includeAllData">True to include all pullable information, false to do bare minimum</param>
254254 public async static Task < bool > FillFromId ( RedumpClient rc , SubmissionInfo info , int id , bool includeAllData )
255255 {
256- // Ensure that required sections exist
257- info = EnsureAllSections ( info ) ;
258256 var discData = await rc . DownloadSingleSiteID ( id ) ;
259257 if ( string . IsNullOrEmpty ( discData ) )
260258 return false ;
@@ -605,35 +603,6 @@ public async static Task<bool> FillFromId(RedumpClient rc, SubmissionInfo info,
605603 return true ;
606604 }
607605
608- /// <summary>
609- /// Ensure all required sections in a submission info exist
610- /// </summary>
611- /// <param name="info">SubmissionInfo object to verify</param>
612- public static SubmissionInfo EnsureAllSections ( SubmissionInfo ? info )
613- {
614- // If there's no info, create one
615- info ??= new SubmissionInfo ( ) ;
616-
617- // Ensure all sections
618- info . CommonDiscInfo ??= new CommonDiscInfoSection ( ) ;
619- info . VersionAndEditions ??= new VersionAndEditionsSection ( ) ;
620- info . EDC ??= new EDCSection ( ) ;
621- info . ParentCloneRelationship ??= new ParentCloneRelationshipSection ( ) ;
622- info . Extras ??= new ExtrasSection ( ) ;
623- info . CopyProtection ??= new CopyProtectionSection ( ) ;
624- info . DumpersAndStatus ??= new DumpersAndStatusSection ( ) ;
625- info . TracksAndWriteOffsets ??= new TracksAndWriteOffsetsSection ( ) ;
626- info . SizeAndChecksums ??= new SizeAndChecksumsSection ( ) ;
627- info . DumpingInfo ??= new DumpingInfoSection ( ) ;
628- info . Artifacts ??= [ ] ;
629-
630- // Ensure special dictionaries
631- info . CommonDiscInfo . CommentsSpecialFields ??= [ ] ;
632- info . CommonDiscInfo . ContentsSpecialFields ??= [ ] ;
633-
634- return info ;
635- }
636-
637606 /// <summary>
638607 /// Inject information from a seed SubmissionInfo into the existing one
639608 /// </summary>
@@ -645,62 +614,52 @@ public static SubmissionInfo EnsureAllSections(SubmissionInfo? info)
645614 if ( seed == null )
646615 return info ;
647616
648- // Ensure that required sections exist
649- info = EnsureAllSections ( info ) ;
650-
651617 // Otherwise, inject information as necessary
652- if ( info . CommonDiscInfo != null && seed . CommonDiscInfo != null )
653- {
654- // Info that only overwrites if supplied
655- if ( ! string . IsNullOrEmpty ( seed . CommonDiscInfo . Title ) ) info . CommonDiscInfo . Title = seed . CommonDiscInfo . Title ;
656- if ( ! string . IsNullOrEmpty ( seed . CommonDiscInfo . ForeignTitleNonLatin ) ) info . CommonDiscInfo . ForeignTitleNonLatin = seed . CommonDiscInfo . ForeignTitleNonLatin ;
657- if ( ! string . IsNullOrEmpty ( seed . CommonDiscInfo . DiscNumberLetter ) ) info . CommonDiscInfo . DiscNumberLetter = seed . CommonDiscInfo . DiscNumberLetter ;
658- if ( ! string . IsNullOrEmpty ( seed . CommonDiscInfo . DiscTitle ) ) info . CommonDiscInfo . DiscTitle = seed . CommonDiscInfo . DiscTitle ;
659- if ( seed . CommonDiscInfo . Category != null ) info . CommonDiscInfo . Category = seed . CommonDiscInfo . Category ;
660- if ( seed . CommonDiscInfo . Region != null ) info . CommonDiscInfo . Region = seed . CommonDiscInfo . Region ;
661- if ( seed . CommonDiscInfo . Languages != null ) info . CommonDiscInfo . Languages = seed . CommonDiscInfo . Languages ;
662- if ( seed . CommonDiscInfo . LanguageSelection != null ) info . CommonDiscInfo . LanguageSelection = seed . CommonDiscInfo . LanguageSelection ;
663- if ( ! string . IsNullOrEmpty ( seed . CommonDiscInfo . Serial ) ) info . CommonDiscInfo . Serial = seed . CommonDiscInfo . Serial ;
664- if ( ! string . IsNullOrEmpty ( seed . CommonDiscInfo . Barcode ) ) info . CommonDiscInfo . Barcode = seed . CommonDiscInfo . Barcode ;
665- if ( ! string . IsNullOrEmpty ( seed . CommonDiscInfo . Comments ) ) info . CommonDiscInfo . Comments = seed . CommonDiscInfo . Comments ;
666- if ( seed . CommonDiscInfo . CommentsSpecialFields != null ) info . CommonDiscInfo . CommentsSpecialFields = seed . CommonDiscInfo . CommentsSpecialFields ;
667- if ( ! string . IsNullOrEmpty ( seed . CommonDiscInfo . Contents ) ) info . CommonDiscInfo . Contents = seed . CommonDiscInfo . Contents ;
668- if ( seed . CommonDiscInfo . ContentsSpecialFields != null ) info . CommonDiscInfo . ContentsSpecialFields = seed . CommonDiscInfo . ContentsSpecialFields ;
669-
670- // Info that always overwrites
671- info . CommonDiscInfo . Layer0MasteringRing = seed . CommonDiscInfo . Layer0MasteringRing ;
672- info . CommonDiscInfo . Layer0MasteringSID = seed . CommonDiscInfo . Layer0MasteringSID ;
673- info . CommonDiscInfo . Layer0ToolstampMasteringCode = seed . CommonDiscInfo . Layer0ToolstampMasteringCode ;
674- info . CommonDiscInfo . Layer0MouldSID = seed . CommonDiscInfo . Layer0MouldSID ;
675- info . CommonDiscInfo . Layer0AdditionalMould = seed . CommonDiscInfo . Layer0AdditionalMould ;
676-
677- info . CommonDiscInfo . Layer1MasteringRing = seed . CommonDiscInfo . Layer1MasteringRing ;
678- info . CommonDiscInfo . Layer1MasteringSID = seed . CommonDiscInfo . Layer1MasteringSID ;
679- info . CommonDiscInfo . Layer1ToolstampMasteringCode = seed . CommonDiscInfo . Layer1ToolstampMasteringCode ;
680- info . CommonDiscInfo . Layer1MouldSID = seed . CommonDiscInfo . Layer1MouldSID ;
681- info . CommonDiscInfo . Layer1AdditionalMould = seed . CommonDiscInfo . Layer1AdditionalMould ;
682-
683- info . CommonDiscInfo . Layer2MasteringRing = seed . CommonDiscInfo . Layer2MasteringRing ;
684- info . CommonDiscInfo . Layer2MasteringSID = seed . CommonDiscInfo . Layer2MasteringSID ;
685- info . CommonDiscInfo . Layer2ToolstampMasteringCode = seed . CommonDiscInfo . Layer2ToolstampMasteringCode ;
686-
687- info . CommonDiscInfo . Layer3MasteringRing = seed . CommonDiscInfo . Layer3MasteringRing ;
688- info . CommonDiscInfo . Layer3MasteringSID = seed . CommonDiscInfo . Layer3MasteringSID ;
689- info . CommonDiscInfo . Layer3ToolstampMasteringCode = seed . CommonDiscInfo . Layer3ToolstampMasteringCode ;
690- }
691-
692- if ( info . VersionAndEditions != null && seed . VersionAndEditions != null )
693- {
694- // Info that only overwrites if supplied
695- if ( ! string . IsNullOrEmpty ( seed . VersionAndEditions . Version ) ) info . VersionAndEditions . Version = seed . VersionAndEditions . Version ;
696- if ( ! string . IsNullOrEmpty ( seed . VersionAndEditions . OtherEditions ) ) info . VersionAndEditions . OtherEditions = seed . VersionAndEditions . OtherEditions ;
697- }
618+ info ??= new SubmissionInfo ( ) ;
698619
699- if ( info . CopyProtection != null && seed . CopyProtection != null )
700- {
701- // Info that only overwrites if supplied
702- if ( ! string . IsNullOrEmpty ( seed . CopyProtection . Protection ) ) info . CopyProtection . Protection = seed . CopyProtection . Protection ;
703- }
620+ // Info that only overwrites if supplied
621+ if ( ! string . IsNullOrEmpty ( seed . CommonDiscInfo . Title ) ) info . CommonDiscInfo . Title = seed . CommonDiscInfo . Title ;
622+ if ( ! string . IsNullOrEmpty ( seed . CommonDiscInfo . ForeignTitleNonLatin ) ) info . CommonDiscInfo . ForeignTitleNonLatin = seed . CommonDiscInfo . ForeignTitleNonLatin ;
623+ if ( ! string . IsNullOrEmpty ( seed . CommonDiscInfo . DiscNumberLetter ) ) info . CommonDiscInfo . DiscNumberLetter = seed . CommonDiscInfo . DiscNumberLetter ;
624+ if ( ! string . IsNullOrEmpty ( seed . CommonDiscInfo . DiscTitle ) ) info . CommonDiscInfo . DiscTitle = seed . CommonDiscInfo . DiscTitle ;
625+ if ( seed . CommonDiscInfo . Category != null ) info . CommonDiscInfo . Category = seed . CommonDiscInfo . Category ;
626+ if ( seed . CommonDiscInfo . Region != null ) info . CommonDiscInfo . Region = seed . CommonDiscInfo . Region ;
627+ if ( seed . CommonDiscInfo . Languages != null ) info . CommonDiscInfo . Languages = seed . CommonDiscInfo . Languages ;
628+ if ( seed . CommonDiscInfo . LanguageSelection != null ) info . CommonDiscInfo . LanguageSelection = seed . CommonDiscInfo . LanguageSelection ;
629+ if ( ! string . IsNullOrEmpty ( seed . CommonDiscInfo . Serial ) ) info . CommonDiscInfo . Serial = seed . CommonDiscInfo . Serial ;
630+ if ( ! string . IsNullOrEmpty ( seed . CommonDiscInfo . Barcode ) ) info . CommonDiscInfo . Barcode = seed . CommonDiscInfo . Barcode ;
631+ if ( ! string . IsNullOrEmpty ( seed . CommonDiscInfo . Comments ) ) info . CommonDiscInfo . Comments = seed . CommonDiscInfo . Comments ;
632+ if ( seed . CommonDiscInfo . CommentsSpecialFields != null ) info . CommonDiscInfo . CommentsSpecialFields = seed . CommonDiscInfo . CommentsSpecialFields ;
633+ if ( ! string . IsNullOrEmpty ( seed . CommonDiscInfo . Contents ) ) info . CommonDiscInfo . Contents = seed . CommonDiscInfo . Contents ;
634+ if ( seed . CommonDiscInfo . ContentsSpecialFields != null ) info . CommonDiscInfo . ContentsSpecialFields = seed . CommonDiscInfo . ContentsSpecialFields ;
635+
636+ // Info that always overwrites
637+ info . CommonDiscInfo . Layer0MasteringRing = seed . CommonDiscInfo . Layer0MasteringRing ;
638+ info . CommonDiscInfo . Layer0MasteringSID = seed . CommonDiscInfo . Layer0MasteringSID ;
639+ info . CommonDiscInfo . Layer0ToolstampMasteringCode = seed . CommonDiscInfo . Layer0ToolstampMasteringCode ;
640+ info . CommonDiscInfo . Layer0MouldSID = seed . CommonDiscInfo . Layer0MouldSID ;
641+ info . CommonDiscInfo . Layer0AdditionalMould = seed . CommonDiscInfo . Layer0AdditionalMould ;
642+
643+ info . CommonDiscInfo . Layer1MasteringRing = seed . CommonDiscInfo . Layer1MasteringRing ;
644+ info . CommonDiscInfo . Layer1MasteringSID = seed . CommonDiscInfo . Layer1MasteringSID ;
645+ info . CommonDiscInfo . Layer1ToolstampMasteringCode = seed . CommonDiscInfo . Layer1ToolstampMasteringCode ;
646+ info . CommonDiscInfo . Layer1MouldSID = seed . CommonDiscInfo . Layer1MouldSID ;
647+ info . CommonDiscInfo . Layer1AdditionalMould = seed . CommonDiscInfo . Layer1AdditionalMould ;
648+
649+ info . CommonDiscInfo . Layer2MasteringRing = seed . CommonDiscInfo . Layer2MasteringRing ;
650+ info . CommonDiscInfo . Layer2MasteringSID = seed . CommonDiscInfo . Layer2MasteringSID ;
651+ info . CommonDiscInfo . Layer2ToolstampMasteringCode = seed . CommonDiscInfo . Layer2ToolstampMasteringCode ;
652+
653+ info . CommonDiscInfo . Layer3MasteringRing = seed . CommonDiscInfo . Layer3MasteringRing ;
654+ info . CommonDiscInfo . Layer3MasteringSID = seed . CommonDiscInfo . Layer3MasteringSID ;
655+ info . CommonDiscInfo . Layer3ToolstampMasteringCode = seed . CommonDiscInfo . Layer3ToolstampMasteringCode ;
656+
657+ // Info that only overwrites if supplied
658+ if ( ! string . IsNullOrEmpty ( seed . VersionAndEditions . Version ) ) info . VersionAndEditions . Version = seed . VersionAndEditions . Version ;
659+ if ( ! string . IsNullOrEmpty ( seed . VersionAndEditions . OtherEditions ) ) info . VersionAndEditions . OtherEditions = seed . VersionAndEditions . OtherEditions ;
660+
661+ // Info that only overwrites if supplied
662+ if ( ! string . IsNullOrEmpty ( seed . CopyProtection . Protection ) ) info . CopyProtection . Protection = seed . CopyProtection . Protection ;
704663
705664 return info ;
706665 }
0 commit comments