אם אתם מחפשים להוציא את קבצי ZIP בתוכנית ב- C#, אתם נמצאים במקום הנכון!מאמר זה משמש כמדריך מקיף על ניהול יעיל של הוצאת קובץ Z IP באמצעות הספרייה הוציאה של .NET Archive.אנו נחקור שיטות שונות ל- unzipping של הקבצים, כולל כיצד לנהל את הארכיונים המוגנים באמצעות סיסמה והצפנה AES.
להוציא קבצים ZIP ב- C#
In our previous מאמר על יצירת קבצי ZIP, we discussed different techniques for packaging files using תגית: ZIP for .NET. עכשיו, בואו נסחף לתוך Unzipping ZIP קבצים ולהוציא קבצים משני ארכיוני ZIP מוגנים סיסמה ו- AES מוצפנים ב- C#.
שולחן התוכן
- C# API to Unzip קבצים - להורדה חינם
- כיצד לחלץ קבצי ZIP ב- C#
- קבצי ZIP מאובטחים ללא סיסמה
- להוציא קבצי ZIP מוצפנים ב- C#
הוספת ארכיון ZIP ב- C# - התקנת API
Before we get started, ensure that you have הורד and referenced Aspose.ZIP for .NET. You can also install the package via the מנהל חבילות NuGet. כדי להוסיף את הספרייה לפרויקט שלך, הפעל את הפקודה הבאה:
PM> NuGet\Install-Package Aspose.Zip
כיצד להוציא קבצים ZIP ב C#
הוצאת קבצי ZIP ניתן להשיג בשתי דרכים עיקריות:
- הוציא כל קובץ מהארכיון ה-ZIP בנפרד.
- Unzip את כל הקבצים לתוך תיקיה מסוימת.
C# להוציא כל קובץ ב- ZIP
כדי לחלץ קבצים בנפרד בעת מעקב אחר התקדמות החילוץ, לעקוב אחר השלבים הבאים:
- Open the ZIP archive using a FileStream.
- Initialize an instance of the ארכיון class with the FileStream object.
- Access files within the ZIP using the ארכיון - כניסות collection.
- Set up an ArchiveEntry.Extractionתקדמות event handler to display the extraction progress.
- Utilize the ArchiveEntry.Extract(String) תגיות method to extract files.
הנה דגימה של קוד המראה כיצד להוציא קבצים מארכיון ZIP ב- C#:
Unzip ZIP קבצים לתוך קובץ ב C#
אם אתה מעדיף להסיר את כל הקבצים לתוך תיקיה מסוימת, לעקוב אחר השלבים הבאים:
- Open the ZIP archive using the FileStream class.
- Create an instance of the ארכיון class initialized with the ZIP’s FileStream object.
- Use the Archive.ExtractToDirectory(String) method to unzip files into the designated folder.
הנה דגימה של קוד כדי להסיר את קבצי ZIP לתוך תיקיה:
C# Unzip סיסמה-גנת ZIP קבצים {#Unzip-סיסמה-גנת ZIP-קבצים-ב-CSharp}
You can extract password-protected ZIP archives using Aspose.ZIP for .NET. Simply specify the password using the ארכיוןOptions class, which you will pass as the second parameter to the ארכיוןלדוגמה, עבור C# Unzip קובץ עם סיסמה, ראה את הדוגמה הבאה.
הנה תפריט קוד דגימה כדי להסיר קובץ ZIP מוגן באמצעות סיסמה:
להוציא קבצי ZIP מוצפנים AES ב- C#
If your ZIP archive is encrypted with AES, Aspose.ZIP for .NET supports AES128, AES192, and AES256 encryption methods. Extracting an AES encrypted ZIP file is similar to unzipping a password-protected archive; you only need to provide the decryption password using the ארכיוןOptions class.
הנה איך להוציא קבצי ZIP מוצפנים AES ב- C#:
C# ZIP Extraction API - קבל רישיון חינם
You can perform ZIP extraction without any evaluation limitations by obtaining רישיון זמני חינם.
מסקנה
In this article, we’ve covered how to unzip ZIP files using C# and tackled the extraction of password-protected ZIP archives. Additionally, we explored how to handle encrypted ZIP files. For more information on using Aspose.ZIP for .NET, check out the מסמכים.
מדריך זה הוא המקור שלך עבור C# .NET 6 Zip File Extraction, C# .NET 7 Zip File Extraction, ועוד. בין אם אתה עובד עם .NET Core Zip File Extraction לתוך קובץ ספציפי או ליישם .NET Zip File Decompression with Error Handling, הטכניקות שנבדקו כאן יגדילו את יכולות החילוץ ZIP שלך ב .NET.
כדי לעזור לך עוד יותר, מדריך זה כולל מידע על C# Unzip File, C# Antivirus File to Folder ו- c# Decompress ZIP. תוכלו גם ללמוד על C# Open Zip* , * C# Unpack Z IP** וכיצד להוציא את *ZIP ללא סיסמה *.אם אתם מעוניינים לעבוד עם ארכיונים מוגנים בסיסמאות, אנו נסתכל על איך להשיג *Retrieve * הסיסמת * ו * Open Encrypted * .
יתר על כן, אם ברצונך לדעת כיצד להפעיל קבצים .NET Unzip או לבצע פעולות C# Archive, מדריך זה מספק את כל המידע הדרוש כדי להתחיל.