如何使用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無法在沒有金鑰的情況下運行。 在一次探測中,每個打開、列出或提取檔案的呼叫引發一個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返回一個Entry,其中包含每個項目的名稱、大小、存儲的CRC和IsCrypted標誌。 GZIP和BZIP2沒有列出呼叫。 文件夾條目計算為條目,kestrel-pod壓縮檔案列出了其中的252個條目佔250個文件。

在沒有密碼的情況下打開加密的ZIP引發ArgumentNullException,對一個沒有密碼的ZIP提供密碼也會如此。 在具有多項目條目的AES壓縮檔案上,構造函數接受一個錯誤的密碼和Entries列出每一個文件,所以列舉不能區分正確的密碼和錯誤的密碼。

如何提取每個壓縮檔案並證明文件完好無損?

OpenAI描述了內建的worker代理,專注於執行,適用於實施和修復。 提取受保護的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不同。

GZIP提取一個ZIP、TAR或文本文件拋出並仍然寫入一個空文件在以檔名命名,而錯誤的密碼留下了一個空文件夾,所以說明文件要求清理。第二次提取到同一文件夾會占據文件而不發出警告。

為何帶子文件夾的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,其消息為無效密碼!!

為何正確的密碼被拒絕?

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,訊息為無效密碼!,而相同的密碼在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比較提取的文件,因此損壞的常青藤條目通過檢查。

如何將一次性代碼轉變為可重用的、經過測試的組件?

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 CLI會話中通過codex exec。 下面的每一個數據都是來自我們自己再次檢查中,包括一個發佈構建帶0錯誤和0警告及獨立於IronZIP的Python哈希重新散列。

  • 第一個提取器報告16個提取的,3個受保護的和6個不可讀的,其25行中的23行與清單相匹配。
  • 在票證提示後,25行中的24行相匹配。
  • 最終工作報告18個提取的,2個受保護的和5個不可讀的,其25行在狀態和原因上相匹配。
  • 重新散列將來自18個提取的上傳中的所有314個文件與合作夥伴列表進行匹配。
  • 剩餘的七個上傳沒有遺留在磁碟上。
  • 在代碼副本上重跑最終作業花費了3.9秒,並寫入了相同的位元組。
  • 所有5個測試在有金鑰的情況下通過,而在不使用金鑰的重跑中全部5個測試均失敗。
  • 快速入門列出8個樣本文件中的2個,帶18個條目且無加密,記錄了其餘的1個ArgumentNullException和5個ZipExceptions。
  • 清單精確標記了上面所述的五個上傳。
  • 探險代理的副本在25行中與腳本的副本在格式字詞中存在10行不同,而其中9行存在7個開頭字節的8個。
  • 列寫到了16個ZIP和TAR上傳的310個條目行,與清單的文件計數匹配的有13個。
  • 無法列出沒有密碼的受保護ZIP、單條目ZIP和截斷的上傳。
  • 在從子過程中刪除金鑰後,8個呼叫中的每一個都引發了許可例外。
  • 密碼掃描讀出了344個輸出文件且無一匹配。
  • 每晚的診斷命名了兩個成因並未改變代碼。
  • 重播每晚作業記錄了相同的16個正常和9個失敗,其中16個中的5個未通過合作夥伴校驗和檢查。
  • 一些步驟與頁面上運行的不同。 Codex將包裹參考手動寫入為IronZIP,因此dotnet列表包立即可用。 第一個提取器已經創建了TAR文件夾,並以.tgz名義安置了GZIP TAR,因此不同意的行為是delta-rates和grove-stock。 格式提示在三輪中都沒有解決,因為其探測通過IronTarArchive給IronBZip2Archive已解壓的CSV。 票證提示修正了delta-rates,重構修正了grove-stock。 重構提示要求保持基於名稱的BZIP2階段,.tar.bz2名不必要。 最終結果文件為該行命名了IronTarArchive呼叫,不再由代碼執行。 IntakeJob.cs達到32行,因為工作流移到第二個部分文件,其有382行。 四個代理以生成執行緒的方式運行,沒有代理類型,因此沒有記錄內建探險或工作者角色。

谷歌Antigravity指南在下載服務中發現了同樣的單條目密碼失敗,並通過提取和SHA-256進行檢查。 在GitHub Copilot指南中,IronZIP的TAR編寫器以其裸檔名存儲每個日志,因此同名日志發生衝突。 Codex的版本、模型和時間在共享的運行記錄中。


疑難排解


問題?

如果您有任何疑問,請聯繫support@ironsoftware.com

Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

閱讀更多

準備好開始了嗎?

NuGet 下載次數 25,383版本:2026.11剛剛發布