# IronZIP 시작하기
## IronZIP: .NET 용 올인원 압축 라이브러리
**IronZIP** 은 Iron Software 에서 개발한 아카이브 압축 및 압축 해제 라이브러리입니다. 널리 사용되는 ZIP 형식 외에도 TAR, GZIP 및 BZIP2도 처리할 수 있습니다.
### C# 아카이브 압축 및 압축 해제 라이브러리
1. [파일 압축 및 압축 해제용 C# 라이브러리를 다운로드하세요](https://www.nuget.org/packages/IronZip/) .
2. ZIP, TAR, GZIP 및 BZIP2 형식을 처리합니다.
3. 압축 수준을 0에서 9까지 사용자 지정할 수 있습니다.
4. 압축 파일에서 콘텐츠 추출
5. 기존 ZIP 압축 파일에 파일을 추가하고 새 ZIP 파일을 생성합니다.
### 호환성
**IronZIP** 다음과 같은 플랫폼과의 호환성을 지원합니다:
#### .NET 버전 지원:
- **C#** , **VB .NET** , **F#**
- **.NET 7, 6** , 5 및 Core 3.1 이상
- .NET Standard (2.0 이상)
- .NET Framework (4.6.2 이상)
#### 운영 체제 및 환경 지원:
- **윈도우** (Windows 10 이상, Server 2016 이상)
- **리눅스** (우분투, 데비안, 센토오스 등)
- **macOS** (10 이상)
- **iOS** (12 이상)
- **안드로이드** API 21 이상 (버전 5 "롤리팝")
- **Docker** (Windows, Linux, Azure)
- **Azure** (VPS, 웹 애플리케이션, 함수)
- **AWS** (EC2, Lambda)
#### .NET 프로젝트 유형 지원:
- **웹** (Blazor 및 웹폼)
- **모바일** (Xamarin 및 MAUI)
- **데스크톱** (WPF 및 MAUI)
- **콘솔** (앱 및 라이브러리)
## 설치
### IronZIP 라이브러리
IronZIP 패키지를 설치하려면 터미널 또는 패키지 관리자 콘솔에서 다음 명령어를 사용하십시오.
```shell
:ProductInstall
```
또는 [IronZIP 공식 NuGet 웹사이트](https://www.nuget.org/packages/IronZip) 에서 직접 다운로드할 수도 있습니다.
설치 후, C# 코드의 맨 위에 `using IronZip;`을 추가하여 시작할 수 있습니다.
## 라이선스 키 적용
다음으로, 라이선스 키 속성에 라이선스 키를 할당하여 유효한 라이선스 또는 체험 키를 IronZIP에 적용하세요. IronZIP 메서드를 사용하기 전에, import 문 바로 뒤에 다음 코드를 포함시키십시오.
```csharp
using IronZip;
// Apply your license key here
IronZip.License.LicenseKey = "YOUR_LICENSE_KEY";
```
## 코드 예제
### 아카이브 예시 생성
`using` 명령어를 사용하여 ZIP 파일을 만드십시오. using 블록 내에서 `AddArchiveEntry` 메소드를 사용하여 파일을 ZIP 파일에 가져옵니다. 마지막으로, `SaveAs` 메소드를 통해 ZIP 파일을 내보냅니다.
```csharp
using IronZip;
using System.IO;
class Program
{
static void Main()
{
// Create a new ZIP file
using (var archive = new ZipArchive())
{
// Add a file to the archive
archive.AddArchiveEntry("example.txt", File.ReadAllBytes("path/to/example.txt"));
// Save the ZIP archive
archive.SaveAs("archive.zip");
}
}
}
```
### 압축 파일을 폴더로 압축 해제
`ExtractArchiveToDirectory` 메소드를 사용하여 ZIP 파일의 내용을 추출합니다. 대상 ZIP 파일의 경로와 압축 해제 디렉토리를 지정하십시오.
```csharp
using IronZip;
class Program
{
static void Main()
{
// path to the ZIP file and extraction directory
string zipPath = "archive.zip";
string extractPath = "extracted/";
// Extract all files in the ZIP archive to the specified directory
using (var archive = new ZipArchive(zipPath))
{
archive.ExtractArchiveToDirectory(extractPath);
}
}
}
```
### 기존 아카이브에 파일 추가
생성자에 ZIP 파일 경로를 전달하면 ZIP 파일이 열립니다. 동일한 `AddArchiveEntry` 메소드를 사용하여 열린 ZIP에 파일을 추가하고 `SaveAs` 메소드를 사용하여 내보냅니다.
```csharp
using IronZip;
using System.IO;
class Program
{
static void Main()
{
// Open an existing ZIP file
using (var archive = new ZipArchive("archive.zip"))
{
// Add more files to the archive
archive.AddArchiveEntry("anotherfile.txt", File.ReadAllBytes("path/to/anotherfile.txt"));
// Save updates to the ZIP archive
archive.SaveAs("archive.zip");
}
}
}
```
## 라이선스 및 지원 가능
**IronZIP**은 유료 라이브러리입니다. 하지만 [여기](trial-license)에서 무료 체험 라이선스도 제공됩니다.
Iron Software 에 대한 자세한 정보는 당사 웹사이트를 방문하십시오.[https://ironsoftware.com/](https://ironsoftware.com/)
더 자세한 지원이나 문의 사항이 있으시면 [저희 팀에 문의해](#live-chat-support) 주세요.
### Iron Software 의 지원
일반적인 지원 및 기술 관련 문의는 다음 이메일 주소로 보내주시기 바랍니다:[support@ironsoftware.com](mailto:support@ironsoftware.com)
설치 후, C# 코드의 맨 위에 using IronZip;을 추가하여 시작할 수 있습니다.
라이선스 키 적용
다음으로, 라이선스 키 속성에 라이선스 키를 할당하여 유효한 라이선스 또는 체험 키를 IronZIP에 적용하세요. IronZIP 메서드를 사용하기 전에, import 문 바로 뒤에 다음 코드를 포함시키십시오.
using IronZip;// Apply your license key hereIronZip.License.LicenseKey = "YOUR_LICENSE_KEY";
using IronZip;
// Apply your license key here
IronZip.License.LicenseKey = "YOUR_LICENSE_KEY";
ImportsIronZip' Apply your license key hereIronZip.License.LicenseKey = "YOUR_LICENSE_KEY"
Imports IronZip
' Apply your license key here
IronZip.License.LicenseKey = "YOUR_LICENSE_KEY"
코드 예제
아카이브 예시 생성
using 명령어를 사용하여 ZIP 파일을 만드십시오. using 블록 내에서 AddArchiveEntry 메소드를 사용하여 파일을 ZIP 파일에 가져옵니다. 마지막으로, SaveAs 메소드를 통해 ZIP 파일을 내보냅니다.
using IronZip;using System.IO;class Program{ static voidMain() { // Create a new ZIP file using (var archive = new ZipArchive()) { // Add a file to the archive archive.AddArchiveEntry("example.txt", File.ReadAllBytes("path/to/example.txt")); // Save the ZIP archive archive.SaveAs("archive.zip"); } }}
using IronZip;
using System.IO;
class Program
{
static void Main()
{
// Create a new ZIP file
using (var archive = new ZipArchive())
{
// Add a file to the archive
archive.AddArchiveEntry("example.txt", File.ReadAllBytes("path/to/example.txt"));
// Save the ZIP archive
archive.SaveAs("archive.zip");
}
}
}
ImportsIronZipImportsSystem.IOFriend Class ProgramShared Sub Main() ' Create a new ZIP fileUsing archive = New ZipArchive() ' Add a file to the archive archive.AddArchiveEntry("example.txt", File.ReadAllBytes("path/to/example.txt")) ' Save the ZIP archive archive.SaveAs("archive.zip")EndUsing End SubEnd Class
Imports IronZip
Imports System.IO
Friend Class Program
Shared Sub Main()
' Create a new ZIP file
Using archive = New ZipArchive()
' Add a file to the archive
archive.AddArchiveEntry("example.txt", File.ReadAllBytes("path/to/example.txt"))
' Save the ZIP archive
archive.SaveAs("archive.zip")
End Using
End Sub
End Class
압축 파일을 폴더로 압축 해제
ExtractArchiveToDirectory 메소드를 사용하여 ZIP 파일의 내용을 추출합니다. 대상 ZIP 파일의 경로와 압축 해제 디렉토리를 지정하십시오.
using IronZip;class Program{ static voidMain() { // path to the ZIP file and extraction directory string zipPath = "archive.zip"; string extractPath = "extracted/"; // Extract all files in the ZIP archive to the specified directory using (var archive = new ZipArchive(zipPath)) { archive.ExtractArchiveToDirectory(extractPath); } }}
using IronZip;
class Program
{
static void Main()
{
// path to the ZIP file and extraction directory
string zipPath = "archive.zip";
string extractPath = "extracted/";
// Extract all files in the ZIP archive to the specified directory
using (var archive = new ZipArchive(zipPath))
{
archive.ExtractArchiveToDirectory(extractPath);
}
}
}
ImportsIronZipFriend Class ProgramShared Sub Main() ' path to the ZIP file and extraction directory Dim zipPath AsString = "archive.zip" Dim extractPath AsString = "extracted/" ' Extract all files in the ZIP archive to the specified directoryUsing archive = New ZipArchive(zipPath) archive.ExtractArchiveToDirectory(extractPath)EndUsing End SubEnd Class
Imports IronZip
Friend Class Program
Shared Sub Main()
' path to the ZIP file and extraction directory
Dim zipPath As String = "archive.zip"
Dim extractPath As String = "extracted/"
' Extract all files in the ZIP archive to the specified directory
Using archive = New ZipArchive(zipPath)
archive.ExtractArchiveToDirectory(extractPath)
End Using
End Sub
End Class
기존 아카이브에 파일 추가
생성자에 ZIP 파일 경로를 전달하면 ZIP 파일이 열립니다. 동일한 AddArchiveEntry 메소드를 사용하여 열린 ZIP에 파일을 추가하고 SaveAs 메소드를 사용하여 내보냅니다.
using IronZip;using System.IO;class Program{ static voidMain() { // Open an existing ZIP file using (var archive = new ZipArchive("archive.zip")) { // Add more files to the archive archive.AddArchiveEntry("anotherfile.txt", File.ReadAllBytes("path/to/anotherfile.txt")); // Save updates to the ZIP archive archive.SaveAs("archive.zip"); } }}
using IronZip;
using System.IO;
class Program
{
static void Main()
{
// Open an existing ZIP file
using (var archive = new ZipArchive("archive.zip"))
{
// Add more files to the archive
archive.AddArchiveEntry("anotherfile.txt", File.ReadAllBytes("path/to/anotherfile.txt"));
// Save updates to the ZIP archive
archive.SaveAs("archive.zip");
}
}
}
ImportsIronZipImportsSystem.IOFriend Class ProgramShared Sub Main() ' Open an existing ZIP fileUsing archive = New ZipArchive("archive.zip") ' Add more files to the archive archive.AddArchiveEntry("anotherfile.txt", File.ReadAllBytes("path/to/anotherfile.txt")) ' Save updates to the ZIP archive archive.SaveAs("archive.zip")EndUsing End SubEnd Class
Imports IronZip
Imports System.IO
Friend Class Program
Shared Sub Main()
' Open an existing ZIP file
Using archive = New ZipArchive("archive.zip")
' Add more files to the archive
archive.AddArchiveEntry("anotherfile.txt", File.ReadAllBytes("path/to/anotherfile.txt"))
' Save updates to the ZIP archive
archive.SaveAs("archive.zip")
End Using
End Sub
End Class
커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.