規則制定・修正: ドメイン毎の出力先フォルダ分離規則の制定およびRyuugamesの対応
- プロジェクト固有規則ファイル AGENTS.md を作成し、ドメイン毎のサブフォルダ作成・出力規則を明文化 - ryuugames.cs の出力先およびキャッシュ読込先を ryuugames.com サブディレクトリに変更 - C:\feeds\ryuugames.com\ 配下への正常出力を確認
This commit is contained in:
1 parent
e4aa86589c
commit
9b5953fbca
2 files changed
+59
-6
No files matched your search
@@ -44,6 +44,15 @@ internal class ryuugames
|
||||
|
||||
#endregion
|
||||
|
||||
#region □定数(Private)
|
||||
|
||||
/// <summary>
|
||||
/// 出力先ドメインサブフォルダ名
|
||||
/// </summary>
|
||||
private const string DomainDir = "ryuugames.com";
|
||||
|
||||
#endregion
|
||||
|
||||
#region □クラス(Private)
|
||||
|
||||
/// <summary>
|
||||
@@ -183,7 +192,7 @@ internal class ryuugames
|
||||
try
|
||||
{
|
||||
// 既存フィードからキャッシュ情報を読み込み(未更新記事の不要な未読化防止および高速化)
|
||||
var existingEntries = LoadExistingEntries(feedFileNameAll);
|
||||
var existingEntries = LoadExistingEntries(feedFileNameAll, DomainDir);
|
||||
|
||||
// 1. 記事リンクの収集(公式フィード 2ページ分 + 日本語カテゴリ一覧 2ページ分)
|
||||
var articleLinks = await CollectArticleLinksAsync(client);
|
||||
@@ -295,9 +304,9 @@ internal class ryuugames
|
||||
feedTrans.Items = transItems;
|
||||
|
||||
// 3つのフィードを出力(画像は直リンク、filter24Hours は未読維持のため false)
|
||||
await CmnUtil.ExportXMLFileAsync(feedFileNameAll, feedAll, client, embedBase64: false, filter24Hours: false);
|
||||
await CmnUtil.ExportXMLFileAsync(feedFileNameJp, feedJp, client, embedBase64: false, filter24Hours: false);
|
||||
await CmnUtil.ExportXMLFileAsync(feedFileNameTrans, feedTrans, client, embedBase64: false, filter24Hours: false);
|
||||
await CmnUtil.ExportXMLFileAsync(feedFileNameAll, feedAll, client, addDir: DomainDir, embedBase64: false, filter24Hours: false);
|
||||
await CmnUtil.ExportXMLFileAsync(feedFileNameJp, feedJp, client, addDir: DomainDir, embedBase64: false, filter24Hours: false);
|
||||
await CmnUtil.ExportXMLFileAsync(feedFileNameTrans, feedTrans, client, addDir: DomainDir, embedBase64: false, filter24Hours: false);
|
||||
|
||||
LogManager.AddLog($"[情報] 【ryuugames】 出力完了 - 全件: {allItems.Count}件, 日本語版: {jpItems.Count}件, 翻訳版: {transItems.Count}件");
|
||||
}
|
||||
@@ -712,15 +721,23 @@ internal class ryuugames
|
||||
|
||||
/// <summary>
|
||||
/// 既存の XML ファイルから過去のエントリ情報を読み込み、URLおよびGUIDをキーとする辞書を返します。
|
||||
/// ドメインサブフォルダ(addDir)および旧ルート直下の両方を探索して互換性を維持します。
|
||||
/// </summary>
|
||||
/// <param name="fileName">XML ファイル名</param>
|
||||
/// <param name="addDir">出力先ドメインサブディレクトリ名</param>
|
||||
/// <returns>既存エントリの辞書</returns>
|
||||
private static Dictionary<string, ExistingFeedEntry> LoadExistingEntries(string fileName)
|
||||
private static Dictionary<string, ExistingFeedEntry> LoadExistingEntries(string fileName, string addDir = "")
|
||||
{
|
||||
var existingEntries = new Dictionary<string, ExistingFeedEntry>(StringComparer.OrdinalIgnoreCase);
|
||||
try
|
||||
{
|
||||
string xmlPath = CmnUtil.GetExportXmlPath(fileName);
|
||||
// まずドメインサブフォルダ内のXMLを探索し、存在しなければルート直下をフォールバック探索
|
||||
string xmlPath = CmnUtil.GetExportXmlPath(fileName, addDir);
|
||||
if (!File.Exists(xmlPath) && !string.IsNullOrEmpty(addDir))
|
||||
{
|
||||
xmlPath = CmnUtil.GetExportXmlPath(fileName);
|
||||
}
|
||||
|
||||
if (!File.Exists(xmlPath))
|
||||
{
|
||||
return existingEntries;
|
||||
|
||||
Reference in new issue
Block a user