IronZIP ile Başlarken
IronZIP: .NET için Tek Çözüm Arşiv Kütüphaneniz
IronZIP, Iron Software tarafından geliştirilen bir arşiv sıkıştırma ve çıkarma kütüphanesidir. Yaygın olarak kullanılan ZIP formatının yanı sıra TAR, GZIP ve BZIP2'yi de işleyebilir.
C# Arşiv Sıkıştırma ve Çıkarma Kütüphanesi
- Dosya sıkıştırma ve çıkarma için C# kütüphanesini indirin
- ZIP, TAR, GZIP ve BZIP2 formatlarını yönetin
- Sıkıştırma seviyelerini 0'dan 9'a kadar özelleştirin
- Sıkıştırılmış arşivlerin içeriğini çıkartın
- Mevcut ZIP arşivlerine dosyalar ekleyin ve yeni ZIP dosyaları oluşturun
Uyumluluk
IronZIP, platformlar arası destek uyumluluğuna sahiptir:
.NET Versiyon Desteği:
- C#, VB.NET, F#
- .NET 7, 6, 5 ve Core 3.1+
- .NET Standard (2.0+)
- .NET Framework (4.6.2+)
İşletim Sistemleri ve Ortam Desteği:
- Windows (10+, Server 2016+)
- Linux (Ubuntu, Debian, CentOS, vb.)
- macOS (10+)
- iOS (12+)
- Android API 21+ (v5 "Lollipop")
- Docker (Windows, Linux, Azure)
- Azure (VPS, WebApp, Function)
- AWS (EC2, Lambda)
.NET Proje Türleri Desteği:
- Web (Blazor ve WebForms)
- Mobil (Xamarin & MAUI)
- Masaüstü (WPF & MAUI)
- Konsol (Uygulama & Kütüphane)
Kurulum
IronZIP Kütüphanesi
IronZIP paketini yüklemek için terminalinizde veya paket yöneticisi konsolunda aşağıdaki komutu kullanın:
Install-Package IronZip
Alternatif olarak, resmi IronZIP NuGet web sitesinden doğrudan indirin.
Yükledikten sonra, C# kodunuzun en üstüne using IronZip; ekleyerek başlayabilirsiniz.
Lisans Anahtarı Uygulamak
Daha sonra, IronZIP'e geçerli bir lisans veya deneme anahtarı uygulamak için lisans anahtarını Lisans sınıfının LicenseKey özelliğine atayın. Herhangi bir IronZIP metodunu kullanmadan önce, ithal beyanından hemen sonra aşağıdaki kodu ekleyin:
using IronZip;
// Apply your license key here
IronZip.License.LicenseKey = "YOUR_LICENSE_KEY";
using IronZip;
// Apply your license key here
IronZip.License.LicenseKey = "YOUR_LICENSE_KEY";
Imports IronZip
' Apply your license key here
IronZip.License.LicenseKey = "YOUR_LICENSE_KEY"
Kod Örnekleri
Bir Arşiv Örneği Oluşturma
using ifadesini kullanarak bir ZIP dosyası oluşturun. Using bloğu içinde, dosyaları ZIP dosyasına aktarmak için AddArchiveEntry metodunu kullanın. Son olarak, ZIP dosyasını SaveAs metodu ile dışa aktarın.
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");
}
}
}
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");
}
}
}
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
Bir Arşivi Klasöre Çıkartma
ZIP dosyasının içeriğini ExtractArchiveToDirectory metodu ile çıkarın. Hedef ZIP dosyasının yolunu ve çıkarma dizinini belirtin.
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);
}
}
}
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);
}
}
}
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
Mevcut Bir Arşive Dosya Ekleme
ZIP dosya yolunu yapıcıya iletmek ZIP dosyasını açacaktır. Açılan ZIP'e dosya eklemek için aynı AddArchiveEntry metodunu kullanın ve SaveAs metodu ile dışa aktarın.
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");
}
}
}
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");
}
}
}
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
Lisanslama ve Destek Mevcut
IronZIP ücretli bir kütüphanedir, ancak ücretsiz deneme lisansları da burada mevcuttur.
Iron Software hakkında daha fazla bilgi için lütfen web sitemizi ziyaret edin: https://ironsoftware.com/ Daha fazla destek ve soru için lütfen ekibimize sorun.
Iron Software'dan Destek
Genel destek ve teknik sorular için lütfen bize şu adresten e-posta gönderin: support@ironsoftware.com

