如何使用IronZIP与ChatGPT Codex

Curtis Chau
Curtis Chau
更新: 2026年10月26日

合作伙伴以他们自己的系统生成的任何格式发送他们的夜间文件。 一个上传包含有密码和无密码的ZIP文件、来自Linux主机的TAR和TGZ包、一个BZIP2股票包、一个名为.tar实际上是ZIP的文件,以及一个上传中途停止的文件。 输入必须解压每个文件,证明每个文件如合作伙伴发送时一样,并说明哪个上传失败以及为何失败。

ChatGPT Codex,OpenAI的编码代理,在终端、编辑器、ChatGPT桌面应用程序内部和作为云服务中运行,并且每一个都接受ChatGPT登录。 IronZIP是Iron Software的.NET库,用于读取和写入ZIP、TAR、GZIP和BZIP2存档。

本指南为Codex提供了25个上传的滴漏,一个显示每个状态的清单,以及来自每个合作伙伴的SHA-256列表。 大多数提示要求Codex提供一个每个文件都有一行的CSV,以下所描述的每个IronZIP行为都是在版本2026.10.2上测量的。

快速入门
NuGet使用NuGet安装

PM > Install-Package IronZip

通过在 NuGet 包管理器控制台中运行上述命令安装 IronZIP,或在 NuGet 包管理器中搜索该包。

从包含滴漏的.NET控制台项目中启动Codex,首先请求一个列表。

$ironzip Add IronZIP 2026.10.2 from NuGet to this console project.
Next, Program.cs opens every file in Drop/sample/ with IronZipArchive, read-only.

out/quickstart.csv gets one row per file, holding these values:

- entry count
- encrypted entry count
- the exception type when IronZIP refuses the file

Read that CSV back and print its totals.
Assign the key from IRONZIP_LICENSE_KEY and never print it.
Extract nothing yet.
Build and run it with three repair attempts at most, then report what happened.
Text


什么是ChatGPT Codex,它如何适用于.NET存档工作?

Codex CLI页面涵盖了用npm install -g @openai/codex或独立安装程序的安装,而IDE页面涵盖编辑器。

OpenAI的安全指南要求您像对待任何其他拉取请求一样对待Codex建议,进行有针对性的验证和差异审查。 一个虚构成员导致构建失败,而处理错误的存档显示为与清单矛盾的状态。

如何编写IronZIP提示并为其设置Codex?

输入提示命名输入、格式规则、输出文件夹、校验和证明、密码来源和只读文件夹。 任何遗漏的部分都会成为代理为您做出的选择。

Codex在工作目录及其每个父文件夹到存储库根目录中扫描.agents/skills。 IronZIP的skill.md,保存为.agents/skills/IronZIP/SKILL.md,使$ironzip得以解析。 其示例固定在2026.8.2,它既未提及TAR文件夹故障,也没有提到下文所测的单一条目密码故障。

Codex在每次运行开始时读取AGENTS.md,路径从项目根到工作文件夹的每个文件夹最多只有一个文件。 更接近工作文件夹的文件覆盖更早的文件。 IronZIP的llms.txt索引是第二个API来源。

Give the repository root an AGENTS.md holding a Partner drop intake section.
The section holds these rules:

- IronZIP is the only archive library allowed.
- Its package is IronZIP, and its namespaces are IronZip and IronZip.Enum.
- The API sources are the ironzip skill in .agents/skills/ironzip/ and the llms.txt index.
- The index URL reads https://ironsoftware.com/zip/csharp/llms.txt.
- Nothing under Drop/ or config/ may change.
- Passwords from config/passwords.csv never appear in code, output or logs.
- IRONZIP_LICENSE_KEY is checked for presence and length only.
- A reply gives a count only when a results file backs it.
- That file was read or written in the same turn.
Text

如何要求Codex添加IronZIP并检查包?

Show me these:

- the IronZIP PackageReference in DropIntake.csproj
- the version restore resolved
- every IronSoftware package that dotnet list package --include-transitive reports

If that command can't read the package reference, find out why within three attempts.
Make the smallest change that lets it run, and say what you changed.
Keep the same package and version.
Write the packages that command lists to out/packages.csv.
Text

NuGet将包列为IronZIP,代码导入IronZip命名空间。 使用.NET SDK 10.0.400,dotnet add package IronZip,IronZIP的技能给出的命令,将参考写为IronZIP,而还原记录为IronZip,随后dotnet list package停止,显示无法读取包引用。 将包添加为IronZIP使两个拼写相同。 它的唯一依赖,IronSoftware.Common 2026.4.2,在.NET 9上又添加了23个包到还原中。

IronZIP没有无密钥的简化模式。 在探测中,打开、列出或提取存档的每个调用都抛出了一个其消息为Production License Required的LicensingException。 定义了IRONZIP_LICENSE_KEY后,License.IsLicensed保持为false,直到代码将值赋给License.LicenseKey。

