Ringkasan kompresi DCM
Aspose.ZIP untuk .NET menyediakan API C# yang sepenuhnya dikelola untuk mengompres file DCM di aplikasi server-side maupun desktop. Anda dapat memproses satu file atau batch besar, menggunakan path atau stream (Stream), serta mengatur level kompresi sesuai kebutuhan penyimpanan dan transfer. Buat arsip ZIP, 7z, TAR, GZIP, dan format lain tanpa utilitas eksternal, lalu amankan output dengan kata sandi atau enkripsi AES jika diperlukan. Pendekatan ini cocok untuk otomasi job batch, pipeline CI/CD, dan proses .NET berskala besar.
Cara mengompres file DCM dengan C#
Untuk mengompres file DCM di C#, gunakan Aspose.ZIP for .NET API . Anda bisa memuat DCM dari disk atau stream, membuat entry arsip, dan memilih format output (ZIP, 7z, TAR, GZIP, dll.) dengan kontrol atas parameter kompresi. Instal paket dari NuGet dan referensikan ke proyek Anda. Setelah itu Anda dapat membuat arsip, menambahkan entry, dan menyimpan output dengan beberapa baris kode C#.
Command
PM> Install-Package Aspose.ZIP
Instal Aspose.ZIP, buat instance Archive, tambahkan file DCM, lalu simpan hasilnya. Langkah berikut merangkum alur kompresi standar di C#.
Langkah untuk mengompres file DCM di C#
Developer dapat mengompres file DCM secara programatik dengan beberapa baris C# menggunakan Aspose.ZIP untuk .NET.
- Tentukan path folder yang berisi file DCM.
- Buat instance dari class
Archive. - Dengan objek
Archive, tambahkan setiap file melalui methodCreateEntrymenggunakan full path. - Panggil
Save()dan tentukan full path untuk file arsip output. - File DCM akan tersimpan dalam arsip ZIP di folder target - tanpa tool pihak ketiga (zip, rar, dll.).
Persyaratan sistem
Aspose.ZIP untuk .NET mendukung platform dan sistem operasi utama. Sebelum menjalankan contoh, pastikan lingkungan Anda memenuhi prasyarat berikut.
- Microsoft Windows atau OS kompatibel yang dapat menjalankan .NET Framework, .NET Core, atau versi .NET modern
- Lingkungan pengembangan seperti Microsoft Visual Studio
- Aspose.ZIP untuk .NET sudah direferensikan di proyek (instal via NuGet atau unduh)
Contoh C# - buat arsip ZIP dari file DCM
Cuplikan berikut menunjukkan alur inti - buat objek Archive, tambahkan entry, lalu simpan ZIP.
Compress DCM file via .NET:
var dir = "full directory path";
using (var arch = new Archive())
{
arch.CreateEntry("filename.dcm", dir+"file.dcm");
arch.Save(dir+"archived_result.zip");
}
FAQ
Can I compress multiple DCM files into a single ZIP archive using C#
1. Yes. Aspose.ZIP for .NET allows you to load and compress multiple DCM files by adding each file as an entry to the Archive object. You can combine individual files, folders, or streams into a single ZIP archive through a straightforward C# workflow.
Does Aspose.ZIP for .NET reduce the original quality of DCM files?
2. No. Aspose.ZIP performs lossless compression, meaning that the content and quality of your DCM files remain unchanged. The library only reduces file size by applying efficient archive compression algorithms without altering the actual data inside the file.
Can I password-protect ZIP archives that contain DCM files?
3. Yes. The library supports password protection and AES encryption, allowing you to securely package sensitive DCM files. You can specify encryption settings when creating entries or during the archive-generation process.
Jelajahi fitur lain Aspose.Zip untuk .NET
Gunakan library Aspose.Zip untuk C# untuk membuat, mengompres, mengamankan, dan mengekstrak arsip di aplikasi .NET.