IronZip'e Başlarken
IronZIP: .NET için Hepsi Bir Arada Arşiv Kütüphanesi
IronZIP, Iron Software tarafından geliştirilen bir arşiv sıkıştırma ve açma kütüphanesiidir. Yaygın olarak kullanılan ZIP formatına ek olarak, TAR, GZIP ve BZIP2 formatlarını da destekler.
C# Arşiv Sıkıştırma ve Açma Kütüphanesi
- Dosya sıkıştırma ve açma için C# kütüphanesini indirin
- ZIP, TAR, GZIP ve BZIP2 formatlarını işleyin
- Sıkıştırma seviyelerini 0 ile 9 arasında özelleştirin
- Sıkıştırılmış arşivlerden içerik çıkarma
- Dosyaları mevcut ZIP arşivlerine ekleyin ve yeni ZIP dosyaları oluşturun
Uyumluluk
IronZip, aşağıdakilerle çapraz platform uyumluluğuna sahiptir:
.NET Sürümü Desteği:
- C#, VB.NET, F#
- .NET 7, 6, 5 ve .NET 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 ve MAUI)
- Masaüstü (WPF ve MAUI)
- Konsol (Uygulama ve Kitaplık)
Kurulum
IronZIP kütüphanesi
IronZIP paketini yüklemek için terminalinizde veya paket yöneticisi konsolunuzda aşağıdaki komutu kullanın:
Install-Package IronZip
Alternatif olarak, resmi IronZip NuGet web sitesinden doğrudan indirebilirsiniz.
Yükleme tamamlandıktan sonra, C# kodunuzun başına using IronZip; ekleyerek kullanmaya başlayabilirsiniz.
Lisans Anahtarını Uygulama
Ardından, lisans anahtarını License sınıfının LicenseKey özelliğine atayarak IronZIP'e geçerli bir lisans veya deneme anahtarı uygulayın. Herhangi bir IronZIP yöntemini kullanmadan önce, import ifadesinin hemen arkasına 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
Arşiv Örneği Oluştur
using deyimini kullanarak bir ZIP dosyası oluşturun. using bloğu içinde, dosyaları ZIP dosyasına aktarmak için AddArchiveEntry yöntemini kullanın. Son olarak, ZIP dosyasını SaveAs yöntemiyle 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
Arşivi Klasöre Çıkar
ExtractArchiveToDirectory yöntemini kullanarak ZIP dosyasından içeriği çı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 dosyasının yolunu yapıcıya aktararak ZIP dosyasını açabilirsiniz. Aynı AddArchiveEntry yöntemini kullanarak açılan ZIP dosyasına dosya ekleyebilir ve SaveAs yöntemiyle dışa aktarabilirsiniz.
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
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 sorularınız için lütfen ekibimize danışın.
Iron Software'den destek
Genel destek ve teknik sorularınız için lütfen bize e-posta gönderin: support@ironsoftware.com/support@ironsoftware.com