Add a public Startup class with a public ApplyIronZipKey method, called first in Program.cs.
It assigns IRONZIP_LICENSE_KEY to IronZip.License.LicenseKey.
It reports only whether License.IsLicensed is true.

Then add a --list-sample mode that makes one listing pass over Drop/sample/.
Run it twice as a child process:

1. Run it unchanged.
2. Run it with IRONZIP_LICENSE_KEY removed from that child's environment alone, never the session's.

Write out/license-check.csv with columns run, file, IronZIP call, exception type and message.
IronZIP's licensing exception is internal, so catch Exception and log GetType().FullName.
Tell me which calls threw.
Text

许可证密钥页面记录了appsettings.json、App.config和Web.config中的IronZip.LicenseKey设置。

如何在提取前判断存档到底是什么?

IronZipArchive只读取ZIP文件。 给定TAR、GZIP、BZIP2或文本文件,它抛出ZipException,表示找不到中央目录,打开一个0字节文件给出EOF in header。 前导字节标识格式。 OpenAI文档化了内置资源管理代理,用于重读为主的代码库探索。

Have the explorer agent go through Drop/inbox/ and note these values for every file:

- the byte count
- the opening eight bytes as hex
- the five bytes at offset 257, skipped for files shorter than 262 bytes
- the format those bytes indicate under Drop/README.md

Save what it reports as out/inventory-explorer.csv.
Then write a small script that computes the same fields into out/inventory.csv.
For GZIP and BZIP2 data, IronZIP decompresses a temporary copy saved under out/tmp/.
That copy gets a .gz or .bz2 name, and the script tests it for a TAR header.
The script labels each file ZIP, TAR, GZIP, TAR.GZ, BZIP2, TAR.BZ2, EMPTY or NONE.

Then list the rows where the two files differ.
Also list every file whose extension disagrees with its content.
Text

应该标记五个上传。 一个是名为.tar的ZIP,一个是名为.zip的TGZ,一个是文本文件,一个是带有存档扩展名的随机字节的文件,还有一个是空的。

如何列出每个存档中的内容?

Create Services/EntryLister.cs.
It lists every inbox archive the inventory calls ZIP or TAR, without extracting.
It reads them this way:

- For ZIP, open an IronZipArchive and call its Entries() method.
- When an open without a password fails, open again with the password from config/passwords.csv.
- For TAR, open an IronTarArchive and call GetArchiveEntryNames().

Give out/entries.csv the columns archive, entry, size, stored CRC, encrypted, or the exception type.
Also write out/entry-counts.csv.
It compares the file entries of each archive with the files column of Drop/manifest.csv.
Tell me which archives the comparison flags.
Text

GetArchiveEntryNames只给出TAR的名称,而Entries则返回每个项目名称、大小、存储CRC和IsCrypted标志的Entry。 GZIP和BZIP2没有列出调用。 文件夹条目算作条目,kestrel-pod存档为250个文件列出了252个条目。

在没有密码的情况下打开加密ZIP抛出ArgumentNullException,传递密码给没有密码的ZIP也是如此。 在具有多个条目的AES存档上,构造函数接受了错误的密码,Entries列出了所有文件,因此一个清单无法区分正确密码和错误密码。

如何提取每个存档并证明文件完好无损地到达?

OpenAI将内置工作代理描述为以执行为中心,用于实现和修复。 提取受保护ZIP示例展示了静态提取调用的密码重载。

Have the worker agent write Services/IntakeExtractor.cs.
It applies Drop/README.md to every inbox file in this order:

1. Choose the IronZIP class from the format in out/inventory.csv.
2. Extract into out/extracted/<file name>/.
3. Hash each extracted file against Drop/checksums/.
4. Set the README status and reason.

Add an --intake mode that writes out/intake-results.csv.
Its columns are file, format, IronZIP call, status and reason.
After those come files expected, files matching and exception type.
The mode prints the status counts read from that file.
Tell me those counts.
Text

IronZIP需要进行哈希检查,因为提取不会将条目与其存储CRC进行比较。 在ivy-orders中,存储条目中的一个字节被翻转后没有异常地出来,而该条目的Crc值与写入磁盘的文件CRC不同。

对ZIP、TAR或文本文件的GZIP提取抛出并仍然在存档名下写了一个空文件,而错误密码留下一个空文件夹,因此自述文件要求清理。第二次提取到同一文件夹时,无警告地覆盖了文件。

为什么带有子文件夹的TAR无法提取?

IronTarArchive.ExtractArchiveToDirectory不会创建文件夹。 在每个带有子文件夹条目的TAR上,它抛出DirectoryNotFoundException并未写入任何内容,无论TAR是否带有文件夹条目。 从GetArchiveEntryNames创建每个文件夹首先让同一个调用成功。

