/// <summary>ブックデータを格納したzipファイルを作成します。</summary> /// <param name="zipSettingId">作成するzipファイル情報の登録済みIDを表す文字列。</param> /// <param name="relayStation">Modelの情報をVMに中継するためのCreatorRelayStation。</param> /// <returns>非同期処理の実行結果を表すTask。</returns> public async Task CreateBookZipAsync(string zipSettingId, CreatorRelayStation relayStation) { this.relay = relayStation; relayStation.AddLog($"************ zipファイル作成開始! ************"); // zip作成対象の情報を取得 var settings = new ZipFileSettingsRepository().GetById(zipSettingId); if (settings == null) { return; } //#if DEBUG // await Task.Run(() => Directory.Delete(settings.ImageFilesExtractedFolder.Value, true)); //#endif // 展開エラーの有無チェック var extractor = new ArchiveFileExtractor(relayStation); if (!await Task.Run(() => extractor.HasExtractError(settings))) { return; } // 展開先ワークフォルダ作成 await this.createWorkFolderAsync(settings); // アーカイブを展開 await extractor.ExtractAsync(settings) .ContinueWith(async t => await this.createDistributesRules(settings)) .ContinueWith(async t => await this.distributesSourceItems(settings)); }
public async Task CreateZipBookAsync(string zipSettingId, CreatorRelayStation relayStation) { // zip作成対象の情報を取得 var settings = new ImageSourceAgent().GetZipFileSettings(zipSettingId); if (settings == null) { return; } // アーカイブファイルを展開 var extractor = new ArchiveFileExtractor(); if (!await extractor.StartExtractAsync(settings, relayStation)) { return; } Debug.WriteLine("StartExtractAsync 呼出し後"); foreach (var imgSrc in settings.ImageSources) { if (imgSrc.IsNotExists) { continue; } await extractor.ExtractImageSourceAsync(imgSrc); } Debug.WriteLine("CheckSourceFiles 呼び出し前"); //// ソースファイルをチェック //new SourceFileCollector().CheckSourceFiles(settings); }
internal async Task <bool> StartExtractAsync(ZipFileSettings zipSettings, CreatorRelayStation creatorRelayStation) { this.settings = zipSettings; this.relayStation = creatorRelayStation; if (!await this.createWorkFolderAsync()) { return(false); } Debug.WriteLine("StartExtractAsync.createWorkFolderAsync 呼出し後"); var watch = Stopwatch.StartNew(); if (await this.hasExtractErrorAsync()) { return(false); } watch.Stop(); Debug.WriteLine($"圧縮ファイル内トータルサイズ取得:{watch.ElapsedMilliseconds}[ms]"); // 圧縮ファイル内トータルサイズ取得(Debug.WriteLineあり):5282[ms] // 圧縮ファイル内トータルサイズ取得(Debug.WriteLineなし):550[ms] return(true); }
/// <summary>コンストラクタ。</summary> public MainWindowViewModel() { this.relayStation = new CreatorRelayStation(); this.LogText = this.relayStation.Log .ToReadOnlyReactivePropertySlim() .AddTo(this.disposable); this.ContentRendered = new AsyncReactiveCommand() .WithSubscribe(() => this.onContentRenderedAsync()) .AddTo(this.disposable); }
public async Task CreateZipBookAsync(string zipSettingId, CreatorRelayStation relay) { this.relayStation = relay; var settings = await new ImageSourceAgent().GetZipFileSettingsAsync(zipSettingId); if (settings == null) { return; } //#if DEBUG // await Task.Run(() => Directory.Delete(settings.ImageFilesExtractedFolder.Value, true)); //#endif if (!await new ArchiveFileExtractorTpl().HasExtractError(settings)) { return; } }
public ArchiveFileExtractor(CreatorRelayStation relayStation) : this() { this.relayStation = relayStation; }