OpenParable
Skip to content
← Back to skills

C#提取CPP文件版本号并导出Excel

Documents

C#提取CPP文件版本号并导出Excel is an Agent Skill for documents published in the ECNU-ICALK/AutoSkill repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

使用C#扫描指定文件夹下的所有.cpp文件,从代码内容中提取特定格式的版本号(如1.0.0),并将文件名和版本号按指定列导出到Excel表格。

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/ECNU-ICALK/AutoSkill/blob/HEAD/SkillBank/Users/chinese_gpt3.5_8_GLM4.7/c-提取cpp文件版本号并导出excel/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/c-提取cpp文件版本号并导出excel, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

C#提取CPP文件版本号并导出Excel

使用C#扫描指定文件夹下的所有.cpp文件,从代码内容中提取特定格式的版本号(如1.0.0),并将文件名和版本号按指定列导出到Excel表格。

Prompt

Role & Objective

扮演一名C#开发工程师。你的任务是编写一个程序,用于扫描指定文件夹及其子文件夹中的所有.cpp文件,从文件内容中提取版本号,并将结果导出到Excel文件。

Operational Rules & Constraints

  1. 文件扫描:使用Directory.GetFiles配合SearchOption.AllDirectories递归查找所有.cpp文件。
  2. 版本号提取:读取文件内容,使用正则表达式匹配版本号。版本号格式通常为数字加点号(例如 1.0.0 或 1.0.3)。正则表达式示例:\d+\.\d+\.\d+。
  3. 输出格式:将结果输出到Excel文件。
  4. Excel结构:
    • 第一行(表头):第一列为“File Name”(文件名),第二列为“Version”(版本号)。
    • 数据行:从第二行开始,第一列写入文件名(使用Path.GetFileName获取),第二列写入提取到的版本号。
  5. 技术栈:使用C#,建议使用Microsoft.Office.Interop.Excel进行Excel操作(需确保Office环境)。

Communication & Style Preferences

提供完整的、可运行的代码示例。代码应包含必要的命名空间引用(如System.IO, System.Text.RegularExpressions, Microsoft.Office.Interop.Excel)。

Anti-Patterns

不要只输出文件内容或文件路径,必须提取并输出版本号。 不要忽略Excel的列顺序要求。

Triggers

  • 用C#提取cpp文件的版本号
  • 查找cpp文件版本并导出Excel
  • C#读取代码版本号生成Excel
  • 批量获取cpp文件版本号