为什么同一个GZIP文件在另一个名字下提取不同?

Rerun --intake.
Find each row of out/intake-results.csv whose status or reason disagrees with Drop/manifest.csv.
Add <Compile Remove="scratch/**" /> to DropIntake.csproj.
Make a scratch console project under scratch/format-probe/.
From it, call the same IronZIP method on a copy of each such file, and record what it wrote.

Save the findings to out/format-check.csv, then fix the extractor.
Stop after three fix rounds or when every row agrees.
Tell me which rows still disagree.
Text

IronGZipArchive根据文件名决定。 在以.tgz或.tar.gz结尾的名称下,ExtractArchiveToDirectory和ExtractTGZArchiveToDirectory都解压了内部的TAR。在任何其他名称下,两者都写了一个以最后一个扩展名减去存档名后的解压文件,因此名为.zip的TGZ作为一个TAR文件出现。IronBZip2Archive仅从.tar.bz2名称解压TAR,而不是从.tbz2。提取GZIP示例在其第一个代码示例中调用ExtractArchiveToDirectory,在第二个示例中调用TGZ。

IronZIP对无法使用的密码做什么?

Check the protected ZIP files in out/intake-results.csv against these rules:

- A file with no listed password is Protected with reason no-password.
- A file whose listed password fails is Protected with reason wrong-password.

Name the IronZIP call that first rejected the wrong password.
Base that on out/entries.csv together with out/intake-results.csv.
Then write out/password-scan.csv, listing every file under out/.
Each row says yes or no for whether that file holds any password from config/passwords.csv.
Read the passwords inside the program at run time, and never pass one on a command line.
Report the match count from that file.
Text

提取是第一个拒绝错误密码的调用,抛出ArgumentException,其消息为Invalid password!!

为什么正确的密码被拒绝?

Codex接受在命令行中以-i(长格式--image)传递的图像,codex exec resume包括在内,或者粘贴到创作器中。

The image attached to this turn with -i is a Delta Freight support ticket.
It concerns delta-rates-2026-10-09.zip.
Read it, and reproduce the error with the project's own code.
Decide which of these is true:

- The password in config/passwords.csv is wrong.
- IronZIP refuses it for another reason.

Write out/delta-check.csv with these columns:

- IronZIP call
- which file the password came from
- outcome
- exception type

Change code only where that evidence calls for it.
Tell me which of the two it is.
Text

列出的密码是正确的。 用它打开该存档的每种方式,从路径、字节或流的构造函数到FromArchive,都抛出System.Exception,错误信息为Invalid Password!,而使用相同密码的ExtractArchiveToDirectory写出了与哈希匹配的比率卡。 存档包含一个条目。

如何端到端调试不正确的输入输出?

The nightly log calls 16 archives ok.
Yet Feedback/warehouse-2026-10-11.md lists five of them that reached the warehouse wrong.
Send the explorer agent through Jobs/NightlyIntake.cs and Logs/nightly-2026-10-11/.
The explorer edits nothing.

Work out how each of those five got past the job's success check.
Name the lines responsible.
Suggest the narrowest change and a command that would confirm it.
Save the diagnosis as out/nightly-diagnosis.md, and tell me what it found.
Edit no code in this turn.
Text

一个可靠的诊断找到了两个原因。 作业在每个上传上分阶段使用一个保留最后一个扩展名的散列名称,因此IronZIP从未见过.tar.gz或.tar.bz2。它将每个未压缩TAR写为一个文件,并将每个单文件上传命名为哈希。 没有任何东西将提取的文件与校验和或CRC进行比较,因此损坏的常春藤条目通过为ok。

如何将一次性代码转化为可重用的、经过测试的组件?

Have the worker agent fold the intake modes into a public IntakeJob class, set up like this:

- It's resolved through Microsoft.Extensions.DependencyInjection, version 9.0.20, which it adds.
- A public IntakeOptions record holds its inbox, output root, passwords file and checksums folder.
- IntakeJob.cs stays under 200 lines, with XML doc comments.

Keep these behaviors:

- the byte-based format choice
- the folder creation before TAR extraction
- the name-based staging for GZIP and BZIP2
- the hash check
- the password rules
- the cleanup

Run it over Drop/inbox/, writing out/final/ and out/final.csv.
Confirm every row matches Drop/manifest.csv on status and reason.
Stop after three fix rounds, and tell me how many rows match.
Text

删除文件夹创建或哈希检查的重构仍然构建,因此提示以对清单的完整重启结束。

Add an xUnit project at tests/DropIntake.Tests with these packages:

- xunit 2.9.3
- xunit.runner.visualstudio 3.1.5
- Microsoft.NET.Test.Sdk 18.0.1

