نمایش نتایج 1 تا 40 از 69

نام تاپیک: ZiP و Unzip کردن فایل و فولدر ها به روش خیلی ساده !

Threaded View

پست قبلی پست قبلی   پست بعدی پست بعدی
  1. #2

    Talking نقل قول: ZiP و Unzip کردن فایل و فولدر ها به روش خیلی ساده !

    یه سری مثال هم برای کار با این فایل براتون آماده کردم ...
    یادم نره از کاراییش بگم که واقعا حرف نداره و امکانات زیادی هم داره از جمله :
    ساختن فایل فشرده و گذاشتن رمز
    باز کردن فایلهای فشرده و دادن رمز به اونها
    امکان Update فایلها
    امکان کنترل عملیات فشره سازی
    ساخت فایل با هر پسوندی که دوست داشتی!
    فشرده سازی به روش های مختلف مثلا WinZip-compatible
    و ...
    سوالی بود در خدمتم .

    اضافه کردن آیتم
     
    Try
    Using zip As ZipFile = New ZipFile
    zip.AddFile("c:\photos\personal\7440-N49th.png", "")
    zip.AddFile("c:\Desktop\2005_Annual_Report.pdf", "")
    zip.AddFile("ReadMe.txt")
    zip.Save("MyZipFile.zip")
    End Using
    Catch ex1 As Exception
    Console.Error.WriteLine("exception: {0}", ex1.ToString)
    End Try

    Extract items from a zip file:
     
    Try
    Using zip As ZipFile = ZipFile.Read(ZipFileToExtract)
    Dim e As ZipEntry
    For Each e In zip
    e.Extract
    Next
    End Using
    Catch ex1 As Exception
    Console.Error.WriteLine("exception: {0}", ex1.ToString)
    End Try


    Extract all entries, and set the StatusMessageTextWriter so that verbose messages are generated:
     

    Using zip As ZipFile = ZipFile.Read(FilePath)
    zip.StatusMessageTextWriter= System.Console.Out
    'Status Messages will be sent to the console during extraction
    zip.ExtractAll()
    End Using


    Create a Zip, entries get passwords:
     

    Try
    Using zip As New ZipFile
    'the first entry is not protected by a password
    zip.AddFile("c:\datafiles\ReadMe.txt", "")
    zip.Password = "123456!"
    zip.AddFile("c:\photos\personal\7440-N49th.png", "images")
    zip.Password= "!Secret1";
    zip.AddFile("c:\Desktop\2005_Annual_Report.pdf", "files\documents")
    zip.Save("Secret.zip")
    End Using
    Catch ex1 As System.Exception
    System.Console.Error.WriteLine("exception: {0}", ex1)
    End Try


    Add a few files to a zip file, using WinZip-compatible AES encryption on the entries:
     
    Try
    Using zip As New ZipFile
    zip.Password = "The.Silvertones.Box.Set!"
    zip.Encryption = EncryptionAlgorithm.WinZipAes256
    zip.AddFile("c:\datafiles\RawData-2008-12-20.csv", "")
    zip.AddFile("c:\photos\personal\7440-N49th.png", "images")
    zip.AddFile("c:\Desktop\2005_Annual_Report.pdf", "files\documents")
    zip.Save("AES-Encrypted-Secret.zip")
    End Using
    Catch ex1 As System.Exception
    System.Console.Error.WriteLine("exception: {0}", ex1)
    End Try


    Extract entries using a password:
     

    Using zip As new ZipFile(FilePath)
    Dim e As ZipEntry
    For Each e In zip
    If (e.UsesEncryption)
    e.ExtractWithPassword("Secret!")
    Else
    e.Extract
    End If
    Next
    End Using



    ادامه دارد ......
    آخرین ویرایش به وسیله Alirezanet : یک شنبه 15 فروردین 1389 در 00:03 صبح

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •