@@ -78,7 +78,7 @@ private async void Operation_Load(object sender, EventArgs e)
7878 foreach ( var component in addedComponents )
7979 {
8080 workingComponent = component ;
81- stream = await downloader . DownloadFileTaskAsync ( component . URL ) ;
81+ if ( component . Size > 0 ) stream = await downloader . DownloadFileTaskAsync ( component . URL ) ;
8282
8383 if ( cancelStatus != 0 ) return ;
8484
@@ -157,25 +157,30 @@ private void OnDownloadFileCompleted(object sender, System.ComponentModel.AsyncC
157157
158158 private void ExtractComponents ( )
159159 {
160+ string rootPath = Path . Combine ( FPM . SourcePath , "Temp" ) ;
161+ string infoPath = Path . Combine ( rootPath , "Components" ) ;
162+ string infoFile = Path . Combine ( infoPath , $ "{ workingComponent . ID } .txt") ;
163+
164+ Directory . CreateDirectory ( infoPath ) ;
165+
166+ using ( TextWriter writer = File . CreateText ( infoFile ) )
167+ {
168+ string [ ] header = new List < string >
169+ { workingComponent . Hash , $ "{ workingComponent . Size } " } . Concat ( workingComponent . Depends ) . ToArray ( ) ;
170+
171+ writer . WriteLine ( string . Join ( " " , header ) ) ;
172+ }
173+
174+ if ( workingComponent . Size == 0 ) return ;
175+
160176 using ( archive = ZipArchive . Open ( stream ) )
161177 {
162178 using ( reader = archive . ExtractAllEntries ( ) )
163179 {
164180 long extractedSize = 0 ;
165181 long totalSize = archive . TotalUncompressSize ;
166182
167- string destPath = Path . Combine ( FPM . SourcePath , "Temp" , workingComponent . Path . Replace ( '/' , '\\ ' ) ) ;
168- string infoPath = Path . Combine ( FPM . SourcePath , "Temp" , "Components" ) ;
169- string infoFile = Path . Combine ( infoPath , $ "{ workingComponent . ID } .txt") ;
170-
171- Directory . CreateDirectory ( infoPath ) ;
172-
173- using ( TextWriter writer = File . CreateText ( infoFile ) )
174- {
175- string [ ] header = new [ ] { workingComponent . Hash , workingComponent . Size . ToString ( ) } . ToArray ( ) ;
176-
177- writer . WriteLine ( string . Join ( " " , header ) ) ;
178- }
183+ string destPath = Path . Combine ( rootPath , workingComponent . Path . Replace ( '/' , '\\ ' ) ) ;
179184
180185 while ( cancelStatus == 0 && reader . MoveToNextEntry ( ) )
181186 {
0 commit comments