{"record":{"id":"7b76b00f1dada56e","repo":"babalae/better-genshin-impact","slug":"featname","errorCode":null,"errorMessage":"未找到{featName}的素材文件夹","messagePattern":"未找到(.+?)的素材文件夹","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/GameTaskManager.cs","lineNumber":164,"sourceCode":"        return LoadAssetImage(featName, assertName, TaskContext.Instance().SystemInfo, flags);\n    }\n\n    /// <summary>\n    /// 获取素材图片并缩放\n    /// </summary>\n    /// <returns></returns>\n    /// <exception cref=\"FileNotFoundException\"></exception>\n    public static Mat LoadAssetImage(string featName, string assertName, ISystemInfo systemInfo, ImreadModes flags = ImreadModes.Color)\n    {\n        var assetsFolder = Global.Absolute($@\"GameTask\\{featName}\\Assets\\{systemInfo.GameScreenSize.Width}x{systemInfo.GameScreenSize.Height}\");\n        if (!Directory.Exists(assetsFolder))\n        {\n            assetsFolder = Global.Absolute($@\"GameTask\\{featName}\\Assets\\1920x1080\");\n        }\n\n        if (!Directory.Exists(assetsFolder))\n        {\n            throw new FileNotFoundException($\"未找到{featName}的素材文件夹\");\n        }\n\n        var filePath = Path.Combine(assetsFolder, assertName);\n        if (!File.Exists(filePath))\n        {\n            throw new FileNotFoundException($\"未找到{featName}中的{assertName}文件\");\n        }\n\n        var mat = Mat.FromStream(File.OpenRead(filePath), flags);\n        if (systemInfo.GameScreenSize.Width != 1920)\n        {\n            mat = ResizeHelper.Resize(mat, systemInfo.AssetScale);\n        }\n\n        return mat;\n    }\n\n    /// <summary>","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/GameTaskManager.cs#L146-L182","documentation":"Thrown by GameTaskManager.LoadAssetImage when neither a resolution-specific Assets folder (e.g. 2560x1440) nor the fallback 1920x1080 folder exists for the given task feature name. The method first tries a folder matching the actual game screen size, then falls back to 1920x1080. If both are absent, the FileNotFoundException fires, halting asset loading for that task.","triggerScenarios":"Calling LoadAssetImage(featName, ...) where featName maps to a GameTask\\{featName}\\Assets directory that does not exist on disk. This happens when featName is misspelled, the task folder was never shipped, or a clean/partial build omitted the Assets directory.","commonSituations":"Running the app from a non-standard working directory where Global.Absolute resolves to a path without the Assets tree; cloning the repo without pulling large asset files (LFS); renaming or refactoring a task folder name without updating the featName callers.","solutions":["Verify the directory GameTask\\{featName}\\Assets\\1920x1080 exists relative to Global.Absolute — create it or restore it from source control.","Check that featName passed to LoadAssetImage exactly matches the folder name on disk (case-sensitive on some file systems).","If running from a published build, ensure the build/publish step copies the Assets folder into the output directory.","Add a Directory.Exists pre-check before calling LoadAssetImage and log the resolved absolute path for easier diagnosis."],"exampleFix":"// before\nvar assetsFolder = Global.Absolute($@\"GameTask\\{featName}\\Assets\\1920x1080\");\nif (!Directory.Exists(assetsFolder))\n    throw new FileNotFoundException($\"未找到{featName}的素材文件夹\");\n\n// after — log resolved path so the caller can diagnose\nif (!Directory.Exists(assetsFolder))\n    throw new FileNotFoundException(\n        $\"未找到{featName}的素材文件夹，期望路径：{assetsFolder}\", assetsFolder);","handlingStrategy":"validation","validationCode":"// Check before calling LoadAssetImage\nvar fallbackFolder = Global.Absolute($@\"GameTask\\{featName}\\Assets\\1920x1080\");\nif (!Directory.Exists(fallbackFolder))\n{\n    logger.LogError(\"素材文件夹不存在：{Path}\", fallbackFolder);\n    return; // or skip task\n}","typeGuard":null,"tryCatchPattern":"try { var mat = GameTaskManager.LoadAssetImage(featName, name, systemInfo); }\ncatch (FileNotFoundException ex) { logger.LogError(ex, \"素材加载失败：{FeatName}\", featName); /* skip or fallback */ }","preventionTips":["Always include Assets directories in version control or build output.","Use consistent featName constants rather than string literals.","Add a startup check that verifies all required Assets folders exist."],"tags":["file-not-found","assets","game-task","configuration"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}