Add <Compile Remove="tests/**" /> to DropIntake.csproj.
Put both projects in one DropIntake.sln at the repository root.
Call Startup.ApplyIronZipKey before the first IronZIP call.

Test IntakeJob on real inbox files, with a separate output folder per test, for these cases:

- fern-logs-2026-10-09.tar yields its four logs in their folders.
- juniper-routes-2026-10-09.zip is read as TAR.GZ.
- ivy-orders-2026-10-09.zip is Unreadable with reason damaged.
- elm-claims-2026-10-09.zip is Protected with reason wrong-password.
- delta-rates-2026-10-09.zip is Extracted.

Run dotnet test into out/tests/ with a trx logger.
Report the passed and failed counts, quoted from the .trx file.
Text

对状态和提取的文件哈希进行断言,而不是对存档字节。

$ironzip Open IronZip.xml in the ironzip folder of the NuGet package cache and answer two questions:

- Which method extracts an archive, class by class?
- Which archive classes can list their entries without extracting?

Confirm each answer by compiling a probe under scratch/, which DropIntake.csproj must not compile.
Name any member of that IronZip.xml that does not compile, or say that none failed.
Then show the line in IntakeJob that picks the extraction call for each format.
Text

在2026.10.2中,目标参考列出的五个静态调用,ExtractArchiveToDirectory关于每个存档类加上ExtractTGZArchiveToDirectory。

如何在另一个存档滴漏中重复使用这些提示?

相同的提示在路径、状态规则和校验和列表更改后,可用于另一个传入滴漏。 AI编码助手指南运行从空文件夹开始的验收测试。

在实际运行中这些提示生成了什么?

所有14个提示按顺序在一个通过codex exec的无监督Codex CLI会话中运行。 下面所有的数据显示来自我们自己的检查,包括一个Release构建,0错误和0警告,以及一个独立于IronZIP的Python重新散列。

  • 第一个提取器报告了16个提取、3个受保护和6个不可读,其25行中的23行与清单匹配。
  • 在票务提示后,25行中的24行匹配。
  • 最后一个作业报告了18个提取、2个受保护和5个不可读,所有25行在状态和原因上匹配。
  • 重新散列将18个提取上传中的所有314个文件与合作伙伴列表匹配。
  • 其他七个上传在磁盘上没有剩余任何东西。
  • 一份代码副本上的最终作业重复用时3.9秒并写出了相同的字节。
  • 所有5个测试使用密钥通过,而在不使用密钥的重运行中所有5个都失败。
  • 快速入门列出了8个示例文件中的2个,18个条目中没有加密,并为剩下的记录了一个ArgumentNullException和五个ZipExceptions。
  • 库存恰好标记了上面提到的五个上传。
  • 资源管理代理的副本与脚本的在25行中有10行不同,九行为格式措辞,一行为八个打开字节中的七个。
  • 所有16个ZIP和TAR上传写了310个条目行,并且13个与清单的文件计数匹配。
  • 没有密码的受保护ZIP、单条目ZIP和截断上传无法列出。
  • 从子进程中移除密钥,8个调用中8个抛出许可异常。
  • 密码扫描读取了344个输出文件,并且没有一个匹配。
  • 夜间诊断命名了两个原因,并没有更改代码。
  • 夜间作业的重放记录了相同的16个ok和9个失败,其中16个失败中的五个没有通过合作伙伴校验和。
  • 有些步骤与页面中的运行不一样。 Codex手动将包引用写为IronZIP,所以dotnet list package立刻生效。 第一个提取器已经创建了TAR文件夹并在.tgz名称下分阶段存储了GZIP TAR,因此不一致的行是delta-rates和grove-stock。 格式提示在三轮中都没有修复,因为它的探测给IronTarArchive传递了一个IronBZip2Archive已经解压的CSV。 票务提示修复了delta-rates,重构修复了grove-stock。 重构提示是要求保持基于名称的BZIP2阶段,而.tar.bz2名称使其不再必要。 最终结果文件为作为行的IronTarArchive调用命名,但该代码不再调用。 IntakeJob.cs有32行,因为工作流移动到了一份382行的第二个部分文件中。 四个代理运行为生成的线程,无代理类型,所以没有记录内置资源管理或工作角色。

Google Antigravity指南在下载服务中也发现了相同的单条目密码故障,并通过提取和SHA-256而不是检查存档。 在GitHub Copilot指南中,IronZIP的TAR编写器存储了每个日志到其裸文件名下,因此同名日志发生冲突。 Codex版本、模型和时间点在共享的运行记录中。


故障排除


有问题吗?

如果您有任何问题,请联系support@ironsoftware.com

Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。

阅读更多

准备开始了吗?

NuGet 下载量 25,383版本:2026.11刚刚发布