11using NeeLaboratory . ComponentModel ;
22using System . Collections . Generic ;
3+ using System . Diagnostics ;
4+ using System . Linq ;
35
46namespace NeeView
57{
@@ -9,7 +11,7 @@ public class SelectableArchiverList : BindableBase
911 public static SelectableArchiverList Current { get ; }
1012
1113
12- private List < ArchiverIdentifier > _archivers = new ( ) ;
14+ private List < SelectableArchiverItem > _archivers = new ( ) ;
1315 private bool _isDirty = true ;
1416
1517
@@ -20,7 +22,7 @@ public SelectableArchiverList()
2022 }
2123
2224
23- public List < ArchiverIdentifier > Archivers
25+ public List < SelectableArchiverItem > Archivers
2426 {
2527 get { return _archivers ; }
2628 set
@@ -38,7 +40,7 @@ public bool IsEnabled
3840 }
3941
4042
41- public List < ArchiverIdentifier > GetLatestArchivers ( )
43+ public List < SelectableArchiverItem > GetLatestArchivers ( )
4244 {
4345 Update ( ) ;
4446 return Archivers ;
@@ -47,17 +49,22 @@ public List<ArchiverIdentifier> GetLatestArchivers()
4749 public void Update ( )
4850 {
4951 if ( ! _isDirty ) return ;
50- _isDirty = true ;
52+ _isDirty = false ;
5153
52- var address = BookHub . Current . Address ;
53- if ( address is not null )
54+ var book = BookOperation . Current . Book ;
55+ if ( book is not null )
5456 {
55- Archivers = ArchiveManager . Current . GetSupportedArchiverList ( address ) ;
57+ var bookArchiveIdentifider = book . Source . ArchiverIdentifier ;
58+ Archivers = ArchiveManager . Current . GetSupportedArchiverList ( book . Path )
59+ . Select ( e => new SelectableArchiverItem ( e , e == bookArchiveIdentifider ) )
60+ . ToList ( ) ;
5661 }
5762 else
5863 {
5964 Archivers = new ( ) ;
6065 }
6166 }
6267 }
68+
69+ public record SelectableArchiverItem ( ArchiverIdentifier ArchiverIdentifier , bool IsChecked ) ;
6370}
0 commit comments