// -------------------------------------------------------------------- // 過去の統計を更新 // -------------------------------------------------------------------- private void UpdatePast() { Debug.WriteLine("UpdatePast()"); using YukariStatisticsContext yukariStatisticsContext = new(); IQueryable <TYukariStatistics> targetYukariStatistics = yukariStatisticsContext.YukariStatistics.Where(x => (UpdatePastYukariStatisticsKind == UpdatePastYukariStatisticsKind.All || !x.AttributesDone) && !x.Invalid); foreach (TYukariStatistics oneStatistics in targetYukariStatistics) { #if DEBUGz if (oneStatistics.RequestMoviePath == @"D:\TempD\TestNkl\TST9_楽曲情報編集\テストタイアップ1_テスト楽曲101_ファイル歌手1,初音ミク.mp4") { } #endif if (!File.Exists(oneStatistics.RequestMoviePath)) { continue; } String requestMovieFolder = Path.GetDirectoryName(oneStatistics.RequestMoviePath) ?? String.Empty; if (YlCommon.FindSettingsFolder(requestMovieFolder) == null) { continue; } Debug.WriteLine("UpdatePast() 設定:" + oneStatistics.RequestMoviePath); // TFound 下準備 FileInfo fileInfo = new(oneStatistics.RequestMoviePath); TFound found = new() { Path = oneStatistics.RequestMoviePath, Folder = requestMovieFolder, ParentFolder = requestMovieFolder, LastWriteTime = JulianDay.DateTimeToModifiedJulianDate(fileInfo.LastWriteTime), FileSize = fileInfo.Length, }; // フォルダー設定を読み込む FolderSettingsInDisk folderSettingsInDisk = YlCommon.LoadFolderSettings(found.Folder); FolderSettingsInMemory folderSettingsInMemory = YlCommon.CreateFolderSettingsInMemory(folderSettingsInDisk); using ListContextInMemory listContextInMemory = new(); using TFoundSetter foundSetter = new(listContextInMemory); // TFound 設定 foundSetter.SetTFoundValues(found, folderSettingsInMemory); // 統計設定 DbCommon.CopyFoundToYukariStatisticsIfAttributesPrepared(found, oneStatistics); } yukariStatisticsContext.SaveChanges(); UpdatePastYukariStatisticsKind = UpdatePastYukariStatisticsKind.None; }