diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d5f7781 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*/obj/* +*/bin/* +.vs/* \ No newline at end of file diff --git a/DolceDL.sln b/DolceDL.sln new file mode 100644 index 0000000..018ad67 --- /dev/null +++ b/DolceDL.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DolceDL", "DolceDL\DolceDL.csproj", "{2FEFD97C-5F9F-4354-BAB8-ECA6FC3EB3C8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2FEFD97C-5F9F-4354-BAB8-ECA6FC3EB3C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2FEFD97C-5F9F-4354-BAB8-ECA6FC3EB3C8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2FEFD97C-5F9F-4354-BAB8-ECA6FC3EB3C8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2FEFD97C-5F9F-4354-BAB8-ECA6FC3EB3C8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9700BE9B-D01C-4210-B59F-C16D86E841FF} + EndGlobalSection +EndGlobal diff --git a/DolceDL/App.config b/DolceDL/App.config new file mode 100644 index 0000000..5754728 --- /dev/null +++ b/DolceDL/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/DolceDL/BasicFormatsForCore.dll b/DolceDL/BasicFormatsForCore.dll new file mode 100644 index 0000000..37c960e Binary files /dev/null and b/DolceDL/BasicFormatsForCore.dll differ diff --git a/DolceDL/DolceDL.csproj b/DolceDL/DolceDL.csproj new file mode 100644 index 0000000..79faf0c --- /dev/null +++ b/DolceDL/DolceDL.csproj @@ -0,0 +1,76 @@ + + + + + Debug + AnyCPU + {2FEFD97C-5F9F-4354-BAB8-ECA6FC3EB3C8} + Exe + DolceDL + DolceDL + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + app.manifest + + + + ..\packages\BCMakeCert.2.0.9\lib\net40\BCMakeCert.dll + + + ..\packages\DotNetZip.1.13.4\lib\net40\DotNetZip.dll + + + ..\packages\FiddlerCore.Trial.5.0.0\lib\net45\FiddlerCore.dll + + + + + + + + + + + + + + ..\packages\Telerik.NetworkConnections.0.2.0\lib\net40\Telerik.NetworkConnections.dll + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DolceDL/Program.cs b/DolceDL/Program.cs new file mode 100644 index 0000000..c377a5f --- /dev/null +++ b/DolceDL/Program.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FiddlerCore; +using Fiddler; +using System.Security.Cryptography.X509Certificates; +using System.IO; +using System.Runtime.InteropServices; + +namespace DolceDL +{ + class Program + { + + [DllImport("kernel32.dll", SetLastError = true)] + private static extern bool SetConsoleCtrlHandler(ConsoleEventDelegate callback, bool add); + + static ConsoleEventDelegate handler; // Keeps it from getting garbage collected + private delegate bool ConsoleEventDelegate(int eventType); + static string UrlFilter; + static bool ConsoleEventCallback(int eventType) + { + if (eventType == 2) // WM_CLOSE + { + if(FiddlerApplication.IsStarted()) + { + Console.WriteLine("Stopping proxy..."); + FiddlerApplication.Shutdown(); + } + } + return false; + } + + static void Main(string[] args) + { + + handler = new ConsoleEventDelegate(ConsoleEventCallback); + SetConsoleCtrlHandler(handler, true); + + if (File.Exists("privkey.key") && File.Exists("privkey.cert")) + { + Console.WriteLine("Reading private key..."); + + string privcert = File.ReadAllText("privkey.cert"); + FiddlerApplication.Prefs.SetStringPref("fiddler.certmaker.bc.cert", privcert); + string privkey = File.ReadAllText("privkey.key"); + FiddlerApplication.Prefs.SetStringPref("fiddler.certmaker.bc.key", privkey); + + } + else + { + Console.WriteLine("Generating root certificate..."); + if (!CertMaker.createRootCert()) + Console.WriteLine("Failed to create cert.."); + + Console.WriteLine("Installing root certificate..."); + X509Store certStore = new X509Store(StoreName.Root, StoreLocation.LocalMachine); + certStore.Open(OpenFlags.ReadWrite); + + try + { + certStore.Add(CertMaker.GetRootCertificate()); + } + catch (Exception) + { + Console.WriteLine("Failed to install cert.."); + } + finally + { + certStore.Close(); + } + + Console.WriteLine("Saving private key..."); + File.WriteAllText("privkey.cert", FiddlerApplication.Prefs.GetStringPref("fiddler.certmaker.bc.cert", null)); + File.WriteAllText("privkey.key", FiddlerApplication.Prefs.GetStringPref("fiddler.certmaker.bc.key", null)); + + } + + Console.Write("Url must contain: "); + UrlFilter = Console.ReadLine(); + + Console.WriteLine("Starting proxy..."); + FiddlerCoreStartupSettingsBuilder builder = new FiddlerCoreStartupSettingsBuilder(); + builder.DecryptSSL(); + builder.ListenOnPort(8080); + builder.RegisterAsSystemProxy(); + FiddlerCoreStartupSettings settings = builder.Build(); + FiddlerApplication.BeforeResponse += FiddlerApplication_BeforeResponse; + FiddlerApplication.Startup(settings); + + while (true) { }; + } + + private static void FiddlerApplication_BeforeResponse(Session oSession) + { + + string path = oSession.fullUrl; + if(path.Contains(UrlFilter)) + { + if(oSession.PathAndQuery == "/") + { + path += "index.html"; + } + oSession.utilDecodeResponse(); + path = path.Replace("&", "&"); + path = path.Replace(":", "&col;"); + path = path.Replace("\\", "&bksl;"); + path = path.Replace("//", "&fwsl;"); + path = path.Replace("|", "&pipe;"); + path = path.Replace("*", "&str;"); + path = path.Replace("?", "&que;"); + path = path.Replace("<", "<"); + path = path.Replace(">", ">"); + path = path.Replace("\"", "&qt;"); + + while (File.Exists(path)) + path += "_"; + + oSession.SaveResponseBody(path); + Console.WriteLine(path); + } + + + } + } +} diff --git a/DolceDL/Properties/AssemblyInfo.cs b/DolceDL/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d294538 --- /dev/null +++ b/DolceDL/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DolceDL")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("DolceDL")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("2fefd97c-5f9f-4354-bab8-eca6fc3eb3c8")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DolceDL/app.manifest b/DolceDL/app.manifest new file mode 100644 index 0000000..14a266d --- /dev/null +++ b/DolceDL/app.manifest @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DolceDL/packages.config b/DolceDL/packages.config new file mode 100644 index 0000000..70f3321 --- /dev/null +++ b/DolceDL/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/packages/BCMakeCert.2.0.9/BCMakeCert.2.0.9.nupkg b/packages/BCMakeCert.2.0.9/BCMakeCert.2.0.9.nupkg new file mode 100644 index 0000000..4961cc7 Binary files /dev/null and b/packages/BCMakeCert.2.0.9/BCMakeCert.2.0.9.nupkg differ diff --git a/packages/BCMakeCert.2.0.9/EULA.txt b/packages/BCMakeCert.2.0.9/EULA.txt new file mode 100644 index 0000000..adc011a --- /dev/null +++ b/packages/BCMakeCert.2.0.9/EULA.txt @@ -0,0 +1,176 @@ +End User License Agreement + +READ THIS END USER LICENSE AGREEMENT ("EULA") BEFORE INSTALLING OR USING THE PRODUCT TO WHICH THIS EULA APPLIES. BY ACCEPTING THIS EULA, COMPLETING THE REGISTRATION PROCESS, AND/OR INSTALLING OR USING THE PRODUCT, YOU AGREE ON BEHALF OF YOURSELF AND YOUR COMPANY (IF APPLICABLE) TO THE TERMS BELOW. IF YOU DO NOT AGREE WITH THESE TERMS, OR DO NOT HAVE THE AUTHORITY TO BIND YOUR COMPANY, DO NOT INSTALL, REGISTER FOR OR USE THE PRODUCT, AND DESTROY OR RETURN ALL COPIES OF THE PRODUCT. ONCE YOU HAVE DONE THIS, YOU MAY REQUEST FROM THE POINT OF PURCHASE A FULL REFUND OF THE LICENSE FEES, IF ANY, PAID FOR THE PRODUCT (OR, IF THE PRODUCT IS PROVIDED TO YOU AS A HOSTED SERVICE, A REFUND OF THE PREPAID SERVICE FEES FOR THE REMAINDER OF THE SUBSCRIPTION PERIOD OF THE PRODUCT). SUCH REQUEST MUST BE COMPLETED WITHIN THIRTY (30) DAYS OF DELIVERY OF THE PRODUCT TO YOU. UNLESS OTHERWISE SPECIFIED IN THIS EULA, PROGRESS SOFTWARE CORPORATION IS THE LICENSOR OF THE PRODUCT. THE LICENSOR MAY BE REFERRED TO HEREIN AS "Licensor", "we", "us", or "our". IF YOU ARE AGREEING TO THIS EULA ON BEHALF OF YOURSELF IN YOUR INDIVIDUAL CAPACITY, THEN YOU ARE THE LICENSEE AND YOU MAY BE REFERRED TO HEREIN AS "Licensee", "you", or "your". IF YOU ARE AGREEING TO THIS EULA ON BEHALF OF YOUR COMPANY, THEN YOUR COMPANY IS THE LICENSEE AND ANY REFERENCES TO "Licensee", "you", or "your" WILL MEAN YOUR COMPANY. + +This EULA includes the following sections: + +1. GENERAL TERMS AND CONDITIONS - these terms apply to all Products; + +2.A. TERMS FOR ON-PREMISE PRODUCTS - these terms apply to Products that you or Permitted Third Parties install on computers; + +2.B. TERMS FOR HOSTED SERVICES - these terms apply to Products that we host; + +3. PRODUCT FAMILY SPECIFIC TERMS - these terms apply to all Products that are part of the family of Products referenced in this section; and + +4. PRODUCT SPECIFIC TERMS - these terms apply to specific Products referenced in this section. + + + +1. GENERAL TERMS AND CONDITIONS +1.1. Definitions. +1.1.1. "Affiliate" means any legal entity that directly or indirectly controls, is controlled by, or is under common control with you or us. For the purposes of this definition, "control" means ownership, directly or indirectly, of more than fifty percent (50%) of the voting shares or other equity interest in an entity. +1.1.2. "Applicable Laws" means national, federal, state, and local laws, rules, and regulations including, without limitation, those laws and regulations relating to data privacy and security in each applicable jurisdiction. +1.1.3. "Authorized Reseller" means a third party who is not our Affiliate and who is authorized by us or our Affiliate to resell the Product. +1.1.4. "Authorized User" means you, your employee or a third-party consultant or agent that you authorize to use the Product for your benefit in accordance with section 1.2.3 (Third Party Use). +1.1.5. "Documentation" means any technical instructions or materials describing the operation of the Product made available to you (electronically or otherwise) by us for use with the Product, expressly excluding any user blogs, reviews or forums. +1.1.6. "Hosted Services" means computer software program(s), content and related services provided by us on a software-as-a-service basis through computers we or our Affiliates or our respective contractors (including cloud infrastructure suppliers) control. +1.1.7. "Intellectual Property Rights" means any and all current and future (a) rights associated with works of authorship, including copyrights, mask work rights, and moral rights; (b) trademark or service mark rights; (c) trade secret rights; (d) patents, patent rights, and industrial property rights; (e) layout design rights, design rights, and other proprietary rights of every kind and nature other than trademarks, service marks, trade dress, and similar rights; and (f) registrations, applications, renewals, extensions, or reissues of any of (a) to (e) , in each case, in any jurisdiction throughout the world. +1.1.8. "On-Premise Product(s)" means computer software program(s) provided to you to download, install and use on computer(s) controlled directly or indirectly by you. +1.1.9. "Order" means a written or electronic order document entered into between you and us (or our Affiliate or an Authorized Reseller) for the Product. Unless an Order says something different, each Order will be governed by the terms of this EULA and include the name of the Product being licensed and any usage limitations, applicable fees, and any other details related to the transaction. +1.1.10. "Our Technology" means any software, code, tools, libraries, scripts, application programming interfaces, templates, algorithms, data science recipes (including any source code for data science recipes and any modifications to such source code), data science workflows, user interfaces, links, proprietary methods and systems, know-how, trade secrets, techniques, designs, inventions, and other tangible or intangible technical material, information and works of authorship underlying or otherwise used to make available the Product, including, without limitation, all Intellectual Property Rights therein and thereto. +1.1.11. "Permitted Third Party" has the meaning given in section 1.2.3 (Third Party Use). +1.1.12. "Product" means the On-Premise Product(s) or Hosted Services, as applicable, identified in an Order, and any Updates. +1.1.13. "Update" means any update, enhancement, error correction, modification or new release to the Product that we make available to you. +1.2. General License Terms, Restrictions and Order of Precedence. +1.2.1. General License Terms. The Product is licensed, not sold, to you by us under the terms of this EULA and the Order. The scope of license granted by us to you for the Product is set out in section 3 (Product Family Specific Terms) and section 4 (Product Specific Terms). +1.2.2. Authorized Users. Anything your Authorized Users do or fail to do will be considered your act or omission, and you accept full responsibility for any such act or omission to the extent you would be liable if it were your act or omission. +1.2.3. Third Party Use. You may allow your agents, contractors and outsourcing service providers (each a "Permitted Third Party") to use the Product(s) licensed to you hereunder solely for your benefit in accordance with the terms of this EULA and you are responsible for any such Permitted Third Party's compliance with this EULA in such use. Any breach by any Permitted Third Party of the terms of this EULA will be considered your breach. +1.2.4. Restrictions. Except as otherwise expressly permitted in this EULA, you will not (and will not allow any of your Affiliates or any third party to): +(a) copy, modify, adapt, translate, or otherwise create derivative works of the Product, Documentation, or any software, services, or other technology of third party vendor(s) or hosting provider(s) that we or our Affiliate engage; +(b) disassemble, decompile or "unlock", decode or otherwise reverse translate or engineer, or attempt in any manner to reconstruct or discover the source code or underlying structure, ideas, or algorithms of the Product except as expressly permitted by law in effect in the jurisdiction in which you are located; +(c) rent, lease, sell, distribute, pledge, assign, sublicense or otherwise transfer or encumber rights to the Product; +(d) make the Product available on a timesharing or service bureau basis or otherwise allow any third party to use or access the Product; +(e) remove or modify any proprietary notices, legends, or labels on the Product or Documentation; +(f) use or access the Product in a manner that: (i) violates any Applicable Laws; (ii) violates the rights of any third party; (iii) purports to subject us or our Affiliates to any other obligations; (iv) could be fraudulent; or (v) is not permitted under this EULA; +(g) use the Product to develop, test, support or market products that are competitive with and/or provide similar functionality to the Product; or +(h) permit your Affiliates to access or use the Product unless specifically authorized elsewhere in this EULA or the Order. +1.2.5. Limitations on Evaluation or Trial Licenses. If the Product is licensed to you on an evaluation or trial basis, then you may use the Product only for such purposes until the earlier of: (a) the end of the evaluation period, if any, specified in the Order, this EULA or otherwise communicated by us to you at the time of delivery; or (b) the start date of a paid for license to the Product; or (c) termination in accordance with the terms of this EULA. You may not extend the evaluation period by uninstalling and re-installing the Product(s) or by any other means other than our written consent. You must not use the Product in a production environment. You will be required to pay for a license for the Product at our then applicable license price if you continue to use the Product, whether in a production or non-production environment, after the evaluation license expires or terminates, and the terms and conditions of the EULA in effect at that time will apply to your continued use of the Product. A Product licensed to you on an evaluation or trial basis may be subject to one or more usage limits specified in section 3 (Product Family Specific Terms), section 4 (Product Specific Terms), the Order or otherwise communicated at the time of delivery (including posting of such limits at the location where you download the Product for evaluation). We may, at our sole discretion, decide whether to offer any maintenance and support for the Product during the evaluation period, and to include any conditions or limits on such maintenance and support. You may not circumvent any technical limitations included in the Product licensed to you on an evaluation or trial basis. +1.2.6. Redistribution. If the Order or section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms) grants you the express right to redistribute or offer access to all or a portion of the Product ("Redistributables"), then, in conjunction with any such grant, you must comply with any limitations or requirements specified in the Order, section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms), as applicable, and you must distribute or offer access to the Redistributables subject to a license agreement or terms of use between you and each third party receiving or accessing the Redistributables ("your customer") that: (a) protects our interests consistent with the terms contained in this EULA, (b) prohibits your customer from any further distribution of the Redistributables (unless expressly permitted pursuant to section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms)), (c) includes a limitation of damages clause that, to the maximum extent permitted by applicable law, disclaims on behalf of us, our Affiliates or our or their respective licensors, suppliers or Authorized Resellers, liability for any and all damages, whether direct, special, incidental or consequential damages, (e) contains terms substantially similar to those in subparts (a) through (g) of section 1.2.4 (Restrictions), section 1.5.1 (Export Compliance) and section 1.5.2 (U.S. Government Customers), and (f) includes a notice substantially similar to section 1.2.7 (Third Party Notices). +1.2.7. Third Party Notices. The Product may contain or be accompanied by certain third-party components which are subject to additional restrictions. These components, are identified in, and subject to, special license terms and conditions which, in the case of On-Premise Product(s), are set out in the "readme.txt" file, the "notices.txt" file, or the "Third Party Software" file accompanying the Product or portions thereof, and in the case of Hosted Services, are set out in the third-party license agreement or notices that comes with the third-party component or is otherwise provided on the web page on which such third-party component is made available ("Special Notices"). The Special Notices include important licensing and warranty information and disclaimers. Unless otherwise expressly stated for a given third-party component, all such third-party components may be used solely in connection with the use of the Product subject to and in accordance with the terms and conditions of this EULA and the Special Notices. In the event of conflict between the Special Notices and the other portions of this EULA, the Special Notices will take precedence (but solely with respect to the third-party component(s) to which the Special Notice relates). +1.2.8. Order of Precedence between EULA and Order. If there is any conflict between the terms and conditions in the Order and the terms and conditions of this EULA, or if the Order changes any of the terms of this EULA, the terms and conditions of the Order will apply, except if the Order is between you and an Authorized Reseller, or the Order is issued/generated by you. In the case where the Order is between you and an Authorized Reseller, the terms of the Order will apply subject to the following: (a) any terms and conditions in the Order imposing obligations on the Authorized Reseller that are in addition to or different from the obligations we have to you pursuant to this EULA will be born solely by the Authorized Reseller and our obligations to you and limits on our liability will be governed solely by the terms and conditions of this EULA and (b) any terms and conditions that conflict with or would otherwise alter any of the following under this EULA will have no effect unless expressly agreed to in a written instrument executed by us: our ownership rights, yours and our confidentiality obligations, your export compliance obligations, limitations on your rights as a U.S. Government customer (if applicable), our audit rights, restrictions on your right to assign, our publicity rights or governing law and jurisdiction. In cases where the Order is issued/generated by you, the terms and conditions of Section 1.19.2. of this EULA, governing a purchase order or other document you supply in connection with this EULA, shall apply to such Order. +1.2.9. Order of Precedence within EULA. If there is any conflict among the terms and conditions of this EULA, or if a section changes the terms of another section within this EULA, the order of precedence will be as follows: first, section 4 (Product Specific Terms) (if any); second, section 3 (Product Family Specific Terms) (if any); third, section 2.A (Terms for On-Premise Products) and/or section 2.B (Terms for Hosted Services), as applicable; and fourth and finally, section 1 (General Terms and Conditions). +1.3. License Types. +1.3.1. Overview of License Types. The license type for the Product will, unless otherwise specified in this EULA, be one of the following license types: perpetual, term or subscription. This will be confirmed in the Order or will be the default license type listed in section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms). +1.3.2. Perpetual License Type. Your license to use the Product will continue in perpetuity unless earlier terminated in accordance with the terms of this EULA. +1.3.3. Term License Type. Your license to use the Product will continue until the expiration of the term identified in the Order unless earlier terminated in accordance with the terms of this EULA. If we continue to make the Product generally available to our customers, you may purchase a new term license for the Product from us or our Authorized Reseller. +1.3.4. Subscription License Type. Your license to use the Product will continue until the expiration of the subscription period identified in the Order unless earlier terminated in accordance with the terms of this EULA. The procedure for renewing your license to the Product is set out in section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms). If you upgrade your subscription to the Product, the upgrade will take effect immediately and you will be charged and must pay the applicable fee, and the term of your then-current subscription period may be extended, as described at the time you upgrade. You may not downgrade a subscription to the Product. +1.4. Our Business Principles. We will apply the principles set out in our Code of Conduct and Business Ethics (published on our website at http://investors.progress.com/governance.cfm) in our performance under this EULA. +1.5. Export Compliance and U.S. Government Customers. +1.5.1. Export Compliance. Export laws and regulations of the United States and any other relevant local export laws and regulations apply to the Products. You agree that such export control laws, including, without limitation, the U.S. Export Administration Act and its associated regulations, govern your use of the Product (including technical data), and you agree to comply with all such export laws and regulations (including "deemed export" and "deemed re-export" regulations). You agree that no data, information and/or Product (or direct product thereof) will be exported, directly or indirectly, in violation of these laws, or will be used for any purpose prohibited by these laws including, without limitation, nuclear, chemical, or biological weapons proliferation, or development of missile technology. +1.5.2. U.S. Government Customers. If the Product is being acquired by or on behalf of the U.S. Government or by a U.S. Government prime contractor or subcontractor (at any tier), then the U.S. Government's rights in the Product will be only as set out herein. The Product and Documentation are "commercial items" as that term is defined at 48 C.F.R. 2.101, consisting of "commercial computer software" and "commercial software documentation" as such terms are used in 48 C.F.R. 12.212. Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4, all U.S. Government end users acquire the Product and such Documentation with only those rights set out herein. +1.6. IP Ownership and Feedback. +1.6.1. IP Ownership. The Product, Our Technology, Documentation, and all other current or future intellectual property developed by us or our Affiliates, and all worldwide Intellectual Property Rights in each of the foregoing and all Updates, upgrades, enhancements, new versions, releases, corrections, and other modifications thereto and derivative works thereof, are the exclusive property of us or our Affiliates or our or their licensors or suppliers. Except for the rights and licenses expressly granted herein, all such rights are reserved by us and our Affiliates and our or their licensors and suppliers. All title and Intellectual Property Rights in and to the content that may be accessed through use of the Product is the property of the respective content owner and may be protected by applicable copyright or other intellectual property laws and treaties. This EULA grants you no rights to use such content. +1.6.2. Feedback. If you provide us any ideas, thoughts, criticisms, suggested improvements or other feedback related to Our Technology (collectively "Feedback") you own the Feedback and you grant to us a worldwide, royalty-free, fully paid, perpetual, irrevocable license to use, reproduce, modify, translate, distribute, perform, display, import, sell, license, offer for sale, make, have made and otherwise exploit the Feedback in any form, media, or technology, whether now known or hereafter developed, and to allow others to do the same without restriction or obligation of any kind, on account of confidential information, intellectual property rights or otherwise, and may incorporate into our products or services any service, product, technology, enhancement, documentation or other development ("Improvement") incorporating or derived from any Feedback with no obligation to license or to make available the Improvement to you or any other person or entity. This is true whether you provide the Feedback through use of the Product or through any other method of communication with us, unless we have entered into a separate agreement with you that provides otherwise. +1.7. Maintenance. +1.7.1. Our Maintenance and Support Policies. If we offer and you purchase maintenance and support for the Product, then it will be provided in accordance with our then current maintenance and support policies for the applicable Product in effect at the time of purchase. You may access our maintenance and support policies by clicking on the applicable Product family link located at https://www.progress.com/support. +1.7.2. Maintenance and Support for Perpetual or Term License Types. For Perpetual and Term License Types, unless otherwise expressly stated by us in the Order, first year annual maintenance and support (if offered by us) is required for the Product and starts on the date the Product is delivered. Thereafter, you may choose to purchase annual maintenance and support (if offered by us). If you do not purchase renewal maintenance and support services for a Product, then you will not receive any maintenance and support services for that Product and will have no entitlement to any benefits of maintenance and support services including, bug fixes, patches, upgrades, enhancements, new releases or technical support. If you want to reinstate lapsed maintenance and support services on a Product, and we offer reinstatement to our customers, then you may re-instate maintenance and support services by paying the then-current fee, plus a reinstatement fee for the lapsed maintenance and support period in accordance with our maintenance and support reinstatement policies then in effect. +1.7.3. Maintenance and Support for Subscription License Type. If the license type for the Product licensed to you is the subscription license type, then maintenance and support (if offered by us) is included in the subscription fees for each subscription period. +1.8. Fees and Taxes. +1.8.1. Payment Terms and Taxes. All fees payable to us are payable in the currency specified in the Order, or if no currency is specified, in United States Dollars, are due within 30 days from the invoice date and, except as otherwise expressly specified herein, are non-cancellable and non-refundable. We may charge you interest at a rate of 1.5% per month (or the highest rate permitted by law, if less) on all overdue payments. You agree to pay any sales, value-added or other similar taxes imposed by applicable law that we must pay on such fees, except those based on our income. Invoices may be issued by our Affiliate. If you and we agree that you will pay by credit card, you will provide us with valid and updated credit card information and you authorize us to store such information and bill such credit card for all fees applicable: (a) at the time that you order the Product and (b) at the time of any renewal or upgrade. +1.8.2. Fees for Renewal Subscription Licenses. If the license type for the Product licensed to you is the Subscription License Type then each renewal subscription will be calculated at the then-current price offered for the Product at the time of renewal. +1.8.3. Fees for Renewal Maintenance Terms. If the license type for the Product licensed to you is a Perpetual license or Term license, then, unless otherwise specified in the Order or in section 3 (Product Family Specific Terms) or section 4 (Product-Specific Terms), the fee for an optional annual renewal maintenance and support term for the Product will be calculated based on the annual rate applicable for the initial maintenance and support term or immediately preceding renewal maintenance and support term, whichever is applicable, plus a rate increase, if applicable, calculated at the lesser of any standard price increase or CPI (or equivalent index) after applying any increases as a consequence of our Lifetime Support policy, if applicable. +1.8.4. Orders between You and Our Authorized Reseller. Notwithstanding the above terms of this section 1.8 (Fees and Taxes), if you purchased your license to the Product and/or maintenance and support from an Authorized Reseller, then the fees will be set out in the Order between you and the Authorized Reseller. The Authorized Reseller may be responsible for billing and/or collecting payment from you and if so, the billing and collection terms agreed to between you and the Authorized Reseller may differ from the terms set out in this section 1.8 (Fees and Taxes). +1.8.5. No Reliance on Future Availability of any Product or Update. You agree that you have not relied on the future availability of any Product or Updates in your purchasing decision or in entering into the payment obligations in your Order. +1.9. Warranties. +1.9.1. Authority. Each party represents and warrants that it has the legal power and authority to enter into this EULA. +1.9.2. Product Compliance with Documentation. We warrant to you that, for six (6) months from delivery (in the case of an On-Premise Product) or for the duration of the license (in the case of a Hosted Service), the Product will comply with the applicable Documentation in all material respects. Your exclusive remedy, and our sole liability, with respect to any breach of this warranty will be for us to use commercially reasonable efforts to promptly correct the non-compliance (provided that you notify us in writing within the warranty period and allow us a reasonable cure period). If we, at our discretion, reasonably determine that correction is not economically or technically feasible, we may terminate your license to the Product and provide you a full refund of the fees paid to us with respect to the Product (in the case of an On-Premise Product) or a refund of the prepaid fees for the unused portion of the license period (in the case of a Hosted Service). Delivery of additional copies of, or Updates to, the Product will not restart or otherwise affect the warranty period. +1.9.3. Warranty Exclusions. The warranty specified in section 1.9.2 (Product Compliance with Documentation) does not cover any Product provided on an unpaid evaluation or trial basis, or defects to the Product due to accident, abuse, service, alteration, modification or improper installation or configuration by you, your Affiliates, your or their personnel or any third party not engaged by us. +1.9.4. Warranty Disclaimers. EXCEPT FOR THE WARRANTIES EXPRESSLY STATED IN THIS SECTION 1.9 OR THE ADDITIONAL WARRANTIES (IF ANY) EXPRESSLY STATED IN SECTION 3 (PRODUCT FAMILY SPECIFIC TERMS) OR SECTION 4 (PRODUCT SPECIFIC TERMS), THE PRODUCT, DOCUMENTATION AND OUR TECHNOLOGY ARE PROVIDED "AS IS", WITH ALL FAULTS, AND WE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, NONINFRINGEMENT, AVAILABILITY, ERROR-FREE OR UNINTERRUPTED OPERATION, AND ANY WARRANTIES ARISING FROM COURSE OF DEALING, COURSE OF PERFORMANCE, OR USAGE OF TRADE. TO THE EXTENT THAT WE MAY NOT AS A MATTER OF APPLICABLE LAW DISCLAIM ANY IMPLIED WARRANTY, THE SCOPE AND DURATION OF SUCH WARRANTY WILL BE THE MINIMUM PERMITTED UNDER APPLICABLE LAW. +1.10. Indemnification. +1.10.1. Our Indemnification Obligation. +1.10.1.1. Intellectual Property Infringement. We will defend you, and your officers, directors, employees, and agents from and against any and all third party claims, lawsuits, and proceedings alleging that your use of the Product, in accordance with the terms and conditions of this EULA, constitutes a direct infringement or misappropriation of such third party's patent, copyright or trade secret rights (the "IP Claim"), and we will indemnify you for damages finally awarded against you by a court of competent jurisdiction with respect to the IP Claim. +1.10.1.2. Exceptions. We will not indemnify you to the extent that the alleged infringement or misappropriation results from (a) use of the Product in combination with any other software or item not supplied by us; (b) failure to promptly implement an Update provided by us pursuant to 1.10.1.3 (Our Options); (c) modification of the Product not made or provided by us; or (d) use of the Product in a manner not permitted by this EULA. We also will not indemnify you if we notify you of our decision to terminate this EULA, and the license to the Product granted hereunder, in accordance with section 1.10.1.3 (Our Options) and you have not ceased all use of the Product within thirty (30) days of such notification. +1.10.1.3. Our Options. If a final injunction is, or we reasonably believe that it could be, obtained against your use of the Product, or if in our opinion the Product is likely to become the subject of a successful claim of infringement, we may, at our option and expense, (a) replace or modify the Product so that it becomes non-infringing (provided that the functionality is substantially equivalent), (b) obtain for you a license to continue to use the Product, or (c) if neither (a) nor (b) are reasonably practicable, terminate this EULA on thirty (30) days' notice and, if the Product was licensed to you on a Perpetual License or Term License basis, refund to you the license fee paid to us for the Product less an amount for depreciation determined on a straight-line five year (or actual term if shorter) depreciation basis with a commencement date as of the date of delivery of the Product, or if the Product was licensed to you on a Subscription License basis, refund to you the unused portion of the fees paid in advance to us for the then-current subscription period for the Product. THE INDEMNIFICATION PROVISIONS SET OUT IN THIS SECTION 1.10.1 STATE OUR ENTIRE LIABILITY AND YOUR SOLE AND EXCLUSIVE REMEDY WITH RESPECT TO ANY INFRINGEMENT OR ALLEGED INFRINGEMENT BY US OF ANY INTELLECTUAL PROPERTY RIGHTS OR PROPRIETARY RIGHTS IN RESPECT OF THE PRODUCT OR ITS USE. +1.10.2. Your Indemnification Obligation. +1.10.2.1. Indemnification for Third Party-Claims. To the extent permitted by applicable law, you will defend us and our Affiliates, and our and their respective officers, directors, employees, and agents from and against any and all third party claims, lawsuits, and proceedings that arise or result from (a) your breach of this EULA, (b) your use, distribution and/or licensing of the Redistributables, if applicable, except to the extent it arises from an IP Claim covered under section 1.10.1 above, or (c) your failure or alleged failure to comply with Applicable Laws or any violation of a third party's rights in connection with your use of the Product (each a "Third-Party Claim" and collectively "Third-Party Claims") and you will indemnify for damages finally awarded by a court of competent jurisdiction with respect to any Third-Party Claim. +1.10.3. Control of the Defense or Settlement. For any indemnification obligation covered in section 1.10.1,"Indemnifying Party" means us, "Indemnified Party" means you, and "Claim" means an IP Claim. For any indemnification obligation covered in section 1.10.2, "Indemnifying Party" means you, "Indemnified Party" means us, and "Claim" means a Third-Party Claim. The Indemnified Party must provide the Indemnifying Party with prompt written notice of a Claim; however, the Indemnified Party's failure to provide or delay in providing such notice will not relieve the Indemnifying Party of its obligations under this section except to the extent the Indemnifying Party is prejudiced by the Indemnified Party's failure or delay. The Indemnified Party will give the Indemnifying Party full control of the defense and settlement of the Claim as long as such settlement does not include a financial obligation on or admission of liability by the Indemnified Party. If the Indemnified Party does not do so, then the Indemnified Party waives the Indemnifying Party's indemnification obligations under section 1.10.1 or 1.10.2, as applicable. The Indemnified Party will reasonably cooperate in the defense of the Claim and may appear, at its own expense, through counsel reasonably acceptable to the Indemnifying Party. +1.11. Confidentiality. +1.11.1. Confidentiality Obligations. Except as otherwise provided herein, each party agrees to retain in confidence all information and know-how transmitted or disclosed to the other that the disclosing party has identified as being proprietary and/or confidential or should reasonably be understood to be confidential given the nature of the information and the circumstances surrounding its disclosure, and agrees to make no use of such information and know-how except under the terms of this EULA. However, neither party will have an obligation to maintain the confidentiality of information that (a) it received rightfully from a third party without an obligation to maintain such information in confidence; (b) was known to the receiving party prior to its disclosure by the disclosing party; (c) is or becomes a matter of public knowledge through no fault of the receiving party; or (d) is independently developed by the receiving party without use of the confidential information of the disclosing party. Further, either party may disclose confidential information of the other party as required by governmental or judicial order, provided such party gives the other party prompt written notice prior to such disclosure (unless such prior notice is not permitted by applicable law) and complies with any protective order (or equivalent) imposed on such disclosure. You will treat any source code for the Product as our confidential information and will not disclose, disseminate or distribute such materials to any third party without our prior written permission. Each party's obligations under this section 1.11 will apply during the term of this EULA and for five (5) years following termination of this EULA, provided, however, that (i) obligations with respect to source code will survive forever and (ii) trade secrets will be maintained as such until they fall into the public domain. +1.11.2. Product Benchmark Results. You acknowledge that any benchmark results pertaining to the Product are our confidential information and may not be disclosed or published without our prior written consent. This provision applies regardless of whether the benchmark tests are conducted by you or us. +1.11.3. Remedies for Breach of Confidentiality Obligations. Each party acknowledges that in the event of a breach or threat of breach of this section 1.11, money damages will not be adequate. Therefore, in addition to any other legal or equitable remedies, the non-breaching party will be entitled to seek injunctive or similar equitable relief against such breach or threat of breach without proof of actual injury and without posting of a bond. +1.12. Data Collection and Personal Data. +1.12.1. Data Collection through use of the Product. THE PRODUCT MAY INCLUDE FEATURE(S) THAT (A) GATHER PRODUCT ACTIVATION, USAGE AND/OR ENVIRONMENT INFORMATION, (B) IDENTIFY TRENDS AND/OR BUGS, (C) COLLECT USAGE STATISTICS, AND/OR (D) TRACK OTHER DATA RELATED TO YOUR USE OF THE PRODUCT, AS FURTHER DESCRIBED IN THE CURRENT VERSION OF OUR PRIVACY POLICY AVAILABLE AT https://www.progress.com/legal/privacy-policy. BY YOUR ACCEPTANCE OF THE TERMS OF THIS EULA AND/OR USE OF THE PRODUCT, YOU AUTHORIZE THE COLLECTION, USE AND DISCLOSURE OF THIS DATA FOR THE PURPOSES PROVIDED FOR IN THIS EULA AND/OR THE PRIVACY POLICY. +1.12.2. Additional Data Collection Terms. Depending on the Product licensed to you, this EULA may contain additional data collection terms in section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms) and/or, if we are hosting the Product, in section 2.B (Terms for Hosted Services). +1.12.3. Your Personal Data. If you determine that you will be supplying us with your Personal Data (as defined in the Data Processing Addendum referenced below) for us to process on your behalf, in the provision of maintenance and support services or hosting services (if the Product licensed to you is a Hosted Service) or during the course of any audits we conduct pursuant to section 1.14 (Audit), you may submit a written request at privacy@progress.com for the mutual execution of a Data Processing Addendum substantially in the form we make available at https://www.progress.com/docs/default-source/progress-software/data-processing-addendum.pdf and we will enter into such Data Processing Addendum with you. To the extent there is any conflict between this EULA and such Data Processing Addendum, the Data Processing Addendum will prevail with respect to our handling and processing of your Personal Data. +1.13. Limitation of Liability and Disclaimer of Certain Types of Damages. +1.13.1. Limitation of Liability. EXCEPT FOR A PARTY'S INDEMNIFICATION OBLIGATIONS SET OUT IN THIS EULA OR A PARTY'S BREACH OF ITS CONFIDENTIALITY OBLIGATIONS PURSUANT TO SECTION 1.11 (CONFIDENTIALITY), OR YOUR MATERIAL VIOLATION OF OUR INTELLECTUAL PROPERTY RIGHTS OR OF THE LICENSE RESTRICTIONS SET OUT IN THIS EULA, TO THE EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL EITHER PARTY'S LIABILITY FOR ALL COSTS, DAMAGES, AND EXPENSES ARISING OUT OF OR RELATED TO THIS EULA WHETHER BASED UPON WARRANTY, CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE AT LAW EXCEED, IN THE AGGREGATE, THE FEES PAID TO US FOR THE PRODUCT AND/OR SERVICE THAT IS THE SUBJECT OF THE CLAIM, PROVIDED, HOWEVER, THAT IF THE FEES PAID FOR SUCH PRODUCT AND/OR SERVICE ARE PAID ON A RECURRING BASIS, THEN THE NOT TO EXCEED LIMIT WILL BE THE FEES PAID TO US FOR THE PRODUCT AND/OR SERVICE DURING THE TWELVE (12) MONTH PERIOD IMMEDIATELY PRECEDING THE DATE THE CLAIM AROSE. OUR AFFILIATES AND LICENSORS, AND THE SUPPLIERS TO US, OUR AFFILIATES OR LICENSORS, WILL, TO THE EXTENT PERMITTED BY APPLICABLE LAW, HAVE NO LIABILITY TO YOU OR TO ANY OTHER PERSON OR ENTITY FOR DAMAGES, DIRECT OR OTHERWISE, ARISING OUT OF THIS EULA, INCLUDING, WITHOUT LIMITATION, DAMAGES IN CONNECTION WITH THE PERFORMANCE OR OPERATION OF OUR PRODUCTS OR OUR PERFORMANCE OF SERVICES. +1.13.2 Disclaimer of Certain Types of Damages. EXCEPT FOR A PARTY'S INDEMNIFICATION OBLIGATIONS SET OUT IN THIS EULA OR YOUR MATERIAL VIOLATION OF OUR INTELLECTUAL PROPERTY RIGHTS OR THE LICENSE RESTRICTIONS SET OUT IN THIS EULA, TO THE EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL EITHER PARTY, ITS AFFILIATES OR ITS LICENSORS OR THEIR RESPECTIVE SUPPLIERS BE LIABLE FOR ANY SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL, PUNITIVE OR TORT DAMAGES ARISING IN CONNECTION WITH THIS EULA OR EITHER PARTY'S PERFORMANCE UNDER THIS EULA OR THE PERFORMANCE OF OUR PRODUCTS, OR FOR ANY DAMAGES RESULTING FROM LOSS OF USE, LOSS OF OPPORTUNITY, LOSS OF DATA, LOSS OF REVENUE, LOSS OF PROFITS, OR LOSS OF BUSINESS, EVEN IF THE PARTY, ITS AFFILIATES, ITS LICENSORS, OR ANY OF THEIR RESPECTIVE SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF THOSE DAMAGES. +1.14. Audit. We may install and use automated license tracking, management and/or enforcement solutions with the Product, which you may not disrupt or alter. You will maintain records in connection with this EULA and the use of the Product and any Updates and/or services provided hereunder. Such records will include at a minimum the number of licenses purchased and being used by you. At our expense and with reasonable written notice to you, we or a third party appointed by us may audit the records, and if necessary and as applicable, the systems on which the Product or any Update is installed for the sole purpose of ensuring compliance with the terms of this EULA. We will have the right to conduct audits as necessary. These audits may be conducted on site at a location where you have installed the Product, remotely from our offices, or a combination of both, if applicable to the Product. On-site audits will be conducted during regular business hours, and neither on-site nor remote audits will interfere unreasonably with your business operations. You agree to share with us copies of all records referenced herein, as well as Product log files and other information reasonably requested by us promptly following such request, but in no event more than five (5) business days following receipt of our written request (or such longer period, if applicable, that we specify in the written request). We will treat all such information obtained or accessed by us during the audit as confidential information pursuant to section 1.11 (Confidentiality) for use by us only as necessary to ensure compliance with and enforcement of the terms of this EULA. If any audit reveals that you have underpaid license, maintenance and support or subscription fees, you will be invoiced for all such underpaid fees based on our list price in effect at the time the audit is completed. If the underpaid fees exceed five percent (5%) of the fees previously paid by you, then you will also pay our reasonable costs of conducting the audit and enforcement of this EULA. +1.15. Termination. +1.15.1. Termination for Breach. We may terminate this EULA by written notice at any time if you do not comply with any of your obligations under this EULA and fail to cure such failure to our satisfaction within thirty (30) days after such notice. This remedy will not be exclusive and will be in addition to any other remedies which we may have under this EULA or otherwise. +1.15.2. Effect of Termination. Upon expiration of your license term to the Product (if applicable) or earlier termination of this EULA, your license to access and/or use the Product and/or distribute the Redistributables (if applicable) will terminate. You must immediately cease use of the Product and destroy all copies of the Product in your possession (and required any Permitted Third Parties to do the same). Any licenses you have granted to the Redistributables in accordance with the terms and conditions of this EULA will, unless otherwise specified in section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms), survive termination of this EULA. +1.15.3. Survival. Any provisions of this EULA containing licensing restrictions, warranties and warranty disclaimers, confidentiality obligations, limitations of liability and/or indemnity terms, audits rights, and any term of this EULA which, by its nature, is intended to survive termination or expiration, will remain in effect following any termination or expiration if this EULA, as will your obligation to pay any fees accrued and owing to us as of termination or expiration. +1.16. Assignment. You may not, without our prior written consent, assign or novate this EULA, any of your rights or obligations under this EULA, or the Products or any of our Confidential Information, in whole or in part, by operation of law, sale of assets, merger or otherwise, to any other party, including any parent, subsidiary or affiliated entity. Your Change of Control will constitute an assignment for purposes of the preceding sentence. A "Change of Control" will include, but not be limited to, any merger, consolidation, amalgamation, reorganization or sale, transfer or exchange of the capital stock or equity interests of you in a transaction or series of transactions which results in the holders of your capital stock or equity interests holding less than 50% of the outstanding capital stock or equity interests immediately following such transaction(s). +1.17. Choice of Law. This EULA is governed by the laws of the Commonwealth of Massachusetts, U.S.A., without regard to the conflict of laws principles thereof. If any dispute, controversy, or claim cannot be resolved by a good-faith discussion between the parties, then it will be submitted for resolution to a state or federal court in Boston, Massachusetts, USA, and the parties hereby irrevocably and unconditionally agree to submit to the exclusive jurisdiction and venue of such court. The Uniform Computer Information Transactions Act and the United Nations Convention on the International Sale of Goods will not apply to this EULA. +1.18. Publicity. You agree that we may, in our sole discretion, publicize your use of the Product, and you license to us (and our Affiliates and necessary sublicensees) any intellectual property rights required to allow us (and our Affiliates and necessary sublicensees) to use your name, trade name(s), trademark(s), service mark(s), logo(s) and domain name(s) in connection with such publicity. +1.19. Miscellaneous. +1.19.1. Notices. Notices of termination, material breach, your insolvency or an indemnifiable claim ("Legal Notices") must be clearly identified as Legal Notices and sent via overnight courier or certified mail with proof of delivery to the following addresses: For us: 14 Oak Park Drive, Bedford, MA 01730, Attention: General Counsel. For you: your address set out in the Order. Legal Notices sent in accordance with the above will be effective upon the second business day after mailing. Either party may change its address for receipt of notices upon written notice to the other party. +1.19.2. Entire Agreement. This EULA, and any terms expressly incorporated herein by reference, will constitute the entire agreement between you and us with respect to the subject matter of this EULA and supersedes all prior and contemporaneous communications, oral or written, signed or unsigned, regarding such subject matter. Use of any purchase order or other document you supply in connection with this EULA will be for administrative convenience only and all terms and conditions stated therein will be void and of no effect. Except as otherwise expressly contemplated in this EULA, this EULA may not be modified or amended other than in writing signed by you and us. +1.19.3. Severability. If any provision of this EULA is terminated or held by a court of competent jurisdiction to be invalid, illegal, or unenforceable, the remainder of this EULA will remain in full force and effect. +1.19.4. Waiver. Failure or delay in exercising any right, power, privilege or remedy hereunder will not constitute a waiver thereof. A waiver of default will not operate as a waiver of any other default or of the same type of default on future occasions. +1.19.5. English Language. This EULA has been drawn up in English at the express wish of the parties. Le present contrat a ete redige en anglais a la demande expresse des parties. +1.19.6. Force Majeure. Neither you nor we will be liable for any delay or failure to take any action required under this EULA (except for payment) due to any cause beyond the reasonable control of you or us, as the case may be, including, but not limited to unavailability or shortages of labour, materials, or equipment, failure or delay in the delivery of vendors and suppliers and delays in transportation. +1.19.7. Our Use of Our Affiliates. We may, at our discretion, engage one or more of our Affiliates in the fulfilment of our obligations, including, our obligations for delivery of the Product to you and/or the provision of any maintenance and support services. + +2.A. TERMS FOR ON-PREMISE PRODUCTS +2.A.1. Delivery. Unless otherwise specified by us, On-Premise Product(s) will be provided to you via electronic delivery, and delivery is deemed complete when the On-Premise Product(s) is/are made available at the electronic software download site specified by us and you are e-mailed or otherwise provided with any necessary instructions, password and/or license keys required for you to be able to access, download and install the On-Premise Product(s). If we provide the On-Premise Product(s) on physical media, shipping terms will be FOB shipping point. +2.A.2. Updates. Each Update to an On-Premise Product replaces part or all of the On-Premise Product (or earlier Update) previously licensed to you ("Replaced Product") and will terminate such previously licensed Replaced Product to the extent replaced by the Update; provided, however, that you may continue to operate the Replaced Product for up to ninety (90) days from delivery of the Update to allow you to complete your implementation of the Update. You must cease all use of the Replaced Product at the end of the ninety (90) day period. Each Update will be subject to the terms and conditions of the license agreement accompanying the Update which must be accepted by you at the time you download or install the Update. If you do not agree to the license agreement accompanying the Update, do not download or install the Update. +2.A.3. Cloud Environment. You may upload the On-Premise Product(s) licensed to you pursuant to this EULA onto a cloud instance supplied by a third party, provided that the operation of the On-Premise Product(s) in the cloud instance complies with all license model restrictions and usage limitations applicable to the On-Premise Product(s). You may also allow the third party to upload, install, operate and/or use the On-Premise Products on the cloud instance, provided that the third party's access to and use of the On-Premise Products is solely for your benefit in accordance with the terms of this EULA. The third party will be considered a Permitted Third Party, and you will be responsible for the Permitted Third Party's compliance with this EULA in accordance with section 1.2.3 (Third Party Use). + +2.B. TERMS FOR HOSTED SERVICES THIS SECTION IS NOT APPLICABLE + +3. PRODUCT FAMILY SPECIFIC TERMS +This section specifies terms and conditions that are applicable to the following On-Premise Products: FiddlerCore Embedded Engine. The terms and conditions set forth in this Section 3 and in Section 4 apply to the Product. The specific Product(s) to which you are granted a license hereunder shall be only those Product(s) identified in the Order. + +Default License Type for each of the above-referenced On-Premise Products: Perpetual, with the exception of any Product obtained under a Trial License. +3.1. Product Family Definitions. +Any defined term used in this section 3 (Product Family Specific Terms) but not defined herein will have the meaning ascribed to it in section 1 (General Terms and Conditions) or section 2.A (Terms for On-Premise Products). +3.1.3. "Licensed Developer" means one of your employees or third-party consultants authorized to develop Your Integrated Product specifically for you using the Product Package in accordance with this EULA. Each Licensed Developer is an Authorized User as defined in section 1.1.3 and all terms and conditions in section 1 (General Terms and Conditions) and section 2.A (Terms for On-Premise Software) pertaining to Authorized Users will apply to a Licensed Developer. +3.1.2. "Permitted End User" means your own employees or subcontractors, each of whom is authorized to use the Software as part of Your Integrated Product solely for Your benefit and in accordance with the requirements of this EULA. +3.1.4. "Product Package" means the Product and the Documentation, collectively. +3.1.5. "Your Integrated Product" means a single internal-facing Licensee software product into which the Product is integrated. "Your Integrated Product" as defined herein, is further limited to Licensee's software product which: (i) is developed by Your Licensed Developers; (ii) adds substantial functionality beyond the functionality provided by the incorporated components of the Product; (iii) has functionalities which would be considered improvements within the natural progression of the software product; and (iv) is not a commercial alternative for, or competitive in the marketplace with, the Product or any components of the Product. +3.2. Restrictions on Eligibility to Purchase a License. Content Management System, .NET, PHP, Java and/or JavaScript component vendors are not allowed to use the Product Package without our express permission. If you or the company you represent is a Content Management System, .NET, PHP, Java or JavaScript component vendor, you may not purchase a license for or use the Product Package unless you contact us directly and obtain permission. +3.3. Required Quantity of Licensed Developers. Licensed Developers must correspond to the maximum number of seats you have purchased for the Product Package from us hereunder. This means that, at any given time, the number of Licensed Developers cannot exceed the number of seats that you have purchased from us and for which you have paid us all the applicable license fees pursuant to this EULA. The Product Package is in "use" on a computer when it is loaded into temporary memory (i.e. RAM) or installed into permanent memory (e.g. hard disk or other storage device). Your Licensed Developers may install the Product Package on multiple machines, so long as the Product Package is not being used simultaneously for development purposes at any given time by more Licensed Developers than you have seats. +3.4. Trial License. +3.4.1. License Grant. If you downloaded the free trial license for the Product Package ("Trial License"), then your use of the Product Package is subject to the limitations and conditions specified in section 1.2.5 (Limitations on Evaluation or Trial Licenses). Without limiting the foregoing, you are not allowed to integrate the Product Package into end products or use it for any commercial, productive or training purpose. You may not redistribute the Product Package. The term of the Trial License will be 30 days. If you wish to continue using the Product Package beyond the expiration of the Trial License, you must purchase the applicable Internal Business Systems License, as defined in section 4 (Product-Specific Terms) or a FiddlerCore Embedded Engine Commercial License, as referenced at the end of section 4.A.1.3. +3.4.2. Support - Trial License. As described in greater detail here: http://www.telerik.com/purchase/support-plans, and subject to the limitations and restrictions described in the Fair Usage Policy, you are entitled to enter support requests via our ticketing system with a 72 hour response time (excluding Saturdays, Sundays and holidays) for thirty (30) days after download of your initial Trial License. For avoidance of doubt, you are not entitled to additional support requests for any Trial Licenses of the same or successor Products downloaded after your initial download (e.g. to evaluate a new release), for a period of one (1) year from the date of your initial download. +3.4.3. Updates - Trial License. At our sole discretion, you may receive certain Updates for the Product Package version you are evaluating. If Licensor makes Updates to the Product Package available to you, such Updates replace and/or supplement (and may disable) the version of the Product Package that formed the basis for your eligibility for the Update. You may use the resulting updated Product Package only in accordance with the terms of this Trial License. For the avoidance of doubt, Updates do not restart the term of the Trial License. +3.5. Support and Updates - Internal Business Systems License +3.5.1. Support. For any applicable period for which you have purchased maintenance and support (the "Maintenance Period"), you will receive minor and major Updates for the Product Package, and will be entitled to receive support, each as described in further detail below. Except as otherwise set forth in Section 4, during the Maintenance Period, you are entitled to either the "Lite", "Priority", or "Ultimate" support package as determined at time of purchase and set forth on the Order and described in greater detail here: http://www.telerik.com/purchase/support-plans subject to the limitations and restrictions described in the following Fair Usage Policy. You will lose the right to receive support and Updates at the end of your Maintenance Period, unless you renew your access to updates and support for additional Maintenance Period(s) with us at additional cost. Your level of support (Lite, Priority or Ultimate) is determined at the time of initial license purchase. You may upgrade your level of support for individually purchased Products at any time during an active Maintenance Period provided we continue to make such levels of support generally available. Any support level upgrades (if purchased) and all access to support and Updates thereunder will be bound to the term of the then active Maintenance Period (i.e. the renewal/expiration date of your Maintenance Period will not change as a result of the support level upgrade). You generally may not downgrade your level of support and there is no automated mechanism available to you by which to downgrade. The following additional terms apply to support hereunder: + (a) We may apply a Fair Usage Policy that allows us to limit or terminate your access to any or all of the support services if your use of the support services is determined by us, in our sole and reasonable discretion, to be excessive. + (b) In no event will we provide support of any kind to your Permitted End Users. +3.5.2. Updates. During the Maintenance Period, you will be eligible to receive all major Updates and minor Updates for the version of the Product Package that you license hereunder. Notwithstanding anything to the contrary in Section 2.A.2., you may use the resulting updated Product Package in accordance with the terms of this EULA, except that: (i) to the extent the Update contains new or updated Special Notices, your use of any third party components shall be subject to Section 1.2.7 of this EULA and the Special Notices accompanying the Update; and, (ii) to the extent the Update contains new Products, components, features and/or functionality which are subject to additional or conflicting terms and conditions than those set forth in this EULA, your use of such new Products, components, features and/or functionality will be subject to the terms and conditions of the license agreement accompanying the Update which must be accepted by you at the time you download or install the Update. If you do not agree to such additional or conflicting terms and conditions, do not download or install the Update. +3.7. No Publicity. Licensee may not publicize or disclose its use of the Product Package (or any portion thereof) in any way nor use Licensor's name, trademarks, service marks or logos without Licensor's prior written consent. For avoidance of doubt, use of the Product within Your Integrated Product (if permitted in accordance with Section 4) shall be "white label". +3.8. Destruction Requirement upon Termination. Upon termination of this EULA, all licenses granted to you hereunder will terminate automatically and the terms of section 1.15.2 (Effect of Termination) will apply. Additionally, you must destroy: (i) all copies of the Product Package not integrated into a live, functioning instance(s) of Your Integrated Product(s) already installed, implemented and deployed for your Permitted End Users, and (ii) any product and company logos provided by us in connection with this EULA. +3.9. Product Discontinuance. We reserve the right to discontinue any Product Package or any component of any Product Package, whether offered as a standalone product or solely as a component, at any time. However, we are obligated to provide support in accordance with the terms of this EULA for the discontinued Product Package or any discontinued component of the Product Package for a period of one year after the date of discontinuance (provided you are under an active Maintenance Period). + +4. PRODUCT-SPECIFIC TERMS +Any defined term used in this section 4 (Product-Specific Terms) but not defined herein will have the meaning ascribed to it in section 1 (General Terms and Conditions), section 2.A (Terms for On-Premise Products), or 3 (Product Family Specific Terms). +4.A FiddlerCore Embedded Engine. +This section specifies terms and conditions that are applicable to the FiddlerCore Embedded Engine. +4.A.1. License. +Subject to the terms of this EULA, we grant to you the following limited, non-exclusive, non-transferable license (the "License") to use the Product Package as set out herein. You are granted either a Trial License pursuant to section 3.4 (Trial License) or an internal business systems license ("Internal Business Systems License") pursuant to section 4.A.1.1 (Internal Business Systems License). Which version of the License applies (i.e., Trial License or Internal Business Systems License) is determined at the time of the License purchase. +4.A.1.1 Internal Business Systems License +If You purchase an Internal Business Systems License with Updates and Support, your Licensed Developers may use the Product Package in object code form only in the development of one (1) Your Integrated Product. In addition, for the applicable period of one (1), two (2), or three (3) years from the date on which you purchased a license to use the Product Package, for which you have purchased updates and support (the "Subscription Period"), you will receive minor and major updates for the Product Package, as well as the "Priority" support package, each as described in 4.A.1.2. +4.A.1.2 Maintenance and Support- Internal Business Systems License +During the Subscription Period, you are entitled to the "Priority" support package as described in greater detail here: http://www.telerik.com/purchase/support-plans/, subject to the limitations and restrictions described herein. +Licensor may limit or terminate your access to any or all of the support services available under the "Priority" support package if your use of the support services is determined by Licensor, in its sole and reasonable discretion, to be excessive. + +4.A.1.3 Third-Party Libraries + +In addition to and without limiting the applicability of any Special Notices, the Product Package installation includes optional third-party libraries which are licensed by third-parties under their own separate terms. If you choose to utilize these libraries, you must comply with the terms outlined by their owners, each as described in section 4.A.1.3.1 and 4.A.1.3.2. + +4.A.1.3.1 Library BCMakeCert.dll + +The included library BCMakeCert.dll is the C# version of "The Legion of the Bouncy Castle" http://www.bouncycastle.org/ and its use and redistribution are governed by the terms specified by its owners. See http://www.bouncycastle.org/csharp/licence.html for details. + +4.A.1.3.2 Library MakeCert.exe + +The included library MakeCert.exe is Microsoft's certificate generation library. This library is redistributed under the license terms included with Visual Studio 2008. + +4.A.1.3 Redistribution + +If you have purchased an Internal Business Systems License, subject to the terms of this EULA, Licensee is granted a limited, non-transferable right to internally distribute the Product in object code form only as embedded in Your Integrated Product to your Permitted End Users for use solely within your organization. You are not permitted to distribute the Product pursuant to this section: (i) in any format other than in object form, (ii) as a standalone product, or (iii) as a part of any product other than Your Integrated Product, or (iv) in any manner which causes the Product to be stored on a server not owned or controlled by you. You must ensure that the Product is not distributed in any form that allows it to be reused by any application other than Your Integrated Product. Licensee is not allowed to and is expressly prohibited from granting its Permitted End Users any right to further sublicense the Product. For avoidance of doubt, your Permitted End Users are not permitted to use the Product, or any portions thereof, for software development or application development purposes unless they also purchase a separate commercial license from Licensor for each of the users. This EULA does not grant you a license or any rights to use or distribute the FiddlerCore Embedded Engine in a public facing, redistributable Your Integrated Product. For the FiddlerCore Embedded Engine Commercial License, please contact sales at sales@telerik.com. + + + diff --git a/packages/BCMakeCert.2.0.9/THIRD-PARTY-NOTICES.txt b/packages/BCMakeCert.2.0.9/THIRD-PARTY-NOTICES.txt new file mode 100644 index 0000000..b441e13 --- /dev/null +++ b/packages/BCMakeCert.2.0.9/THIRD-PARTY-NOTICES.txt @@ -0,0 +1,86 @@ +Progress Telerik FiddlerCore v5 + +Copyright © 2010-2019 Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved. + +Portions of the Product include certain open source and commercial third-party components listed below (“Third-Party Components”). The authors of the Third-Party Components require Progress Software Corporation (“PSC”) to include the following notices and additional licensing terms as a condition of PSC’s use of such Third-Party Components. You acknowledge that the authors of the Third-Party Components have no obligation to provide support to you for the Third-Party Components or the Product. You hereby undertake to comply with all licenses related to the applicable Third-Party Components. Notwithstanding anything to the contrary, to the extent that any of the terms and conditions of the Progress Agreement conflict, vary, or are in addition to the terms and conditions of the aforementioned third-party licenses for these technologies, such terms and conditions are offered by PSC alone and not by any other party. + +1. Special Notices Regarding Open Source Third Party Components incorporated in the Product: + +(1) MIT-Style Licenses: + +(a) Progress Telerik FiddlerCore v5 incorporates Bouncy Castle C# API v1.8.1. Such technology is subject to the following terms and conditions: +LICENSE +Copyright (c) 2000 - 2019 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org) +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +(b) Progress Telerik FiddlerCore v5 incorporates Windows SDK for Google Analytics v1.5.0.0.Feb.2017. Such technology is subject to the following terms and conditions: +MIT License +Copyright (c) 2017 .NET Foundation +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +(2) Microsoft Public License (Ms-PL): + +Progress Telerik FiddlerCore v5 incorporates DotNetZip Library v1.13.4. Such technology is subject to the following terms and conditions: +Software Licenses that apply to the DotNetZip library and tools +As DotNetZip includes work derived from other projects, you are required to comply with the terms and conditions for each of them. These licenses include BSD, Apache, and zlib. +To use the software, you must accept the licenses. If you do not accept the licenses, do not use the software. +Original intellectual property in DotNetZip is provided under the Ms-PL: +Copyright (c) 2006 - 2011 Dino Chiesa +Copyright (c) 2006, 2007, 2008, 2009 Dino Chiesa and Microsoft Corporation. +Microsoft Public License (Ms-PL) +This license governs use of the accompanying software, the DotNetZip library ("the software"). If you use the software, you accept this license. If you do not accept the license, do not use the software. +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. +A "contribution" is the original software, or any additions or changes to the software. +A "contributor" is any person that distributes its contribution under this license. +"Licensed patents" are a contributor's patent claims that read directly on its contribution. +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. +(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. +-------------------------------------------------------------- +The managed ZLIB code included in Ionic.Zlib.dll and Ionic.Zip.dll is derived from jzlib. +jzlib ( https://github.com/ymnk/jzlib ) is provided under a BSD-style (3 clause) +Copyright (c) 2000,2001,2002,2003 ymnk, JCraft, Inc. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------- +The jzlib library, itself, is a re-implementation of ZLIB v1.1.3 in pure Java. +zlib is provided under the zlib license: +Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler + The ZLIB software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + Jean-loup Gailly jloup@gzip.org? Mark Adler madler@alumni.caltech.edu +-------------------------------------------------------------- +The managed BZIP2 code included in Ionic.BZip2.dll and Ionic.Zip.dll is modified code, based on Java code in the Apache commons compress library. +Apache Commons Compress ( http://commons.apache.org/proper/commons-compress/ ) is provided under the Apache 2 license: +Apache Commons Compress +Copyright 2002-2014 The Apache Software Foundation + Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. +Many thanks to Julian Seward for the original C implementation of BZip2 ( http://www.bzip.org/ ). + + +2. Special Notices Regarding Commercially Licensed Third-Party Components incorporated in the Product: None + + +NOTICE FROM PROGRESS SOFTWARE CORPORATION: Additional notices may be included in the release notes or other documentation that accompanies updates received in connection with support of the Product. + + +Updated 11/6/2019 diff --git a/packages/BCMakeCert.2.0.9/icon.png b/packages/BCMakeCert.2.0.9/icon.png new file mode 100644 index 0000000..0f81c91 Binary files /dev/null and b/packages/BCMakeCert.2.0.9/icon.png differ diff --git a/packages/BCMakeCert.2.0.9/lib/net40/BCMakeCert.dll b/packages/BCMakeCert.2.0.9/lib/net40/BCMakeCert.dll new file mode 100644 index 0000000..4571692 Binary files /dev/null and b/packages/BCMakeCert.2.0.9/lib/net40/BCMakeCert.dll differ diff --git a/packages/BCMakeCert.2.0.9/lib/netstandard2.0/BCMakeCert.dll b/packages/BCMakeCert.2.0.9/lib/netstandard2.0/BCMakeCert.dll new file mode 100644 index 0000000..19f4f10 Binary files /dev/null and b/packages/BCMakeCert.2.0.9/lib/netstandard2.0/BCMakeCert.dll differ diff --git a/packages/DotNetZip.1.13.4/.signature.p7s b/packages/DotNetZip.1.13.4/.signature.p7s new file mode 100644 index 0000000..20f545e Binary files /dev/null and b/packages/DotNetZip.1.13.4/.signature.p7s differ diff --git a/packages/DotNetZip.1.13.4/DotNetZip.1.13.4.nupkg b/packages/DotNetZip.1.13.4/DotNetZip.1.13.4.nupkg new file mode 100644 index 0000000..611052b Binary files /dev/null and b/packages/DotNetZip.1.13.4/DotNetZip.1.13.4.nupkg differ diff --git a/packages/DotNetZip.1.13.4/lib/net40/DotNetZip.dll b/packages/DotNetZip.1.13.4/lib/net40/DotNetZip.dll new file mode 100644 index 0000000..2b6455d Binary files /dev/null and b/packages/DotNetZip.1.13.4/lib/net40/DotNetZip.dll differ diff --git a/packages/DotNetZip.1.13.4/lib/net40/DotNetZip.pdb b/packages/DotNetZip.1.13.4/lib/net40/DotNetZip.pdb new file mode 100644 index 0000000..87522e7 Binary files /dev/null and b/packages/DotNetZip.1.13.4/lib/net40/DotNetZip.pdb differ diff --git a/packages/DotNetZip.1.13.4/lib/net40/DotNetZip.xml b/packages/DotNetZip.1.13.4/lib/net40/DotNetZip.xml new file mode 100644 index 0000000..bcb5bbf --- /dev/null +++ b/packages/DotNetZip.1.13.4/lib/net40/DotNetZip.xml @@ -0,0 +1,18529 @@ + + + + DotNetZip + + + + + Delivers the remaining bits, left-aligned, in a byte. + + + + This is valid only if NumRemainingBits is less than 8; + in other words it is valid only after a call to Flush(). + + + + + + Reset the BitWriter. + + + + This is useful when the BitWriter writes into a MemoryStream, and + is used by a BZip2Compressor, which itself is re-used for multiple + distinct data blocks. + + + + + + Write some number of bits from the given value, into the output. + + + + The nbits value should be a max of 25, for safety. For performance + reasons, this method does not check! + + + + + + Write a full 8-bit byte into the output. + + + + + Write four 8-bit bytes into the output. + + + + + Write all available byte-aligned bytes. + + + + This method writes no new output, but flushes any accumulated + bits. At completion, the accumulator may contain up to 7 + bits. + + + This is necessary when re-assembling output from N independent + compressors, one for each of N blocks. The output of any + particular compressor will in general have some fragment of a byte + remaining. This fragment needs to be accumulated into the + parent BZip2OutputStream. + + + + + + Writes all available bytes, and emits padding for the final byte as + necessary. This must be the last method invoked on an instance of + BitWriter. + + + + Knuth's increments seem to work better than Incerpi-Sedgewick here. + Possibly because the number of elems to sort is usually small, typically + <= 20. + + + + BZip2Compressor writes its compressed data out via a BitWriter. This + is necessary because BZip2 does byte shredding. + + + + + The number of uncompressed bytes being held in the buffer. + + + + I am thinking this may be useful in a Stream that uses this + compressor class. In the Close() method on the stream it could + check this value to see if anything has been written at all. You + may think the stream could easily track the number of bytes it + wrote, which would eliminate the need for this. But, there is the + case where the stream writes a complete block, and it is full, and + then writes no more. In that case the stream may want to check. + + + + + + Accept new bytes into the compressor data buffer + + + + This method does the first-level (cheap) run-length encoding, and + stores the encoded data into the rle block. + + + + + + Process one input byte into the block. + + + + + To "process" the byte means to do the run-length encoding. + There are 3 possible return values: + + 0 - the byte was not written, in other words, not + encoded into the block. This happens when the + byte b would require the start of a new run, and + the block has no more room for new runs. + + 1 - the byte was written, and the block is not full. + + 2 - the byte was written, and the block is full. + + + + 0 if the byte was not written, non-zero if written. + + + + Append one run to the output block. + + + + + This compressor does run-length-encoding before BWT and etc. This + method simply appends a run to the output block. The append always + succeeds. The return value indicates whether the block is full: + false (not full) implies that at least one additional run could be + processed. + + + true if the block is now full; otherwise false. + + + + Compress the data that has been placed (Run-length-encoded) into the + block. The compressed data goes into the CompressedBytes array. + + + + Side effects: 1. fills the CompressedBytes array. 2. sets the + AvailableBytesOut property. + + + + + This is the most hammered method of this class. + +

+ This is the version using unrolled loops. +

+
+ + Method "mainQSort3", file "blocksort.c", BZip2 1.0.2 + + + Array instance identical to sfmap, both are used only + temporarily and independently, so we do not need to allocate + additional memory. + + + + A read-only decorator stream that performs BZip2 decompression on Read. + + + + + Compressor State + + + + + Create a BZip2InputStream, wrapping it around the given input Stream. + + + + The input stream will be closed when the BZip2InputStream is closed. + + + The stream from which to read compressed data + + + + Create a BZip2InputStream with the given stream, and + specifying whether to leave the wrapped stream open when + the BZip2InputStream is closed. + + The stream from which to read compressed data + + Whether to leave the input stream open, when the BZip2InputStream closes. + + + + + This example reads a bzip2-compressed file, decompresses it, + and writes the decompressed data into a newly created file. + + + var fname = "logfile.log.bz2"; + using (var fs = File.OpenRead(fname)) + { + using (var decompressor = new Ionic.BZip2.BZip2InputStream(fs)) + { + var outFname = fname + ".decompressed"; + using (var output = File.Create(outFname)) + { + byte[] buffer = new byte[2048]; + int n; + while ((n = decompressor.Read(buffer, 0, buffer.Length)) > 0) + { + output.Write(buffer, 0, n); + } + } + } + } + + + + + + Read data from the stream. + + + + + To decompress a BZip2 data stream, create a BZip2InputStream, + providing a stream that reads compressed data. Then call Read() on + that BZip2InputStream, and the data read will be decompressed + as you read. + + + + A BZip2InputStream can be used only for Read(), not for Write(). + + + + The buffer into which the read data should be placed. + the offset within that data array to put the first byte read. + the number of bytes to read. + the number of bytes actually read + + + + Read a single byte from the stream. + + the byte read from the stream, or -1 if EOF + + + + Indicates whether the stream can be read. + + + The return value depends on whether the captive stream supports reading. + + + + + Indicates whether the stream supports Seek operations. + + + Always returns false. + + + + + Indicates whether the stream can be written. + + + The return value depends on whether the captive stream supports writing. + + + + + Flush the stream. + + + + + Reading this property always throws a . + + + + + The position of the stream pointer. + + + + Setting this property always throws a . Reading will return the + total number of uncompressed bytes read in. + + + + + Calling this method always throws a . + + this is irrelevant, since it will always throw! + this is irrelevant, since it will always throw! + irrelevant! + + + + Calling this method always throws a . + + this is irrelevant, since it will always throw! + + + + Calling this method always throws a . + + this parameter is never used + this parameter is never used + this parameter is never used + + + + Dispose the stream. + + + indicates whether the Dispose method was invoked by user code. + + + + + Close the stream. + + + + + Read n bits from input, right justifying the result. + + + + For example, if you read 1 bit, the result is either 0 + or 1. + + + + The number of bits to read, always between 1 and 32. + + + + Called by createHuffmanDecodingTables() exclusively. + + + Called by recvDecodingTables() exclusively. + + + Freq table collected to save a pass over the data during + decompression. + + + Initializes the tt array. + + This method is called when the required length of the array is known. + I don't initialize it at construction time to avoid unneccessary + memory allocation when compressing small files. + + + + A write-only decorator stream that compresses data as it is + written using the BZip2 algorithm. + + + + + Constructs a new BZip2OutputStream, that sends its + compressed output to the given output stream. + + + + The destination stream, to which compressed output will be sent. + + + + + This example reads a file, then compresses it with bzip2 file, + and writes the compressed data into a newly created file. + + + var fname = "logfile.log"; + using (var fs = File.OpenRead(fname)) + { + var outFname = fname + ".bz2"; + using (var output = File.Create(outFname)) + { + using (var compressor = new Ionic.BZip2.BZip2OutputStream(output)) + { + byte[] buffer = new byte[2048]; + int n; + while ((n = fs.Read(buffer, 0, buffer.Length)) > 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + + + + Constructs a new BZip2OutputStream with specified blocksize. + + the destination stream. + + The blockSize in units of 100000 bytes. + The valid range is 1..9. + + + + + Constructs a new BZip2OutputStream. + + the destination stream. + + whether to leave the captive stream open upon closing this stream. + + + + + Constructs a new BZip2OutputStream with specified blocksize, + and explicitly specifies whether to leave the wrapped stream open. + + + the destination stream. + + The blockSize in units of 100000 bytes. + The valid range is 1..9. + + + whether to leave the captive stream open upon closing this stream. + + + + + Close the stream. + + + + This may or may not close the underlying stream. Check the + constructors that accept a bool value. + + + + + + Flush the stream. + + + + + The blocksize parameter specified at construction time. + + + + + Write data to the stream. + + + + + Use the BZip2OutputStream to compress data while writing: + create a BZip2OutputStream with a writable output stream. + Then call Write() on that BZip2OutputStream, providing + uncompressed data as input. The data sent to the output stream will + be the compressed form of the input data. + + + + A BZip2OutputStream can be used only for Write() not for Read(). + + + + + The buffer holding data to write to the stream. + the offset within that data array to find the first byte to write. + the number of bytes to write. + + + + Indicates whether the stream can be read. + + + The return value is always false. + + + + + Indicates whether the stream supports Seek operations. + + + Always returns false. + + + + + Indicates whether the stream can be written. + + + The return value should always be true, unless and until the + object is disposed and closed. + + + + + Reading this property always throws a . + + + + + The position of the stream pointer. + + + + Setting this property always throws a . Reading will return the + total number of uncompressed bytes written through. + + + + + Calling this method always throws a . + + this is irrelevant, since it will always throw! + this is irrelevant, since it will always throw! + irrelevant! + + + + Calling this method always throws a . + + this is irrelevant, since it will always throw! + + + + Calling this method always throws a . + + this parameter is never used + this parameter is never used + this parameter is never used + never returns anything; always throws + + + + A write-only decorator stream that compresses data as it is + written using the BZip2 algorithm. This stream compresses by + block using multiple threads. + + + This class performs BZIP2 compression through writing. For + more information on the BZIP2 algorithm, see + . + + + + This class is similar to , + except that this implementation uses an approach that employs multiple + worker threads to perform the compression. On a multi-cpu or multi-core + computer, the performance of this class can be significantly higher than + the single-threaded BZip2OutputStream, particularly for larger streams. + How large? Anything over 10mb is a good candidate for parallel + compression. + + + + The tradeoff is that this class uses more memory and more CPU than the + vanilla BZip2OutputStream. Also, for small files, the + ParallelBZip2OutputStream can be much slower than the vanilla + BZip2OutputStream, because of the overhead associated to using the + thread pool. + + + + + + + Constructs a new ParallelBZip2OutputStream, that sends its + compressed output to the given output stream. + + + + The destination stream, to which compressed output will be sent. + + + + + This example reads a file, then compresses it with bzip2 file, + and writes the compressed data into a newly created file. + + + var fname = "logfile.log"; + using (var fs = File.OpenRead(fname)) + { + var outFname = fname + ".bz2"; + using (var output = File.Create(outFname)) + { + using (var compressor = new Ionic.BZip2.ParallelBZip2OutputStream(output)) + { + byte[] buffer = new byte[2048]; + int n; + while ((n = fs.Read(buffer, 0, buffer.Length)) > 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + + + + Constructs a new ParallelBZip2OutputStream with specified blocksize. + + the destination stream. + + The blockSize in units of 100000 bytes. + The valid range is 1..9. + + + + + Constructs a new ParallelBZip2OutputStream. + + the destination stream. + + whether to leave the captive stream open upon closing this stream. + + + + + Constructs a new ParallelBZip2OutputStream with specified blocksize, + and explicitly specifies whether to leave the wrapped stream open. + + + the destination stream. + + The blockSize in units of 100000 bytes. + The valid range is 1..9. + + + whether to leave the captive stream open upon closing this stream. + + + + + The maximum number of concurrent compression worker threads to use. + + + + + This property sets an upper limit on the number of concurrent worker + threads to employ for compression. The implementation of this stream + employs multiple threads from the .NET thread pool, via + ThreadPool.QueueUserWorkItem(), to compress the incoming data by + block. As each block of data is compressed, this stream re-orders the + compressed blocks and writes them to the output stream. + + + + A higher number of workers enables a higher degree of + parallelism, which tends to increase the speed of compression on + multi-cpu computers. On the other hand, a higher number of buffer + pairs also implies a larger memory consumption, more active worker + threads, and a higher cpu utilization for any compression. This + property enables the application to limit its memory consumption and + CPU utilization behavior depending on requirements. + + + + By default, DotNetZip allocates 4 workers per CPU core, subject to the + upper limit specified in this property. For example, suppose the + application sets this property to 16. Then, on a machine with 2 + cores, DotNetZip will use 8 workers; that number does not exceed the + upper limit specified by this property, so the actual number of + workers used will be 4 * 2 = 8. On a machine with 4 cores, DotNetZip + will use 16 workers; again, the limit does not apply. On a machine + with 8 cores, DotNetZip will use 16 workers, because of the limit. + + + + For each compression "worker thread" that occurs in parallel, there is + up to 2mb of memory allocated, for buffering and processing. The + actual number depends on the property. + + + + CPU utilization will also go up with additional workers, because a + larger number of buffer pairs allows a larger number of background + threads to compress in parallel. If you find that parallel + compression is consuming too much memory or CPU, you can adjust this + value downward. + + + + The default value is 16. Different values may deliver better or + worse results, depending on your priorities and the dynamic + performance characteristics of your storage and compute resources. + + + + The application can set this value at any time, but it is effective + only before the first call to Write(), which is when the buffers are + allocated. + + + + + + Close the stream. + + + + This may or may not close the underlying stream. Check the + constructors that accept a bool value. + + + + + + Flush the stream. + + + + + The blocksize parameter specified at construction time. + + + + + Write data to the stream. + + + + + Use the ParallelBZip2OutputStream to compress data while + writing: create a ParallelBZip2OutputStream with a writable + output stream. Then call Write() on that + ParallelBZip2OutputStream, providing uncompressed data as + input. The data sent to the output stream will be the compressed + form of the input data. + + + + A ParallelBZip2OutputStream can be used only for + Write() not for Read(). + + + + + The buffer holding data to write to the stream. + the offset within that data array to find the first byte to write. + the number of bytes to write. + + + + Indicates whether the stream can be read. + + + The return value is always false. + + + + + Indicates whether the stream supports Seek operations. + + + Always returns false. + + + + + Indicates whether the stream can be written. + + + The return value depends on whether the captive stream supports writing. + + + + + Reading this property always throws a . + + + + + The position of the stream pointer. + + + + Setting this property always throws a . Reading will return the + total number of uncompressed bytes written through. + + + + + The total number of bytes written out by the stream. + + + This value is meaningful only after a call to Close(). + + + + + Calling this method always throws a . + + this is irrelevant, since it will always throw! + this is irrelevant, since it will always throw! + irrelevant! + + + + Calling this method always throws a . + + this is irrelevant, since it will always throw! + + + + Calling this method always throws a . + + this parameter is never used + this parameter is never used + this parameter is never used + never returns anything; always throws + + + + Returns the "random" number at a specific index. + + the index + the random number + + + + An enum that provides the different self-extractor flavors + + + + + A self-extracting zip archive that runs from the console or + command line. + + + + + A self-extracting zip archive that presents a graphical user + interface when it is executed. + + + + + The options for generating a self-extracting archive. + + + + + The type of SFX to create. + + + + + The command to run after extraction. + + + + + This is optional. Leave it empty (null in C# or Nothing in + VB) to run no command after extraction. + + + + If it is non-empty, the SFX will execute the command specified in this + string on the user's machine, and using the extract directory as the + working directory for the process, after unpacking the archive. The + program to execute can include a path, if you like. If you want to execute + a program that accepts arguments, specify the program name, followed by a + space, and then the arguments for the program, each separated by a space, + just as you would on a normal command line. Example: program.exe arg1 + arg2. The string prior to the first space will be taken as the + program name, and the string following the first space specifies the + arguments to the program. + + + + If you want to execute a program that has a space in the name or path of + the file, surround the program name in double-quotes. The first character + of the command line should be a double-quote character, and there must be + a matching double-quote following the end of the program file name. Any + optional arguments to the program follow that, separated by + spaces. Example: "c:\project files\program name.exe" arg1 arg2. + + + + If the flavor of the SFX is SelfExtractorFlavor.ConsoleApplication, + then the SFX starts a new process, using this string as the post-extract + command line. The SFX waits for the process to exit. The exit code of + the post-extract command line is returned as the exit code of the + command-line self-extractor exe. A non-zero exit code is typically used to + indicated a failure by the program. In the case of an SFX, a non-zero exit + code may indicate a failure during extraction, OR, it may indicate a + failure of the run-after-extract program if specified, OR, it may indicate + the run-after-extract program could not be fuond. There is no way to + distinguish these conditions from the calling shell, aside from parsing + the output of the SFX. If you have Quiet set to true, you may not + see error messages, if a problem occurs. + + + + If the flavor of the SFX is + SelfExtractorFlavor.WinFormsApplication, then the SFX starts a new + process, using this string as the post-extract command line, and using the + extract directory as the working directory for the process. The SFX does + not wait for the command to complete, and does not check the exit code of + the program. If the run-after-extract program cannot be fuond, a message + box is displayed indicating that fact. + + + + You can specify environment variables within this string, with a format like + %NAME%. The value of these variables will be expanded at the time + the SFX is run. Example: %WINDIR%\system32\xcopy.exe may expand at + runtime to c:\Windows\System32\xcopy.exe. + + + + By combining this with the RemoveUnpackedFilesAfterExecute + flag, you can create an SFX that extracts itself, runs a file that + was extracted, then deletes all the files that were extracted. If + you want it to run "invisibly" then set Flavor to + SelfExtractorFlavor.ConsoleApplication, and set Quiet + to true. The user running such an EXE will see a console window + appear, then disappear quickly. You may also want to specify the + default extract location, with DefaultExtractDirectory. + + + + If you set Flavor to + SelfExtractorFlavor.WinFormsApplication, and set Quiet to + true, then a GUI with progressbars is displayed, but it is + "non-interactive" - it accepts no input from the user. Instead the SFX + just automatically unpacks and exits. + + + + + + + The default extract directory the user will see when + running the self-extracting archive. + + + + + Passing null (or Nothing in VB) here will cause the Self Extractor to use + the the user's personal directory () for the default extract + location. + + + + This is only a default location. The actual extract location will be + settable on the command line when the SFX is executed. + + + + You can specify environment variables within this string, + with %NAME%. The value of these variables will be + expanded at the time the SFX is run. Example: + %USERPROFILE%\Documents\unpack may expand at runtime to + c:\users\melvin\Documents\unpack. + + + + + + The name of an .ico file in the filesystem to use for the application icon + for the generated SFX. + + + + + Normally, DotNetZip will embed an "zipped folder" icon into the generated + SFX. If you prefer to use a different icon, you can specify it here. It + should be a .ico file. This file is passed as the /win32icon + option to the csc.exe compiler when constructing the SFX file. + + + + + + + Whether the ConsoleApplication SFX will be quiet during extraction. + + + + + This option affects the way the generated SFX runs. By default it is + false. When you set it to true,... + + + + + Flavor + Behavior + + + + ConsoleApplication + no messages will be emitted during successful + operation. Double-clicking the SFX in Windows + Explorer or as an attachment in an email will cause a console + window to appear briefly, before it disappears. If you run the + ConsoleApplication SFX from the cmd.exe prompt, it runs as a + normal console app; by default, because it is quiet, it displays + no messages to the console. If you pass the -v+ command line + argument to the Console SFX when you run it, you will get verbose + messages to the console. + + + + + WinFormsApplication + the SFX extracts automatically when the application + is launched, with no additional user input. + + + + + + + When you set it to false,... + + + + + Flavor + Behavior + + + + ConsoleApplication + the extractor will emit a + message to the console for each entry extracted. + + When double-clicking to launch the SFX, the console window will + remain, and the SFX will emit a message for each file as it + extracts. The messages fly by quickly, they won't be easily + readable, unless the extracted files are fairly large. + + + + + + WinFormsApplication + the SFX presents a forms UI and allows the user to select + options before extracting. + + + + + + + + + + Specify what the self-extractor will do when extracting an entry + would overwrite an existing file. + + + + The default behavvior is to Throw. + + + + + + Whether to remove the files that have been unpacked, after executing the + PostExtractCommandLine. + + + + + If true, and if there is a + PostExtractCommandLine, and if the command runs successfully, + then the files that the SFX unpacked will be removed, afterwards. If + the command does not complete successfully (non-zero return code), + that is interpreted as a failure, and the extracted files will not be + removed. + + + + Setting this flag, and setting Flavor to + SelfExtractorFlavor.ConsoleApplication, and setting Quiet to + true, results in an SFX that extracts itself, runs a file that was + extracted, then deletes all the files that were extracted, with no + intervention by the user. You may also want to specify the default + extract location, with DefaultExtractDirectory. + + + + + + + The file version number to embed into the generated EXE. It will show up, for + example, during a mouseover in Windows Explorer. + + + + + + The product version to embed into the generated EXE. It will show up, for + example, during a mouseover in Windows Explorer. + + + + You can use any arbitrary string, but a human-readable version number is + recommended. For example "v1.2 alpha" or "v4.2 RC2". If you specify nothing, + then there is no product version embedded into the EXE. + + + + + + The copyright notice, if any, to embed into the generated EXE. + + + + It will show up, for example, while viewing properties of the file in + Windows Explorer. You can use any arbitrary string, but typically you + want something like "Copyright � Dino Chiesa 2011". + + + + + + The description to embed into the generated EXE. + + + + Use any arbitrary string. This text will be displayed during a + mouseover in Windows Explorer. If you specify nothing, then the string + "DotNetZip SFX Archive" is embedded into the EXE as the description. + + + + + + The product name to embed into the generated EXE. + + + + Use any arbitrary string. This text will be displayed + while viewing properties of the EXE file in + Windows Explorer. + + + + + + The title to display in the Window of a GUI SFX, while it extracts. + + + + + By default the title show in the GUI window of a self-extractor + is "DotNetZip Self-extractor (http://DotNetZip.codeplex.com/)". + You can change that by setting this property before saving the SFX. + + + + This property has an effect only when producing a Self-extractor + of flavor SelfExtractorFlavor.WinFormsApplication. + + + + + + + Additional options for the csc.exe compiler, when producing the SFX + EXE. + + + + + + The ZipFile type represents a zip archive file. + + + + + This is the main type in the DotNetZip class library. This class reads and + writes zip files, as defined in the specification + for zip files described by PKWare. The compression for this + implementation is provided by a managed-code version of Zlib, included with + DotNetZip in the classes in the Ionic.Zlib namespace. + + + + This class provides a general purpose zip file capability. Use it to read, + create, or update zip files. When you want to create zip files using a + Stream type to write the zip file, you may want to consider the class. + + + + Both the ZipOutputStream class and the ZipFile class can + be used to create zip files. Both of them support many of the common zip + features, including Unicode, different compression methods and levels, + and ZIP64. They provide very similar performance when creating zip + files. + + + + The ZipFile class is generally easier to use than + ZipOutputStream and should be considered a higher-level interface. For + example, when creating a zip file via calls to the PutNextEntry() and + Write() methods on the ZipOutputStream class, the caller is + responsible for opening the file, reading the bytes from the file, writing + those bytes into the ZipOutputStream, setting the attributes on the + ZipEntry, and setting the created, last modified, and last accessed + timestamps on the zip entry. All of these things are done automatically by a + call to ZipFile.AddFile(). + For this reason, the ZipOutputStream is generally recommended for use + only when your application emits arbitrary data, not necessarily data from a + filesystem file, directly into a zip file, and does so using a Stream + metaphor. + + + + Aside from the differences in programming model, there are other + differences in capability between the two classes. + + + + + ZipFile can be used to read and extract zip files, in addition to + creating zip files. ZipOutputStream cannot read zip files. If you want + to use a stream to read zip files, check out the class. + + + + ZipOutputStream does not support the creation of segmented or spanned + zip files. + + + + ZipOutputStream cannot produce a self-extracting archive. + + + + + Be aware that the ZipFile class implements the interface. In order for ZipFile to + produce a valid zip file, you use use it within a using clause (Using + in VB), or call the Dispose() method explicitly. See the examples + for how to employ a using clause. + + + + + + + Saves the ZipFile instance to a self-extracting zip archive. + + + + + + The generated exe image will execute on any machine that has the .NET + Framework 4.0 installed on it. The generated exe image is also a + valid ZIP file, readable with DotNetZip or another Zip library or tool + such as WinZip. + + + + There are two "flavors" of self-extracting archive. The + WinFormsApplication version will pop up a GUI and allow the + user to select a target directory into which to extract. There's also + a checkbox allowing the user to specify to overwrite existing files, + and another checkbox to allow the user to request that Explorer be + opened to see the extracted files after extraction. The other flavor + is ConsoleApplication. A self-extractor generated with that + flavor setting will run from the command line. It accepts command-line + options to set the overwrite behavior, and to specify the target + extraction directory. + + + + There are a few temporary files created during the saving to a + self-extracting zip. These files are created in the directory pointed + to by , which defaults to . These temporary files are + removed upon successful completion of this method. + + + + When a user runs the WinForms SFX, the user's personal directory (Environment.SpecialFolder.Personal) + will be used as the default extract location. If you want to set the + default extract location, you should use the other overload of + SaveSelfExtractor()/ The user who runs the SFX will have the + opportunity to change the extract directory before extracting. When + the user runs the Command-Line SFX, the user must explicitly specify + the directory to which to extract. The .NET Framework 4.0 is required + on the computer when the self-extracting archive is run. + + + + NB: This method is not available in the "Reduced" DotNetZip library. + + + + + + + string DirectoryPath = "c:\\Documents\\Project7"; + using (ZipFile zip = new ZipFile()) + { + zip.AddDirectory(DirectoryPath, System.IO.Path.GetFileName(DirectoryPath)); + zip.Comment = "This will be embedded into a self-extracting console-based exe"; + zip.SaveSelfExtractor("archive.exe", SelfExtractorFlavor.ConsoleApplication); + } + + + Dim DirectoryPath As String = "c:\Documents\Project7" + Using zip As New ZipFile() + zip.AddDirectory(DirectoryPath, System.IO.Path.GetFileName(DirectoryPath)) + zip.Comment = "This will be embedded into a self-extracting console-based exe" + zip.SaveSelfExtractor("archive.exe", SelfExtractorFlavor.ConsoleApplication) + End Using + + + + + a pathname, possibly fully qualified, to be created. Typically it + will end in an .exe extension. + + Indicates whether a Winforms or Console self-extractor is + desired. + + + + Saves the ZipFile instance to a self-extracting zip archive, using + the specified save options. + + + + + This method saves a self extracting archive, using the specified save + options. These options include the flavor of the SFX, the default extract + directory, the icon file, and so on. See the documentation + for for more + details. + + + + The user who runs the SFX will have the opportunity to change the extract + directory before extracting. If at the time of extraction, the specified + directory does not exist, the SFX will create the directory before + extracting the files. + + + + + + This example saves a WinForms-based self-extracting archive EXE that + will use c:\ExtractHere as the default extract location. The C# code + shows syntax for .NET 3.0, which uses an object initializer for + the SelfExtractorOptions object. + + string DirectoryPath = "c:\\Documents\\Project7"; + using (ZipFile zip = new ZipFile()) + { + zip.AddDirectory(DirectoryPath, System.IO.Path.GetFileName(DirectoryPath)); + zip.Comment = "This will be embedded into a self-extracting WinForms-based exe"; + var options = new SelfExtractorOptions + { + Flavor = SelfExtractorFlavor.WinFormsApplication, + DefaultExtractDirectory = "%USERPROFILE%\\ExtractHere", + PostExtractCommandLine = ExeToRunAfterExtract, + SfxExeWindowTitle = "My Custom Window Title", + RemoveUnpackedFilesAfterExecute = true + }; + zip.SaveSelfExtractor("archive.exe", options); + } + + + Dim DirectoryPath As String = "c:\Documents\Project7" + Using zip As New ZipFile() + zip.AddDirectory(DirectoryPath, System.IO.Path.GetFileName(DirectoryPath)) + zip.Comment = "This will be embedded into a self-extracting console-based exe" + Dim options As New SelfExtractorOptions() + options.Flavor = SelfExtractorFlavor.WinFormsApplication + options.DefaultExtractDirectory = "%USERPROFILE%\\ExtractHere" + options.PostExtractCommandLine = ExeToRunAfterExtract + options.SfxExeWindowTitle = "My Custom Window Title" + options.RemoveUnpackedFilesAfterExecute = True + zip.SaveSelfExtractor("archive.exe", options) + End Using + + + + The name of the EXE to generate. + provides the options for creating the + Self-extracting archive. + + + + Adds an item, either a file or a directory, to a zip file archive. + + + + + This method is handy if you are adding things to zip archive and don't + want to bother distinguishing between directories or files. Any files are + added as single entries. A directory added through this method is added + recursively: all files and subdirectories contained within the directory + are added to the ZipFile. + + + + The name of the item may be a relative path or a fully-qualified + path. Remember, the items contained in ZipFile instance get written + to the disk only when you call or a similar + save method. + + + + The directory name used for the file within the archive is the same + as the directory name (potentially a relative path) specified in the + . + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + + + This method has two overloads. + + the name of the file or directory to add. + + The ZipEntry added. + + + + Adds an item, either a file or a directory, to a zip file archive, + explicitly specifying the directory path to be used in the archive. + + + + + If adding a directory, the add is recursive on all files and + subdirectories contained within it. + + + The name of the item may be a relative path or a fully-qualified path. + The item added by this call to the ZipFile is not read from the + disk nor written to the zip file archive until the application calls + Save() on the ZipFile. + + + + This version of the method allows the caller to explicitly specify the + directory path to be used in the archive, which would override the + "natural" path of the filesystem file. + + + + Encryption will be used on the file data if the Password has + been set on the ZipFile object, prior to calling this method. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + Thrown if the file or directory passed in does not exist. + + + the name of the file or directory to add. + + + + The name of the directory path to use within the zip archive. This path + need not refer to an extant directory in the current filesystem. If the + files within the zip are later extracted, this is the path used for the + extracted file. Passing null (Nothing in VB) will use the + path on the fileOrDirectoryName. Passing the empty string ("") will + insert the item at the root path within the archive. + + + + + + + + This example shows how to zip up a set of files into a flat hierarchy, + regardless of where in the filesystem the files originated. The resulting + zip archive will contain a toplevel directory named "flat", which itself + will contain files Readme.txt, MyProposal.docx, and Image1.jpg. A + subdirectory under "flat" called SupportFiles will contain all the files + in the "c:\SupportFiles" directory on disk. + + + String[] itemnames= { + "c:\\fixedContent\\Readme.txt", + "MyProposal.docx", + "c:\\SupportFiles", // a directory + "images\\Image1.jpg" + }; + + try + { + using (ZipFile zip = new ZipFile()) + { + for (int i = 1; i < itemnames.Length; i++) + { + // will add Files or Dirs, recurses and flattens subdirectories + zip.AddItem(itemnames[i],"flat"); + } + zip.Save(ZipToCreate); + } + } + catch (System.Exception ex1) + { + System.Console.Error.WriteLine("exception: {0}", ex1); + } + + + + Dim itemnames As String() = _ + New String() { "c:\fixedContent\Readme.txt", _ + "MyProposal.docx", _ + "SupportFiles", _ + "images\Image1.jpg" } + Try + Using zip As New ZipFile + Dim i As Integer + For i = 1 To itemnames.Length - 1 + ' will add Files or Dirs, recursing and flattening subdirectories. + zip.AddItem(itemnames(i), "flat") + Next i + zip.Save(ZipToCreate) + End Using + Catch ex1 As Exception + Console.Error.WriteLine("exception: {0}", ex1.ToString()) + End Try + + + The ZipEntry added. + + + + Adds a File to a Zip file archive. + + + + + This call collects metadata for the named file in the filesystem, + including the file attributes and the timestamp, and inserts that metadata + into the resulting ZipEntry. Only when the application calls Save() on + the ZipFile, does DotNetZip read the file from the filesystem and + then write the content to the zip file archive. + + + + This method will throw an exception if an entry with the same name already + exists in the ZipFile. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + In this example, three files are added to a Zip archive. The ReadMe.txt + file will be placed in the root of the archive. The .png file will be + placed in a folder within the zip called photos\personal. The pdf file + will be included into a folder within the zip called Desktop. + + + try + { + using (ZipFile zip = new ZipFile()) + { + zip.AddFile("c:\\photos\\personal\\7440-N49th.png"); + zip.AddFile("c:\\Desktop\\2008-Regional-Sales-Report.pdf"); + zip.AddFile("ReadMe.txt"); + + zip.Save("Package.zip"); + } + } + catch (System.Exception ex1) + { + System.Console.Error.WriteLine("exception: " + ex1); + } + + + + Try + Using zip As ZipFile = New ZipFile + zip.AddFile("c:\photos\personal\7440-N49th.png") + zip.AddFile("c:\Desktop\2008-Regional-Sales-Report.pdf") + zip.AddFile("ReadMe.txt") + zip.Save("Package.zip") + End Using + Catch ex1 As Exception + Console.Error.WriteLine("exception: {0}", ex1.ToString) + End Try + + + + This method has two overloads. + + + + + + + The name of the file to add. It should refer to a file in the filesystem. + The name of the file may be a relative path or a fully-qualified path. + + The ZipEntry corresponding to the File added. + + + + Adds a File to a Zip file archive, potentially overriding the path to be + used within the zip archive. + + + + + The file added by this call to the ZipFile is not written to the + zip file archive until the application calls Save() on the ZipFile. + + + + This method will throw an exception if an entry with the same name already + exists in the ZipFile. + + + + This version of the method allows the caller to explicitly specify the + directory path to be used in the archive. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + In this example, three files are added to a Zip archive. The ReadMe.txt + file will be placed in the root of the archive. The .png file will be + placed in a folder within the zip called images. The pdf file will be + included into a folder within the zip called files\docs, and will be + encrypted with the given password. + + + try + { + using (ZipFile zip = new ZipFile()) + { + // the following entry will be inserted at the root in the archive. + zip.AddFile("c:\\datafiles\\ReadMe.txt", ""); + // this image file will be inserted into the "images" directory in the archive. + zip.AddFile("c:\\photos\\personal\\7440-N49th.png", "images"); + // the following will result in a password-protected file called + // files\\docs\\2008-Regional-Sales-Report.pdf in the archive. + zip.Password = "EncryptMe!"; + zip.AddFile("c:\\Desktop\\2008-Regional-Sales-Report.pdf", "files\\docs"); + zip.Save("Archive.zip"); + } + } + catch (System.Exception ex1) + { + System.Console.Error.WriteLine("exception: {0}", ex1); + } + + + + Try + Using zip As ZipFile = New ZipFile + ' the following entry will be inserted at the root in the archive. + zip.AddFile("c:\datafiles\ReadMe.txt", "") + ' this image file will be inserted into the "images" directory in the archive. + zip.AddFile("c:\photos\personal\7440-N49th.png", "images") + ' the following will result in a password-protected file called + ' files\\docs\\2008-Regional-Sales-Report.pdf in the archive. + zip.Password = "EncryptMe!" + zip.AddFile("c:\Desktop\2008-Regional-Sales-Report.pdf", "files\documents") + zip.Save("Archive.zip") + End Using + Catch ex1 As Exception + Console.Error.WriteLine("exception: {0}", ex1) + End Try + + + + + + + + + The name of the file to add. The name of the file may be a relative path + or a fully-qualified path. + + + + Specifies a directory path to use to override any path in the fileName. + This path may, or may not, correspond to a real directory in the current + filesystem. If the files within the zip are later extracted, this is the + path used for the extracted file. Passing null (Nothing in + VB) will use the path on the fileName, if any. Passing the empty string + ("") will insert the item at the root path within the archive. + + + The ZipEntry corresponding to the file added. + + + + This method removes a collection of entries from the ZipFile. + + + + A collection of ZipEntry instances from this zip file to be removed. For + example, you can pass in an array of ZipEntry instances; or you can call + SelectEntries(), and then add or remove entries from that + ICollection<ZipEntry> (ICollection(Of ZipEntry) in VB), and pass + that ICollection to this method. + + + + + + + + This method removes a collection of entries from the ZipFile, by name. + + + + A collection of strings that refer to names of entries to be removed + from the ZipFile. For example, you can pass in an array or a + List of Strings that provide the names of entries to be removed. + + + + + + + + This method adds a set of files to the ZipFile. + + + + + Use this method to add a set of files to the zip archive, in one call. + For example, a list of files received from + System.IO.Directory.GetFiles() can be added to a zip archive in one + call. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to each + ZipEntry added. + + + + + The collection of names of the files to add. Each string should refer to a + file in the filesystem. The name of the file may be a relative path or a + fully-qualified path. + + + + This example shows how to create a zip file, and add a few files into it. + + String ZipFileToCreate = "archive1.zip"; + String DirectoryToZip = "c:\\reports"; + using (ZipFile zip = new ZipFile()) + { + // Store all files found in the top level directory, into the zip archive. + String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip); + zip.AddFiles(filenames); + zip.Save(ZipFileToCreate); + } + + + + Dim ZipFileToCreate As String = "archive1.zip" + Dim DirectoryToZip As String = "c:\reports" + Using zip As ZipFile = New ZipFile + ' Store all files found in the top level directory, into the zip archive. + Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip) + zip.AddFiles(filenames) + zip.Save(ZipFileToCreate) + End Using + + + + + + + + Adds or updates a set of files in the ZipFile. + + + + + Any files that already exist in the archive are updated. Any files that + don't yet exist in the archive are added. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to each + ZipEntry added. + + + + + The collection of names of the files to update. Each string should refer to a file in + the filesystem. The name of the file may be a relative path or a fully-qualified path. + + + + + + Adds a set of files to the ZipFile, using the + specified directory path in the archive. + + + + + Any directory structure that may be present in the + filenames contained in the list is "flattened" in the + archive. Each file in the list is added to the archive in + the specified top-level directory. + + + + For ZipFile properties including , , , , , , and , their respective values at the + time of this call will be applied to each ZipEntry added. + + + + + The names of the files to add. Each string should refer to + a file in the filesystem. The name of the file may be a + relative path or a fully-qualified path. + + + + Specifies a directory path to use to override any path in the file name. + Th is path may, or may not, correspond to a real directory in the current + filesystem. If the files within the zip are later extracted, this is the + path used for the extracted file. Passing null (Nothing in + VB) will use the path on each of the fileNames, if any. Passing + the empty string ("") will insert the item at the root path within the + archive. + + + + + + + Adds a set of files to the ZipFile, using the specified directory + path in the archive, and preserving the full directory structure in the + filenames. + + + + + + Think of the as a "root" or + base directory used in the archive for the files that get added. when + is true, the hierarchy of files + found in the filesystem will be placed, with the hierarchy intact, + starting at that root in the archive. When preserveDirHierarchy + is false, the path hierarchy of files is flattned, and the flattened + set of files gets placed in the root within the archive as specified in + directoryPathInArchive. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to each + ZipEntry added. + + + + + + The names of the files to add. Each string should refer to a file in the + filesystem. The name of the file may be a relative path or a + fully-qualified path. + + + + Specifies a directory path to use as a prefix for each entry name. + This path may, or may not, correspond to a real directory in the current + filesystem. If the files within the zip are later extracted, this is the + path used for the extracted file. Passing null (Nothing in + VB) will use the path on each of the fileNames, if any. Passing + the empty string ("") will insert the item at the root path within the + archive. + + + + whether the entries in the zip archive will reflect the directory + hierarchy that is present in the various filenames. For example, if + includes two paths, + \Animalia\Chordata\Mammalia\Info.txt and + \Plantae\Magnoliophyta\Dicotyledon\Info.txt, then calling this method + with = false will + result in an exception because of a duplicate entry name, while + calling this method with = + true will result in the full direcory paths being included in + the entries added to the ZipFile. + + + + + + Adds or updates a set of files to the ZipFile, using the specified + directory path in the archive. + + + + + + Any files that already exist in the archive are updated. Any files that + don't yet exist in the archive are added. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to each + ZipEntry added. + + + + + The names of the files to add or update. Each string should refer to a + file in the filesystem. The name of the file may be a relative path or a + fully-qualified path. + + + + Specifies a directory path to use to override any path in the file name. + This path may, or may not, correspond to a real directory in the current + filesystem. If the files within the zip are later extracted, this is the + path used for the extracted file. Passing null (Nothing in + VB) will use the path on each of the fileNames, if any. Passing + the empty string ("") will insert the item at the root path within the + archive. + + + + + + + Adds or Updates a File in a Zip file archive. + + + + + This method adds a file to a zip archive, or, if the file already exists + in the zip archive, this method Updates the content of that given filename + in the zip archive. The UpdateFile method might more accurately be + called "AddOrUpdateFile". + + + + Upon success, there is no way for the application to learn whether the file + was added versus updated. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + This example shows how to Update an existing entry in a zipfile. The first + call to UpdateFile adds the file to the newly-created zip archive. The + second call to UpdateFile updates the content for that file in the zip + archive. + + + using (ZipFile zip1 = new ZipFile()) + { + // UpdateFile might more accurately be called "AddOrUpdateFile" + zip1.UpdateFile("MyDocuments\\Readme.txt"); + zip1.UpdateFile("CustomerList.csv"); + zip1.Comment = "This zip archive has been created."; + zip1.Save("Content.zip"); + } + + using (ZipFile zip2 = ZipFile.Read("Content.zip")) + { + zip2.UpdateFile("Updates\\Readme.txt"); + zip2.Comment = "This zip archive has been updated: The Readme.txt file has been changed."; + zip2.Save(); + } + + + + Using zip1 As New ZipFile + ' UpdateFile might more accurately be called "AddOrUpdateFile" + zip1.UpdateFile("MyDocuments\Readme.txt") + zip1.UpdateFile("CustomerList.csv") + zip1.Comment = "This zip archive has been created." + zip1.Save("Content.zip") + End Using + + Using zip2 As ZipFile = ZipFile.Read("Content.zip") + zip2.UpdateFile("Updates\Readme.txt") + zip2.Comment = "This zip archive has been updated: The Readme.txt file has been changed." + zip2.Save + End Using + + + + + + + + + The name of the file to add or update. It should refer to a file in the + filesystem. The name of the file may be a relative path or a + fully-qualified path. + + + + The ZipEntry corresponding to the File that was added or updated. + + + + + Adds or Updates a File in a Zip file archive. + + + + + This method adds a file to a zip archive, or, if the file already exists + in the zip archive, this method Updates the content of that given filename + in the zip archive. + + + + This version of the method allows the caller to explicitly specify the + directory path to be used in the archive. The entry to be added or + updated is found by using the specified directory path, combined with the + basename of the specified filename. + + + + Upon success, there is no way for the application to learn if the file was + added versus updated. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + + + The name of the file to add or update. It should refer to a file in the + filesystem. The name of the file may be a relative path or a + fully-qualified path. + + + + Specifies a directory path to use to override any path in the + fileName. This path may, or may not, correspond to a real + directory in the current filesystem. If the files within the zip are + later extracted, this is the path used for the extracted file. Passing + null (Nothing in VB) will use the path on the + fileName, if any. Passing the empty string ("") will insert the + item at the root path within the archive. + + + + The ZipEntry corresponding to the File that was added or updated. + + + + + Add or update a directory in a zip archive. + + + + If the specified directory does not exist in the archive, then this method + is equivalent to calling AddDirectory(). If the specified + directory already exists in the archive, then this method updates any + existing entries, and adds any new entries. Any entries that are in the + zip archive but not in the specified directory, are left alone. In other + words, the contents of the zip file will be a union of the previous + contents and the new files. + + + + + + + + The path to the directory to be added to the zip archive, or updated in + the zip archive. + + + + The ZipEntry corresponding to the Directory that was added or updated. + + + + + Add or update a directory in the zip archive at the specified root + directory in the archive. + + + + If the specified directory does not exist in the archive, then this method + is equivalent to calling AddDirectory(). If the specified + directory already exists in the archive, then this method updates any + existing entries, and adds any new entries. Any entries that are in the + zip archive but not in the specified directory, are left alone. In other + words, the contents of the zip file will be a union of the previous + contents and the new files. + + + + + + + + The path to the directory to be added to the zip archive, or updated + in the zip archive. + + + + Specifies a directory path to use to override any path in the + directoryName. This path may, or may not, correspond to a real + directory in the current filesystem. If the files within the zip are + later extracted, this is the path used for the extracted file. Passing + null (Nothing in VB) will use the path on the + directoryName, if any. Passing the empty string ("") will insert + the item at the root path within the archive. + + + + The ZipEntry corresponding to the Directory that was added or updated. + + + + + Add or update a file or directory in the zip archive. + + + + + This is useful when the application is not sure or does not care if the + item to be added is a file or directory, and does not know or does not + care if the item already exists in the ZipFile. Calling this method + is equivalent to calling RemoveEntry() if an entry by the same name + already exists, followed calling by AddItem(). + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + + + the path to the file or directory to be added or updated. + + + + + Add or update a file or directory. + + + + + This method is useful when the application is not sure or does not care if + the item to be added is a file or directory, and does not know or does not + care if the item already exists in the ZipFile. Calling this method + is equivalent to calling RemoveEntry(), if an entry by that name + exists, and then calling AddItem(). + + + + This version of the method allows the caller to explicitly specify the + directory path to be used for the item being added to the archive. The + entry or entries that are added or updated will use the specified + DirectoryPathInArchive. Extracting the entry from the archive will + result in a file stored in that directory path. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + + + The path for the File or Directory to be added or updated. + + + Specifies a directory path to use to override any path in the + itemName. This path may, or may not, correspond to a real + directory in the current filesystem. If the files within the zip are + later extracted, this is the path used for the extracted file. Passing + null (Nothing in VB) will use the path on the + itemName, if any. Passing the empty string ("") will insert the + item at the root path within the archive. + + + + + Adds a named entry into the zip archive, taking content for the entry + from a string. + + + + Calling this method creates an entry using the given fileName and + directory path within the archive. There is no need for a file by the + given name to exist in the filesystem; the name is used within the zip + archive only. The content for the entry is encoded using the default text + encoding for the machine. + + + + The content of the file, should it be extracted from the zip. + + + + The name, including any path, to use for the entry within the archive. + + + The ZipEntry added. + + + + This example shows how to add an entry to the zipfile, using a string as + content for that entry. + + + string Content = "This string will be the content of the Readme.txt file in the zip archive."; + using (ZipFile zip1 = new ZipFile()) + { + zip1.AddFile("MyDocuments\\Resume.doc", "files"); + zip1.AddEntry("Readme.txt", Content); + zip1.Comment = "This zip file was created at " + System.DateTime.Now.ToString("G"); + zip1.Save("Content.zip"); + } + + + + Public Sub Run() + Dim Content As String = "This string will be the content of the Readme.txt file in the zip archive." + Using zip1 As ZipFile = New ZipFile + zip1.AddEntry("Readme.txt", Content) + zip1.AddFile("MyDocuments\Resume.doc", "files") + zip1.Comment = ("This zip file was created at " & DateTime.Now.ToString("G")) + zip1.Save("Content.zip") + End Using + End Sub + + + + + + Adds a named entry into the zip archive, taking content for the entry + from a string, and using the specified text encoding. + + + + + + Calling this method creates an entry using the given fileName and + directory path within the archive. There is no need for a file by the + given name to exist in the filesystem; the name is used within the zip + archive only. + + + + The content for the entry, a string value, is encoded using the given + text encoding. A BOM (byte-order-mark) is emitted into the file, if the + Encoding parameter is set for that. + + + + Most Encoding classes support a constructor that accepts a boolean, + indicating whether to emit a BOM or not. For example see . + + + + + + The name, including any path, to use within the archive for the entry. + + + + The content of the file, should it be extracted from the zip. + + + + The text encoding to use when encoding the string. Be aware: This is + distinct from the text encoding used to encode the fileName, as specified + in . + + + The ZipEntry added. + + + + + Create an entry in the ZipFile using the given Stream + as input. The entry will have the given filename. + + + + + + The application should provide an open, readable stream; in this case it + will be read during the call to or one of + its overloads. + + + + The passed stream will be read from its current position. If + necessary, callers should set the position in the stream before + calling AddEntry(). This might be appropriate when using this method + with a MemoryStream, for example. + + + + In cases where a large number of streams will be added to the + ZipFile, the application may wish to avoid maintaining all of the + streams open simultaneously. To handle this situation, the application + should use the + overload. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + This example adds a single entry to a ZipFile via a Stream. + + + + String zipToCreate = "Content.zip"; + String fileNameInArchive = "Content-From-Stream.bin"; + using (System.IO.Stream streamToRead = MyStreamOpener()) + { + using (ZipFile zip = new ZipFile()) + { + ZipEntry entry= zip.AddEntry(fileNameInArchive, streamToRead); + zip.AddFile("Readme.txt"); + zip.Save(zipToCreate); // the stream is read implicitly here + } + } + + + + Dim zipToCreate As String = "Content.zip" + Dim fileNameInArchive As String = "Content-From-Stream.bin" + Using streamToRead as System.IO.Stream = MyStreamOpener() + Using zip As ZipFile = New ZipFile() + Dim entry as ZipEntry = zip.AddEntry(fileNameInArchive, streamToRead) + zip.AddFile("Readme.txt") + zip.Save(zipToCreate) '' the stream is read implicitly, here + End Using + End Using + + + + + + + The name, including any path, which is shown in the zip file for the added + entry. + + + The input stream from which to grab content for the file + + The ZipEntry added. + + + + Add a ZipEntry for which content is written directly by the application. + + + + + When the application needs to write the zip entry data, use this + method to add the ZipEntry. For example, in the case that the + application wishes to write the XML representation of a DataSet into + a ZipEntry, the application can use this method to do so. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + About progress events: When using the WriteDelegate, DotNetZip does + not issue any SaveProgress events with EventType = + Saving_EntryBytesRead. (This is because it is the + application's code that runs in WriteDelegate - there's no way for + DotNetZip to know when to issue a EntryBytesRead event.) + Applications that want to update a progress bar or similar status + indicator should do so from within the WriteDelegate + itself. DotNetZip will issue the other SaveProgress events, + including + Saving_Started, + + Saving_BeforeWriteEntry, and + Saving_AfterWriteEntry. + + + + Note: When you use PKZip encryption, it's normally necessary to + compute the CRC of the content to be encrypted, before compressing or + encrypting it. Therefore, when using PKZip encryption with a + WriteDelegate, the WriteDelegate CAN BE called twice: once to compute + the CRC, and the second time to potentially compress and + encrypt. Surprising, but true. This is because PKWARE specified that + the encryption initialization data depends on the CRC. + If this happens, for each call of the delegate, your + application must stream the same entry data in its entirety. If your + application writes different data during the second call, it will + result in a corrupt zip file. + + + + The double-read behavior happens with all types of entries, not only + those that use WriteDelegate. It happens if you add an entry from a + filesystem file, or using a string, or a stream, or an opener/closer + pair. But in those cases, DotNetZip takes care of reading twice; in + the case of the WriteDelegate, the application code gets invoked + twice. Be aware. + + + + As you can imagine, this can cause performance problems for large + streams, and it can lead to correctness problems when you use a + WriteDelegate. This is a pretty big pitfall. There are two + ways to avoid it. First, and most preferred: don't use PKZIP + encryption. If you use the WinZip AES encryption, this problem + doesn't occur, because the encryption protocol doesn't require the CRC + up front. Second: if you do choose to use PKZIP encryption, write out + to a non-seekable stream (like standard output, or the + Response.OutputStream in an ASP.NET application). In this case, + DotNetZip will use an alternative encryption protocol that does not + rely on the CRC of the content. This also implies setting bit 3 in + the zip entry, which still presents problems for some zip tools. + + + + In the future I may modify DotNetZip to *always* use bit 3 when PKZIP + encryption is in use. This seems like a win overall, but there will + be some work involved. If you feel strongly about it, visit the + DotNetZip forums and vote up the Workitem + tracking this issue. + + + + + the name of the entry to add + the delegate which will write the entry content + the ZipEntry added + + + + This example shows an application filling a DataSet, then saving the + contents of that DataSet as XML, into a ZipEntry in a ZipFile, using an + anonymous delegate in C#. The DataSet XML is never saved to a disk file. + + + var c1= new System.Data.SqlClient.SqlConnection(connstring1); + var da = new System.Data.SqlClient.SqlDataAdapter() + { + SelectCommand= new System.Data.SqlClient.SqlCommand(strSelect, c1) + }; + + DataSet ds1 = new DataSet(); + da.Fill(ds1, "Invoices"); + + using(Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile()) + { + zip.AddEntry(zipEntryName, (name,stream) => ds1.WriteXml(stream) ); + zip.Save(zipFileName); + } + + + + + + This example uses an anonymous method in C# as the WriteDelegate to provide + the data for the ZipEntry. The example is a bit contrived - the + AddFile() method is a simpler way to insert the contents of a file + into an entry in a zip file. On the other hand, if there is some sort of + processing or transformation of the file contents required before writing, + the application could use the WriteDelegate to do it, in this way. + + + using (var input = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite )) + { + using(Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile()) + { + zip.AddEntry(zipEntryName, (name,output) => + { + byte[] buffer = new byte[BufferSize]; + int n; + while ((n = input.Read(buffer, 0, buffer.Length)) != 0) + { + // could transform the data here... + output.Write(buffer, 0, n); + // could update a progress bar here + } + }); + + zip.Save(zipFileName); + } + } + + + + + + This example uses a named delegate in VB to write data for the given + ZipEntry (VB9 does not have anonymous delegates). The example here is a bit + contrived - a simpler way to add the contents of a file to a ZipEntry is to + simply use the appropriate AddFile() method. The key scenario for + which the WriteDelegate makes sense is saving a DataSet, in XML + format, to the zip file. The DataSet can write XML to a stream, and the + WriteDelegate is the perfect place to write into the zip file. There may be + other data structures that can write to a stream, but cannot be read as a + stream. The WriteDelegate would be appropriate for those cases as + well. + + + Private Sub WriteEntry (ByVal name As String, ByVal output As Stream) + Using input As FileStream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite) + Dim n As Integer = -1 + Dim buffer As Byte() = New Byte(BufferSize){} + Do While n <> 0 + n = input.Read(buffer, 0, buffer.Length) + output.Write(buffer, 0, n) + Loop + End Using + End Sub + + Public Sub Run() + Using zip = New ZipFile + zip.AddEntry(zipEntryName, New WriteDelegate(AddressOf WriteEntry)) + zip.Save(zipFileName) + End Using + End Sub + + + + + + Add an entry, for which the application will provide a stream + containing the entry data, on a just-in-time basis. + + + + + In cases where the application wishes to open the stream that + holds the content for the ZipEntry, on a just-in-time basis, the + application can use this method. The application provides an + opener delegate that will be called by the DotNetZip library to + obtain a readable stream that can be read to get the bytes for + the given entry. Typically, this delegate opens a stream. + Optionally, the application can provide a closer delegate as + well, which will be called by DotNetZip when all bytes have been + read from the entry. + + + + These delegates are called from within the scope of the call to + ZipFile.Save(). + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + This example uses anonymous methods in C# to open and close the + source stream for the content for a zip entry. + + + using(Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile()) + { + zip.AddEntry(zipEntryName, + (name) => File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ), + (name, stream) => stream.Close() + ); + + zip.Save(zipFileName); + } + + + + + + + This example uses delegates in VB.NET to open and close the + the source stream for the content for a zip entry. VB 9.0 lacks + support for "Sub" lambda expressions, and so the CloseDelegate must + be an actual, named Sub. + + + + Function MyStreamOpener(ByVal entryName As String) As Stream + '' This simply opens a file. You probably want to do somethinig + '' more involved here: open a stream to read from a database, + '' open a stream on an HTTP connection, and so on. + Return File.OpenRead(entryName) + End Function + + Sub MyStreamCloser(entryName As String, stream As Stream) + stream.Close() + End Sub + + Public Sub Run() + Dim dirToZip As String = "fodder" + Dim zipFileToCreate As String = "Archive.zip" + Dim opener As OpenDelegate = AddressOf MyStreamOpener + Dim closer As CloseDelegate = AddressOf MyStreamCloser + Dim numFilestoAdd As Int32 = 4 + Using zip As ZipFile = New ZipFile + Dim i As Integer + For i = 0 To numFilesToAdd - 1 + zip.AddEntry(String.Format("content-{0:000}.txt"), opener, closer) + Next i + zip.Save(zipFileToCreate) + End Using + End Sub + + + + + the name of the entry to add + + the delegate that will be invoked by ZipFile.Save() to get the + readable stream for the given entry. ZipFile.Save() will call + read on this stream to obtain the data for the entry. This data + will then be compressed and written to the newly created zip + file. + + + the delegate that will be invoked to close the stream. This may + be null (Nothing in VB), in which case no call is makde to close + the stream. + + the ZipEntry added + + + + + Updates the given entry in the ZipFile, using the given + string as content for the ZipEntry. + + + + + + Calling this method is equivalent to removing the ZipEntry for + the given file name and directory path, if it exists, and then calling + . See the documentation for + that method for further explanation. The string content is encoded + using the default encoding for the machine. This encoding is distinct + from the encoding used for the filename itself. See + . + + + + + + The name, including any path, to use within the archive for the entry. + + + + The content of the file, should it be extracted from the zip. + + + The ZipEntry added. + + + + + Updates the given entry in the ZipFile, using the given string as + content for the ZipEntry. + + + + Calling this method is equivalent to removing the ZipEntry for the + given file name and directory path, if it exists, and then calling . See the + documentation for that method for further explanation. + + + + The name, including any path, to use within the archive for the entry. + + + + The content of the file, should it be extracted from the zip. + + + + The text encoding to use when encoding the string. Be aware: This is + distinct from the text encoding used to encode the filename. See . + + + The ZipEntry added. + + + + + Updates the given entry in the ZipFile, using the given delegate + as the source for content for the ZipEntry. + + + + Calling this method is equivalent to removing the ZipEntry for the + given file name and directory path, if it exists, and then calling . See the + documentation for that method for further explanation. + + + + The name, including any path, to use within the archive for the entry. + + + the delegate which will write the entry content. + + The ZipEntry added. + + + + + Updates the given entry in the ZipFile, using the given delegates + to open and close the stream that provides the content for the ZipEntry. + + + + Calling this method is equivalent to removing the ZipEntry for the + given file name and directory path, if it exists, and then calling . See the + documentation for that method for further explanation. + + + + The name, including any path, to use within the archive for the entry. + + + + the delegate that will be invoked to open the stream + + + the delegate that will be invoked to close the stream + + + The ZipEntry added or updated. + + + + + Updates the given entry in the ZipFile, using the given stream as + input, and the given filename and given directory Path. + + + + + Calling the method is equivalent to calling RemoveEntry() if an + entry by the same name already exists, and then calling AddEntry() + with the given fileName and stream. + + + + The stream must be open and readable during the call to + ZipFile.Save. You can dispense the stream on a just-in-time basis + using the property. Check the + documentation of that property for more information. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + + + The name, including any path, to use within the archive for the entry. + + + The input stream from which to read file data. + The ZipEntry added. + + + + Add an entry into the zip archive using the given filename and + directory path within the archive, and the given content for the + file. No file is created in the filesystem. + + + The data to use for the entry. + + + The name, including any path, to use within the archive for the entry. + + + The ZipEntry added. + + + + Updates the given entry in the ZipFile, using the given byte + array as content for the entry. + + + + Calling this method is equivalent to removing the ZipEntry + for the given filename and directory path, if it exists, and then + calling . See the + documentation for that method for further explanation. + + + + The name, including any path, to use within the archive for the entry. + + + The content to use for the ZipEntry. + + The ZipEntry added. + + + + + Adds the contents of a filesystem directory to a Zip file archive. + + + + + + The name of the directory may be a relative path or a fully-qualified + path. Any files within the named directory are added to the archive. Any + subdirectories within the named directory are also added to the archive, + recursively. + + + + Top-level entries in the named directory will appear as top-level entries + in the zip archive. Entries in subdirectories in the named directory will + result in entries in subdirectories in the zip archive. + + + + If you want the entries to appear in a containing directory in the zip + archive itself, then you should call the AddDirectory() overload that + allows you to explicitly specify a directory path for use in the archive. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to each + ZipEntry added. + + + + + + + + + + This method has 2 overloads. + + The name of the directory to add. + The ZipEntry added. + + + + Adds the contents of a filesystem directory to a Zip file archive, + overriding the path to be used for entries in the archive. + + + + + The name of the directory may be a relative path or a fully-qualified + path. The add operation is recursive, so that any files or subdirectories + within the name directory are also added to the archive. + + + + Top-level entries in the named directory will appear as top-level entries + in the zip archive. Entries in subdirectories in the named directory will + result in entries in subdirectories in the zip archive. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to each + ZipEntry added. + + + + + + + In this code, calling the ZipUp() method with a value of "c:\reports" for + the directory parameter will result in a zip file structure in which all + entries are contained in a toplevel "reports" directory. + + + + public void ZipUp(string targetZip, string directory) + { + using (var zip = new ZipFile()) + { + zip.AddDirectory(directory, System.IO.Path.GetFileName(directory)); + zip.Save(targetZip); + } + } + + + + + + + + The name of the directory to add. + + + Specifies a directory path to use to override any path in the + DirectoryName. This path may, or may not, correspond to a real directory + in the current filesystem. If the zip is later extracted, this is the + path used for the extracted file or directory. Passing null + (Nothing in VB) or the empty string ("") will insert the items at + the root path within the archive. + + + The ZipEntry added. + + + + Creates a directory in the zip archive. + + + + + + Use this when you want to create a directory in the archive but there is + no corresponding filesystem representation for that directory. + + + + You will probably not need to do this in your code. One of the only times + you will want to do this is if you want an empty directory in the zip + archive. The reason: if you add a file to a zip archive that is stored + within a multi-level directory, all of the directory tree is implicitly + created in the zip archive. + + + + + + The name of the directory to create in the archive. + + The ZipEntry added. + + + + Checks a zip file to see if its directory is consistent. + + + + + + In cases of data error, the directory within a zip file can get out + of synch with the entries in the zip file. This method checks the + given zip file and returns true if this has occurred. + + + This method may take a long time to run for large zip files. + + + This method is not supported in the Reduced version of DotNetZip. + + + + Developers using COM can use the ComHelper.CheckZip(String) + method. + + + + + The filename to of the zip file to check. + + true if the named zip file checks OK. Otherwise, false. + + + + + + + Checks a zip file to see if its directory is consistent, + and optionally fixes the directory if necessary. + + + + + + In cases of data error, the directory within a zip file can get out of + synch with the entries in the zip file. This method checks the given + zip file, and returns true if this has occurred. It also optionally + fixes the zipfile, saving the fixed copy in Name_Fixed.zip. + + + + This method may take a long time to run for large zip files. It + will take even longer if the file actually needs to be fixed, and if + fixIfNecessary is true. + + + + This method is not supported in the Reduced version of DotNetZip. + + + + + The filename to of the zip file to check. + + If true, the method will fix the zip file if + necessary. + + + a TextWriter in which messages generated while checking will be written. + + + true if the named zip is OK; false if the file needs to be fixed. + + + + + + + Rewrite the directory within a zipfile. + + + + + + In cases of data error, the directory in a zip file can get out of + synch with the entries in the zip file. This method attempts to fix + the zip file if this has occurred. + + + This can take a long time for large zip files. + + This won't work if the zip file uses a non-standard + code page - neither IBM437 nor UTF-8. + + + This method is not supported in the Reduced or Compact Framework + versions of DotNetZip. + + + + Developers using COM can use the ComHelper.FixZipDirectory(String) + method. + + + + + The filename to of the zip file to fix. + + + + + + + Verify the password on a zip file. + + + + + Keep in mind that passwords in zipfiles are applied to + zip entries, not to the entire zip file. So testing a + zipfile for a particular password doesn't work in the + general case. On the other hand, it's often the case + that a single password will be used on all entries in a + zip file. This method works for that case. + + + There is no way to check a password without doing the + decryption. So this code decrypts and extracts the given + zipfile into + + + + The filename to of the zip file to fix. + + The password to check. + + a bool indicating whether the password matches. + + + + Provides a human-readable string with information about the ZipFile. + + + + + The information string contains 10 lines or so, about each ZipEntry, + describing whether encryption is in use, the compressed and uncompressed + length of the entry, the offset of the entry, and so on. As a result the + information string can be very long for zip files that contain many + entries. + + + This information is mostly useful for diagnostic purposes. + + + + + + Indicates whether to perform a full scan of the zip file when reading it. + + + + + + You almost never want to use this property. + + + + When reading a zip file, if this flag is true (True in + VB), the entire zip archive will be scanned and searched for entries. + For large archives, this can take a very, long time. The much more + efficient default behavior is to read the zip directory, which is + stored at the end of the zip file. But, in some cases the directory is + corrupted and you need to perform a full scan of the zip file to + determine the contents of the zip file. This property lets you do + that, when necessary. + + + + This flag is effective only when calling . Normally you would read a ZipFile with the + static ZipFile.Read + method. But you can't set the FullScan property on the + ZipFile instance when you use a static factory method like + ZipFile.Read. + + + + + + + This example shows how to read a zip file using the full scan approach, + and then save it, thereby producing a corrected zip file. + + + using (var zip = new ZipFile()) + { + zip.FullScan = true; + zip.Initialize(zipFileName); + zip.Save(newName); + } + + + + Using zip As New ZipFile + zip.FullScan = True + zip.Initialize(zipFileName) + zip.Save(newName) + End Using + + + + + + + Whether to sort the ZipEntries before saving the file. + + + + The default is false. If you have a large number of zip entries, the sort + alone can consume significant time. + + + + + using (var zip = new ZipFile()) + { + zip.AddFiles(filesToAdd); + zip.SortEntriesBeforeSaving = true; + zip.Save(name); + } + + + + Using zip As New ZipFile + zip.AddFiles(filesToAdd) + zip.SortEntriesBeforeSaving = True + zip.Save(name) + End Using + + + + + + + Indicates whether NTFS Reparse Points, like junctions, should be + traversed during calls to AddDirectory(). + + + + By default, calls to AddDirectory() will traverse NTFS reparse + points, like mounted volumes, and directory junctions. An example + of a junction is the "My Music" directory in Windows Vista. In some + cases you may not want DotNetZip to traverse those directories. In + that case, set this property to false. + + + + + using (var zip = new ZipFile()) + { + zip.AddDirectoryWillTraverseReparsePoints = false; + zip.AddDirectory(dirToZip,"fodder"); + zip.Save(zipFileToCreate); + } + + + + + + Size of the IO buffer used while saving. + + + + + + First, let me say that you really don't need to bother with this. It is + here to allow for optimizations that you probably won't make! It will work + fine if you don't set or get this property at all. Ok? + + + + Now that we have that out of the way, the fine print: This + property affects the size of the buffer that is used for I/O for each + entry contained in the zip file. When a file is read in to be compressed, + it uses a buffer given by the size here. When you update a zip file, the + data for unmodified entries is copied from the first zip file to the + other, through a buffer given by the size here. + + + + Changing the buffer size affects a few things: first, for larger buffer + sizes, the memory used by the ZipFile, obviously, will be larger + during I/O operations. This may make operations faster for very much + larger files. Last, for any given entry, when you use a larger buffer + there will be fewer progress events during I/O operations, because there's + one progress event generated for each time the buffer is filled and then + emptied. + + + + The default buffer size is 8k. Increasing the buffer size may speed + things up as you compress larger files. But there are no hard-and-fast + rules here, eh? You won't know til you test it. And there will be a + limit where ever larger buffers actually slow things down. So as I said + in the beginning, it's probably best if you don't set or get this property + at all. + + + + + + This example shows how you might set a large buffer size for efficiency when + dealing with zip entries that are larger than 1gb. + + using (ZipFile zip = new ZipFile()) + { + zip.SaveProgress += this.zip1_SaveProgress; + zip.AddDirectory(directoryToZip, ""); + zip.UseZip64WhenSaving = Zip64Option.Always; + zip.BufferSize = 65536*8; // 65536 * 8 = 512k + zip.Save(ZipFileToCreate); + } + + + + + + Size of the work buffer to use for the ZLIB codec during compression. + + + + + When doing ZLIB or Deflate compression, the library fills a buffer, + then passes it to the compressor for compression. Then the library + reads out the compressed bytes. This happens repeatedly until there + is no more uncompressed data to compress. This property sets the + size of the buffer that will be used for chunk-wise compression. In + order for the setting to take effect, your application needs to set + this property before calling one of the ZipFile.Save() + overloads. + + + Setting this affects the performance and memory efficiency of + compression and decompression. For larger files, setting this to a + larger size may improve compression performance, but the exact + numbers vary depending on available memory, the size of the streams + you are compressing, and a bunch of other variables. I don't have + good firm recommendations on how to set it. You'll have to test it + yourself. Or just leave it alone and accept the default. + + + + + + Indicates whether extracted files should keep their paths as + stored in the zip archive. + + + + + This property affects Extraction. It is not used when creating zip + archives. + + + + With this property set to false, the default, extracting entries + from a zip file will create files in the filesystem that have the full + path associated to the entry within the zip file. With this property set + to true, extracting entries from the zip file results in files + with no path: the folders are "flattened." + + + + An example: suppose the zip file contains entries /directory1/file1.txt and + /directory2/file2.txt. With FlattenFoldersOnExtract set to false, + the files created will be \directory1\file1.txt and \directory2\file2.txt. + With the property set to true, the files created are file1.txt and file2.txt. + + + + + + + The compression strategy to use for all entries. + + + + Set the Strategy used by the ZLIB-compatible compressor, when + compressing entries using the DEFLATE method. Different compression + strategies work better on different sorts of data. The strategy + parameter can affect the compression ratio and the speed of + compression but not the correctness of the compresssion. For more + information see Ionic.Zlib.CompressionStrategy. + + + + + The name of the ZipFile, on disk. + + + + + + When the ZipFile instance was created by reading an archive using + one of the ZipFile.Read methods, this property represents the name + of the zip file that was read. When the ZipFile instance was + created by using the no-argument constructor, this value is null + (Nothing in VB). + + + + If you use the no-argument constructor, and you then explicitly set this + property, when you call , this name will + specify the name of the zip file created. Doing so is equivalent to + calling . When instantiating a + ZipFile by reading from a stream or byte array, the Name + property remains null. When saving to a stream, the Name + property is implicitly set to null. + + + + + + Sets the compression level to be used for entries subsequently added to + the zip archive. + + + + + Varying the compression level used on entries can affect the + size-vs-speed tradeoff when compression and decompressing data streams + or files. + + + + As with some other properties on the ZipFile class, like , , and , setting this property on a ZipFile + instance will cause the specified CompressionLevel to be used on all + items that are subsequently added to the + ZipFile instance. If you set this property after you have added + items to the ZipFile, but before you have called Save(), + those items will not use the specified compression level. + + + + If you do not set this property, the default compression level is used, + which normally gives a good balance of compression efficiency and + compression speed. In some tests, using BestCompression can + double the time it takes to compress, while delivering just a small + increase in compression efficiency. This behavior will vary with the + type of data you compress. If you are in doubt, just leave this setting + alone, and accept the default. + + + + + + The compression method for the zipfile. + + + + By default, the compression method is CompressionMethod.Deflate. + + + + + + + A comment attached to the zip archive. + + + + + + This property is read/write. It allows the application to specify a + comment for the ZipFile, or read the comment for the + ZipFile. After setting this property, changes are only made + permanent when you call a Save() method. + + + + According to PKWARE's + zip specification, the comment is not encrypted, even if there is a + password set on the zip file. + + + + The specification does not describe how to indicate the encoding used + on a comment string. Many "compliant" zip tools and libraries use + IBM437 as the code page for comments; DotNetZip, too, follows that + practice. On the other hand, there are situations where you want a + Comment to be encoded with something else, for example using code page + 950 "Big-5 Chinese". To fill that need, DotNetZip will encode the + comment following the same procedure it follows for encoding + filenames: (a) if is + Never, it uses the default encoding (IBM437). (b) if is Always, it always uses the + alternate encoding (). (c) if is AsNecessary, it uses the + alternate encoding only if the default encoding is not sufficient for + encoding the comment - in other words if decoding the result does not + produce the original string. This decision is taken at the time of + the call to ZipFile.Save(). + + + + When creating a zip archive using this library, it is possible to change + the value of between each + entry you add, and between adding entries and the call to + Save(). Don't do this. It will likely result in a zip file that is + not readable by any tool or application. For best interoperability, leave + alone, or specify it only + once, before adding any entries to the ZipFile instance. + + + + + + + Specifies whether the Creation, Access, and Modified times for entries + added to the zip file will be emitted in “Windows format” + when the zip archive is saved. + + + + + An application creating a zip archive can use this flag to explicitly + specify that the file times for the entries should or should not be stored + in the zip archive in the format used by Windows. By default this flag is + true, meaning the Windows-format times are stored in the zip + archive. + + + + When adding an entry from a file or directory, the Creation (), Access (), and Modified () times for the given entry are + automatically set from the filesystem values. When adding an entry from a + stream or string, all three values are implicitly set to + DateTime.Now. Applications can also explicitly set those times by + calling . + + + + PKWARE's + zip specification describes multiple ways to format these times in a + zip file. One is the format Windows applications normally use: 100ns ticks + since January 1, 1601 UTC. The other is a format Unix applications typically + use: seconds since January 1, 1970 UTC. Each format can be stored in an + "extra field" in the zip entry when saving the zip archive. The former + uses an extra field with a Header Id of 0x000A, while the latter uses a + header ID of 0x5455, although you probably don't need to know that. + + + + Not all tools and libraries can interpret these fields. Windows + compressed folders is one that can read the Windows Format timestamps, + while I believe the Infozip + tools can read the Unix format timestamps. Some tools and libraries + may be able to read only one or the other. DotNetZip can read or write + times in either or both formats. + + + + The times stored are taken from , , and . + + + + The value set here applies to all entries subsequently added to the + ZipFile. + + + + This property is not mutually exclusive of the property. It is possible and + legal and valid to produce a zip file that contains timestamps encoded in + the Unix format as well as in the Windows format, in addition to the LastModified time attached to each + entry in the archive, a time that is always stored in "DOS format". And, + notwithstanding the names PKWare uses for these time formats, any of them + can be read and written by any computer, on any operating system. But, + there are no guarantees that a program running on Mac or Linux will + gracefully handle a zip file with "Windows" formatted times, or that an + application that does not use DotNetZip but runs on Windows will be able to + handle file times in Unix format. + + + + When in doubt, test. Sorry, I haven't got a complete list of tools and + which sort of timestamps they can use and will tolerate. If you get any + good information and would like to pass it on, please do so and I will + include that information in this documentation. + + + + + This example shows how to save a zip file that contains file timestamps + in a format normally used by Unix. + + using (var zip = new ZipFile()) + { + // produce a zip file the Mac will like + zip.EmitTimesInWindowsFormatWhenSaving = false; + zip.EmitTimesInUnixFormatWhenSaving = true; + zip.AddDirectory(directoryToZip, "files"); + zip.Save(outputFile); + } + + + + Using zip As New ZipFile + '' produce a zip file the Mac will like + zip.EmitTimesInWindowsFormatWhenSaving = False + zip.EmitTimesInUnixFormatWhenSaving = True + zip.AddDirectory(directoryToZip, "files") + zip.Save(outputFile) + End Using + + + + + + + + + Specifies whether the Creation, Access, and Modified times + for entries added to the zip file will be emitted in "Unix(tm) + format" when the zip archive is saved. + + + + + An application creating a zip archive can use this flag to explicitly + specify that the file times for the entries should or should not be stored + in the zip archive in the format used by Unix. By default this flag is + false, meaning the Unix-format times are not stored in the zip + archive. + + + + When adding an entry from a file or directory, the Creation (), Access (), and Modified () times for the given entry are + automatically set from the filesystem values. When adding an entry from a + stream or string, all three values are implicitly set to DateTime.Now. + Applications can also explicitly set those times by calling . + + + + PKWARE's + zip specification describes multiple ways to format these times in a + zip file. One is the format Windows applications normally use: 100ns ticks + since January 1, 1601 UTC. The other is a format Unix applications + typically use: seconds since January 1, 1970 UTC. Each format can be + stored in an "extra field" in the zip entry when saving the zip + archive. The former uses an extra field with a Header Id of 0x000A, while + the latter uses a header ID of 0x5455, although you probably don't need to + know that. + + + + Not all tools and libraries can interpret these fields. Windows + compressed folders is one that can read the Windows Format timestamps, + while I believe the Infozip + tools can read the Unix format timestamps. Some tools and libraries may be + able to read only one or the other. DotNetZip can read or write times in + either or both formats. + + + + The times stored are taken from , , and . + + + + This property is not mutually exclusive of the property. It is possible and + legal and valid to produce a zip file that contains timestamps encoded in + the Unix format as well as in the Windows format, in addition to the LastModified time attached to each + entry in the zip archive, a time that is always stored in "DOS + format". And, notwithstanding the names PKWare uses for these time + formats, any of them can be read and written by any computer, on any + operating system. But, there are no guarantees that a program running on + Mac or Linux will gracefully handle a zip file with "Windows" formatted + times, or that an application that does not use DotNetZip but runs on + Windows will be able to handle file times in Unix format. + + + + When in doubt, test. Sorry, I haven't got a complete list of tools and + which sort of timestamps they can use and will tolerate. If you get any + good information and would like to pass it on, please do so and I will + include that information in this documentation. + + + + + + + + + Indicates whether verbose output is sent to the during AddXxx() and + ReadXxx() operations. + + + + This is a synthetic property. It returns true if the is non-null. + + + + + Returns true if an entry by the given name exists in the ZipFile. + + + the name of the entry to find + true if an entry with the given name exists; otherwise false. + + + + + Indicates whether to perform case-sensitive matching on the filename when + retrieving entries in the zipfile via the string-based indexer. + + + + The default value is false, which means don't do case-sensitive + matching. In other words, retrieving zip["ReadMe.Txt"] is the same as + zip["readme.txt"]. It really makes sense to set this to true only + if you are not running on Windows, which has case-insensitive + filenames. But since this library is not built for non-Windows platforms, + in most cases you should just leave this property alone. + + + + + Indicates whether to ignore duplicate files (report only the first entry) + when loading a zipfile. + + + + The default value is false, which will try to make all files + available (duplicates will have a "copy" suffix appended to their name). + Setting this to true prior to using Initialize to read a + zipfile will prevent this and instead just ignore the duplicates. + + + + + Indicates whether to encode entry filenames and entry comments using Unicode + (UTF-8). + + + + + The + PKWare zip specification provides for encoding file names and file + comments in either the IBM437 code page, or in UTF-8. This flag selects + the encoding according to that specification. By default, this flag is + false, and filenames and comments are encoded into the zip file in the + IBM437 codepage. Setting this flag to true will specify that filenames + and comments that cannot be encoded with IBM437 will be encoded with + UTF-8. + + + + Zip files created with strict adherence to the PKWare specification with + respect to UTF-8 encoding can contain entries with filenames containing + any combination of Unicode characters, including the full range of + characters from Chinese, Latin, Hebrew, Greek, Cyrillic, and many other + alphabets. However, because at this time, the UTF-8 portion of the PKWare + specification is not broadly supported by other zip libraries and + utilities, such zip files may not be readable by your favorite zip tool or + archiver. In other words, interoperability will decrease if you set this + flag to true. + + + + In particular, Zip files created with strict adherence to the PKWare + specification with respect to UTF-8 encoding will not work well with + Explorer in Windows XP or Windows Vista, because Windows compressed + folders, as far as I know, do not support UTF-8 in zip files. Vista can + read the zip files, but shows the filenames incorrectly. Unpacking from + Windows Vista Explorer will result in filenames that have rubbish + characters in place of the high-order UTF-8 bytes. + + + + Also, zip files that use UTF-8 encoding will not work well with Java + applications that use the java.util.zip classes, as of v5.0 of the Java + runtime. The Java runtime does not correctly implement the PKWare + specification in this regard. + + + + As a result, we have the unfortunate situation that "correct" behavior by + the DotNetZip library with regard to Unicode encoding of filenames during + zip creation will result in zip files that are readable by strictly + compliant and current tools (for example the most recent release of the + commercial WinZip tool); but these zip files will not be readable by + various other tools or libraries, including Windows Explorer. + + + + The DotNetZip library can read and write zip files with UTF8-encoded + entries, according to the PKware spec. If you use DotNetZip for both + creating and reading the zip file, and you use UTF-8, there will be no + loss of information in the filenames. For example, using a self-extractor + created by this library will allow you to unpack files correctly with no + loss of information in the filenames. + + + + If you do not set this flag, it will remain false. If this flag is false, + your ZipFile will encode all filenames and comments using the + IBM437 codepage. This can cause "loss of information" on some filenames, + but the resulting zipfile will be more interoperable with other + utilities. As an example of the loss of information, diacritics can be + lost. The o-tilde character will be down-coded to plain o. The c with a + cedilla (Unicode 0xE7) used in Portugese will be downcoded to a c. + Likewise, the O-stroke character (Unicode 248), used in Danish and + Norwegian, will be down-coded to plain o. Chinese characters cannot be + represented in codepage IBM437; when using the default encoding, Chinese + characters in filenames will be represented as ?. These are all examples + of "information loss". + + + + The loss of information associated to the use of the IBM437 encoding is + inconvenient, and can also lead to runtime errors. For example, using + IBM437, any sequence of 4 Chinese characters will be encoded as ????. If + your application creates a ZipFile, then adds two files, each with + names of four Chinese characters each, this will result in a duplicate + filename exception. In the case where you add a single file with a name + containing four Chinese characters, calling Extract() on the entry that + has question marks in the filename will result in an exception, because + the question mark is not legal for use within filenames on Windows. These + are just a few examples of the problems associated to loss of information. + + + + This flag is independent of the encoding of the content within the entries + in the zip file. Think of the zip file as a container - it supports an + encoding. Within the container are other "containers" - the file entries + themselves. The encoding within those entries is independent of the + encoding of the zip archive container for those entries. + + + + Rather than specify the encoding in a binary fashion using this flag, an + application can specify an arbitrary encoding via the property. Setting the encoding + explicitly when creating zip archives will result in non-compliant zip + files that, curiously, are fairly interoperable. The challenge is, the + PKWare specification does not provide for a way to specify that an entry + in a zip archive uses a code page that is neither IBM437 nor UTF-8. + Therefore if you set the encoding explicitly when creating a zip archive, + you must take care upon reading the zip archive to use the same code page. + If you get it wrong, the behavior is undefined and may result in incorrect + filenames, exceptions, stomach upset, hair loss, and acne. + + + + + + + Specify whether to use ZIP64 extensions when saving a zip archive. + + + + + + When creating a zip file, the default value for the property is . is + safest, in the sense that you will not get an Exception if a pre-ZIP64 + limit is exceeded. + + + + You may set the property at any time before calling Save(). + + + + When reading a zip file via the Zipfile.Read() method, DotNetZip + will properly read ZIP64-endowed zip archives, regardless of the value of + this property. DotNetZip will always read ZIP64 archives. This property + governs only whether DotNetZip will write them. Therefore, when updating + archives, be careful about setting this property after reading an archive + that may use ZIP64 extensions. + + + + An interesting question is, if you have set this property to + AsNecessary, and then successfully saved, does the resulting + archive use ZIP64 extensions or not? To learn this, check the property, after calling Save(). + + + + Have you thought about + donating? + + + + + + + + Indicates whether the archive requires ZIP64 extensions. + + + + + + This property is null (or Nothing in VB) if the archive has + not been saved, and there are fewer than 65334 ZipEntry items + contained in the archive. + + + + The Value is true if any of the following four conditions holds: + the uncompressed size of any entry is larger than 0xFFFFFFFF; the + compressed size of any entry is larger than 0xFFFFFFFF; the relative + offset of any entry within the zip archive is larger than 0xFFFFFFFF; or + there are more than 65534 entries in the archive. (0xFFFFFFFF = + 4,294,967,295). The result may not be known until a Save() is attempted + on the zip archive. The Value of this + property may be set only AFTER one of the Save() methods has been called. + + + + If none of the four conditions holds, and the archive has been saved, then + the Value is false. + + + + A Value of false does not indicate that the zip archive, as saved, + does not use ZIP64. It merely indicates that ZIP64 is not required. An + archive may use ZIP64 even when not required if the property is set to , or if the property is set to and the output stream was not + seekable. Use the property to determine if + the most recent Save() method resulted in an archive that utilized + the ZIP64 extensions. + + + + + + + + + Indicates whether the most recent Save() operation used ZIP64 extensions. + + + + + The use of ZIP64 extensions within an archive is not always necessary, and + for interoperability concerns, it may be desired to NOT use ZIP64 if + possible. The property can be + set to use ZIP64 extensions only when necessary. In those cases, + Sometimes applications want to know whether a Save() actually used ZIP64 + extensions. Applications can query this read-only property to learn + whether ZIP64 has been used in a just-saved ZipFile. + + + + The value is null (or Nothing in VB) if the archive has not + been saved. + + + + Non-null values (HasValue is true) indicate whether ZIP64 + extensions were used during the most recent Save() operation. The + ZIP64 extensions may have been used as required by any particular entry + because of its uncompressed or compressed size, or because the archive is + larger than 4294967295 bytes, or because there are more than 65534 entries + in the archive, or because the UseZip64WhenSaving property was set + to , or because the + UseZip64WhenSaving property was set to and the output stream was not seekable. + The value of this property does not indicate the reason the ZIP64 + extensions were used. + + + + + + + + + Indicates whether the most recent Read() operation read a zip file that uses + ZIP64 extensions. + + + + This property will return null (Nothing in VB) if you've added an entry after reading + the zip file. + + + + + The text encoding to use when writing new entries to the ZipFile, + for those entries that cannot be encoded with the default (IBM437) + encoding; or, the text encoding that was used when reading the entries + from the ZipFile. + + + + + In its + zip specification, PKWare describes two options for encoding + filenames and comments: using IBM437 or UTF-8. But, some archiving tools + or libraries do not follow the specification, and instead encode + characters using the system default code page. For example, WinRAR when + run on a machine in Shanghai may encode filenames with the Big-5 Chinese + (950) code page. This behavior is contrary to the Zip specification, but + it occurs anyway. + + + + When using DotNetZip to write zip archives that will be read by one of + these other archivers, set this property to specify the code page to use + when encoding the and for each ZipEntry in the zip file, for + values that cannot be encoded with the default codepage for zip files, + IBM437. This is why this property is "provisional". In all cases, IBM437 + is used where possible, in other words, where no loss of data would + result. It is possible, therefore, to have a given entry with a + Comment encoded in IBM437 and a FileName encoded with the + specified "provisional" codepage. + + + + Be aware that a zip file created after you've explicitly set the property to a value other than + IBM437 may not be compliant to the PKWare specification, and may not be + readable by compliant archivers. On the other hand, many (most?) + archivers are non-compliant and can read zip files created in arbitrary + code pages. The trick is to use or specify the proper codepage when + reading the zip. + + + + When creating a zip archive using this library, it is possible to change + the value of between each + entry you add, and between adding entries and the call to + Save(). Don't do this. It will likely result in a zipfile that is + not readable. For best interoperability, either leave alone, or specify it only once, + before adding any entries to the ZipFile instance. There is one + exception to this recommendation, described later. + + + + When using an arbitrary, non-UTF8 code page for encoding, there is no + standard way for the creator application - whether DotNetZip, WinZip, + WinRar, or something else - to formally specify in the zip file which + codepage has been used for the entries. As a result, readers of zip files + are not able to inspect the zip file and determine the codepage that was + used for the entries contained within it. It is left to the application + or user to determine the necessary codepage when reading zip files encoded + this way. In other words, if you explicitly specify the codepage when you + create the zipfile, you must explicitly specify the same codepage when + reading the zipfile. + + + + The way you specify the code page to use when reading a zip file varies + depending on the tool or library you use to read the zip. In DotNetZip, + you use a ZipFile.Read() method that accepts an encoding parameter. It + isn't possible with Windows Explorer, as far as I know, to specify an + explicit codepage to use when reading a zip. If you use an incorrect + codepage when reading a zipfile, you will get entries with filenames that + are incorrect, and the incorrect filenames may even contain characters + that are not legal for use within filenames in Windows. Extracting entries + with illegal characters in the filenames will lead to exceptions. It's too + bad, but this is just the way things are with code pages in zip + files. Caveat Emptor. + + + + Example: Suppose you create a zipfile that contains entries with + filenames that have Danish characters. If you use equal to "iso-8859-1" (cp 28591), + the filenames will be correctly encoded in the zip. But, to read that + zipfile correctly, you have to specify the same codepage at the time you + read it. If try to read that zip file with Windows Explorer or another + application that is not flexible with respect to the codepage used to + decode filenames in zipfiles, you will get a filename like "Inf�.txt". + + + + When using DotNetZip to read a zip archive, and the zip archive uses an + arbitrary code page, you must specify the encoding to use before or when + the Zipfile is READ. This means you must use a ZipFile.Read() + method that allows you to specify a System.Text.Encoding parameter. Setting + the ProvisionalAlternateEncoding property after your application has read in + the zip archive will not affect the entry names of entries that have already + been read in. + + + + And now, the exception to the rule described above. One strategy for + specifying the code page for a given zip file is to describe the code page + in a human-readable form in the Zip comment. For example, the comment may + read "Entries in this archive are encoded in the Big5 code page". For + maximum interoperability, the zip comment in this case should be encoded + in the default, IBM437 code page. In this case, the zip comment is + encoded using a different page than the filenames. To do this, Specify + ProvisionalAlternateEncoding to your desired region-specific code + page, once before adding any entries, and then reset + ProvisionalAlternateEncoding to IBM437 before setting the property and calling Save(). + + + + + This example shows how to read a zip file using the Big-5 Chinese code page + (950), and extract each entry in the zip file. For this code to work as + desired, the Zipfile must have been created using the big5 code page + (CP950). This is typical, for example, when using WinRar on a machine with + CP950 set as the default code page. In that case, the names of entries + within the Zip archive will be stored in that code page, and reading the zip + archive must be done using that code page. If the application did not use + the correct code page in ZipFile.Read(), then names of entries within the + zip archive would not be correctly retrieved. + + using (var zip = ZipFile.Read(zipFileName, System.Text.Encoding.GetEncoding("big5"))) + { + // retrieve and extract an entry using a name encoded with CP950 + zip[MyDesiredEntry].Extract("unpack"); + } + + + + Using zip As ZipFile = ZipFile.Read(ZipToExtract, System.Text.Encoding.GetEncoding("big5")) + ' retrieve and extract an entry using a name encoded with CP950 + zip(MyDesiredEntry).Extract("unpack") + End Using + + + + DefaultEncoding + + + + A Text Encoding to use when encoding the filenames and comments for + all the ZipEntry items, during a ZipFile.Save() operation. + + + + Whether the encoding specified here is used during the save depends + on . + + + + + + A flag that tells if and when this instance should apply + AlternateEncoding to encode the filenames and comments associated to + of ZipEntry objects contained within this instance. + + + + + Gets or sets the TextWriter to which status messages are delivered + for the instance. + + + + If the TextWriter is set to a non-null value, then verbose output is sent + to the TextWriter during Add, Read, Save and + Extract operations. Typically, console applications might use + Console.Out and graphical or headless applications might use a + System.IO.StringWriter. The output of this is suitable for viewing + by humans. + + + + + In this example, a console application instantiates a ZipFile, then + sets the StatusMessageTextWriter to Console.Out. At that + point, all verbose status messages for that ZipFile are sent to the + console. + + + + using (ZipFile zip= ZipFile.Read(FilePath)) + { + zip.StatusMessageTextWriter= System.Console.Out; + // messages are sent to the console during extraction + zip.ExtractAll(); + } + + + + 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 + + + + In this example, a Windows Forms application instantiates a + ZipFile, then sets the StatusMessageTextWriter to a + StringWriter. At that point, all verbose status messages for that + ZipFile are sent to the StringWriter. + + + + var sw = new System.IO.StringWriter(); + using (ZipFile zip= ZipFile.Read(FilePath)) + { + zip.StatusMessageTextWriter= sw; + zip.ExtractAll(); + } + Console.WriteLine("{0}", sw.ToString()); + + + + Dim sw as New System.IO.StringWriter + Using zip As ZipFile = ZipFile.Read(FilePath) + zip.StatusMessageTextWriter= sw + zip.ExtractAll() + End Using + 'Status Messages are now available in sw + + + + + + + Gets or sets the name for the folder to store the temporary file + this library writes when saving a zip archive. + + + + + This library will create a temporary file when saving a Zip archive to a + file. This file is written when calling one of the Save() methods + that does not save to a stream, or one of the SaveSelfExtractor() + methods. + + + + By default, the library will create the temporary file in the directory + specified for the file itself, via the property or via + the method. + + + + Setting this property allows applications to override this default + behavior, so that the library will create the temporary file in the + specified folder. For example, to have the library create the temporary + file in the current working directory, regardless where the ZipFile + is saved, specfy ".". To revert to the default behavior, set this + property to null (Nothing in VB). + + + + When setting the property to a non-null value, the folder specified must + exist; if it does not an exception is thrown. The application should have + write and delete permissions on the folder. The permissions are not + explicitly checked ahead of time; if the application does not have the + appropriate rights, an exception will be thrown at the time Save() + is called. + + + + There is no temporary file created when reading a zip archive. When + saving to a Stream, there is no temporary file created. For example, if + the application is an ASP.NET application and calls Save() + specifying the Response.OutputStream as the output stream, there is + no temporary file created. + + + + + Thrown when setting the property if the directory does not exist. + + + + + + Sets the password to be used on the ZipFile instance. + + + + + + When writing a zip archive, this password is applied to the entries, not + to the zip archive itself. It applies to any ZipEntry subsequently + added to the ZipFile, using one of the AddFile, + AddDirectory, AddEntry, or AddItem methods, etc. + When reading a zip archive, this property applies to any entry + subsequently extracted from the ZipFile using one of the Extract + methods on the ZipFile class. + + + + When writing a zip archive, keep this in mind: though the password is set + on the ZipFile object, according to the Zip spec, the "directory" of the + archive - in other words the list of entries or files contained in the archive - is + not encrypted with the password, or protected in any way. If you set the + Password property, the password actually applies to individual entries + that are added to the archive, subsequent to the setting of this property. + The list of filenames in the archive that is eventually created will + appear in clear text, but the contents of the individual files are + encrypted. This is how Zip encryption works. + + + + One simple way around this limitation is to simply double-wrap sensitive + filenames: Store the files in a zip file, and then store that zip file + within a second, "outer" zip file. If you apply a password to the outer + zip file, then readers will be able to see that the outer zip file + contains an inner zip file. But readers will not be able to read the + directory or file list of the inner zip file. + + + + If you set the password on the ZipFile, and then add a set of files + to the archive, then each entry is encrypted with that password. You may + also want to change the password between adding different entries. If you + set the password, add an entry, then set the password to null + (Nothing in VB), and add another entry, the first entry is + encrypted and the second is not. If you call AddFile(), then set + the Password property, then call ZipFile.Save, the file + added will not be password-protected, and no warning will be generated. + + + + When setting the Password, you may also want to explicitly set the property, to specify how to encrypt the entries added + to the ZipFile. If you set the Password to a non-null value and do not + set , then PKZip 2.0 ("Weak") encryption is used. + This encryption is relatively weak but is very interoperable. If you set + the password to a null value (Nothing in VB), Encryption is + reset to None. + + + + All of the preceding applies to writing zip archives, in other words when + you use one of the Save methods. To use this property when reading or an + existing ZipFile, do the following: set the Password property on the + ZipFile, then call one of the Extract() overloads on the . In this case, the entry is extracted using the + Password that is specified on the ZipFile instance. If you + have not set the Password property, then the password is + null, and the entry is extracted with no password. + + + + If you set the Password property on the ZipFile, then call + Extract() an entry that has not been encrypted with a password, the + password is not used for that entry, and the ZipEntry is extracted + as normal. In other words, the password is used only if necessary. + + + + The class also has a Password property. It takes precedence + over this property on the ZipFile. Typically, you would use the + per-entry Password when most entries in the zip archive use one password, + and a few entries use a different password. If all entries in the zip + file use the same password, then it is simpler to just set this property + on the ZipFile itself, whether creating a zip archive or extracting + a zip archive. + + + + + + + This example creates a zip file, using password protection for the + entries, and then extracts the entries from the zip file. When creating + the zip file, the Readme.txt file is not protected with a password, but + the other two are password-protected as they are saved. During extraction, + each file is extracted with the appropriate password. + + + // create a file with encryption + using (ZipFile zip = new ZipFile()) + { + zip.AddFile("ReadMe.txt"); + zip.Password= "!Secret1"; + zip.AddFile("MapToTheSite-7440-N49th.png"); + zip.AddFile("2008-Regional-Sales-Report.pdf"); + zip.Save("EncryptedArchive.zip"); + } + + // extract entries that use encryption + using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip")) + { + zip.Password= "!Secret1"; + zip.ExtractAll("extractDir"); + } + + + + + Using zip As New ZipFile + zip.AddFile("ReadMe.txt") + zip.Password = "123456!" + zip.AddFile("MapToTheSite-7440-N49th.png") + zip.Password= "!Secret1"; + zip.AddFile("2008-Regional-Sales-Report.pdf") + zip.Save("EncryptedArchive.zip") + End Using + + + ' extract entries that use encryption + Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip")) + zip.Password= "!Secret1" + zip.ExtractAll("extractDir") + End Using + + + + + + ZipFile.Encryption + ZipEntry.Password + + + + The action the library should take when extracting a file that already + exists. + + + + + This property affects the behavior of the Extract methods (one of the + Extract() or ExtractWithPassword() overloads), when + extraction would would overwrite an existing filesystem file. If you do + not set this property, the library throws an exception when extracting an + entry would overwrite an existing file. + + + + This property has no effect when extracting to a stream, or when the file + to be extracted does not already exist. + + + + + + + The action the library should take when an error is encountered while + opening or reading files as they are saved into a zip archive. + + + + + Errors can occur as a file is being saved to the zip archive. For + example, the File.Open may fail, or a File.Read may fail, because of + lock conflicts or other reasons. + + + + The first problem might occur after having called AddDirectory() on a + directory that contains a Clipper .dbf file; the file is locked by + Clipper and cannot be opened for read by another process. An example of + the second problem might occur when trying to zip a .pst file that is in + use by Microsoft Outlook. Outlook locks a range on the file, which allows + other processes to open the file, but not read it in its entirety. + + + + This property tells DotNetZip what you would like to do in the case of + these errors. The primary options are: ZipErrorAction.Throw to + throw an exception (this is the default behavior if you don't set this + property); ZipErrorAction.Skip to Skip the file for which there + was an error and continue saving; ZipErrorAction.Retry to Retry + the entry that caused the problem; or + ZipErrorAction.InvokeErrorEvent to invoke an event handler. + + + + This property is implicitly set to ZipErrorAction.InvokeErrorEvent + if you add a handler to the event. If you set + this property to something other than + ZipErrorAction.InvokeErrorEvent, then the ZipError + event is implicitly cleared. What it means is you can set one or the + other (or neither), depending on what you want, but you never need to set + both. + + + + As with some other properties on the ZipFile class, like , , and , setting this property on a ZipFile + instance will cause the specified ZipErrorAction to be used on all + items that are subsequently added to the + ZipFile instance. If you set this property after you have added + items to the ZipFile, but before you have called Save(), + those items will not use the specified error handling action. + + + + If you want to handle any errors that occur with any entry in the zip + file in the same way, then set this property once, before adding any + entries to the zip archive. + + + + If you set this property to ZipErrorAction.Skip and you'd like to + learn which files may have been skipped after a Save(), you can + set the on the ZipFile before + calling Save(). A message will be emitted into that writer for + each skipped file, if any. + + + + + + This example shows how to tell DotNetZip to skip any files for which an + error is generated during the Save(). + + Public Sub SaveZipFile() + Dim SourceFolder As String = "fodder" + Dim DestFile As String = "eHandler.zip" + Dim sw as New StringWriter + Using zipArchive As ZipFile = New ZipFile + ' Tell DotNetZip to skip any files for which it encounters an error + zipArchive.ZipErrorAction = ZipErrorAction.Skip + zipArchive.StatusMessageTextWriter = sw + zipArchive.AddDirectory(SourceFolder) + zipArchive.Save(DestFile) + End Using + ' examine sw here to see any messages + End Sub + + + + + + + + + + The Encryption to use for entries added to the ZipFile. + + + + + Set this when creating a zip archive, or when updating a zip archive. The + specified Encryption is applied to the entries subsequently added to the + ZipFile instance. Applications do not need to set the + Encryption property when reading or extracting a zip archive. + + + + If you set this to something other than EncryptionAlgorithm.None, you + will also need to set the . + + + + As with some other properties on the ZipFile class, like and , setting this + property on a ZipFile instance will cause the specified + EncryptionAlgorithm to be used on all items + that are subsequently added to the ZipFile instance. In other + words, if you set this property after you have added items to the + ZipFile, but before you have called Save(), those items will + not be encrypted or protected with a password in the resulting zip + archive. To get a zip archive with encrypted entries, set this property, + along with the property, before calling + AddFile, AddItem, or AddDirectory (etc.) on the + ZipFile instance. + + + + If you read a ZipFile, you can modify the Encryption on an + encrypted entry, only by setting the Encryption property on the + ZipEntry itself. Setting the Encryption property on the + ZipFile, once it has been created via a call to + ZipFile.Read(), does not affect entries that were previously read. + + + + For example, suppose you read a ZipFile, and there is an encrypted + entry. Setting the Encryption property on that ZipFile and + then calling Save() on the ZipFile does not update the + Encryption used for the entries in the archive. Neither is an + exception thrown. Instead, what happens during the Save() is that + all previously existing entries are copied through to the new zip archive, + with whatever encryption and password that was used when originally + creating the zip archive. Upon re-reading that archive, to extract + entries, applications should use the original password or passwords, if + any. + + + + Suppose an application reads a ZipFile, and there is an encrypted + entry. Setting the Encryption property on that ZipFile and + then adding new entries (via AddFile(), AddEntry(), etc) + and then calling Save() on the ZipFile does not update the + Encryption on any of the entries that had previously been in the + ZipFile. The Encryption property applies only to the + newly-added entries. + + + + + + + This example creates a zip archive that uses encryption, and then extracts + entries from the archive. When creating the zip archive, the ReadMe.txt + file is zipped without using a password or encryption. The other files + use encryption. + + + + // Create a zip archive with AES Encryption. + using (ZipFile zip = new ZipFile()) + { + zip.AddFile("ReadMe.txt"); + zip.Encryption= EncryptionAlgorithm.WinZipAes256; + zip.Password= "Top.Secret.No.Peeking!"; + zip.AddFile("7440-N49th.png"); + zip.AddFile("2008-Regional-Sales-Report.pdf"); + zip.Save("EncryptedArchive.zip"); + } + + // Extract a zip archive that uses AES Encryption. + // You do not need to specify the algorithm during extraction. + using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip")) + { + zip.Password= "Top.Secret.No.Peeking!"; + zip.ExtractAll("extractDirectory"); + } + + + + ' Create a zip that uses Encryption. + Using zip As New ZipFile() + zip.Encryption= EncryptionAlgorithm.WinZipAes256 + zip.Password= "Top.Secret.No.Peeking!" + zip.AddFile("ReadMe.txt") + zip.AddFile("7440-N49th.png") + zip.AddFile("2008-Regional-Sales-Report.pdf") + zip.Save("EncryptedArchive.zip") + End Using + + ' Extract a zip archive that uses AES Encryption. + ' You do not need to specify the algorithm during extraction. + Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip")) + zip.Password= "Top.Secret.No.Peeking!" + zip.ExtractAll("extractDirectory") + End Using + + + + + ZipFile.Password + ZipEntry.Encryption + + + + A callback that allows the application to specify the compression level + to use for entries subsequently added to the zip archive. + + + + + + With this callback, the DotNetZip library allows the application to + determine whether compression will be used, at the time of the + Save. This may be useful if the application wants to favor + speed over size, and wants to defer the decision until the time of + Save. + + + + Typically applications set the property on + the ZipFile or on each ZipEntry to determine the level of + compression used. This is done at the time the entry is added to the + ZipFile. Setting the property to + Ionic.Zlib.CompressionLevel.None means no compression will be used. + + + + This callback allows the application to defer the decision on the + CompressionLevel to use, until the time of the call to + ZipFile.Save(). The callback is invoked once per ZipEntry, + at the time the data for the entry is being written out as part of a + Save() operation. The application can use whatever criteria it + likes in determining the level to return. For example, an application may + wish that no .mp3 files should be compressed, because they are already + compressed and the extra compression is not worth the CPU time incurred, + and so can return None for all .mp3 entries. + + + + The library determines whether compression will be attempted for an entry + this way: If the entry is a zero length file, or a directory, no + compression is used. Otherwise, if this callback is set, it is invoked + and the CompressionLevel is set to the return value. If this + callback has not been set, then the previously set value for + CompressionLevel is used. + + + + + + + The maximum size of an output segment, when saving a split Zip file. + + + + Make sure you do not read from this field if you've set the value using + + + + Set this to a non-zero value before calling or to specify that the ZipFile should be saved as a + split archive, also sometimes called a spanned archive. Some also + call them multi-file archives. + + + + A split zip archive is saved in a set of discrete filesystem files, + rather than in a single file. This is handy when transmitting the + archive in email or some other mechanism that has a limit to the size of + each file. The first file in a split archive will be named + basename.z01, the second will be named basename.z02, and + so on. The final file is named basename.zip. According to the zip + specification from PKWare, the minimum value is 65536, for a 64k segment + size. The maximum number of segments allows in a split archive is 99. + + + + The value of this property determines the maximum size of a split + segment when writing a split archive. For example, suppose you have a + ZipFile that would save to a single file of 200k. If you set the + MaxOutputSegmentSize to 65536 before calling Save(), you + will get four distinct output files. On the other hand if you set this + property to 256k, then you will get a single-file archive for that + ZipFile. + + + + The size of each split output file will be as large as possible, up to + the maximum size set here. The zip specification requires that some data + fields in a zip archive may not span a split boundary, and an output + segment may be smaller than the maximum if necessary to avoid that + problem. Also, obviously the final segment of the archive may be smaller + than the maximum segment size. Segments will never be larger than the + value set with this property. + + + + You can save a split Zip file only when saving to a regular filesystem + file. It's not possible to save a split zip file as a self-extracting + archive, nor is it possible to save a split zip file to a stream. When + saving to a SFX or to a Stream, this property is ignored. + + + + About interoperability: Split or spanned zip files produced by DotNetZip + can be read by WinZip or PKZip, and vice-versa. Segmented zip files may + not be readable by other tools, if those other tools don't support zip + spanning or splitting. When in doubt, test. I don't believe Windows + Explorer can extract a split archive. + + + + This property has no effect when reading a split archive. You can read + a split archive in the normal way with DotNetZip. + + + + When saving a zip file, if you want a regular zip file rather than a + split zip file, don't set this property, or set it to Zero. + + + + If you read a split archive, with and + then subsequently call ZipFile.Save(), unless you set this + property before calling Save(), you will get a normal, + single-file archive. + + + + + + + + The maximum size of an output segment, when saving a split Zip file. + + + + If you set this value, make sure you do not accidently use in your code + + + + Set this to a non-zero value before calling or to specify that the ZipFile should be saved as a + split archive, also sometimes called a spanned archive. Some also + call them multi-file archives. + + + + A split zip archive is saved in a set of discrete filesystem files, + rather than in a single file. This is handy when transmitting the + archive in email or some other mechanism that has a limit to the size of + each file. The first file in a split archive will be named + basename.z01, the second will be named basename.z02, and + so on. The final file is named basename.zip. According to the zip + specification from PKWare, the minimum value is 65536, for a 64k segment + size. The maximum number of segments allows in a split archive is 99. + + + + The value of this property determines the maximum size of a split + segment when writing a split archive. For example, suppose you have a + ZipFile that would save to a single file of 200k. If you set the + MaxOutputSegmentSize to 65536 before calling Save(), you + will get four distinct output files. On the other hand if you set this + property to 256k, then you will get a single-file archive for that + ZipFile. + + + + The size of each split output file will be as large as possible, up to + the maximum size set here. The zip specification requires that some data + fields in a zip archive may not span a split boundary, and an output + segment may be smaller than the maximum if necessary to avoid that + problem. Also, obviously the final segment of the archive may be smaller + than the maximum segment size. Segments will never be larger than the + value set with this property. + + + + You can save a split Zip file only when saving to a regular filesystem + file. It's not possible to save a split zip file as a self-extracting + archive, nor is it possible to save a split zip file to a stream. When + saving to a SFX or to a Stream, this property is ignored. + + + + About interoperability: Split or spanned zip files produced by DotNetZip + can be read by WinZip or PKZip, and vice-versa. Segmented zip files may + not be readable by other tools, if those other tools don't support zip + spanning or splitting. When in doubt, test. I don't believe Windows + Explorer can extract a split archive. + + + + This property has no effect when reading a split archive. You can read + a split archive in the normal way with DotNetZip. + + + + When saving a zip file, if you want a regular zip file rather than a + split zip file, don't set this property, or set it to Zero. + + + + If you read a split archive, with and + then subsequently call ZipFile.Save(), unless you set this + property before calling Save(), you will get a normal, + single-file archive. + + + + + + + + Returns the number of segments used in the most recent Save() operation. + + + + This is normally zero, unless you have set the property. If you have set , and then you save a file, after the call to + Save() completes, you can read this value to learn the number of segments that + were created. + + + If you call Save("Archive.zip"), and it creates 5 segments, then you + will have filesystem files named Archive.z01, Archive.z02, Archive.z03, + Archive.z04, and Archive.zip, and the value of this property will be 5. + + + + + + + The size threshold for an entry, above which a parallel deflate is used. + + + + + + DotNetZip will use multiple threads to compress any ZipEntry, + if the entry is larger than the given size. Zero means "always + use parallel deflate", while -1 means "never use parallel + deflate". The default value for this property is 512k. Aside + from the special values of 0 and 1, the minimum value is 65536. + + + + If the entry size cannot be known before compression, as with a + read-forward stream, then Parallel deflate will never be + performed, unless the value of this property is zero. + + + + A parallel deflate operations will speed up the compression of + large files, on computers with multiple CPUs or multiple CPU + cores. For files above 1mb, on a dual core or dual-cpu (2p) + machine, the time required to compress the file can be 70% of the + single-threaded deflate. For very large files on 4p machines the + compression can be done in 30% of the normal time. The downside + is that parallel deflate consumes extra memory during the deflate, + and the deflation is not as effective. + + + + Parallel deflate tends to yield slightly less compression when + compared to as single-threaded deflate; this is because the original + data stream is split into multiple independent buffers, each of which + is compressed in parallel. But because they are treated + independently, there is no opportunity to share compression + dictionaries. For that reason, a deflated stream may be slightly + larger when compressed using parallel deflate, as compared to a + traditional single-threaded deflate. Sometimes the increase over the + normal deflate is as much as 5% of the total compressed size. For + larger files it can be as small as 0.1%. + + + + Multi-threaded compression does not give as much an advantage when + using Encryption. This is primarily because encryption tends to slow + down the entire pipeline. Also, multi-threaded compression gives less + of an advantage when using lower compression levels, for example . You may have to + perform some tests to determine the best approach for your situation. + + + + + + + + + + The maximum number of buffer pairs to use when performing + parallel compression. + + + + + This property sets an upper limit on the number of memory + buffer pairs to create when performing parallel + compression. The implementation of the parallel + compression stream allocates multiple buffers to + facilitate parallel compression. As each buffer fills up, + the stream uses + ThreadPool.QueueUserWorkItem() to compress those + buffers in a background threadpool thread. After a buffer + is compressed, it is re-ordered and written to the output + stream. + + + + A higher number of buffer pairs enables a higher degree of + parallelism, which tends to increase the speed of compression on + multi-cpu computers. On the other hand, a higher number of buffer + pairs also implies a larger memory consumption, more active worker + threads, and a higher cpu utilization for any compression. This + property enables the application to limit its memory consumption and + CPU utilization behavior depending on requirements. + + + + For each compression "task" that occurs in parallel, there are 2 + buffers allocated: one for input and one for output. This property + sets a limit for the number of pairs. The total amount of storage + space allocated for buffering will then be (N*S*2), where N is the + number of buffer pairs, S is the size of each buffer (). By default, DotNetZip allocates 4 buffer + pairs per CPU core, so if your machine has 4 cores, and you retain + the default buffer size of 128k, then the + ParallelDeflateOutputStream will use 4 * 4 * 2 * 128kb of buffer + memory in total, or 4mb, in blocks of 128kb. If you then set this + property to 8, then the number will be 8 * 2 * 128kb of buffer + memory, or 2mb. + + + + CPU utilization will also go up with additional buffers, because a + larger number of buffer pairs allows a larger number of background + threads to compress in parallel. If you find that parallel + compression is consuming too much memory or CPU, you can adjust this + value downward. + + + + The default value is 16. Different values may deliver better or + worse results, depending on your priorities and the dynamic + performance characteristics of your storage and compute resources. + + + + This property is not the number of buffer pairs to use; it is an + upper limit. An illustration: Suppose you have an application that + uses the default value of this property (which is 16), and it runs + on a machine with 2 CPU cores. In that case, DotNetZip will allocate + 4 buffer pairs per CPU core, for a total of 8 pairs. The upper + limit specified by this property has no effect. + + + + The application can set this value at any time + before calling ZipFile.Save(). + + + + + + + + Provides a string representation of the instance. + a string representation of the instance. + + + + Returns the version number on the DotNetZip assembly. + + + + + This property is exposed as a convenience. Callers could also get the + version value by retrieving GetName().Version on the + System.Reflection.Assembly object pointing to the DotNetZip + assembly. But sometimes it is not clear which assembly is being loaded. + This property makes it clear. + + + This static property is primarily useful for diagnostic purposes. + + + + + + Creates a new ZipFile instance, using the specified filename. + + + + + Applications can use this constructor to create a new ZipFile for writing, + or to slurp in an existing zip archive for read and update purposes. + + + + To create a new zip archive, an application can call this constructor, + passing the name of a file that does not exist. The name may be a fully + qualified path. Then the application can add directories or files to the + ZipFile via AddDirectory(), AddFile(), AddItem() + and then write the zip archive to the disk by calling Save(). The + zip file is not actually opened and written to the disk until the + application calls ZipFile.Save(). At that point the new zip file + with the given name is created. + + + + If you won't know the name of the Zipfile until the time you call + ZipFile.Save(), or if you plan to save to a stream (which has no + name), then you should use the no-argument constructor. + + + + The application can also call this constructor to read an existing zip + archive. passing the name of a valid zip file that does exist. But, it's + better form to use the static method, + passing the name of the zip file, because using ZipFile.Read() in + your code communicates very clearly what you are doing. In either case, + the file is then read into the ZipFile instance. The app can then + enumerate the entries or can modify the zip file, for example adding + entries, removing entries, changing comments, and so on. + + + + One advantage to this parameterized constructor: it allows applications to + use the same code to add items to a zip archive, regardless of whether the + zip file exists. + + + + Instances of the ZipFile class are not multi-thread safe. You may + not party on a single instance with multiple threads. You may have + multiple threads that each use a distinct ZipFile instance, or you + can synchronize multi-thread access to a single instance. + + + + By the way, since DotNetZip is so easy to use, don't you think you should + donate $5 or $10? + + + + + + Thrown if name refers to an existing file that is not a valid zip file. + + + + This example shows how to create a zipfile, and add a few files into it. + + String ZipFileToCreate = "archive1.zip"; + String DirectoryToZip = "c:\\reports"; + using (ZipFile zip = new ZipFile()) + { + // Store all files found in the top level directory, into the zip archive. + String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip); + zip.AddFiles(filenames, "files"); + zip.Save(ZipFileToCreate); + } + + + + Dim ZipFileToCreate As String = "archive1.zip" + Dim DirectoryToZip As String = "c:\reports" + Using zip As ZipFile = New ZipFile() + Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip) + zip.AddFiles(filenames, "files") + zip.Save(ZipFileToCreate) + End Using + + + + The filename to use for the new zip archive. + + + + + Creates a new ZipFile instance, using the specified name for the + filename, and the specified Encoding. + + + + + See the documentation on the ZipFile + constructor that accepts a single string argument for basic + information on all the ZipFile constructors. + + + + The Encoding is used as the default alternate encoding for entries with + filenames or comments that cannot be encoded with the IBM437 code page. + This is equivalent to setting the property on the ZipFile + instance after construction. + + + + Instances of the ZipFile class are not multi-thread safe. You may + not party on a single instance with multiple threads. You may have + multiple threads that each use a distinct ZipFile instance, or you + can synchronize multi-thread access to a single instance. + + + + + + Thrown if name refers to an existing file that is not a valid zip file. + + + The filename to use for the new zip archive. + The Encoding is used as the default alternate + encoding for entries with filenames or comments that cannot be encoded + with the IBM437 code page. + + + + Create a zip file, without specifying a target filename or stream to save to. + + + + + See the documentation on the ZipFile + constructor that accepts a single string argument for basic + information on all the ZipFile constructors. + + + + After instantiating with this constructor and adding entries to the + archive, the application should call or + to save to a file or a + stream, respectively. The application can also set the + property and then call the no-argument method. (This + is the preferred approach for applications that use the library through + COM interop.) If you call the no-argument method + without having set the Name of the ZipFile, either through + the parameterized constructor or through the explicit property , the + Save() will throw, because there is no place to save the file. + + + Instances of the ZipFile class are not multi-thread safe. You may + have multiple threads that each use a distinct ZipFile instance, or + you can synchronize multi-thread access to a single instance. + + + + + This example creates a Zip archive called Backup.zip, containing all the files + in the directory DirectoryToZip. Files within subdirectories are not zipped up. + + using (ZipFile zip = new ZipFile()) + { + // Store all files found in the top level directory, into the zip archive. + // note: this code does not recurse subdirectories! + String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip); + zip.AddFiles(filenames, "files"); + zip.Save("Backup.zip"); + } + + + + Using zip As New ZipFile + ' Store all files found in the top level directory, into the zip archive. + ' note: this code does not recurse subdirectories! + Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip) + zip.AddFiles(filenames, "files") + zip.Save("Backup.zip") + End Using + + + + + + Create a zip file, specifying a text Encoding, but without specifying a + target filename or stream to save to. + + + + + See the documentation on the ZipFile + constructor that accepts a single string argument for basic + information on all the ZipFile constructors. + + + + + + The Encoding is used as the default alternate encoding for entries with + filenames or comments that cannot be encoded with the IBM437 code page. + + + + + Creates a new ZipFile instance, using the specified name for the + filename, and the specified status message writer. + + + + + See the documentation on the ZipFile + constructor that accepts a single string argument for basic + information on all the ZipFile constructors. + + + + This version of the constructor allows the caller to pass in a TextWriter, + to which verbose messages will be written during extraction or creation of + the zip archive. A console application may wish to pass + System.Console.Out to get messages on the Console. A graphical or headless + application may wish to capture the messages in a different + TextWriter, for example, a StringWriter, and then display + the messages in a TextBox, or generate an audit log of ZipFile operations. + + + + To encrypt the data for the files added to the ZipFile instance, + set the Password property after creating the ZipFile instance. + + + + Instances of the ZipFile class are not multi-thread safe. You may + not party on a single instance with multiple threads. You may have + multiple threads that each use a distinct ZipFile instance, or you + can synchronize multi-thread access to a single instance. + + + + + + Thrown if name refers to an existing file that is not a valid zip file. + + + + + using (ZipFile zip = new ZipFile("Backup.zip", Console.Out)) + { + // Store all files found in the top level directory, into the zip archive. + // note: this code does not recurse subdirectories! + // Status messages will be written to Console.Out + String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip); + zip.AddFiles(filenames); + zip.Save(); + } + + + + Using zip As New ZipFile("Backup.zip", Console.Out) + ' Store all files found in the top level directory, into the zip archive. + ' note: this code does not recurse subdirectories! + ' Status messages will be written to Console.Out + Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip) + zip.AddFiles(filenames) + zip.Save() + End Using + + + + The filename to use for the new zip archive. + A TextWriter to use for writing + verbose status messages. + + + + Creates a new ZipFile instance, using the specified name for the + filename, the specified status message writer, and the specified Encoding. + + + + + This constructor works like the ZipFile + constructor that accepts a single string argument. See that + reference for detail on what this constructor does. + + + + This version of the constructor allows the caller to pass in a + TextWriter, and an Encoding. The TextWriter will collect + verbose messages that are generated by the library during extraction or + creation of the zip archive. A console application may wish to pass + System.Console.Out to get messages on the Console. A graphical or + headless application may wish to capture the messages in a different + TextWriter, for example, a StringWriter, and then display + the messages in a TextBox, or generate an audit log of + ZipFile operations. + + + + The Encoding is used as the default alternate encoding for entries + with filenames or comments that cannot be encoded with the IBM437 code + page. This is a equivalent to setting the property on the ZipFile + instance after construction. + + + + To encrypt the data for the files added to the ZipFile instance, + set the Password property after creating the ZipFile + instance. + + + + Instances of the ZipFile class are not multi-thread safe. You may + not party on a single instance with multiple threads. You may have + multiple threads that each use a distinct ZipFile instance, or you + can synchronize multi-thread access to a single instance. + + + + + + Thrown if fileName refers to an existing file that is not a valid zip file. + + + The filename to use for the new zip archive. + A TextWriter to use for writing verbose + status messages. + + The Encoding is used as the default alternate encoding for entries with + filenames or comments that cannot be encoded with the IBM437 code page. + + + + + Initialize a ZipFile instance by reading in a zip file. + + + + + + This method is primarily useful from COM Automation environments, when + reading or extracting zip files. In COM, it is not possible to invoke + parameterized constructors for a class. A COM Automation application can + update a zip file by using the default (no argument) + constructor, then calling Initialize() to read the contents + of an on-disk zip archive into the ZipFile instance. + + + + .NET applications are encouraged to use the ZipFile.Read() methods + for better clarity. + + + + the name of the existing zip file to read in. + + + + This is an integer indexer into the Zip archive. + + + + + This property is read-only. + + + + Internally, the ZipEntry instances that belong to the + ZipFile are stored in a Dictionary. When you use this + indexer the first time, it creates a read-only + List<ZipEntry> from the Dictionary.Values Collection. + If at any time you modify the set of entries in the ZipFile, + either by adding an entry, removing an entry, or renaming an + entry, a new List will be created, and the numeric indexes for the + remaining entries may be different. + + + + This means you cannot rename any ZipEntry from + inside an enumeration of the zip file. + + + + The index value. + + + + + + The ZipEntry within the Zip archive at the specified index. If the + entry does not exist in the archive, this indexer throws. + + + + + + This is a name-based indexer into the Zip archive. + + + + + This property is read-only. + + + + The property on the ZipFile + determines whether retrieval via this indexer is done via case-sensitive + comparisons. By default, retrieval is not case sensitive. This makes + sense on Windows, in which filesystems are not case sensitive. + + + + Regardless of case-sensitivity, it is not always the case that + this[value].FileName == value. In other words, the FileName + property of the ZipEntry retrieved with this indexer, may or may + not be equal to the index value. + + + + This is because DotNetZip performs a normalization of filenames passed to + this indexer, before attempting to retrieve the item. That normalization + includes: removal of a volume letter and colon, swapping backward slashes + for forward slashes. So, zip["dir1\\entry1.txt"].FileName == + "dir1/entry.txt". + + + + Directory entries in the zip file may be retrieved via this indexer only + with names that have a trailing slash. DotNetZip automatically appends a + trailing slash to the names of any directory entries added to a zip. + + + + + + This example extracts only the entries in a zip file that are .txt files. + + using (ZipFile zip = ZipFile.Read("PackedDocuments.zip")) + { + foreach (string s1 in zip.EntryFilenames) + { + if (s1.EndsWith(".txt")) + zip[s1].Extract("textfiles"); + } + } + + + Using zip As ZipFile = ZipFile.Read("PackedDocuments.zip") + Dim s1 As String + For Each s1 In zip.EntryFilenames + If s1.EndsWith(".txt") Then + zip(s1).Extract("textfiles") + End If + Next + End Using + + + + + + Thrown if the caller attempts to assign a non-null value to the indexer. + + + + The name of the file, including any directory path, to retrieve from the + zip. The filename match is not case-sensitive by default; you can use the + property to change this behavior. The + pathname can use forward-slashes or backward slashes. + + + + The ZipEntry within the Zip archive, given by the specified + filename. If the named entry does not exist in the archive, this indexer + returns null (Nothing in VB). + + + + + + The list of filenames for the entries contained within the zip archive. + + + + According to the ZIP specification, the names of the entries use forward + slashes in pathnames. If you are scanning through the list, you may have + to swap forward slashes for backslashes. + + + + + + This example shows one way to test if a filename is already contained + within a zip archive. + + String zipFileToRead= "PackedDocuments.zip"; + string candidate = "DatedMaterial.xps"; + using (ZipFile zip = new ZipFile(zipFileToRead)) + { + if (zip.EntryFilenames.Contains(candidate)) + Console.WriteLine("The file '{0}' exists in the zip archive '{1}'", + candidate, + zipFileName); + else + Console.WriteLine("The file, '{0}', does not exist in the zip archive '{1}'", + candidate, + zipFileName); + Console.WriteLine(); + } + + + Dim zipFileToRead As String = "PackedDocuments.zip" + Dim candidate As String = "DatedMaterial.xps" + Using zip As ZipFile.Read(ZipFileToRead) + If zip.EntryFilenames.Contains(candidate) Then + Console.WriteLine("The file '{0}' exists in the zip archive '{1}'", _ + candidate, _ + zipFileName) + Else + Console.WriteLine("The file, '{0}', does not exist in the zip archive '{1}'", _ + candidate, _ + zipFileName) + End If + Console.WriteLine + End Using + + + + + The list of strings for the filenames contained within the Zip archive. + + + + + + Returns the readonly collection of entries in the Zip archive. + + + + + + If there are no entries in the current ZipFile, the value returned is a + non-null zero-element collection. If there are entries in the zip file, + the elements are returned in no particular order. + + + This is the implied enumerator on the ZipFile class. If you use a + ZipFile instance in a context that expects an enumerator, you will + get this collection. + + + + + + + Returns a readonly collection of entries in the Zip archive, sorted by FileName. + + + + If there are no entries in the current ZipFile, the value returned + is a non-null zero-element collection. If there are entries in the zip + file, the elements are returned sorted by the name of the entry. + + + + + This example fills a Windows Forms ListView with the entries in a zip file. + + + using (ZipFile zip = ZipFile.Read(zipFile)) + { + foreach (ZipEntry entry in zip.EntriesSorted) + { + ListViewItem item = new ListViewItem(n.ToString()); + n++; + string[] subitems = new string[] { + entry.FileName.Replace("/","\\"), + entry.LastModified.ToString("yyyy-MM-dd HH:mm:ss"), + entry.UncompressedSize.ToString(), + String.Format("{0,5:F0}%", entry.CompressionRatio), + entry.CompressedSize.ToString(), + (entry.UsesEncryption) ? "Y" : "N", + String.Format("{0:X8}", entry.Crc)}; + + foreach (String s in subitems) + { + ListViewItem.ListViewSubItem subitem = new ListViewItem.ListViewSubItem(); + subitem.Text = s; + item.SubItems.Add(subitem); + } + + this.listView1.Items.Add(item); + } + } + + + + + + + + Returns the number of entries in the Zip archive. + + + + + Removes the given ZipEntry from the zip archive. + + + + + After calling RemoveEntry, the application must call Save to + make the changes permanent. + + + + + Thrown if the specified ZipEntry does not exist in the ZipFile. + + + + In this example, all entries in the zip archive dating from before + December 31st, 2007, are removed from the archive. This is actually much + easier if you use the RemoveSelectedEntries method. But I needed an + example for RemoveEntry, so here it is. + + String ZipFileToRead = "ArchiveToModify.zip"; + System.DateTime Threshold = new System.DateTime(2007,12,31); + using (ZipFile zip = ZipFile.Read(ZipFileToRead)) + { + var EntriesToRemove = new System.Collections.Generic.List<ZipEntry>(); + foreach (ZipEntry e in zip) + { + if (e.LastModified < Threshold) + { + // We cannot remove the entry from the list, within the context of + // an enumeration of said list. + // So we add the doomed entry to a list to be removed later. + EntriesToRemove.Add(e); + } + } + + // actually remove the doomed entries. + foreach (ZipEntry zombie in EntriesToRemove) + zip.RemoveEntry(zombie); + + zip.Comment= String.Format("This zip archive was updated at {0}.", + System.DateTime.Now.ToString("G")); + + // save with a different name + zip.Save("Archive-Updated.zip"); + } + + + + Dim ZipFileToRead As String = "ArchiveToModify.zip" + Dim Threshold As New DateTime(2007, 12, 31) + Using zip As ZipFile = ZipFile.Read(ZipFileToRead) + Dim EntriesToRemove As New System.Collections.Generic.List(Of ZipEntry) + Dim e As ZipEntry + For Each e In zip + If (e.LastModified < Threshold) Then + ' We cannot remove the entry from the list, within the context of + ' an enumeration of said list. + ' So we add the doomed entry to a list to be removed later. + EntriesToRemove.Add(e) + End If + Next + + ' actually remove the doomed entries. + Dim zombie As ZipEntry + For Each zombie In EntriesToRemove + zip.RemoveEntry(zombie) + Next + zip.Comment = String.Format("This zip archive was updated at {0}.", DateTime.Now.ToString("G")) + 'save as a different name + zip.Save("Archive-Updated.zip") + End Using + + + + + The ZipEntry to remove from the zip. + + + + + + + + Removes the ZipEntry with the given filename from the zip archive. + + + + + After calling RemoveEntry, the application must call Save to + make the changes permanent. + + + + + + Thrown if the ZipFile is not updatable. + + + + Thrown if a ZipEntry with the specified filename does not exist in + the ZipFile. + + + + + This example shows one way to remove an entry with a given filename from + an existing zip archive. + + + String zipFileToRead= "PackedDocuments.zip"; + string candidate = "DatedMaterial.xps"; + using (ZipFile zip = ZipFile.Read(zipFileToRead)) + { + if (zip.EntryFilenames.Contains(candidate)) + { + zip.RemoveEntry(candidate); + zip.Comment= String.Format("The file '{0}' has been removed from this archive.", + Candidate); + zip.Save(); + } + } + + + Dim zipFileToRead As String = "PackedDocuments.zip" + Dim candidate As String = "DatedMaterial.xps" + Using zip As ZipFile = ZipFile.Read(zipFileToRead) + If zip.EntryFilenames.Contains(candidate) Then + zip.RemoveEntry(candidate) + zip.Comment = String.Format("The file '{0}' has been removed from this archive.", Candidate) + zip.Save + End If + End Using + + + + + The name of the file, including any directory path, to remove from the zip. + The filename match is not case-sensitive by default; you can use the + CaseSensitiveRetrieval property to change this behavior. The + pathname can use forward-slashes or backward slashes. + + + + + + Closes the read and write streams associated + to the ZipFile, if necessary. + + + + The Dispose() method is generally employed implicitly, via a using(..) {..} + statement. (Using...End Using in VB) If you do not employ a using + statement, insure that your application calls Dispose() explicitly. For + example, in a Powershell application, or an application that uses the COM + interop interface, you must call Dispose() explicitly. + + + + This example extracts an entry selected by name, from the Zip file to the + Console. + + using (ZipFile zip = ZipFile.Read(zipfile)) + { + foreach (ZipEntry e in zip) + { + if (WantThisEntry(e.FileName)) + zip.Extract(e.FileName, Console.OpenStandardOutput()); + } + } // Dispose() is called implicitly here. + + + + Using zip As ZipFile = ZipFile.Read(zipfile) + Dim e As ZipEntry + For Each e In zip + If WantThisEntry(e.FileName) Then + zip.Extract(e.FileName, Console.OpenStandardOutput()) + End If + Next + End Using ' Dispose is implicity called here + + + + + + Disposes any managed resources, if the flag is set, then marks the + instance disposed. This method is typically not called explicitly from + application code. + + + + Applications should call the no-arg Dispose method. + + + + indicates whether the method should dispose streams or not. + + + + + Default size of the buffer used for IO. + + + + + An event handler invoked when a Save() starts, before and after each + entry has been written to the archive, when a Save() completes, and + during other Save events. + + + + + Depending on the particular event, different properties on the parameter are set. The following + table summarizes the available EventTypes and the conditions under + which this event handler is invoked with a + SaveProgressEventArgs with the given EventType. + + + + + value of EntryType + Meaning and conditions + + + + ZipProgressEventType.Saving_Started + Fired when ZipFile.Save() begins. + + + + + ZipProgressEventType.Saving_BeforeSaveEntry + + Fired within ZipFile.Save(), just before writing data for each + particular entry. + + + + + ZipProgressEventType.Saving_AfterSaveEntry + + Fired within ZipFile.Save(), just after having finished writing data + for each particular entry. + + + + + ZipProgressEventType.Saving_Completed + Fired when ZipFile.Save() has completed. + + + + + ZipProgressEventType.Saving_AfterSaveTempArchive + + Fired after the temporary file has been created. This happens only + when saving to a disk file. This event will not be invoked when + saving to a stream. + + + + + ZipProgressEventType.Saving_BeforeRenameTempArchive + + Fired just before renaming the temporary file to the permanent + location. This happens only when saving to a disk file. This event + will not be invoked when saving to a stream. + + + + + ZipProgressEventType.Saving_AfterRenameTempArchive + + Fired just after renaming the temporary file to the permanent + location. This happens only when saving to a disk file. This event + will not be invoked when saving to a stream. + + + + + ZipProgressEventType.Saving_AfterCompileSelfExtractor + + Fired after a self-extracting archive has finished compiling. This + EventType is used only within SaveSelfExtractor(). + + + + + ZipProgressEventType.Saving_BytesRead + + Set during the save of a particular entry, to update progress of the + Save(). When this EventType is set, the BytesTransferred is the + number of bytes that have been read from the source stream. The + TotalBytesToTransfer is the number of bytes in the uncompressed + file. + + + + + + + + + This example uses an anonymous method to handle the + SaveProgress event, by updating a progress bar. + + + progressBar1.Value = 0; + progressBar1.Max = listbox1.Items.Count; + using (ZipFile zip = new ZipFile()) + { + // listbox1 contains a list of filenames + zip.AddFiles(listbox1.Items); + + // do the progress bar: + zip.SaveProgress += (sender, e) => { + if (e.EventType == ZipProgressEventType.Saving_BeforeWriteEntry) { + progressBar1.PerformStep(); + } + }; + + zip.Save(fs); + } + + + + + This example uses a named method as the + SaveProgress event handler, to update the user, in a + console-based application. + + + static bool justHadByteUpdate= false; + public static void SaveProgress(object sender, SaveProgressEventArgs e) + { + if (e.EventType == ZipProgressEventType.Saving_Started) + Console.WriteLine("Saving: {0}", e.ArchiveName); + + else if (e.EventType == ZipProgressEventType.Saving_Completed) + { + justHadByteUpdate= false; + Console.WriteLine(); + Console.WriteLine("Done: {0}", e.ArchiveName); + } + + else if (e.EventType == ZipProgressEventType.Saving_BeforeWriteEntry) + { + if (justHadByteUpdate) + Console.WriteLine(); + Console.WriteLine(" Writing: {0} ({1}/{2})", + e.CurrentEntry.FileName, e.EntriesSaved, e.EntriesTotal); + justHadByteUpdate= false; + } + + else if (e.EventType == ZipProgressEventType.Saving_EntryBytesRead) + { + if (justHadByteUpdate) + Console.SetCursorPosition(0, Console.CursorTop); + Console.Write(" {0}/{1} ({2:N0}%)", e.BytesTransferred, e.TotalBytesToTransfer, + e.BytesTransferred / (0.01 * e.TotalBytesToTransfer )); + justHadByteUpdate= true; + } + } + + public static ZipUp(string targetZip, string directory) + { + using (var zip = new ZipFile()) { + zip.SaveProgress += SaveProgress; + zip.AddDirectory(directory); + zip.Save(targetZip); + } + } + + + + + Public Sub ZipUp(ByVal targetZip As String, ByVal directory As String) + Using zip As ZipFile = New ZipFile + AddHandler zip.SaveProgress, AddressOf MySaveProgress + zip.AddDirectory(directory) + zip.Save(targetZip) + End Using + End Sub + + Private Shared justHadByteUpdate As Boolean = False + + Public Shared Sub MySaveProgress(ByVal sender As Object, ByVal e As SaveProgressEventArgs) + If (e.EventType Is ZipProgressEventType.Saving_Started) Then + Console.WriteLine("Saving: {0}", e.ArchiveName) + + ElseIf (e.EventType Is ZipProgressEventType.Saving_Completed) Then + justHadByteUpdate = False + Console.WriteLine + Console.WriteLine("Done: {0}", e.ArchiveName) + + ElseIf (e.EventType Is ZipProgressEventType.Saving_BeforeWriteEntry) Then + If justHadByteUpdate Then + Console.WriteLine + End If + Console.WriteLine(" Writing: {0} ({1}/{2})", e.CurrentEntry.FileName, e.EntriesSaved, e.EntriesTotal) + justHadByteUpdate = False + + ElseIf (e.EventType Is ZipProgressEventType.Saving_EntryBytesRead) Then + If justHadByteUpdate Then + Console.SetCursorPosition(0, Console.CursorTop) + End If + Console.Write(" {0}/{1} ({2:N0}%)", e.BytesTransferred, _ + e.TotalBytesToTransfer, _ + (CDbl(e.BytesTransferred) / (0.01 * e.TotalBytesToTransfer))) + justHadByteUpdate = True + End If + End Sub + + + + + + This is a more complete example of using the SaveProgress + events in a Windows Forms application, with a + Thread object. + + + delegate void SaveEntryProgress(SaveProgressEventArgs e); + delegate void ButtonClick(object sender, EventArgs e); + + public class WorkerOptions + { + public string ZipName; + public string Folder; + public string Encoding; + public string Comment; + public int ZipFlavor; + public Zip64Option Zip64; + } + + private int _progress2MaxFactor; + private bool _saveCanceled; + private long _totalBytesBeforeCompress; + private long _totalBytesAfterCompress; + private Thread _workerThread; + + + private void btnZipup_Click(object sender, EventArgs e) + { + KickoffZipup(); + } + + private void btnCancel_Click(object sender, EventArgs e) + { + if (this.lblStatus.InvokeRequired) + { + this.lblStatus.Invoke(new ButtonClick(this.btnCancel_Click), new object[] { sender, e }); + } + else + { + _saveCanceled = true; + lblStatus.Text = "Canceled..."; + ResetState(); + } + } + + private void KickoffZipup() + { + _folderName = tbDirName.Text; + + if (_folderName == null || _folderName == "") return; + if (this.tbZipName.Text == null || this.tbZipName.Text == "") return; + + // check for existence of the zip file: + if (System.IO.File.Exists(this.tbZipName.Text)) + { + var dlgResult = MessageBox.Show(String.Format("The file you have specified ({0}) already exists." + + " Do you want to overwrite this file?", this.tbZipName.Text), + "Confirmation is Required", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (dlgResult != DialogResult.Yes) return; + System.IO.File.Delete(this.tbZipName.Text); + } + + _saveCanceled = false; + _nFilesCompleted = 0; + _totalBytesAfterCompress = 0; + _totalBytesBeforeCompress = 0; + this.btnOk.Enabled = false; + this.btnOk.Text = "Zipping..."; + this.btnCancel.Enabled = true; + lblStatus.Text = "Zipping..."; + + var options = new WorkerOptions + { + ZipName = this.tbZipName.Text, + Folder = _folderName, + Encoding = "ibm437" + }; + + if (this.comboBox1.SelectedIndex != 0) + { + options.Encoding = this.comboBox1.SelectedItem.ToString(); + } + + if (this.radioFlavorSfxCmd.Checked) + options.ZipFlavor = 2; + else if (this.radioFlavorSfxGui.Checked) + options.ZipFlavor = 1; + else options.ZipFlavor = 0; + + if (this.radioZip64AsNecessary.Checked) + options.Zip64 = Zip64Option.AsNecessary; + else if (this.radioZip64Always.Checked) + options.Zip64 = Zip64Option.Always; + else options.Zip64 = Zip64Option.Never; + + options.Comment = String.Format("Encoding:{0} || Flavor:{1} || ZIP64:{2}\r\nCreated at {3} || {4}\r\n", + options.Encoding, + FlavorToString(options.ZipFlavor), + options.Zip64.ToString(), + System.DateTime.Now.ToString("yyyy-MMM-dd HH:mm:ss"), + this.Text); + + if (this.tbComment.Text != TB_COMMENT_NOTE) + options.Comment += this.tbComment.Text; + + _workerThread = new Thread(this.DoSave); + _workerThread.Name = "Zip Saver thread"; + _workerThread.Start(options); + this.Cursor = Cursors.WaitCursor; + } + + + private void DoSave(Object p) + { + WorkerOptions options = p as WorkerOptions; + try + { + using (var zip1 = new ZipFile()) + { + zip1.ProvisionalAlternateEncoding = System.Text.Encoding.GetEncoding(options.Encoding); + zip1.Comment = options.Comment; + zip1.AddDirectory(options.Folder); + _entriesToZip = zip1.EntryFileNames.Count; + SetProgressBars(); + zip1.SaveProgress += this.zip1_SaveProgress; + + zip1.UseZip64WhenSaving = options.Zip64; + + if (options.ZipFlavor == 1) + zip1.SaveSelfExtractor(options.ZipName, SelfExtractorFlavor.WinFormsApplication); + else if (options.ZipFlavor == 2) + zip1.SaveSelfExtractor(options.ZipName, SelfExtractorFlavor.ConsoleApplication); + else + zip1.Save(options.ZipName); + } + } + catch (System.Exception exc1) + { + MessageBox.Show(String.Format("Exception while zipping: {0}", exc1.Message)); + btnCancel_Click(null, null); + } + } + + + + void zip1_SaveProgress(object sender, SaveProgressEventArgs e) + { + switch (e.EventType) + { + case ZipProgressEventType.Saving_AfterWriteEntry: + StepArchiveProgress(e); + break; + case ZipProgressEventType.Saving_EntryBytesRead: + StepEntryProgress(e); + break; + case ZipProgressEventType.Saving_Completed: + SaveCompleted(); + break; + case ZipProgressEventType.Saving_AfterSaveTempArchive: + // this event only occurs when saving an SFX file + TempArchiveSaved(); + break; + } + if (_saveCanceled) + e.Cancel = true; + } + + + + private void StepArchiveProgress(SaveProgressEventArgs e) + { + if (this.progressBar1.InvokeRequired) + { + this.progressBar1.Invoke(new SaveEntryProgress(this.StepArchiveProgress), new object[] { e }); + } + else + { + if (!_saveCanceled) + { + _nFilesCompleted++; + this.progressBar1.PerformStep(); + _totalBytesAfterCompress += e.CurrentEntry.CompressedSize; + _totalBytesBeforeCompress += e.CurrentEntry.UncompressedSize; + + // reset the progress bar for the entry: + this.progressBar2.Value = this.progressBar2.Maximum = 1; + + this.Update(); + } + } + } + + + private void StepEntryProgress(SaveProgressEventArgs e) + { + if (this.progressBar2.InvokeRequired) + { + this.progressBar2.Invoke(new SaveEntryProgress(this.StepEntryProgress), new object[] { e }); + } + else + { + if (!_saveCanceled) + { + if (this.progressBar2.Maximum == 1) + { + // reset + Int64 max = e.TotalBytesToTransfer; + _progress2MaxFactor = 0; + while (max > System.Int32.MaxValue) + { + max /= 2; + _progress2MaxFactor++; + } + this.progressBar2.Maximum = (int)max; + lblStatus.Text = String.Format("{0} of {1} files...({2})", + _nFilesCompleted + 1, _entriesToZip, e.CurrentEntry.FileName); + } + + int xferred = e.BytesTransferred >> _progress2MaxFactor; + + this.progressBar2.Value = (xferred >= this.progressBar2.Maximum) + ? this.progressBar2.Maximum + : xferred; + + this.Update(); + } + } + } + + private void SaveCompleted() + { + if (this.lblStatus.InvokeRequired) + { + this.lblStatus.Invoke(new MethodInvoker(this.SaveCompleted)); + } + else + { + lblStatus.Text = String.Format("Done, Compressed {0} files, {1:N0}% of original.", + _nFilesCompleted, (100.00 * _totalBytesAfterCompress) / _totalBytesBeforeCompress); + ResetState(); + } + } + + private void ResetState() + { + this.btnCancel.Enabled = false; + this.btnOk.Enabled = true; + this.btnOk.Text = "Zip it!"; + this.progressBar1.Value = 0; + this.progressBar2.Value = 0; + this.Cursor = Cursors.Default; + if (!_workerThread.IsAlive) + _workerThread.Join(); + } + + + + + + + + + + + An event handler invoked before, during, and after the reading of a zip archive. + + + + + Depending on the particular event being signaled, different properties on the + parameter are set. The following table + summarizes the available EventTypes and the conditions under which this + event handler is invoked with a ReadProgressEventArgs with the given EventType. + + + + + value of EntryType + Meaning and conditions + + + + ZipProgressEventType.Reading_Started + Fired just as ZipFile.Read() begins. Meaningful properties: ArchiveName. + + + + + ZipProgressEventType.Reading_Completed + Fired when ZipFile.Read() has completed. Meaningful properties: ArchiveName. + + + + + ZipProgressEventType.Reading_ArchiveBytesRead + Fired while reading, updates the number of bytes read for the entire archive. + Meaningful properties: ArchiveName, CurrentEntry, BytesTransferred, TotalBytesToTransfer. + + + + + ZipProgressEventType.Reading_BeforeReadEntry + Indicates an entry is about to be read from the archive. + Meaningful properties: ArchiveName, EntriesTotal. + + + + + ZipProgressEventType.Reading_AfterReadEntry + Indicates an entry has just been read from the archive. + Meaningful properties: ArchiveName, EntriesTotal, CurrentEntry. + + + + + + + + + + + + + An event handler invoked before, during, and after extraction of + entries in the zip archive. + + + + + Depending on the particular event, different properties on the parameter are set. The following + table summarizes the available EventTypes and the conditions under + which this event handler is invoked with a + ExtractProgressEventArgs with the given EventType. + + + + + value of EntryType + Meaning and conditions + + + + ZipProgressEventType.Extracting_BeforeExtractAll + + Set when ExtractAll() begins. The ArchiveName, Overwrite, and + ExtractLocation properties are meaningful. + + + + ZipProgressEventType.Extracting_AfterExtractAll + + Set when ExtractAll() has completed. The ArchiveName, Overwrite, + and ExtractLocation properties are meaningful. + + + + + ZipProgressEventType.Extracting_BeforeExtractEntry + + Set when an Extract() on an entry in the ZipFile has begun. + Properties that are meaningful: ArchiveName, EntriesTotal, + CurrentEntry, Overwrite, ExtractLocation, EntriesExtracted. + + + + + ZipProgressEventType.Extracting_AfterExtractEntry + + Set when an Extract() on an entry in the ZipFile has completed. + Properties that are meaningful: ArchiveName, EntriesTotal, + CurrentEntry, Overwrite, ExtractLocation, EntriesExtracted. + + + + + ZipProgressEventType.Extracting_EntryBytesWritten + + Set within a call to Extract() on an entry in the ZipFile, as data + is extracted for the entry. Properties that are meaningful: + ArchiveName, CurrentEntry, BytesTransferred, TotalBytesToTransfer. + + + + + ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite + + Set within a call to Extract() on an entry in the ZipFile, when the + extraction would overwrite an existing file. This event type is used + only when ExtractExistingFileAction on the ZipFile or + ZipEntry is set to InvokeExtractProgressEvent. + + + + + + + + + + private static bool justHadByteUpdate = false; + public static void ExtractProgress(object sender, ExtractProgressEventArgs e) + { + if(e.EventType == ZipProgressEventType.Extracting_EntryBytesWritten) + { + if (justHadByteUpdate) + Console.SetCursorPosition(0, Console.CursorTop); + + Console.Write(" {0}/{1} ({2:N0}%)", e.BytesTransferred, e.TotalBytesToTransfer, + e.BytesTransferred / (0.01 * e.TotalBytesToTransfer )); + justHadByteUpdate = true; + } + else if(e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry) + { + if (justHadByteUpdate) + Console.WriteLine(); + Console.WriteLine("Extracting: {0}", e.CurrentEntry.FileName); + justHadByteUpdate= false; + } + } + + public static ExtractZip(string zipToExtract, string directory) + { + string TargetDirectory= "extract"; + using (var zip = ZipFile.Read(zipToExtract)) { + zip.ExtractProgress += ExtractProgress; + foreach (var e in zip1) + { + e.Extract(TargetDirectory, true); + } + } + } + + + + Public Shared Sub Main(ByVal args As String()) + Dim ZipToUnpack As String = "C1P3SML.zip" + Dim TargetDir As String = "ExtractTest_Extract" + Console.WriteLine("Extracting file {0} to {1}", ZipToUnpack, TargetDir) + Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack) + AddHandler zip1.ExtractProgress, AddressOf MyExtractProgress + Dim e As ZipEntry + For Each e In zip1 + e.Extract(TargetDir, True) + Next + End Using + End Sub + + Private Shared justHadByteUpdate As Boolean = False + + Public Shared Sub MyExtractProgress(ByVal sender As Object, ByVal e As ExtractProgressEventArgs) + If (e.EventType = ZipProgressEventType.Extracting_EntryBytesWritten) Then + If ExtractTest.justHadByteUpdate Then + Console.SetCursorPosition(0, Console.CursorTop) + End If + Console.Write(" {0}/{1} ({2:N0}%)", e.BytesTransferred, e.TotalBytesToTransfer, (CDbl(e.BytesTransferred) / (0.01 * e.TotalBytesToTransfer))) + ExtractTest.justHadByteUpdate = True + ElseIf (e.EventType = ZipProgressEventType.Extracting_BeforeExtractEntry) Then + If ExtractTest.justHadByteUpdate Then + Console.WriteLine + End If + Console.WriteLine("Extracting: {0}", e.CurrentEntry.FileName) + ExtractTest.justHadByteUpdate = False + End If + End Sub + + + + + + + + + + An event handler invoked before, during, and after Adding entries to a zip archive. + + + + Adding a large number of entries to a zip file can take a long + time. For example, when calling on a + directory that contains 50,000 files, it could take 3 minutes or so. + This event handler allws an application to track the progress of the Add + operation, and to optionally cancel a lengthy Add operation. + + + + + + int _numEntriesToAdd= 0; + int _numEntriesAdded= 0; + void AddProgressHandler(object sender, AddProgressEventArgs e) + { + switch (e.EventType) + { + case ZipProgressEventType.Adding_Started: + Console.WriteLine("Adding files to the zip..."); + break; + case ZipProgressEventType.Adding_AfterAddEntry: + _numEntriesAdded++; + Console.WriteLine(String.Format("Adding file {0}/{1} :: {2}", + _numEntriesAdded, _numEntriesToAdd, e.CurrentEntry.FileName)); + break; + case ZipProgressEventType.Adding_Completed: + Console.WriteLine("Added all files"); + break; + } + } + + void CreateTheZip() + { + using (ZipFile zip = new ZipFile()) + { + zip.AddProgress += AddProgressHandler; + zip.AddDirectory(System.IO.Path.GetFileName(DirToZip)); + zip.Save(ZipFileToCreate); + } + } + + + + + + Private Sub AddProgressHandler(ByVal sender As Object, ByVal e As AddProgressEventArgs) + Select Case e.EventType + Case ZipProgressEventType.Adding_Started + Console.WriteLine("Adding files to the zip...") + Exit Select + Case ZipProgressEventType.Adding_AfterAddEntry + Console.WriteLine(String.Format("Adding file {0}", e.CurrentEntry.FileName)) + Exit Select + Case ZipProgressEventType.Adding_Completed + Console.WriteLine("Added all files") + Exit Select + End Select + End Sub + + Sub CreateTheZip() + Using zip as ZipFile = New ZipFile + AddHandler zip.AddProgress, AddressOf AddProgressHandler + zip.AddDirectory(System.IO.Path.GetFileName(DirToZip)) + zip.Save(ZipFileToCreate); + End Using + End Sub + + + + + + + + + + + + An event that is raised when an error occurs during open or read of files + while saving a zip archive. + + + + + Errors can occur as a file is being saved to the zip archive. For + example, the File.Open may fail, or a File.Read may fail, because of + lock conflicts or other reasons. If you add a handler to this event, + you can handle such errors in your own code. If you don't add a + handler, the library will throw an exception if it encounters an I/O + error during a call to Save(). + + + + Setting a handler implicitly sets to + ZipErrorAction.InvokeErrorEvent. + + + + The handler you add applies to all items that are + subsequently added to the ZipFile instance. If you set this + property after you have added items to the ZipFile, but before you + have called Save(), errors that occur while saving those items + will not cause the error handler to be invoked. + + + + If you want to handle any errors that occur with any entry in the zip + file using the same error handler, then add your error handler once, + before adding any entries to the zip archive. + + + + In the error handler method, you need to set the property on the + ZipErrorEventArgs.CurrentEntry. This communicates back to + DotNetZip what you would like to do with this particular error. Within + an error handler, if you set the ZipEntry.ZipErrorAction property + on the ZipEntry to ZipErrorAction.InvokeErrorEvent or if + you don't set it at all, the library will throw the exception. (It is the + same as if you had set the ZipEntry.ZipErrorAction property on the + ZipEntry to ZipErrorAction.Throw.) If you set the + ZipErrorEventArgs.Cancel to true, the entire Save() will be + canceled. + + + + In the case that you use ZipErrorAction.Skip, implying that + you want to skip the entry for which there's been an error, DotNetZip + tries to seek backwards in the output stream, and truncate all bytes + written on behalf of that particular entry. This works only if the + output stream is seekable. It will not work, for example, when using + ASPNET's Response.OutputStream. + + + + + + + This example shows how to use an event handler to handle + errors during save of the zip file. + + + public static void MyZipError(object sender, ZipErrorEventArgs e) + { + Console.WriteLine("Error saving {0}...", e.FileName); + Console.WriteLine(" Exception: {0}", e.exception); + ZipEntry entry = e.CurrentEntry; + string response = null; + // Ask the user whether he wants to skip this error or not + do + { + Console.Write("Retry, Skip, Throw, or Cancel ? (R/S/T/C) "); + response = Console.ReadLine(); + Console.WriteLine(); + + } while (response != null && + response[0]!='S' && response[0]!='s' && + response[0]!='R' && response[0]!='r' && + response[0]!='T' && response[0]!='t' && + response[0]!='C' && response[0]!='c'); + + e.Cancel = (response[0]=='C' || response[0]=='c'); + + if (response[0]=='S' || response[0]=='s') + entry.ZipErrorAction = ZipErrorAction.Skip; + else if (response[0]=='R' || response[0]=='r') + entry.ZipErrorAction = ZipErrorAction.Retry; + else if (response[0]=='T' || response[0]=='t') + entry.ZipErrorAction = ZipErrorAction.Throw; + } + + public void SaveTheFile() + { + string directoryToZip = "fodder"; + string directoryInArchive = "files"; + string zipFileToCreate = "Archive.zip"; + using (var zip = new ZipFile()) + { + // set the event handler before adding any entries + zip.ZipError += MyZipError; + zip.AddDirectory(directoryToZip, directoryInArchive); + zip.Save(zipFileToCreate); + } + } + + + + Private Sub MyZipError(ByVal sender As Object, ByVal e As Ionic.Zip.ZipErrorEventArgs) + ' At this point, the application could prompt the user for an action to take. + ' But in this case, this application will simply automatically skip the file, in case of error. + Console.WriteLine("Zip Error, entry {0}", e.CurrentEntry.FileName) + Console.WriteLine(" Exception: {0}", e.exception) + ' set the desired ZipErrorAction on the CurrentEntry to communicate that to DotNetZip + e.CurrentEntry.ZipErrorAction = Zip.ZipErrorAction.Skip + End Sub + + Public Sub SaveTheFile() + Dim directoryToZip As String = "fodder" + Dim directoryInArchive As String = "files" + Dim zipFileToCreate as String = "Archive.zip" + Using zipArchive As ZipFile = New ZipFile + ' set the event handler before adding any entries + AddHandler zipArchive.ZipError, AddressOf MyZipError + zipArchive.AddDirectory(directoryToZip, directoryInArchive) + zipArchive.Save(zipFileToCreate) + End Using + End Sub + + + + + + + + + Extracts all of the items in the zip archive, to the specified path in the + filesystem. The path can be relative or fully-qualified. + + + + + This method will extract all entries in the ZipFile to the + specified path. + + + + If an extraction of a file from the zip archive would overwrite an + existing file in the filesystem, the action taken is dictated by the + ExtractExistingFile property, which overrides any setting you may have + made on individual ZipEntry instances. By default, if you have not + set that property on the ZipFile instance, the entry will not + be extracted, the existing file will not be overwritten and an + exception will be thrown. To change this, set the property, or use the + overload that allows you to + specify an ExtractExistingFileAction parameter. + + + + The action to take when an extract would overwrite an existing file + applies to all entries. If you want to set this on a per-entry basis, + then you must use one of the ZipEntry.Extract methods. + + + + This method will send verbose output messages to the , if it is set on the ZipFile + instance. + + + + You may wish to take advantage of the ExtractProgress event. + + + + About timestamps: When extracting a file entry from a zip archive, the + extracted file gets the last modified time of the entry as stored in + the archive. The archive may also store extended file timestamp + information, including last accessed and created times. If these are + present in the ZipEntry, then the extracted file will also get + these times. + + + + A Directory entry is somewhat different. It will get the times as + described for a file entry, but, if there are file entries in the zip + archive that, when extracted, appear in the just-created directory, + then when those file entries are extracted, the last modified and last + accessed times of the directory will change, as a side effect. The + result is that after an extraction of a directory and a number of + files within the directory, the last modified and last accessed + timestamps on the directory will reflect the time that the last file + was extracted into the directory, rather than the time stored in the + zip archive for the directory. + + + + To compensate, when extracting an archive with ExtractAll, + DotNetZip will extract all the file and directory entries as described + above, but it will then make a second pass on the directories, and + reset the times on the directories to reflect what is stored in the + zip archive. + + + + This compensation is performed only within the context of an + ExtractAll. If you call ZipEntry.Extract on a directory + entry, the timestamps on directory in the filesystem will reflect the + times stored in the zip. If you then call ZipEntry.Extract on + a file entry, which is extracted into the directory, the timestamps on + the directory will be updated to the current time. + + + + + This example extracts all the entries in a zip archive file, to the + specified target directory. The extraction will overwrite any + existing files silently. + + + String TargetDirectory= "unpack"; + using(ZipFile zip= ZipFile.Read(ZipFileToExtract)) + { + zip.ExtractExistingFile= ExtractExistingFileAction.OverwriteSilently; + zip.ExtractAll(TargetDirectory); + } + + + + Dim TargetDirectory As String = "unpack" + Using zip As ZipFile = ZipFile.Read(ZipFileToExtract) + zip.ExtractExistingFile= ExtractExistingFileAction.OverwriteSilently + zip.ExtractAll(TargetDirectory) + End Using + + + + + + + + The path to which the contents of the zipfile will be extracted. + The path can be relative or fully-qualified. + + + + + + Extracts all of the items in the zip archive, to the specified path in the + filesystem, using the specified behavior when extraction would overwrite an + existing file. + + + + + + This method will extract all entries in the ZipFile to the specified + path. For an extraction that would overwrite an existing file, the behavior + is dictated by , which overrides any + setting you may have made on individual ZipEntry instances. + + + + The action to take when an extract would overwrite an existing file + applies to all entries. If you want to set this on a per-entry basis, + then you must use or one of the similar methods. + + + + Calling this method is equivalent to setting the property and then calling . + + + + This method will send verbose output messages to the + , if it is set on the ZipFile instance. + + + + + This example extracts all the entries in a zip archive file, to the + specified target directory. It does not overwrite any existing files. + + String TargetDirectory= "c:\\unpack"; + using(ZipFile zip= ZipFile.Read(ZipFileToExtract)) + { + zip.ExtractAll(TargetDirectory, ExtractExistingFileAction.DontOverwrite); + } + + + + Dim TargetDirectory As String = "c:\unpack" + Using zip As ZipFile = ZipFile.Read(ZipFileToExtract) + zip.ExtractAll(TargetDirectory, ExtractExistingFileAction.DontOverwrite) + End Using + + + + + The path to which the contents of the zipfile will be extracted. + The path can be relative or fully-qualified. + + + + The action to take if extraction would overwrite an existing file. + + + + + + Reads a zip file archive and returns the instance. + + + + + The stream is read using the default System.Text.Encoding, which is the + IBM437 codepage. + + + + + Thrown if the ZipFile cannot be read. The implementation of this method + relies on System.IO.File.OpenRead, which can throw a variety of exceptions, + including specific exceptions if a file is not found, an unauthorized access + exception, exceptions for poorly formatted filenames, and so on. + + + + The name of the zip archive to open. This can be a fully-qualified or relative + pathname. + + + . + + The instance read from the zip archive. + + + + + Reads a zip file archive from the named filesystem file using the + specified options. + + + + + This version of the Read() method allows the caller to pass + in a TextWriter an Encoding, via an instance of the + ReadOptions class. The ZipFile is read in using the + specified encoding for entries where UTF-8 encoding is not + explicitly specified. + + + + + + + This example shows how to read a zip file using the Big-5 Chinese + code page (950), and extract each entry in the zip file, while + sending status messages out to the Console. + + + + For this code to work as intended, the zipfile must have been + created using the big5 code page (CP950). This is typical, for + example, when using WinRar on a machine with CP950 set as the + default code page. In that case, the names of entries within the + Zip archive will be stored in that code page, and reading the zip + archive must be done using that code page. If the application did + not use the correct code page in ZipFile.Read(), then names of + entries within the zip archive would not be correctly retrieved. + + + + string zipToExtract = "MyArchive.zip"; + string extractDirectory = "extract"; + var options = new ReadOptions + { + StatusMessageWriter = System.Console.Out, + Encoding = System.Text.Encoding.GetEncoding(950) + }; + using (ZipFile zip = ZipFile.Read(zipToExtract, options)) + { + foreach (ZipEntry e in zip) + { + e.Extract(extractDirectory); + } + } + + + + + Dim zipToExtract as String = "MyArchive.zip" + Dim extractDirectory as String = "extract" + Dim options as New ReadOptions + options.Encoding = System.Text.Encoding.GetEncoding(950) + options.StatusMessageWriter = System.Console.Out + Using zip As ZipFile = ZipFile.Read(zipToExtract, options) + Dim e As ZipEntry + For Each e In zip + e.Extract(extractDirectory) + Next + End Using + + + + + + + + This example shows how to read a zip file using the default + code page, to remove entries that have a modified date before a given threshold, + sending status messages out to a StringWriter. + + + + var options = new ReadOptions + { + StatusMessageWriter = new System.IO.StringWriter() + }; + using (ZipFile zip = ZipFile.Read("PackedDocuments.zip", options)) + { + var Threshold = new DateTime(2007,7,4); + // We cannot remove the entry from the list, within the context of + // an enumeration of said list. + // So we add the doomed entry to a list to be removed later. + // pass 1: mark the entries for removal + var MarkedEntries = new System.Collections.Generic.List<ZipEntry>(); + foreach (ZipEntry e in zip) + { + if (e.LastModified < Threshold) + MarkedEntries.Add(e); + } + // pass 2: actually remove the entry. + foreach (ZipEntry zombie in MarkedEntries) + zip.RemoveEntry(zombie); + zip.Comment = "This archive has been updated."; + zip.Save(); + } + // can now use contents of sw, eg store in an audit log + + + + Dim options as New ReadOptions + options.StatusMessageWriter = New System.IO.StringWriter + Using zip As ZipFile = ZipFile.Read("PackedDocuments.zip", options) + Dim Threshold As New DateTime(2007, 7, 4) + ' We cannot remove the entry from the list, within the context of + ' an enumeration of said list. + ' So we add the doomed entry to a list to be removed later. + ' pass 1: mark the entries for removal + Dim MarkedEntries As New System.Collections.Generic.List(Of ZipEntry) + Dim e As ZipEntry + For Each e In zip + If (e.LastModified < Threshold) Then + MarkedEntries.Add(e) + End If + Next + ' pass 2: actually remove the entry. + Dim zombie As ZipEntry + For Each zombie In MarkedEntries + zip.RemoveEntry(zombie) + Next + zip.Comment = "This archive has been updated." + zip.Save + End Using + ' can now use contents of sw, eg store in an audit log + + + + + Thrown if the zipfile cannot be read. The implementation of + this method relies on System.IO.File.OpenRead, which + can throw a variety of exceptions, including specific + exceptions if a file is not found, an unauthorized access + exception, exceptions for poorly formatted filenames, and so + on. + + + + The name of the zip archive to open. + This can be a fully-qualified or relative pathname. + + + + The set of options to use when reading the zip file. + + + The ZipFile instance read from the zip archive. + + + + + + + Reads a zip file archive using the specified text encoding, the specified + TextWriter for status messages, and the specified ReadProgress event handler, + and returns the instance. + + + + The name of the zip archive to open. + This can be a fully-qualified or relative pathname. + + + + An event handler for Read operations. + + + + The System.IO.TextWriter to use for writing verbose status messages + during operations on the zip archive. A console application may wish to + pass System.Console.Out to get messages on the Console. A graphical + or headless application may wish to capture the messages in a different + TextWriter, such as a System.IO.StringWriter. + + + + The System.Text.Encoding to use when reading in the zip archive. Be + careful specifying the encoding. If the value you use here is not the same + as the Encoding used when the zip archive was created (possibly by a + different archiver) you will get unexpected results and possibly exceptions. + + + The instance read from the zip archive. + + + + + Reads a zip archive from a stream. + + + + + + When reading from a file, it's probably easier to just use + ZipFile.Read(String, ReadOptions). This + overload is useful when when the zip archive content is + available from an already-open stream. The stream must be + open and readable and seekable when calling this method. The + stream is left open when the reading is completed. + + + + Using this overload, the stream is read using the default + System.Text.Encoding, which is the IBM437 + codepage. If you want to specify the encoding to use when + reading the zipfile content, see + ZipFile.Read(Stream, ReadOptions). This + + + + Reading of zip content begins at the current position in the + stream. This means if you have a stream that concatenates + regular data and zip data, if you position the open, readable + stream at the start of the zip data, you will be able to read + the zip archive using this constructor, or any of the ZipFile + constructors that accept a as + input. Some examples of where this might be useful: the zip + content is concatenated at the end of a regular EXE file, as + some self-extracting archives do. (Note: SFX files produced + by DotNetZip do not work this way; they can be read as normal + ZIP files). Another example might be a stream being read from + a database, where the zip content is embedded within an + aggregate stream of data. + + + + + + + This example shows how to Read zip content from a stream, and + extract one entry into a different stream. In this example, + the filename "NameOfEntryInArchive.doc", refers only to the + name of the entry within the zip archive. A file by that + name is not created in the filesystem. The I/O is done + strictly with the given streams. + + + + using (ZipFile zip = ZipFile.Read(InputStream)) + { + zip.Extract("NameOfEntryInArchive.doc", OutputStream); + } + + + + Using zip as ZipFile = ZipFile.Read(InputStream) + zip.Extract("NameOfEntryInArchive.doc", OutputStream) + End Using + + + + the stream containing the zip data. + + The ZipFile instance read from the stream + + + + + Reads a zip file archive from the given stream using the + specified options. + + + + + + When reading from a file, it's probably easier to just use + ZipFile.Read(String, ReadOptions). This + overload is useful when when the zip archive content is + available from an already-open stream. The stream must be + open and readable and seekable when calling this method. The + stream is left open when the reading is completed. + + + + Reading of zip content begins at the current position in the + stream. This means if you have a stream that concatenates + regular data and zip data, if you position the open, readable + stream at the start of the zip data, you will be able to read + the zip archive using this constructor, or any of the ZipFile + constructors that accept a as + input. Some examples of where this might be useful: the zip + content is concatenated at the end of a regular EXE file, as + some self-extracting archives do. (Note: SFX files produced + by DotNetZip do not work this way; they can be read as normal + ZIP files). Another example might be a stream being read from + a database, where the zip content is embedded within an + aggregate stream of data. + + + + the stream containing the zip data. + + + The set of options to use when reading the zip file. + + + + Thrown if the zip archive cannot be read. + + + The ZipFile instance read from the stream. + + + + + + + Reads a zip archive from a stream, using the specified text Encoding, the + specified TextWriter for status messages, + and the specified ReadProgress event handler. + + + + + Reading of zip content begins at the current position in the stream. This + means if you have a stream that concatenates regular data and zip data, if + you position the open, readable stream at the start of the zip data, you + will be able to read the zip archive using this constructor, or any of the + ZipFile constructors that accept a as + input. Some examples of where this might be useful: the zip content is + concatenated at the end of a regular EXE file, as some self-extracting + archives do. (Note: SFX files produced by DotNetZip do not work this + way). Another example might be a stream being read from a database, where + the zip content is embedded within an aggregate stream of data. + + + + the stream containing the zip data. + + + The System.IO.TextWriter to which verbose status messages are written + during operations on the ZipFile. For example, in a console + application, System.Console.Out works, and will get a message for each entry + added to the ZipFile. If the TextWriter is null, no verbose messages + are written. + + + + The text encoding to use when reading entries that do not have the UTF-8 + encoding bit set. Be careful specifying the encoding. If the value you use + here is not the same as the Encoding used when the zip archive was created + (possibly by a different archiver) you will get unexpected results and + possibly exceptions. See the + property for more information. + + + + An event handler for Read operations. + + + an instance of ZipFile + + + + Checks the given file to see if it appears to be a valid zip file. + + + + + Calling this method is equivalent to calling with the testExtract parameter set to false. + + + + The file to check. + true if the file appears to be a zip file. + + + + Checks a file to see if it is a valid zip file. + + + + + This method opens the specified zip file, reads in the zip archive, + verifying the ZIP metadata as it reads. + + + + If everything succeeds, then the method returns true. If anything fails - + for example if an incorrect signature or CRC is found, indicating a + corrupt file, the the method returns false. This method also returns + false for a file that does not exist. + + + + If is true, as part of its check, this + method reads in the content for each entry, expands it, and checks CRCs. + This provides an additional check beyond verifying the zip header and + directory data. + + + + If is true, and if any of the zip entries + are protected with a password, this method will return false. If you want + to verify a ZipFile that has entries which are protected with a + password, you will need to do that manually. + + + + + The zip file to check. + true if the caller wants to extract each entry. + true if the file contains a valid zip file. + + + + Checks a stream to see if it contains a valid zip archive. + + + + + This method reads the zip archive contained in the specified stream, verifying + the ZIP metadata as it reads. If testExtract is true, this method also extracts + each entry in the archive, dumping all the bits into . + + + + If everything succeeds, then the method returns true. If anything fails - + for example if an incorrect signature or CRC is found, indicating a corrupt + file, the the method returns false. This method also returns false for a + file that does not exist. + + + + If testExtract is true, this method reads in the content for each + entry, expands it, and checks CRCs. This provides an additional check + beyond verifying the zip header data. + + + + If testExtract is true, and if any of the zip entries are protected + with a password, this method will return false. If you want to verify a + ZipFile that has entries which are protected with a password, you will need + to do that manually. + + + + + + The stream to check. + true if the caller wants to extract each entry. + true if the stream contains a valid zip archive. + + + + Delete file with retry on UnauthorizedAccessException. + + + + + When calling File.Delete() on a file that has been "recently" + created, the call sometimes fails with + UnauthorizedAccessException. This method simply retries the Delete 3 + times with a sleep between tries. + + + + the name of the file to be deleted + + + + Saves the Zip archive to a file, specified by the Name property of the + ZipFile. + + + + + The ZipFile instance is written to storage, typically a zip file + in a filesystem, only when the caller calls Save. In the typical + case, the Save operation writes the zip content to a temporary file, and + then renames the temporary file to the desired name. If necessary, this + method will delete a pre-existing file before the rename. + + + + The property is specified either explicitly, + or implicitly using one of the parameterized ZipFile constructors. For + COM Automation clients, the Name property must be set explicitly, + because COM Automation clients cannot call parameterized constructors. + + + + When using a filesystem file for the Zip output, it is possible to call + Save multiple times on the ZipFile instance. With each + call the zip content is re-written to the same output file. + + + + Data for entries that have been added to the ZipFile instance is + written to the output when the Save method is called. This means + that the input streams for those entries must be available at the time + the application calls Save. If, for example, the application + adds entries with AddEntry using a dynamically-allocated + MemoryStream, the memory stream must not have been disposed + before the call to Save. See the property for more discussion of the + availability requirements of the input stream for an entry, and an + approach for providing just-in-time stream lifecycle management. + + + + + + + + Thrown if you haven't specified a location or stream for saving the zip, + either in the constructor or by setting the Name property, or if you try + to save a regular zip archive to a filename with a .exe extension. + + + + Thrown if or is non-zero, and the number + of segments that would be generated for the spanned zip file during the + save operation exceeds 99. If this happens, you need to increase the + segment size. + + + + + + Save the file to a new zipfile, with the given name. + + + + + This method allows the application to explicitly specify the name of the zip + file when saving. Use this when creating a new zip file, or when + updating a zip archive. + + + + An application can also save a zip archive in several places by calling this + method multiple times in succession, with different filenames. + + + + The ZipFile instance is written to storage, typically a zip file in a + filesystem, only when the caller calls Save. The Save operation writes + the zip content to a temporary file, and then renames the temporary file + to the desired name. If necessary, this method will delete a pre-existing file + before the rename. + + + + + + Thrown if you specify a directory for the filename. + + + + The name of the zip archive to save to. Existing files will + be overwritten with great prejudice. + + + + This example shows how to create and Save a zip file. + + using (ZipFile zip = new ZipFile()) + { + zip.AddDirectory(@"c:\reports\January"); + zip.Save("January.zip"); + } + + + + Using zip As New ZipFile() + zip.AddDirectory("c:\reports\January") + zip.Save("January.zip") + End Using + + + + + + This example shows how to update a zip file. + + using (ZipFile zip = ZipFile.Read("ExistingArchive.zip")) + { + zip.AddFile("NewData.csv"); + zip.Save("UpdatedArchive.zip"); + } + + + + Using zip As ZipFile = ZipFile.Read("ExistingArchive.zip") + zip.AddFile("NewData.csv") + zip.Save("UpdatedArchive.zip") + End Using + + + + + + + Save the zip archive to the specified stream. + + + + + The ZipFile instance is written to storage - typically a zip file + in a filesystem, but using this overload, the storage can be anything + accessible via a writable stream - only when the caller calls Save. + + + + Use this method to save the zip content to a stream directly. A common + scenario is an ASP.NET application that dynamically generates a zip file + and allows the browser to download it. The application can call + Save(Response.OutputStream) to write a zipfile directly to the + output stream, without creating a zip file on the disk on the ASP.NET + server. + + + + Be careful when saving a file to a non-seekable stream, including + Response.OutputStream. When DotNetZip writes to a non-seekable + stream, the zip archive is formatted in such a way that may not be + compatible with all zip tools on all platforms. It's a perfectly legal + and compliant zip file, but some people have reported problems opening + files produced this way using the Mac OS archive utility. + + + + + + + This example saves the zipfile content into a MemoryStream, and + then gets the array of bytes from that MemoryStream. + + + using (var zip = new Ionic.Zip.ZipFile()) + { + zip.CompressionLevel= Ionic.Zlib.CompressionLevel.BestCompression; + zip.Password = "VerySecret."; + zip.Encryption = EncryptionAlgorithm.WinZipAes128; + zip.AddFile(sourceFileName); + MemoryStream output = new MemoryStream(); + zip.Save(output); + + byte[] zipbytes = output.ToArray(); + } + + + + + + This example shows a pitfall you should avoid. DO NOT read + from a stream, then try to save to the same stream. DO + NOT DO THIS: + + + + using (var fs = new FileStream(filename, FileMode.Open)) + { + using (var zip = Ionic.Zip.ZipFile.Read(inputStream)) + { + zip.AddEntry("Name1.txt", "this is the content"); + zip.Save(inputStream); // NO NO NO!! + } + } + + + + Better like this: + + + + using (var zip = Ionic.Zip.ZipFile.Read(filename)) + { + zip.AddEntry("Name1.txt", "this is the content"); + zip.Save(); // YES! + } + + + + + + The System.IO.Stream to write to. It must be + writable. If you created the ZipFile instance by calling + ZipFile.Read(), this stream must not be the same stream + you passed to ZipFile.Read(). + + + + + Adds to the ZipFile a set of files from the current working directory on + disk, that conform to the specified criteria. + + + + + This method selects files from the the current working directory matching + the specified criteria, and adds them to the ZipFile. + + + + Specify the criteria in statements of 3 elements: a noun, an operator, and + a value. Consider the string "name != *.doc" . The noun is "name". The + operator is "!=", implying "Not Equal". The value is "*.doc". That + criterion, in English, says "all files with a name that does not end in + the .doc extension." + + + + Supported nouns include "name" (or "filename") for the filename; "atime", + "mtime", and "ctime" for last access time, last modfied time, and created + time of the file, respectively; "attributes" (or "attrs") for the file + attributes; "size" (or "length") for the file length (uncompressed), and + "type" for the type of object, either a file or a directory. The + "attributes", "name" and "type" nouns both support = and != as operators. + The "size", "atime", "mtime", and "ctime" nouns support = and !=, and + >, >=, <, <= as well. The times are taken to be expressed in + local time. + + + + Specify values for the file attributes as a string with one or more of the + characters H,R,S,A,I,L in any order, implying file attributes of Hidden, + ReadOnly, System, Archive, NotContextIndexed, and ReparsePoint (symbolic + link) respectively. + + + + To specify a time, use YYYY-MM-DD-HH:mm:ss or YYYY/MM/DD-HH:mm:ss as the + format. If you omit the HH:mm:ss portion, it is assumed to be 00:00:00 + (midnight). + + + + The value for a size criterion is expressed in integer quantities of bytes, + kilobytes (use k or kb after the number), megabytes (m or mb), or gigabytes + (g or gb). + + + + The value for a name is a pattern to match against the filename, potentially + including wildcards. The pattern follows CMD.exe glob rules: * implies one + or more of any character, while ? implies one character. If the name + pattern contains any slashes, it is matched to the entire filename, + including the path; otherwise, it is matched against only the filename + without the path. This means a pattern of "*\*.*" matches all files one + directory level deep, while a pattern of "*.*" matches all files in all + directories. + + + + To specify a name pattern that includes spaces, use single quotes around the + pattern. A pattern of "'* *.*'" will match all files that have spaces in + the filename. The full criteria string for that would be "name = '* *.*'" . + + + + The value for a type criterion is either F (implying a file) or D (implying + a directory). + + + + Some examples: + + + + + criteria + Files retrieved + + + + name != *.xls + any file with an extension that is not .xls + + + + + name = *.mp3 + any file with a .mp3 extension. + + + + + *.mp3 + (same as above) any file with a .mp3 extension. + + + + + attributes = A + all files whose attributes include the Archive bit. + + + + + attributes != H + all files whose attributes do not include the Hidden bit. + + + + + mtime > 2009-01-01 + all files with a last modified time after January 1st, 2009. + + + + + size > 2gb + all files whose uncompressed size is greater than 2gb. + + + + + type = D + all directories in the filesystem. + + + + + + You can combine criteria with the conjunctions AND or OR. Using a string + like "name = *.txt AND size >= 100k" for the selectionCriteria retrieves + entries whose names end in .txt, and whose uncompressed size is greater than + or equal to 100 kilobytes. + + + + For more complex combinations of criteria, you can use parenthesis to group + clauses in the boolean logic. Without parenthesis, the precedence of the + criterion atoms is determined by order of appearance. Unlike the C# + language, the AND conjunction does not take precendence over the logical OR. + This is important only in strings that contain 3 or more criterion atoms. + In other words, "name = *.txt and size > 1000 or attributes = H" implies + "((name = *.txt AND size > 1000) OR attributes = H)" while "attributes = + H OR name = *.txt and size > 1000" evaluates to "((attributes = H OR name + = *.txt) AND size > 1000)". When in doubt, use parenthesis. + + + + Using time properties requires some extra care. If you want to retrieve all + entries that were last updated on 2009 February 14, specify a time range + like so:"mtime >= 2009-02-14 AND mtime < 2009-02-15". Read this to + say: all files updated after 12:00am on February 14th, until 12:00am on + February 15th. You can use the same bracketing approach to specify any time + period - a year, a month, a week, and so on. + + + + The syntax allows one special case: if you provide a string with no spaces, it is + treated as a pattern to match for the filename. Therefore a string like "*.xls" + will be equivalent to specifying "name = *.xls". + + + + There is no logic in this method that insures that the file inclusion + criteria are internally consistent. For example, it's possible to specify + criteria that says the file must have a size of less than 100 bytes, as well + as a size that is greater than 1000 bytes. Obviously no file will ever + satisfy such criteria, but this method does not detect such logical + inconsistencies. The caller is responsible for insuring the criteria are + sensible. + + + + Using this method, the file selection does not recurse into + subdirectories, and the full path of the selected files is included in the + entries added into the zip archive. If you don't like these behaviors, + see the other overloads of this method. + + + + + This example zips up all *.csv files in the current working directory. + + using (ZipFile zip = new ZipFile()) + { + // To just match on filename wildcards, + // use the shorthand form of the selectionCriteria string. + zip.AddSelectedFiles("*.csv"); + zip.Save(PathToZipArchive); + } + + + Using zip As ZipFile = New ZipFile() + zip.AddSelectedFiles("*.csv") + zip.Save(PathToZipArchive) + End Using + + + + The criteria for file selection + + + + Adds to the ZipFile a set of files from the disk that conform to the + specified criteria, optionally recursing into subdirectories. + + + + + This method selects files from the the current working directory matching + the specified criteria, and adds them to the ZipFile. If + recurseDirectories is true, files are also selected from + subdirectories, and the directory structure in the filesystem is + reproduced in the zip archive, rooted at the current working directory. + + + + Using this method, the full path of the selected files is included in the + entries added into the zip archive. If you don't want this behavior, use + one of the overloads of this method that allows the specification of a + directoryInArchive. + + + + For details on the syntax for the selectionCriteria parameter, see . + + + + + + + This example zips up all *.xml files in the current working directory, or any + subdirectory, that are larger than 1mb. + + + using (ZipFile zip = new ZipFile()) + { + // Use a compound expression in the selectionCriteria string. + zip.AddSelectedFiles("name = *.xml and size > 1024kb", true); + zip.Save(PathToZipArchive); + } + + + Using zip As ZipFile = New ZipFile() + ' Use a compound expression in the selectionCriteria string. + zip.AddSelectedFiles("name = *.xml and size > 1024kb", true) + zip.Save(PathToZipArchive) + End Using + + + + The criteria for file selection + + + If true, the file selection will recurse into subdirectories. + + + + + Adds to the ZipFile a set of files from a specified directory in the + filesystem, that conform to the specified criteria. + + + + + This method selects files that conform to the specified criteria, from the + the specified directory on disk, and adds them to the ZipFile. The search + does not recurse into subdirectores. + + + + Using this method, the full filesystem path of the files on disk is + reproduced on the entries added to the zip file. If you don't want this + behavior, use one of the other overloads of this method. + + + + For details on the syntax for the selectionCriteria parameter, see . + + + + + + + This example zips up all *.xml files larger than 1mb in the directory + given by "d:\rawdata". + + + using (ZipFile zip = new ZipFile()) + { + // Use a compound expression in the selectionCriteria string. + zip.AddSelectedFiles("name = *.xml and size > 1024kb", "d:\\rawdata"); + zip.Save(PathToZipArchive); + } + + + + Using zip As ZipFile = New ZipFile() + ' Use a compound expression in the selectionCriteria string. + zip.AddSelectedFiles("name = *.xml and size > 1024kb", "d:\rawdata) + zip.Save(PathToZipArchive) + End Using + + + + The criteria for file selection + + + The name of the directory on the disk from which to select files. + + + + + Adds to the ZipFile a set of files from the specified directory on disk, + that conform to the specified criteria. + + + + + + This method selects files from the the specified disk directory matching + the specified selection criteria, and adds them to the ZipFile. If + recurseDirectories is true, files are also selected from + subdirectories. + + + + The full directory structure in the filesystem is reproduced on the + entries added to the zip archive. If you don't want this behavior, use + one of the overloads of this method that allows the specification of a + directoryInArchive. + + + + For details on the syntax for the selectionCriteria parameter, see . + + + + + + This example zips up all *.csv files in the "files" directory, or any + subdirectory, that have been saved since 2009 February 14th. + + + using (ZipFile zip = new ZipFile()) + { + // Use a compound expression in the selectionCriteria string. + zip.AddSelectedFiles("name = *.csv and mtime > 2009-02-14", "files", true); + zip.Save(PathToZipArchive); + } + + + Using zip As ZipFile = New ZipFile() + ' Use a compound expression in the selectionCriteria string. + zip.AddSelectedFiles("name = *.csv and mtime > 2009-02-14", "files", true) + zip.Save(PathToZipArchive) + End Using + + + + + This example zips up all files in the current working + directory, and all its child directories, except those in + the excludethis subdirectory. + + Using Zip As ZipFile = New ZipFile(zipfile) + Zip.AddSelectedFfiles("name != 'excludethis\*.*'", datapath, True) + Zip.Save() + End Using + + + + The criteria for file selection + + + The filesystem path from which to select files. + + + + If true, the file selection will recurse into subdirectories. + + + + + Adds to the ZipFile a selection of files from the specified directory on + disk, that conform to the specified criteria, and using a specified root + path for entries added to the zip archive. + + + + + This method selects files from the specified disk directory matching the + specified selection criteria, and adds those files to the ZipFile, using + the specified directory path in the archive. The search does not recurse + into subdirectories. For details on the syntax for the selectionCriteria + parameter, see . + + + + + + + This example zips up all *.psd files in the "photos" directory that have + been saved since 2009 February 14th, and puts them all in a zip file, + using the directory name of "content" in the zip archive itself. When the + zip archive is unzipped, the folder containing the .psd files will be + named "content". + + + using (ZipFile zip = new ZipFile()) + { + // Use a compound expression in the selectionCriteria string. + zip.AddSelectedFiles("name = *.psd and mtime > 2009-02-14", "photos", "content"); + zip.Save(PathToZipArchive); + } + + + Using zip As ZipFile = New ZipFile + zip.AddSelectedFiles("name = *.psd and mtime > 2009-02-14", "photos", "content") + zip.Save(PathToZipArchive) + End Using + + + + + The criteria for selection of files to add to the ZipFile. + + + + The path to the directory in the filesystem from which to select files. + + + + Specifies a directory path to use to in place of the + directoryOnDisk. This path may, or may not, correspond to a real + directory in the current filesystem. If the files within the zip are + later extracted, this is the path used for the extracted file. Passing + null (nothing in VB) will use the path on the file name, if any; in other + words it would use directoryOnDisk, plus any subdirectory. Passing + the empty string ("") will insert the item at the root path within the + archive. + + + + + Adds to the ZipFile a selection of files from the specified directory on + disk, that conform to the specified criteria, optionally recursing through + subdirectories, and using a specified root path for entries added to the + zip archive. + + + + This method selects files from the specified disk directory that match the + specified selection criteria, and adds those files to the ZipFile, using + the specified directory path in the archive. If recurseDirectories + is true, files are also selected from subdirectories, and the directory + structure in the filesystem is reproduced in the zip archive, rooted at + the directory specified by directoryOnDisk. For details on the + syntax for the selectionCriteria parameter, see . + + + + + This example zips up all files that are NOT *.pst files, in the current + working directory and any subdirectories. + + + using (ZipFile zip = new ZipFile()) + { + zip.AddSelectedFiles("name != *.pst", SourceDirectory, "backup", true); + zip.Save(PathToZipArchive); + } + + + Using zip As ZipFile = New ZipFile + zip.AddSelectedFiles("name != *.pst", SourceDirectory, "backup", true) + zip.Save(PathToZipArchive) + End Using + + + + + The criteria for selection of files to add to the ZipFile. + + + + The path to the directory in the filesystem from which to select files. + + + + Specifies a directory path to use to in place of the + directoryOnDisk. This path may, or may not, correspond to a real + directory in the current filesystem. If the files within the zip are + later extracted, this is the path used for the extracted file. Passing + null (nothing in VB) will use the path on the file name, if any; in other + words it would use directoryOnDisk, plus any subdirectory. Passing + the empty string ("") will insert the item at the root path within the + archive. + + + + If true, the method also scans subdirectories for files matching the + criteria. + + + + + Updates the ZipFile with a selection of files from the disk that conform + to the specified criteria. + + + + This method selects files from the specified disk directory that match the + specified selection criteria, and Updates the ZipFile with those + files, using the specified directory path in the archive. If + recurseDirectories is true, files are also selected from + subdirectories, and the directory structure in the filesystem is + reproduced in the zip archive, rooted at the directory specified by + directoryOnDisk. For details on the syntax for the + selectionCriteria parameter, see . + + + + The criteria for selection of files to add to the ZipFile. + + + + The path to the directory in the filesystem from which to select files. + + + + Specifies a directory path to use to in place of the + directoryOnDisk. This path may, or may not, correspond to a + real directory in the current filesystem. If the files within the zip + are later extracted, this is the path used for the extracted file. + Passing null (nothing in VB) will use the path on the file name, if + any; in other words it would use directoryOnDisk, plus any + subdirectory. Passing the empty string ("") will insert the item at + the root path within the archive. + + + + If true, the method also scans subdirectories for files matching the criteria. + + + + + + + Retrieve entries from the zipfile by specified criteria. + + + + + This method allows callers to retrieve the collection of entries from the zipfile + that fit the specified criteria. The criteria are described in a string format, and + can include patterns for the filename; constraints on the size of the entry; + constraints on the last modified, created, or last accessed time for the file + described by the entry; or the attributes of the entry. + + + + For details on the syntax for the selectionCriteria parameter, see . + + + + This method is intended for use with a ZipFile that has been read from storage. + When creating a new ZipFile, this method will work only after the ZipArchive has + been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip + archive from storage.) Calling SelectEntries on a ZipFile that has not yet been + saved will deliver undefined results. + + + + + Thrown if selectionCriteria has an invalid syntax. + + + + This example selects all the PhotoShop files from within an archive, and extracts them + to the current working directory. + + using (ZipFile zip1 = ZipFile.Read(ZipFileName)) + { + var PhotoShopFiles = zip1.SelectEntries("*.psd"); + foreach (ZipEntry psd in PhotoShopFiles) + { + psd.Extract(); + } + } + + + Using zip1 As ZipFile = ZipFile.Read(ZipFileName) + Dim PhotoShopFiles as ICollection(Of ZipEntry) + PhotoShopFiles = zip1.SelectEntries("*.psd") + Dim psd As ZipEntry + For Each psd In PhotoShopFiles + psd.Extract + Next + End Using + + + the string that specifies which entries to select + a collection of ZipEntry objects that conform to the inclusion spec + + + + Retrieve entries from the zipfile by specified criteria. + + + + + This method allows callers to retrieve the collection of entries from the zipfile + that fit the specified criteria. The criteria are described in a string format, and + can include patterns for the filename; constraints on the size of the entry; + constraints on the last modified, created, or last accessed time for the file + described by the entry; or the attributes of the entry. + + + + For details on the syntax for the selectionCriteria parameter, see . + + + + This method is intended for use with a ZipFile that has been read from storage. + When creating a new ZipFile, this method will work only after the ZipArchive has + been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip + archive from storage.) Calling SelectEntries on a ZipFile that has not yet been + saved will deliver undefined results. + + + + + Thrown if selectionCriteria has an invalid syntax. + + + + + using (ZipFile zip1 = ZipFile.Read(ZipFileName)) + { + var UpdatedPhotoShopFiles = zip1.SelectEntries("*.psd", "UpdatedFiles"); + foreach (ZipEntry e in UpdatedPhotoShopFiles) + { + // prompt for extract here + if (WantExtract(e.FileName)) + e.Extract(); + } + } + + + Using zip1 As ZipFile = ZipFile.Read(ZipFileName) + Dim UpdatedPhotoShopFiles As ICollection(Of ZipEntry) = zip1.SelectEntries("*.psd", "UpdatedFiles") + Dim e As ZipEntry + For Each e In UpdatedPhotoShopFiles + ' prompt for extract here + If Me.WantExtract(e.FileName) Then + e.Extract + End If + Next + End Using + + + the string that specifies which entries to select + + + the directory in the archive from which to select entries. If null, then + all directories in the archive are used. + + + a collection of ZipEntry objects that conform to the inclusion spec + + + + Remove entries from the zipfile by specified criteria. + + + + + This method allows callers to remove the collection of entries from the zipfile + that fit the specified criteria. The criteria are described in a string format, and + can include patterns for the filename; constraints on the size of the entry; + constraints on the last modified, created, or last accessed time for the file + described by the entry; or the attributes of the entry. + + + + For details on the syntax for the selectionCriteria parameter, see . + + + + This method is intended for use with a ZipFile that has been read from storage. + When creating a new ZipFile, this method will work only after the ZipArchive has + been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip + archive from storage.) Calling SelectEntries on a ZipFile that has not yet been + saved will deliver undefined results. + + + + + Thrown if selectionCriteria has an invalid syntax. + + + + This example removes all entries in a zip file that were modified prior to January 1st, 2008. + + using (ZipFile zip1 = ZipFile.Read(ZipFileName)) + { + // remove all entries from prior to Jan 1, 2008 + zip1.RemoveEntries("mtime < 2008-01-01"); + // don't forget to save the archive! + zip1.Save(); + } + + + Using zip As ZipFile = ZipFile.Read(ZipFileName) + ' remove all entries from prior to Jan 1, 2008 + zip1.RemoveEntries("mtime < 2008-01-01") + ' do not forget to save the archive! + zip1.Save + End Using + + + the string that specifies which entries to select + the number of entries removed + + + + Remove entries from the zipfile by specified criteria, and within the specified + path in the archive. + + + + + This method allows callers to remove the collection of entries from the zipfile + that fit the specified criteria. The criteria are described in a string format, and + can include patterns for the filename; constraints on the size of the entry; + constraints on the last modified, created, or last accessed time for the file + described by the entry; or the attributes of the entry. + + + + For details on the syntax for the selectionCriteria parameter, see . + + + + This method is intended for use with a ZipFile that has been read from storage. + When creating a new ZipFile, this method will work only after the ZipArchive has + been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip + archive from storage.) Calling SelectEntries on a ZipFile that has not yet been + saved will deliver undefined results. + + + + + Thrown if selectionCriteria has an invalid syntax. + + + + + using (ZipFile zip1 = ZipFile.Read(ZipFileName)) + { + // remove all entries from prior to Jan 1, 2008 + zip1.RemoveEntries("mtime < 2008-01-01", "documents"); + // a call to ZipFile.Save will make the modifications permanent + zip1.Save(); + } + + + Using zip As ZipFile = ZipFile.Read(ZipFileName) + ' remove all entries from prior to Jan 1, 2008 + zip1.RemoveEntries("mtime < 2008-01-01", "documents") + ' a call to ZipFile.Save will make the modifications permanent + zip1.Save + End Using + + + + the string that specifies which entries to select + + the directory in the archive from which to select entries. If null, then + all directories in the archive are used. + + the number of entries removed + + + + Selects and Extracts a set of Entries from the ZipFile. + + + + + The entries are extracted into the current working directory. + + + + If any of the files to be extracted already exist, then the action taken is as + specified in the property on the + corresponding ZipEntry instance. By default, the action taken in this case is to + throw an exception. + + + + For information on the syntax of the selectionCriteria string, + see . + + + + + This example shows how extract all XML files modified after 15 January 2009. + + using (ZipFile zip = ZipFile.Read(zipArchiveName)) + { + zip.ExtractSelectedEntries("name = *.xml and mtime > 2009-01-15"); + } + + + the selection criteria for entries to extract. + + + + + + Selects and Extracts a set of Entries from the ZipFile. + + + + + The entries are extracted into the current working directory. When extraction would would + overwrite an existing filesystem file, the action taken is as specified in the + parameter. + + + + For information on the syntax of the string describing the entry selection criteria, + see . + + + + + This example shows how extract all XML files modified after 15 January 2009, + overwriting any existing files. + + using (ZipFile zip = ZipFile.Read(zipArchiveName)) + { + zip.ExtractSelectedEntries("name = *.xml and mtime > 2009-01-15", + ExtractExistingFileAction.OverwriteSilently); + } + + + + the selection criteria for entries to extract. + + + The action to take if extraction would overwrite an existing file. + + + + + Selects and Extracts a set of Entries from the ZipFile. + + + + + The entries are selected from the specified directory within the archive, and then + extracted into the current working directory. + + + + If any of the files to be extracted already exist, then the action taken is as + specified in the property on the + corresponding ZipEntry instance. By default, the action taken in this case is to + throw an exception. + + + + For information on the syntax of the string describing the entry selection criteria, + see . + + + + + This example shows how extract all XML files modified after 15 January 2009, + and writes them to the "unpack" directory. + + using (ZipFile zip = ZipFile.Read(zipArchiveName)) + { + zip.ExtractSelectedEntries("name = *.xml and mtime > 2009-01-15","unpack"); + } + + + + the selection criteria for entries to extract. + + + the directory in the archive from which to select entries. If null, then + all directories in the archive are used. + + + + + + + Selects and Extracts a set of Entries from the ZipFile. + + + + + The entries are extracted into the specified directory. If any of the files to be + extracted already exist, an exception will be thrown. + + + For information on the syntax of the string describing the entry selection criteria, + see . + + + + the selection criteria for entries to extract. + + + the directory in the archive from which to select entries. If null, then + all directories in the archive are used. + + + + the directory on the disk into which to extract. It will be created + if it does not exist. + + + + + Selects and Extracts a set of Entries from the ZipFile. + + + + + The entries are extracted into the specified directory. When extraction would would + overwrite an existing filesystem file, the action taken is as specified in the + parameter. + + + + For information on the syntax of the string describing the entry selection criteria, + see . + + + + + This example shows how extract all files with an XML extension or with a size larger than 100,000 bytes, + and puts them in the unpack directory. For any files that already exist in + that destination directory, they will not be overwritten. + + using (ZipFile zip = ZipFile.Read(zipArchiveName)) + { + zip.ExtractSelectedEntries("name = *.xml or size > 100000", + null, + "unpack", + ExtractExistingFileAction.DontOverwrite); + } + + + + the selection criteria for entries to extract. + + + The directory on the disk into which to extract. It will be created if it does not exist. + + + + The directory in the archive from which to select entries. If null, then + all directories in the archive are used. + + + + The action to take if extraction would overwrite an existing file. + + + + + + + + Static constructor for ZipFile + + + Code Pages 437 and 1252 for English are same + Code Page 1252 Windows Latin 1 (ANSI) - + Code Page 437 MS-DOS Latin US - + + + + + The default text encoding used in zip archives. It is numeric 437, also + known as IBM437. + + + + + + Generic IEnumerator support, for use of a ZipFile in an enumeration. + + + + You probably do not want to call GetEnumerator explicitly. Instead + it is implicitly called when you use a loop in C#, or a + For Each loop in VB.NET. + + + + This example reads a zipfile of a given name, then enumerates the + entries in that zip file, and displays the information about each + entry on the Console. + + using (ZipFile zip = ZipFile.Read(zipfile)) + { + bool header = true; + foreach (ZipEntry e in zip) + { + if (header) + { + System.Console.WriteLine("Zipfile: {0}", zip.Name); + System.Console.WriteLine("Version Needed: 0x{0:X2}", e.VersionNeeded); + System.Console.WriteLine("BitField: 0x{0:X2}", e.BitField); + System.Console.WriteLine("Compression Method: 0x{0:X2}", e.CompressionMethod); + System.Console.WriteLine("\n{1,-22} {2,-6} {3,4} {4,-8} {0}", + "Filename", "Modified", "Size", "Ratio", "Packed"); + System.Console.WriteLine(new System.String('-', 72)); + header = false; + } + + System.Console.WriteLine("{1,-22} {2,-6} {3,4:F0}% {4,-8} {0}", + e.FileName, + e.LastModified.ToString("yyyy-MM-dd HH:mm:ss"), + e.UncompressedSize, + e.CompressionRatio, + e.CompressedSize); + + e.Extract(); + } + } + + + + Dim ZipFileToExtract As String = "c:\foo.zip" + Using zip As ZipFile = ZipFile.Read(ZipFileToExtract) + Dim header As Boolean = True + Dim e As ZipEntry + For Each e In zip + If header Then + Console.WriteLine("Zipfile: {0}", zip.Name) + Console.WriteLine("Version Needed: 0x{0:X2}", e.VersionNeeded) + Console.WriteLine("BitField: 0x{0:X2}", e.BitField) + Console.WriteLine("Compression Method: 0x{0:X2}", e.CompressionMethod) + Console.WriteLine(ChrW(10) & "{1,-22} {2,-6} {3,4} {4,-8} {0}", _ + "Filename", "Modified", "Size", "Ratio", "Packed" ) + Console.WriteLine(New String("-"c, 72)) + header = False + End If + Console.WriteLine("{1,-22} {2,-6} {3,4:F0}% {4,-8} {0}", _ + e.FileName, _ + e.LastModified.ToString("yyyy-MM-dd HH:mm:ss"), _ + e.UncompressedSize, _ + e.CompressionRatio, _ + e.CompressedSize ) + e.Extract + Next + End Using + + + + A generic enumerator suitable for use within a foreach loop. + + + + An IEnumerator, for use of a ZipFile in a foreach construct. + + + + This method is included for COM support. An application generally does not call + this method directly. It is called implicitly by COM clients when enumerating + the entries in the ZipFile instance. In VBScript, this is done with a For Each + statement. In Javascript, this is done with new Enumerator(zipfile). + + + + The IEnumerator over the entries in the ZipFile. + + + + + This class exposes a set of COM-accessible wrappers for static + methods available on the ZipFile class. You don't need this + class unless you are using DotNetZip from a COM environment. + + + + + A wrapper for ZipFile.IsZipFile(string) + + The filename to of the zip file to check. + true if the file contains a valid zip file. + + + + A wrapper for ZipFile.IsZipFile(string, bool) + + + We cannot use "overloaded" Method names in COM interop. + So, here, we use a unique name. + + The filename to of the zip file to check. + true if the file contains a valid zip file. + + + + A wrapper for ZipFile.CheckZip(string) + + The filename to of the zip file to check. + + true if the named zip file checks OK. Otherwise, false. + + + + A COM-friendly wrapper for the static method . + + + The filename to of the zip file to check. + + The password to check. + + true if the named zip file checks OK. Otherwise, false. + + + + A wrapper for ZipFile.FixZipDirectory(string) + + The filename to of the zip file to fix. + + + + A wrapper for ZipFile.LibraryVersion + + + the version number on the DotNetZip assembly, formatted as a string. + + + + + An enum that provides the various encryption algorithms supported by this + library. + + + + + + PkzipWeak implies the use of Zip 2.0 encryption, which is known to be + weak and subvertible. + + + + A note on interoperability: Values of PkzipWeak and None are + specified in PKWARE's zip + specification, and are considered to be "standard". Zip archives + produced using these options will be interoperable with many other zip tools + and libraries, including Windows Explorer. + + + + Values of WinZipAes128 and WinZipAes256 are not part of the Zip + specification, but rather imply the use of a vendor-specific extension from + WinZip. If you want to produce interoperable Zip archives, do not use these + values. For example, if you produce a zip archive using WinZipAes256, you + will be able to open it in Windows Explorer on Windows XP and Vista, but you + will not be able to extract entries; trying this will lead to an "unspecified + error". For this reason, some people have said that a zip archive that uses + WinZip's AES encryption is not actually a zip archive at all. A zip archive + produced this way will be readable with the WinZip tool (Version 11 and + beyond). + + + + There are other third-party tools and libraries, both commercial and + otherwise, that support WinZip's AES encryption. These will be able to read + AES-encrypted zip archives produced by DotNetZip, and conversely applications + that use DotNetZip to read zip archives will be able to read AES-encrypted + archives produced by those tools or libraries. Consult the documentation for + those other tools and libraries to find out if WinZip's AES encryption is + supported. + + + + In case you care: According to the WinZip specification, the + actual AES key used is derived from the via an + algorithm that complies with RFC 2898, using an iteration + count of 1000. The algorithm is sometimes referred to as PBKDF2, which stands + for "Password Based Key Derivation Function #2". + + + + A word about password strength and length: The AES encryption technology is + very good, but any system is only as secure as the weakest link. If you want + to secure your data, be sure to use a password that is hard to guess. To make + it harder to guess (increase its "entropy"), you should make it longer. If + you use normal characters from an ASCII keyboard, a password of length 20 will + be strong enough that it will be impossible to guess. For more information on + that, I'd encourage you to read this + article. + + + + + + + No encryption at all. + + + + + Traditional or Classic pkzip encryption. + + + + + WinZip AES encryption (128 key bits). + + + + + WinZip AES encryption (256 key bits). + + + + + An encryption algorithm that is not supported by DotNetZip. + + + + + Delegate in which the application writes the ZipEntry content for the named entry. + + + The name of the entry that must be written. + The stream to which the entry data should be written. + + + When you add an entry and specify a WriteDelegate, via , the application + code provides the logic that writes the entry data directly into the zip file. + + + + + This example shows how to define a WriteDelegate that obtains a DataSet, and then + writes the XML for the DataSet into the zip archive. There's no need to + save the XML to a disk file first. + + + private void WriteEntry (String filename, Stream output) + { + DataSet ds1 = ObtainDataSet(); + ds1.WriteXml(output); + } + + private void Run() + { + using (var zip = new ZipFile()) + { + zip.AddEntry(zipEntryName, WriteEntry); + zip.Save(zipFileName); + } + } + + + + Private Sub WriteEntry (ByVal filename As String, ByVal output As Stream) + DataSet ds1 = ObtainDataSet() + ds1.WriteXml(stream) + End Sub + + Public Sub Run() + Using zip = New ZipFile + zip.AddEntry(zipEntryName, New WriteDelegate(AddressOf WriteEntry)) + zip.Save(zipFileName) + End Using + End Sub + + + + + + + Delegate in which the application opens the stream, just-in-time, for the named entry. + + + + The name of the ZipEntry that the application should open the stream for. + + + + When you add an entry via , the application code provides the logic that + opens and closes the stream for the given ZipEntry. + + + + + + + Delegate in which the application closes the stream, just-in-time, for the named entry. + + + + The name of the ZipEntry that the application should close the stream for. + + + The stream to be closed. + + + When you add an entry via , the application code provides the logic that + opens and closes the stream for the given ZipEntry. + + + + + + + Delegate for the callback by which the application tells the + library the CompressionLevel to use for a file. + + + + + Using this callback, the application can, for example, specify that + previously-compressed files (.mp3, .png, .docx, etc) should use a + CompressionLevel of None, or can set the compression level based + on any other factor. + + + + + + + In an EventArgs type, indicates which sort of progress event is being + reported. + + + There are events for reading, events for saving, and events for + extracting. This enumeration allows a single EventArgs type to be sued to + describe one of multiple subevents. For example, a SaveProgress event is + invoked before, after, and during the saving of a single entry. The value + of an enum with this type, specifies which event is being triggered. The + same applies to Extraction, Reading and Adding events. + + + + + Indicates that a Add() operation has started. + + + + + Indicates that an individual entry in the archive has been added. + + + + + Indicates that a Add() operation has completed. + + + + + Indicates that a Read() operation has started. + + + + + Indicates that an individual entry in the archive is about to be read. + + + + + Indicates that an individual entry in the archive has just been read. + + + + + Indicates that a Read() operation has completed. + + + + + The given event reports the number of bytes read so far + during a Read() operation. + + + + + Indicates that a Save() operation has started. + + + + + Indicates that an individual entry in the archive is about to be written. + + + + + Indicates that an individual entry in the archive has just been saved. + + + + + Indicates that a Save() operation has completed. + + + + + Indicates that the zip archive has been created in a + temporary location during a Save() operation. + + + + + Indicates that the temporary file is about to be renamed to the final archive + name during a Save() operation. + + + + + Indicates that the temporary file is has just been renamed to the final archive + name during a Save() operation. + + + + + Indicates that the self-extracting archive has been compiled + during a Save() operation. + + + + + The given event is reporting the number of source bytes that have run through the compressor so far + during a Save() operation. + + + + + Indicates that an entry is about to be extracted. + + + + + Indicates that an entry has just been extracted. + + + + + Indicates that extraction of an entry would overwrite an existing + filesystem file. You must use + + ExtractExistingFileAction.InvokeExtractProgressEvent in the call + to ZipEntry.Extract() in order to receive this event. + + + + + The given event is reporting the number of bytes written so far for + the current entry during an Extract() operation. + + + + + Indicates that an ExtractAll operation is about to begin. + + + + + Indicates that an ExtractAll operation has completed. + + + + + Indicates that an error has occurred while saving a zip file. + This generally means the file cannot be opened, because it has been + removed, or because it is locked by another process. It can also + mean that the file cannot be Read, because of a range lock conflict. + + + + + Provides information about the progress of a save, read, or extract operation. + This is a base class; you will probably use one of the classes derived from this one. + + + + + The total number of entries to be saved or extracted. + + + + + The name of the last entry saved or extracted. + + + + + In an event handler, set this to cancel the save or extract + operation that is in progress. + + + + + The type of event being reported. + + + + + Returns the archive name associated to this event. + + + + + The number of bytes read or written so far for this entry. + + + + + Total number of bytes that will be read or written for this entry. + This number will be -1 if the value cannot be determined. + + + + + Provides information about the progress of a Read operation. + + + + + Provides information about the progress of a Add operation. + + + + + Provides information about the progress of a save operation. + + + + + Constructor for the SaveProgressEventArgs. + + the name of the zip archive. + whether this is before saving the entry, or after + The total number of entries in the zip archive. + Number of entries that have been saved. + The entry involved in the event. + + + + Number of entries saved so far. + + + + + Provides information about the progress of the extract operation. + + + + + Constructor for the ExtractProgressEventArgs. + + the name of the zip archive. + whether this is before saving the entry, or after + The total number of entries in the zip archive. + Number of entries that have been extracted. + The entry involved in the event. + The location to which entries are extracted. + + + + Number of entries extracted so far. This is set only if the + EventType is Extracting_BeforeExtractEntry or Extracting_AfterExtractEntry, and + the Extract() is occurring witin the scope of a call to ExtractAll(). + + + + + Returns the extraction target location, a filesystem path. + + + + + Provides information about the an error that occurred while zipping. + + + + + Returns the exception that occurred, if any. + + + + + Returns the name of the file that caused the exception, if any. + + + + + Issued when an ZipEntry.ExtractWithPassword() method is invoked + with an incorrect password. + + + + + Default ctor. + + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + The innerException for this exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The serialization info for the exception. + The streaming context from which to deserialize. + + + + Indicates that a read was attempted on a stream, and bad or incomplete data was + received. + + + + + Default ctor. + + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + The innerException for this exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The serialization info for the exception. + The streaming context from which to deserialize. + + + + Issued when an CRC check fails upon extracting an entry from a zip archive. + + + + + Default ctor. + + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The serialization info for the exception. + The streaming context from which to deserialize. + + + + Issued when errors occur saving a self-extracting archive. + + + + + Default ctor. + + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The serialization info for the exception. + The streaming context from which to deserialize. + + + + Indicates that an operation was attempted on a ZipFile which was not possible + given the state of the instance. For example, if you call Save() on a ZipFile + which has no filename set, you can get this exception. + + + + + Default ctor. + + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + The innerException for this exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The serialization info for the exception. + The streaming context from which to deserialize. + + + + Base class for all exceptions defined by and throw by the Zip library. + + + + + Default ctor. + + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + The innerException for this exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The serialization info for the exception. + The streaming context from which to deserialize. + + + + An enum for the options when extracting an entry would overwrite an existing file. + + + + + This enum describes the actions that the library can take when an + Extract() or ExtractWithPassword() method is called to extract an + entry to a filesystem, and the extraction would overwrite an existing filesystem + file. + + + + + + + Throw an exception when extraction would overwrite an existing file. (For + COM clients, this is a 0 (zero).) + + + + + When extraction would overwrite an existing file, overwrite the file silently. + The overwrite will happen even if the target file is marked as read-only. + (For COM clients, this is a 1.) + + + + + When extraction would overwrite an existing file, don't overwrite the file, silently. + (For COM clients, this is a 2.) + + + + + When extraction would overwrite an existing file, invoke the ExtractProgress + event, using an event type of . In + this way, the application can decide, just-in-time, whether to overwrite the + file. For example, a GUI application may wish to pop up a dialog to allow + the user to choose. You may want to examine the property before making + the decision. If, after your processing in the Extract progress event, you + want to NOT extract the file, set + on the ZipProgressEventArgs.CurrentEntry to DoNotOverwrite. + If you do want to extract the file, set ZipEntry.ExtractExistingFile + to OverwriteSilently. If you want to cancel the Extraction, set + ZipProgressEventArgs.Cancel to true. Cancelling differs from using + DoNotOverwrite in that a cancel will not extract any further entries, if + there are any. (For COM clients, the value of this enum is a 3.) + + + + + Collects general purpose utility methods. + + + + private null constructor + + + + Utility routine for transforming path names from filesystem format (on Windows that means backslashes) to + a format suitable for use within zipfiles. This means trimming the volume letter and colon (if any) And + swapping backslashes for forward slashes. + + source path. + transformed path + + + + Sanitize paths in zip files. This means making sure that relative paths in a zip file don't go outside + the top directory. Entries like something/../../../../Temp/evil.txt get sanitized to Temp/evil.txt + when extracting + + A path with forward slashes as directory separator + sanitized path + + + + Finds a signature in the zip stream. This is useful for finding + the end of a zip entry, for example, or the beginning of the next ZipEntry. + + + + + Scans through 64k at a time. + + + + If the method fails to find the requested signature, the stream Position + after completion of this method is unchanged. If the method succeeds in + finding the requested signature, the stream position after completion is + direct AFTER the signature found in the stream. + + + + The stream to search + The 4-byte signature to find + The number of bytes read + + + + Create a pseudo-random filename, suitable for use as a temporary + file, and open it. + + + + This method produces a filename of the form + DotNetZip-xxxxxxxx.tmp, where xxxxxxxx is replaced by randomly + chosen characters, and creates that file. + + + + + + Workitem 7889: handle ERROR_LOCK_VIOLATION during read + + + This could be gracefully handled with an extension attribute, but + This assembly used to be built for .NET 2.0, so could not use + extension methods. + + + + + A decorator stream. It wraps another stream, and performs bookkeeping + to keep track of the stream Position. + + + + In some cases, it is not possible to get the Position of a stream, let's + say, on a write-only output stream like ASP.NET's + Response.OutputStream, or on a different write-only stream + provided as the destination for the zip by the application. In this + case, programmers can use this counting stream to count the bytes read + or written. + + + Consider the scenario of an application that saves a self-extracting + archive (SFX), that uses a custom SFX stub. + + + Saving to a filesystem file, the application would open the + filesystem file (getting a FileStream), save the custom sfx stub + into it, and then call ZipFile.Save(), specifying the same + FileStream. ZipFile.Save() does the right thing for the zipentry + offsets, by inquiring the Position of the FileStream before writing + any data, and then adding that initial offset into any ZipEntry + offsets in the zip directory. Everything works fine. + + + Now suppose the application is an ASPNET application and it saves + directly to Response.OutputStream. It's not possible for DotNetZip to + inquire the Position, so the offsets for the SFX will be wrong. + + + The workaround is for the application to use this class to wrap + HttpResponse.OutputStream, then write the SFX stub and the ZipFile + into that wrapper stream. Because ZipFile.Save() can inquire the + Position, it will then do the right thing with the offsets. + + + + + + The constructor. + + The underlying stream + + + + Gets the wrapped stream. + + + + + The count of bytes written out to the stream. + + + + + the count of bytes that have been read from the stream. + + + + + Adjust the byte count on the stream. + + + + the number of bytes to subtract from the count. + + + + + Subtract delta from the count of bytes written to the stream. + This is necessary when seeking back, and writing additional data, + as happens in some cases when saving Zip files. + + + + + + The read method. + + The buffer to hold the data read from the stream. + the offset within the buffer to copy the first byte read. + the number of bytes to read. + the number of bytes read, after decryption and decompression. + + + + Write data into the stream. + + The buffer holding data to write to the stream. + the offset within that data array to find the first byte to write. + the number of bytes to write. + + + + Whether the stream can be read. + + + + + Whether it is possible to call Seek() on the stream. + + + + + Whether it is possible to call Write() on the stream. + + + + + Flushes the underlying stream. + + + + + The length of the underlying stream. + + + + + Returns the sum of number of bytes written, plus the initial + offset before writing. + + + + + The Position of the stream. + + + + + Seek in the stream. + + the offset point to seek to + the reference point from which to seek + The new position + + + + Set the length of the underlying stream. Be careful with this! + + + the length to set on the underlying stream. + + + + This is a helper class supporting WinZip AES encryption. + This class is intended for use only by the DotNetZip library. + + + + Most uses of the DotNetZip library will not involve direct calls into + the WinZipAesCrypto class. Instead, the WinZipAesCrypto class is + instantiated and used by the ZipEntry() class when WinZip AES + encryption or decryption on an entry is employed. + + + + + A stream that encrypts as it writes, or decrypts as it reads. The + Crypto is AES in CTR (counter) mode, which is compatible with the AES + encryption employed by WinZip 12.0. + + + + The AES/CTR encryption protocol used by WinZip works like this: + + - start with a counter, initialized to zero. + + - to encrypt, take the data by 16-byte blocks. For each block: + - apply the transform to the counter + - increement the counter + - XOR the result of the transform with the plaintext to + get the ciphertext. + - compute the mac on the encrypted bytes + - when finished with all blocks, store the computed MAC. + + - to decrypt, take the data by 16-byte blocks. For each block: + - compute the mac on the encrypted bytes, + - apply the transform to the counter + - increement the counter + - XOR the result of the transform with the ciphertext to + get the plaintext. + - when finished with all blocks, compare the computed MAC against + the stored MAC + + + + + + + The constructor. + + The underlying stream + To either encrypt or decrypt. + The pre-initialized WinZipAesCrypto object. + The maximum number of bytes to read from the stream. + + + + Returns the final HMAC-SHA1-80 for the data that was encrypted. + + + + + Close the stream. + + + + + Returns true if the stream can be read. + + + + + Always returns false. + + + + + Returns true if the CryptoMode is Encrypt. + + + + + Flush the content in the stream. + + + + + Getting this property throws a NotImplementedException. + + + + + Getting or Setting this property throws a NotImplementedException. + + + + + This method throws a NotImplementedException. + + + + + This method throws a NotImplementedException. + + + + + This class implements the "traditional" or "classic" PKZip encryption, + which today is considered to be weak. On the other hand it is + ubiquitous. This class is intended for use only by the DotNetZip + library. + + + + Most uses of the DotNetZip library will not involve direct calls into + the ZipCrypto class. Instead, the ZipCrypto class is instantiated and + used by the ZipEntry() class when encryption or decryption on an entry + is employed. If for some reason you really wanted to use a weak + encryption algorithm in some other application, you might use this + library. But you would be much better off using one of the built-in + strong encryption libraries in the .NET Framework, like the AES + algorithm or SHA. + + + + + The default constructor for ZipCrypto. + + + + This class is intended for internal use by the library only. It's + probably not useful to you. Seriously. Stop reading this + documentation. It's a waste of your time. Go do something else. + Check the football scores. Go get an ice cream with a friend. + Seriously. + + + + + + From AppNote.txt: + unsigned char decrypt_byte() + local unsigned short temp + temp :=- Key(2) | 2 + decrypt_byte := (temp * (temp ^ 1)) bitshift-right 8 + end decrypt_byte + + + + + Call this method on a cipher text to render the plaintext. You must + first initialize the cipher with a call to InitCipher. + + + + + var cipher = new ZipCrypto(); + cipher.InitCipher(Password); + // Decrypt the header. This has a side effect of "further initializing the + // encryption keys" in the traditional zip encryption. + byte[] DecryptedMessage = cipher.DecryptMessage(EncryptedMessage); + + + + The encrypted buffer. + + The number of bytes to encrypt. + Should be less than or equal to CipherText.Length. + + + The plaintext. + + + + This is the converse of DecryptMessage. It encrypts the plaintext + and produces a ciphertext. + + + The plain text buffer. + + + The number of bytes to encrypt. + Should be less than or equal to plainText.Length. + + + The ciphertext. + + + + This initializes the cipher with the given password. + See AppNote.txt for details. + + + + The passphrase for encrypting or decrypting with this cipher. + + + + + Step 1 - Initializing the encryption keys + ----------------------------------------- + Start with these keys: + Key(0) := 305419896 (0x12345678) + Key(1) := 591751049 (0x23456789) + Key(2) := 878082192 (0x34567890) + + Then, initialize the keys with a password: + + loop for i from 0 to length(password)-1 + update_keys(password(i)) + end loop + + Where update_keys() is defined as: + + update_keys(char): + Key(0) := crc32(key(0),char) + Key(1) := Key(1) + (Key(0) bitwiseAND 000000ffH) + Key(1) := Key(1) * 134775813 + 1 + Key(2) := crc32(key(2),key(1) rightshift 24) + end update_keys + + Where crc32(old_crc,char) is a routine that given a CRC value and a + character, returns an updated CRC value after applying the CRC-32 + algorithm described elsewhere in this document. + + + + + After the keys are initialized, then you can use the cipher to + encrypt the plaintext. + + + + Essentially we encrypt the password with the keys, then discard the + ciphertext for the password. This initializes the keys for later use. + + + + + + + A Stream for reading and concurrently decrypting data from a zip file, + or for writing and concurrently encrypting data to a zip file. + + + + The constructor. + The underlying stream + To either encrypt or decrypt. + The pre-initialized ZipCrypto object. + + + + Represents a single entry in a ZipFile. Typically, applications get a ZipEntry + by enumerating the entries within a ZipFile, or by adding an entry to a ZipFile. + + + + + True if the referenced entry is a directory. + + + + + Provides a human-readable string with information about the ZipEntry. + + + + + Reads one entry from the zip directory structure in the zip file. + + + + The zipfile for which a directory entry will be read. From this param, the + method gets the ReadStream and the expected text encoding + (ProvisionalAlternateEncoding) which is used if the entry is not marked + UTF-8. + + + + a list of previously seen entry names; used to prevent duplicates. + + + the entry read from the archive. + + + + Returns true if the passed-in value is a valid signature for a ZipDirEntry. + + the candidate 4-byte signature value. + true, if the signature is valid according to the PKWare spec. + + + + Default constructor. + + + Applications should never need to call this directly. It is exposed to + support COM Automation environments. + + + + + The time and date at which the file indicated by the ZipEntry was + last modified. + + + + + The DotNetZip library sets the LastModified value for an entry, equal to + the Last Modified time of the file in the filesystem. If an entry is + added from a stream, the library uses System.DateTime.Now for this + value, for the given entry. + + + + This property allows the application to retrieve and possibly set the + LastModified value on an entry, to an arbitrary value. values with a + setting of DateTimeKind.Unspecified are taken to be expressed as + DateTimeKind.Local. + + + + Be aware that because of the way PKWare's + Zip specification describes how times are stored in the zip file, + the full precision of the System.DateTime datatype is not stored + for the last modified time when saving zip files. For more information on + how times are formatted, see the PKZip specification. + + + + The actual last modified time of a file can be stored in multiple ways in + the zip file, and they are not mutually exclusive: + + + + + In the so-called "DOS" format, which has a 2-second precision. Values + are rounded to the nearest even second. For example, if the time on the + file is 12:34:43, then it will be stored as 12:34:44. This first value + is accessible via the LastModified property. This value is always + present in the metadata for each zip entry. In some cases the value is + invalid, or zero. + + + + In the so-called "Windows" or "NTFS" format, as an 8-byte integer + quantity expressed as the number of 1/10 milliseconds (in other words + the number of 100 nanosecond units) since January 1, 1601 (UTC). This + format is how Windows represents file times. This time is accessible + via the ModifiedTime property. + + + + In the "Unix" format, a 4-byte quantity specifying the number of seconds since + January 1, 1970 UTC. + + + + In an older format, now deprecated but still used by some current + tools. This format is also a 4-byte quantity specifying the number of + seconds since January 1, 1970 UTC. + + + + + + Zip tools and libraries will always at least handle (read or write) the + DOS time, and may also handle the other time formats. Keep in mind that + while the names refer to particular operating systems, there is nothing in + the time formats themselves that prevents their use on other operating + systems. + + + + When reading ZIP files, the DotNetZip library reads the Windows-formatted + time, if it is stored in the entry, and sets both LastModified and + ModifiedTime to that value. When writing ZIP files, the DotNetZip + library by default will write both time quantities. It can also emit the + Unix-formatted time if desired (See .) + + + + The last modified time of the file created upon a call to + ZipEntry.Extract() may be adjusted during extraction to compensate + for differences in how the .NET Base Class Library deals with daylight + saving time (DST) versus how the Windows filesystem deals with daylight + saving time. Raymond Chen provides + some good context. + + + + In a nutshell: Daylight savings time rules change regularly. In 2007, for + example, the inception week of DST changed. In 1977, DST was in place all + year round. In 1945, likewise. And so on. Win32 does not attempt to + guess which time zone rules were in effect at the time in question. It + will render a time as "standard time" and allow the app to change to DST + as necessary. .NET makes a different choice. + + + + Compare the output of FileInfo.LastWriteTime.ToString("f") with what you + see in the Windows Explorer property sheet for a file that was last + written to on the other side of the DST transition. For example, suppose + the file was last modified on October 17, 2003, during DST but DST is not + currently in effect. Explorer's file properties reports Thursday, October + 17, 2003, 8:45:38 AM, but .NETs FileInfo reports Thursday, October 17, + 2003, 9:45 AM. + + + + Win32 says, "Thursday, October 17, 2002 8:45:38 AM PST". Note: Pacific + STANDARD Time. Even though October 17 of that year occurred during Pacific + Daylight Time, Win32 displays the time as standard time because that's + what time it is NOW. + + + + .NET BCL assumes that the current DST rules were in place at the time in + question. So, .NET says, "Well, if the rules in effect now were also in + effect on October 17, 2003, then that would be daylight time" so it + displays "Thursday, October 17, 2003, 9:45 AM PDT" - daylight time. + + + + So .NET gives a value which is more intuitively correct, but is also + potentially incorrect, and which is not invertible. Win32 gives a value + which is intuitively incorrect, but is strictly correct. + + + + Because of this funkiness, this library adds one hour to the LastModified + time on the extracted file, if necessary. That is to say, if the time in + question had occurred in what the .NET Base Class Library assumed to be + DST. This assumption may be wrong given the constantly changing DST rules, + but it is the best we can do. + + + + + + + + Ability to set Last Modified DOS time to zero + (for using with EmitTimesInWindowsFormatWhenSaving+EmitTimesInUnixFormatWhenSaving setted to false) + some flasher hardware use as marker of first binary + + + + + Last Modified time for the file represented by the entry. + + + + + + This value corresponds to the "last modified" time in the NTFS file times + as described in the Zip + specification. When getting this property, the value may be + different from . When setting the property, + the property also gets set, but with a lower + precision. + + + + Let me explain. It's going to take a while, so get + comfortable. Originally, waaaaay back in 1989 when the ZIP specification + was originally described by the esteemed Mr. Phil Katz, the dominant + operating system of the time was MS-DOS. MSDOS stored file times with a + 2-second precision, because, c'mon, who is ever going to need better + resolution than THAT? And so ZIP files, regardless of the platform on + which the zip file was created, store file times in exactly the same format that DOS used + in 1989. + + + + Since then, the ZIP spec has evolved, but the internal format for file + timestamps remains the same. Despite the fact that the way times are + stored in a zip file is rooted in DOS heritage, any program on any + operating system can format a time in this way, and most zip tools and + libraries DO - they round file times to the nearest even second and store + it just like DOS did 25+ years ago. + + + + PKWare extended the ZIP specification to allow a zip file to store what + are called "NTFS Times" and "Unix(tm) times" for a file. These are the + last write, last access, and file creation + times of a particular file. These metadata are not actually specific + to NTFS or Unix. They are tracked for each file by NTFS and by various + Unix filesystems, but they are also tracked by other filesystems, too. + The key point is that the times are formatted in the zip file + in the same way that NTFS formats the time (ticks since win32 epoch), + or in the same way that Unix formats the time (seconds since Unix + epoch). As with the DOS time, any tool or library running on any + operating system is capable of formatting a time in one of these ways + and embedding it into the zip file. + + + + These extended times are higher precision quantities than the DOS time. + As described above, the (DOS) LastModified has a precision of 2 seconds. + The Unix time is stored with a precision of 1 second. The NTFS time is + stored with a precision of 0.0000001 seconds. The quantities are easily + convertible, except for the loss of precision you may incur. + + + + A zip archive can store the {C,A,M} times in NTFS format, in Unix format, + or not at all. Often a tool running on Unix or Mac will embed the times + in Unix format (1 second precision), while WinZip running on Windows might + embed the times in NTFS format (precision of of 0.0000001 seconds). When + reading a zip file with these "extended" times, in either format, + DotNetZip represents the values with the + ModifiedTime, AccessedTime and CreationTime + properties on the ZipEntry. + + + + While any zip application or library, regardless of the platform it + runs on, could use any of the time formats allowed by the ZIP + specification, not all zip tools or libraries do support all these + formats. Storing the higher-precision times for each entry is + optional for zip files, and many tools and libraries don't use the + higher precision quantities at all. The old DOS time, represented by + , is guaranteed to be present, though it + sometimes unset. + + + + Ok, getting back to the question about how the LastModified + property relates to this ModifiedTime + property... LastModified is always set, while + ModifiedTime is not. (The other times stored in the NTFS + times extension, CreationTime and AccessedTime also + may not be set on an entry that is read from an existing zip file.) + When reading a zip file, then LastModified takes the DOS time + that is stored with the file. If the DOS time has been stored as zero + in the zipfile, then this library will use DateTime.Now for the + LastModified value. If the ZIP file was created by an evolved + tool, then there will also be higher precision NTFS or Unix times in + the zip file. In that case, this library will read those times, and + set LastModified and ModifiedTime to the same value, the + one corresponding to the last write time of the file. If there are no + higher precision times stored for the entry, then ModifiedTime + remains unset (likewise AccessedTime and CreationTime), + and LastModified keeps its DOS time. + + + + When creating zip files with this library, by default the extended time + properties (ModifiedTime, AccessedTime, and + CreationTime) are set on the ZipEntry instance, and these data are + stored in the zip archive for each entry, in NTFS format. If you add an + entry from an actual filesystem file, then the entry gets the actual file + times for that file, to NTFS-level precision. If you add an entry from a + stream, or a string, then the times get the value DateTime.Now. In + this case LastModified and ModifiedTime will be identical, + to 2 seconds of precision. You can explicitly set the + CreationTime, AccessedTime, and ModifiedTime of an + entry using the property setters. If you want to set all of those + quantities, it's more efficient to use the method. Those + changes are not made permanent in the zip file until you call or one of its cousins. + + + + When creating a zip file, you can override the default behavior of + this library for formatting times in the zip file, disabling the + embedding of file times in NTFS format or enabling the storage of file + times in Unix format, or both. You may want to do this, for example, + when creating a zip file on Windows, that will be consumed on a Mac, + by an application that is not hip to the "NTFS times" format. To do + this, use the and + properties. A valid zip + file may store the file times in both formats. But, there are no + guarantees that a program running on Mac or Linux will gracefully + handle the NTFS-formatted times when Unix times are present, or that a + non-DotNetZip-powered application running on Windows will be able to + handle file times in Unix format. DotNetZip will always do something + reasonable; other libraries or tools may not. When in doubt, test. + + + + I'll bet you didn't think one person could type so much about time, eh? + And reading it was so enjoyable, too! Well, in appreciation, maybe you + should donate? + + + + + + + + + + + Last Access time for the file represented by the entry. + + + This value may or may not be meaningful. If the ZipEntry was read from an existing + Zip archive, this information may not be available. For an explanation of why, see + . + + + + + + + + The file creation time for the file represented by the entry. + + + + This value may or may not be meaningful. If the ZipEntry was read + from an existing zip archive, and the creation time was not set on the entry + when the zip file was created, then this property may be meaningless. For an + explanation of why, see . + + + + + + + + Sets the NTFS Creation, Access, and Modified times for the given entry. + + + + + When adding an entry from a file or directory, the Creation, Access, and + Modified times for the given entry are automatically set from the + filesystem values. When adding an entry from a stream or string, the + values are implicitly set to DateTime.Now. The application may wish to + set these values to some arbitrary value, before saving the archive, and + can do so using the various setters. If you want to set all of the times, + this method is more efficient. + + + + The values you set here will be retrievable with the , and properties. + + + + When this method is called, if both and are false, then the + EmitTimesInWindowsFormatWhenSaving flag is automatically set. + + + + DateTime values provided here without a DateTimeKind are assumed to be Local Time. + + + + the creation time of the entry. + the last access time of the entry. + the last modified time of the entry. + + + + + + + + + + Specifies whether the Creation, Access, and Modified times for the given + entry will be emitted in "Windows format" when the zip archive is saved. + + + + + An application creating a zip archive can use this flag to explicitly + specify that the file times for the entry should or should not be stored + in the zip archive in the format used by Windows. The default value of + this property is true. + + + + When adding an entry from a file or directory, the Creation (), Access (), and Modified + () times for the given entry are automatically + set from the filesystem values. When adding an entry from a stream or + string, all three values are implicitly set to DateTime.Now. Applications + can also explicitly set those times by calling . + + + + PKWARE's + zip specification describes multiple ways to format these times in a + zip file. One is the format Windows applications normally use: 100ns ticks + since Jan 1, 1601 UTC. The other is a format Unix applications typically + use: seconds since January 1, 1970 UTC. Each format can be stored in an + "extra field" in the zip entry when saving the zip archive. The former + uses an extra field with a Header Id of 0x000A, while the latter uses a + header ID of 0x5455. + + + + Not all zip tools and libraries can interpret these fields. Windows + compressed folders is one that can read the Windows Format timestamps, + while I believe the Infozip + tools can read the Unix format timestamps. Although the time values are + easily convertible, subject to a loss of precision, some tools and + libraries may be able to read only one or the other. DotNetZip can read or + write times in either or both formats. + + + + The times stored are taken from , , and . + + + + This property is not mutually exclusive from the property. It is + possible that a zip entry can embed the timestamps in both forms, one + form, or neither. But, there are no guarantees that a program running on + Mac or Linux will gracefully handle NTFS Formatted times, or that a + non-DotNetZip-powered application running on Windows will be able to + handle file times in Unix format. When in doubt, test. + + + + Normally you will use the ZipFile.EmitTimesInWindowsFormatWhenSaving + property, to specify the behavior for all entries in a zip, rather than + the property on each individual entry. + + + + + + + + + + + + + Specifies whether the Creation, Access, and Modified times for the given + entry will be emitted in "Unix(tm) format" when the zip archive is saved. + + + + + An application creating a zip archive can use this flag to explicitly + specify that the file times for the entry should or should not be stored + in the zip archive in the format used by Unix. By default this flag is + false, meaning the Unix-format times are not stored in the zip + archive. + + + + When adding an entry from a file or directory, the Creation (), Access (), and Modified + () times for the given entry are automatically + set from the filesystem values. When adding an entry from a stream or + string, all three values are implicitly set to DateTime.Now. Applications + can also explicitly set those times by calling . + + + + PKWARE's + zip specification describes multiple ways to format these times in a + zip file. One is the format Windows applications normally use: 100ns ticks + since Jan 1, 1601 UTC. The other is a format Unix applications typically + use: seconds since Jan 1, 1970 UTC. Each format can be stored in an + "extra field" in the zip entry when saving the zip archive. The former + uses an extra field with a Header Id of 0x000A, while the latter uses a + header ID of 0x5455. + + + + Not all tools and libraries can interpret these fields. Windows + compressed folders is one that can read the Windows Format timestamps, + while I believe the Infozip + tools can read the Unix format timestamps. Although the time values are + easily convertible, subject to a loss of precision, some tools and + libraries may be able to read only one or the other. DotNetZip can read or + write times in either or both formats. + + + + The times stored are taken from , , and . + + + + This property is not mutually exclusive from the property. It is + possible that a zip entry can embed the timestamps in both forms, one + form, or neither. But, there are no guarantees that a program running on + Mac or Linux will gracefully handle NTFS Formatted times, or that a + non-DotNetZip-powered application running on Windows will be able to + handle file times in Unix format. When in doubt, test. + + + + Normally you will use the ZipFile.EmitTimesInUnixFormatWhenSaving + property, to specify the behavior for all entries, rather than the + property on each individual entry. + + + + + + + + + + + + + The type of timestamp attached to the ZipEntry. + + + + This property is valid only for a ZipEntry that was read from a zip archive. + It indicates the type of timestamp attached to the entry. + + + + + + + + The file attributes for the entry. + + + + + + The attributes in NTFS include + ReadOnly, Archive, Hidden, System, and Indexed. When adding a + ZipEntry to a ZipFile, these attributes are set implicitly when + adding an entry from the filesystem. When adding an entry from a stream + or string, the Attributes are not set implicitly. Regardless of the way + an entry was added to a ZipFile, you can set the attributes + explicitly if you like. + + + + When reading a ZipEntry from a ZipFile, the attributes are + set according to the data stored in the ZipFile. If you extract the + entry from the archive to a filesystem file, DotNetZip will set the + attributes on the resulting file accordingly. + + + + The attributes can be set explicitly by the application. For example the + application may wish to set the FileAttributes.ReadOnly bit for all + entries added to an archive, so that on unpack, this attribute will be set + on the extracted file. Any changes you make to this property are made + permanent only when you call a Save() method on the ZipFile + instance that contains the ZipEntry. + + + + For example, an application may wish to zip up a directory and set the + ReadOnly bit on every file in the archive, so that upon later extraction, + the resulting files will be marked as ReadOnly. Not every extraction tool + respects these attributes, but if you unpack with DotNetZip, as for + example in a self-extracting archive, then the attributes will be set as + they are stored in the ZipFile. + + + + These attributes may not be interesting or useful if the resulting archive + is extracted on a non-Windows platform. How these attributes get used + upon extraction depends on the platform and tool used. + + + + + + + The name of the filesystem file, referred to by the ZipEntry. + + + + + This property specifies the thing-to-be-zipped on disk, and is set only + when the ZipEntry is being created from a filesystem file. If the + ZipFile is instantiated by reading an existing .zip archive, then + the LocalFileName will be null (Nothing in VB). + + + + When it is set, the value of this property may be different than , which is the path used in the archive itself. If you + call Zip.AddFile("foop.txt", AlternativeDirectory), then the path + used for the ZipEntry within the zip archive will be different + than this path. + + + + If the entry is being added from a stream, then this is null (Nothing in VB). + + + + + + + + The name of the file contained in the ZipEntry. + + + + + + This is the name of the entry in the ZipFile itself. When creating + a zip archive, if the ZipEntry has been created from a filesystem + file, via a call to or , or a related overload, the value + of this property is derived from the name of that file. The + FileName property does not include drive letters, and may include a + different directory path, depending on the value of the + directoryPathInArchive parameter used when adding the entry into + the ZipFile. + + + + In some cases there is no related filesystem file - for example when a + ZipEntry is created using or one of the similar overloads. In this case, the value of + this property is derived from the fileName and the directory path passed + to that method. + + + + When reading a zip file, this property takes the value of the entry name + as stored in the zip file. If you extract such an entry, the extracted + file will take the name given by this property. + + + + Applications can set this property when creating new zip archives or when + reading existing archives. When setting this property, the actual value + that is set will replace backslashes with forward slashes, in accordance + with the Zip + specification, for compatibility with Unix(tm) and ... get + this.... Amiga! + + + + If an application reads a ZipFile via or a related overload, and then explicitly + sets the FileName on an entry contained within the ZipFile, and + then calls , the application will effectively + rename the entry within the zip archive. + + + + If an application sets the value of FileName, then calls + Extract() on the entry, the entry is extracted to a file using the + newly set value as the filename. The FileName value is made + permanent in the zip archive only after a call to one of the + ZipFile.Save() methods on the ZipFile that contains the + ZipEntry. + + + + If an application attempts to set the FileName to a value that + would result in a duplicate entry in the ZipFile, an exception is + thrown. + + + + When a ZipEntry is contained within a ZipFile, applications + cannot rename the entry within the context of a foreach (For + Each in VB) loop, because of the way the ZipFile stores + entries. If you need to enumerate through all the entries and rename one + or more of them, use ZipFile.EntriesSorted as the + collection. See also, ZipFile.GetEnumerator(). + + + + + + + The stream that provides content for the ZipEntry. + + + + + + The application can use this property to set the input stream for an + entry on a just-in-time basis. Imagine a scenario where the application + creates a ZipFile comprised of content obtained from hundreds of + files, via calls to AddFile(). The DotNetZip library opens streams + on these files on a just-in-time basis, only when writing the entry out to + an external store within the scope of a ZipFile.Save() call. Only + one input stream is opened at a time, as each entry is being written out. + + + + Now imagine a different application that creates a ZipFile + with content obtained from hundreds of streams, added through . Normally the + application would supply an open stream to that call. But when large + numbers of streams are being added, this can mean many open streams at one + time, unnecessarily. + + + + To avoid this, call and specify delegates that open and close the stream at + the time of Save. + + + + + Setting the value of this property when the entry was not added from a + stream (for example, when the ZipEntry was added with or , or when the entry was added by + reading an existing zip archive) will throw an exception. + + + + + + + + A flag indicating whether the InputStream was provided Just-in-time. + + + + + + When creating a zip archive, an application can obtain content for one or + more of the ZipEntry instances from streams, using the method. At the time + of calling that method, the application can supply null as the value of + the stream parameter. By doing so, the application indicates to the + library that it will provide a stream for the entry on a just-in-time + basis, at the time one of the ZipFile.Save() methods is called and + the data for the various entries are being compressed and written out. + + + + In this case, the application can set the + property, typically within the SaveProgress event (event type: ) for that entry. + + + + The application will later want to call Close() and Dispose() on that + stream. In the SaveProgress event, when the event type is , the application can + do so. This flag indicates that the stream has been provided by the + application on a just-in-time basis and that it is the application's + responsibility to call Close/Dispose on that stream. + + + + + + + + An enum indicating the source of the ZipEntry. + + + + + The version of the zip engine needed to read the ZipEntry. + + + + + This is a readonly property, indicating the version of the Zip + specification that the extracting tool or library must support to + extract the given entry. Generally higher versions indicate newer + features. Older zip engines obviously won't know about new features, and + won't be able to extract entries that depend on those newer features. + + + + + value + Features + + + + 20 + a basic Zip Entry, potentially using PKZIP encryption. + + + + + 45 + The ZIP64 extension is used on the entry. + + + + + 46 + File is compressed using BZIP2 compression* + + + + 50 + File is encrypted using PkWare's DES, 3DES, (broken) RC2 or RC4 + + + + 51 + File is encrypted using PKWare's AES encryption or corrected RC2 encryption. + + + + 52 + File is encrypted using corrected RC2-64 encryption** + + + + 61 + File is encrypted using non-OAEP key wrapping*** + + + + 63 + File is compressed using LZMA, PPMd+, Blowfish, or Twofish + + + + + + There are other values possible, not listed here. DotNetZip supports + regular PKZip encryption, and ZIP64 extensions. DotNetZip cannot extract + entries that require a zip engine higher than 45. + + + + This value is set upon reading an existing zip file, or after saving a zip + archive. + + + + + + The comment attached to the ZipEntry. + + + + + Each entry in a zip file can optionally have a comment associated to + it. The comment might be displayed by a zip tool during extraction, for + example. + + + + By default, the Comment is encoded in IBM437 code page. You can + specify an alternative with and + . + + + + + + + + Indicates whether the entry requires ZIP64 extensions. + + + + + + This property is null (Nothing in VB) until a Save() method on the + containing instance has been called. The property is + non-null (HasValue is true) only after a Save() method has + been called. + + + + After the containing ZipFile has been saved, the Value of this + property is true if any of the following three conditions holds: the + uncompressed size of the entry is larger than 0xFFFFFFFF; the compressed + size of the entry is larger than 0xFFFFFFFF; the relative offset of the + entry within the zip archive is larger than 0xFFFFFFFF. These quantities + are not known until a Save() is attempted on the zip archive and + the compression is applied. + + + + If none of the three conditions holds, then the Value is false. + + + + A Value of false does not indicate that the entry, as saved in the + zip archive, does not use ZIP64. It merely indicates that ZIP64 is + not required. An entry may use ZIP64 even when not required if + the property on the containing + ZipFile instance is set to , or if + the property on the containing + ZipFile instance is set to + and the output stream was not seekable. + + + + + + + + Indicates whether the entry actually used ZIP64 extensions, as it was most + recently written to the output file or stream. + + + + + + This Nullable property is null (Nothing in VB) until a Save() + method on the containing instance has been + called. HasValue is true only after a Save() method has been + called. + + + + The value of this property for a particular ZipEntry may change + over successive calls to Save() methods on the containing ZipFile, + even if the file that corresponds to the ZipEntry does not. This + may happen if other entries contained in the ZipFile expand, + causing the offset for this particular entry to exceed 0xFFFFFFFF. + + + + + + + The bitfield for the entry as defined in the zip spec. You probably + never need to look at this. + + + + + You probably do not need to concern yourself with the contents of this + property, but in case you do: + + + + + bit + meaning + + + + 0 + set if encryption is used. + + + + 1-2 + + set to determine whether normal, max, fast deflation. DotNetZip library + always leaves these bits unset when writing (indicating "normal" + deflation"), but can read an entry with any value here. + + + + + 3 + + Indicates that the Crc32, Compressed and Uncompressed sizes are zero in the + local header. This bit gets set on an entry during writing a zip file, when + it is saved to a non-seekable output stream. + + + + + + 4 + reserved for "enhanced deflating". This library doesn't do enhanced deflating. + + + + 5 + set to indicate the zip is compressed patched data. This library doesn't do that. + + + + 6 + + set if PKWare's strong encryption is used (must also set bit 1 if bit 6 is + set). This bit is not set if WinZip's AES encryption is set. + + + + 7 + not used + + + + 8 + not used + + + + 9 + not used + + + + 10 + not used + + + + 11 + + Language encoding flag (EFS). If this bit is set, the filename and comment + fields for this file must be encoded using UTF-8. This library currently + does not support UTF-8. + + + + + 12 + Reserved by PKWARE for enhanced compression. + + + + 13 + + Used when encrypting the Central Directory to indicate selected data + values in the Local Header are masked to hide their actual values. See + the section in the Zip + specification describing the Strong Encryption Specification for + details. + + + + + 14 + Reserved by PKWARE. + + + + 15 + Reserved by PKWARE. + + + + + + + + + The compression method employed for this ZipEntry. + + + + + + The + Zip specification allows a variety of compression methods. This + library supports just two: 0x08 = Deflate. 0x00 = Store (no compression), + for reading or writing. + + + + When reading an entry from an existing zipfile, the value you retrieve + here indicates the compression method used on the entry by the original + creator of the zip. When writing a zipfile, you can specify either 0x08 + (Deflate) or 0x00 (None). If you try setting something else, you will get + an exception. + + + + You may wish to set CompressionMethod to CompressionMethod.None (0) + when zipping already-compressed data like a jpg, png, or mp3 file. + This can save time and cpu cycles. + + + + When setting this property on a ZipEntry that is read from an + existing zip file, calling ZipFile.Save() will cause the new + CompressionMethod to be used on the entry in the newly saved zip file. + + + + Setting this property may have the side effect of modifying the + CompressionLevel property. If you set the CompressionMethod to a + value other than None, and CompressionLevel is previously + set to None, then CompressionLevel will be set to + Default. + + + + + + + In this example, the first entry added to the zip archive uses the default + behavior - compression is used where it makes sense. The second entry, + the MP3 file, is added to the archive without being compressed. + + using (ZipFile zip = new ZipFile(ZipFileToCreate)) + { + ZipEntry e1= zip.AddFile(@"notes\Readme.txt"); + ZipEntry e2= zip.AddFile(@"music\StopThisTrain.mp3"); + e2.CompressionMethod = CompressionMethod.None; + zip.Save(); + } + + + + Using zip As New ZipFile(ZipFileToCreate) + zip.AddFile("notes\Readme.txt") + Dim e2 as ZipEntry = zip.AddFile("music\StopThisTrain.mp3") + e2.CompressionMethod = CompressionMethod.None + zip.Save + End Using + + + + + + Sets the compression level to be used for the entry when saving the zip + archive. This applies only for CompressionMethod = DEFLATE. + + + + + When using the DEFLATE compression method, Varying the compression + level used on entries can affect the size-vs-speed tradeoff when + compression and decompressing data streams or files. + + + + If you do not set this property, the default compression level is used, + which normally gives a good balance of compression efficiency and + compression speed. In some tests, using BestCompression can + double the time it takes to compress, while delivering just a small + increase in compression efficiency. This behavior will vary with the + type of data you compress. If you are in doubt, just leave this setting + alone, and accept the default. + + + + When setting this property on a ZipEntry that is read from an + existing zip file, calling ZipFile.Save() will cause the new + CompressionLevel to be used on the entry in the newly saved zip file. + + + + Setting this property may have the side effect of modifying the + CompressionMethod property. If you set the CompressionLevel + to a value other than None, CompressionMethod will be set + to Deflate, if it was previously None. + + + + Setting this property has no effect if the CompressionMethod is something + other than Deflate or None. + + + + + + + + The compressed size of the file, in bytes, within the zip archive. + + + + When reading a ZipFile, this value is read in from the existing + zip file. When creating or updating a ZipFile, the compressed + size is computed during compression. Therefore the value on a + ZipEntry is valid after a call to Save() (or one of its + overloads) in that case. + + + + + + + The size of the file, in bytes, before compression, or after extraction. + + + + When reading a ZipFile, this value is read in from the existing + zip file. When creating or updating a ZipFile, the uncompressed + size is computed during compression. Therefore the value on a + ZipEntry is valid after a call to Save() (or one of its + overloads) in that case. + + + + + + + The ratio of compressed size to uncompressed size of the ZipEntry. + + + + + This is a ratio of the compressed size to the uncompressed size of the + entry, expressed as a double in the range of 0 to 100+. A value of 100 + indicates no compression at all. It could be higher than 100 when the + compression algorithm actually inflates the data, as may occur for small + files, or uncompressible data that is encrypted. + + + + You could format it for presentation to a user via a format string of + "{3,5:F0}%" to see it as a percentage. + + + + If the size of the original uncompressed file is 0, implying a + denominator of 0, the return value will be zero. + + + + This property is valid after reading in an existing zip file, or after + saving the ZipFile that contains the ZipEntry. You cannot know the + effect of a compression transform until you try it. + + + + + + + The 32-bit CRC (Cyclic Redundancy Check) on the contents of the ZipEntry. + + + + + You probably don't need to concern yourself with this. It is used + internally by DotNetZip to verify files or streams upon extraction. + + The value is a 32-bit + CRC using 0xEDB88320 for the polynomial. This is the same CRC-32 used in + PNG, MPEG-2, and other protocols and formats. It is a read-only property; when + creating a Zip archive, the CRC for each entry is set only after a call to + Save() on the containing ZipFile. When reading an existing zip file, the value + of this property reflects the stored CRC for the entry. + + + + + + True if the entry is a directory (not a file). + This is a readonly property on the entry. + + + + + A derived property that is true if the entry uses encryption. + + + + + This is a readonly property on the entry. When reading a zip file, + the value for the ZipEntry is determined by the data read + from the zip file. After saving a ZipFile, the value of this + property for each ZipEntry indicates whether encryption was + actually used (which will have been true if the was set and the property + was something other than . + + + + + + Set this to specify which encryption algorithm to use for the entry when + saving it to a zip archive. + + + + + + Set this property in order to encrypt the entry when the ZipFile is + saved. When setting this property, you must also set a on the entry. If you set a value other than on this property and do not set a + Password then the entry will not be encrypted. The ZipEntry + data is encrypted as the ZipFile is saved, when you call or one of its cousins on the containing + ZipFile instance. You do not need to specify the Encryption + when extracting entries from an archive. + + + + The Zip specification from PKWare defines a set of encryption algorithms, + and the data formats for the zip archive that support them, and PKWare + supports those algorithms in the tools it produces. Other vendors of tools + and libraries, such as WinZip or Xceed, typically support a + subset of the algorithms specified by PKWare. These tools can + sometimes support additional different encryption algorithms and data + formats, not specified by PKWare. The AES Encryption specified and + supported by WinZip is the most popular example. This library supports a + subset of the complete set of algorithms specified by PKWare and other + vendors. + + + + There is no common, ubiquitous multi-vendor standard for strong encryption + within zip files. There is broad support for so-called "traditional" Zip + encryption, sometimes called Zip 2.0 encryption, as specified + by PKWare, but this encryption is considered weak and + breakable. This library currently supports the Zip 2.0 "weak" encryption, + and also a stronger WinZip-compatible AES encryption, using either 128-bit + or 256-bit key strength. If you want DotNetZip to support an algorithm + that is not currently supported, call the author of this library and maybe + we can talk business. + + + + The class also has a property. In most cases you will use + that property when setting encryption. This property takes + precedence over any Encryption set on the ZipFile itself. + Typically, you would use the per-entry Encryption when most entries in the + zip archive use one encryption algorithm, and a few entries use a + different one. If all entries in the zip file use the same Encryption, + then it is simpler to just set this property on the ZipFile itself, when + creating a zip archive. + + + + Some comments on updating archives: If you read a ZipFile, you can + modify the Encryption on an encrypted entry: you can remove encryption + from an entry that was encrypted; you can encrypt an entry that was not + encrypted previously; or, you can change the encryption algorithm. The + changes in encryption are not made permanent until you call Save() on the + ZipFile. To effect changes in encryption, the entry content is + streamed through several transformations, depending on the modification + the application has requested. For example if the entry is not encrypted + and the application sets Encryption to PkzipWeak, then at + the time of Save(), the original entry is read and decompressed, + then re-compressed and encrypted. Conversely, if the original entry is + encrypted with PkzipWeak encryption, and the application sets the + Encryption property to WinZipAes128, then at the time of + Save(), the original entry is decrypted via PKZIP encryption and + decompressed, then re-compressed and re-encrypted with AES. This all + happens automatically within the library, but it can be time-consuming for + large entries. + + + + Additionally, when updating archives, it is not possible to change the + password when changing the encryption algorithm. To change both the + algorithm and the password, you need to Save() the zipfile twice. First + set the Encryption to None, then call Save(). Then set the + Encryption to the new value (not "None"), then call Save() + once again. + + + + The WinZip AES encryption algorithms are not supported on the .NET Compact + Framework. + + + + + + This example creates a zip archive that uses encryption, and then extracts + entries from the archive. When creating the zip archive, the ReadMe.txt + file is zipped without using a password or encryption. The other file + uses encryption. + + + // Create a zip archive with AES Encryption. + using (ZipFile zip = new ZipFile()) + { + zip.AddFile("ReadMe.txt") + ZipEntry e1= zip.AddFile("2008-Regional-Sales-Report.pdf"); + e1.Encryption= EncryptionAlgorithm.WinZipAes256; + e1.Password= "Top.Secret.No.Peeking!"; + zip.Save("EncryptedArchive.zip"); + } + + // Extract a zip archive that uses AES Encryption. + // You do not need to specify the algorithm during extraction. + using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip")) + { + // Specify the password that is used during extraction, for + // all entries that require a password: + zip.Password= "Top.Secret.No.Peeking!"; + zip.ExtractAll("extractDirectory"); + } + + + + ' Create a zip that uses Encryption. + Using zip As New ZipFile() + zip.AddFile("ReadMe.txt") + Dim e1 as ZipEntry + e1= zip.AddFile("2008-Regional-Sales-Report.pdf") + e1.Encryption= EncryptionAlgorithm.WinZipAes256 + e1.Password= "Top.Secret.No.Peeking!" + zip.Save("EncryptedArchive.zip") + End Using + + ' Extract a zip archive that uses AES Encryption. + ' You do not need to specify the algorithm during extraction. + Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip")) + ' Specify the password that is used during extraction, for + ' all entries that require a password: + zip.Password= "Top.Secret.No.Peeking!" + zip.ExtractAll("extractDirectory") + End Using + + + + + + Thrown in the setter if EncryptionAlgorithm.Unsupported is specified. + + + ZipEntry.Password + ZipFile.Encryption + + + + The Password to be used when encrypting a ZipEntry upon + ZipFile.Save(), or when decrypting an entry upon Extract(). + + + + + This is a write-only property on the entry. Set this to request that the + entry be encrypted when writing the zip archive, or set it to specify the + password to be used when extracting an existing entry that is encrypted. + + + + The password set here is implicitly used to encrypt the entry during the + operation, or to decrypt during the or operation. If you set + the Password on a ZipEntry after calling Save(), there is no + effect. + + + + Consider setting the property when using a + password. Answering concerns that the standard password protection + supported by all zip tools is weak, WinZip has extended the ZIP + specification with a way to use AES Encryption to protect entries in the + Zip file. Unlike the "PKZIP 2.0" encryption specified in the PKZIP + specification, AES + Encryption uses a standard, strong, tested, encryption + algorithm. DotNetZip can create zip archives that use WinZip-compatible + AES encryption, if you set the property. But, + archives created that use AES encryption may not be readable by all other + tools and libraries. For example, Windows Explorer cannot read a + "compressed folder" (a zip file) that uses AES encryption, though it can + read a zip file that uses "PKZIP encryption." + + + + The class also has a + property. This property takes precedence over any password set on the + ZipFile itself. Typically, you would use the per-entry Password when most + entries in the zip archive use one password, and a few entries use a + different password. If all entries in the zip file use the same password, + then it is simpler to just set this property on the ZipFile itself, + whether creating a zip archive or extracting a zip archive. + + + + Some comments on updating archives: If you read a ZipFile, you + cannot modify the password on any encrypted entry, except by extracting + the entry with the original password (if any), removing the original entry + via , and then adding a new + entry with a new Password. + + + + For example, suppose you read a ZipFile, and there is an encrypted + entry. Setting the Password property on that ZipEntry and then + calling Save() on the ZipFile does not update the password + on that entry in the archive. Neither is an exception thrown. Instead, + what happens during the Save() is the existing entry is copied + through to the new zip archive, in its original encrypted form. Upon + re-reading that archive, the entry can be decrypted with its original + password. + + + + If you read a ZipFile, and there is an un-encrypted entry, you can set the + Password on the entry and then call Save() on the ZipFile, and get + encryption on that entry. + + + + + + + This example creates a zip file with two entries, and then extracts the + entries from the zip file. When creating the zip file, the two files are + added to the zip file using password protection. Each entry uses a + different password. During extraction, each file is extracted with the + appropriate password. + + + // create a file with encryption + using (ZipFile zip = new ZipFile()) + { + ZipEntry entry; + entry= zip.AddFile("Declaration.txt"); + entry.Password= "123456!"; + entry = zip.AddFile("Report.xls"); + entry.Password= "1Secret!"; + zip.Save("EncryptedArchive.zip"); + } + + // extract entries that use encryption + using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip")) + { + ZipEntry entry; + entry = zip["Declaration.txt"]; + entry.Password = "123456!"; + entry.Extract("extractDir"); + entry = zip["Report.xls"]; + entry.Password = "1Secret!"; + entry.Extract("extractDir"); + } + + + + + Using zip As New ZipFile + Dim entry as ZipEntry + entry= zip.AddFile("Declaration.txt") + entry.Password= "123456!" + entry = zip.AddFile("Report.xls") + entry.Password= "1Secret!" + zip.Save("EncryptedArchive.zip") + End Using + + + ' extract entries that use encryption + Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip")) + Dim entry as ZipEntry + entry = zip("Declaration.txt") + entry.Password = "123456!" + entry.Extract("extractDir") + entry = zip("Report.xls") + entry.Password = "1Secret!" + entry.Extract("extractDir") + End Using + + + + + + + ZipFile.Password + + + + The action the library should take when extracting a file that already exists. + + + + + This property affects the behavior of the Extract methods (one of the + Extract() or ExtractWithPassword() overloads), when + extraction would would overwrite an existing filesystem file. If you do + not set this property, the library throws an exception when extracting + an entry would overwrite an existing file. + + + + This property has no effect when extracting to a stream, or when the file to be + extracted does not already exist. + + + + + + + This example shows how to set the ExtractExistingFile property in + an ExtractProgress event, in response to user input. The + ExtractProgress event is invoked if and only if the + ExtractExistingFile property was previously set to + ExtractExistingFileAction.InvokeExtractProgressEvent. + + public static void ExtractProgress(object sender, ExtractProgressEventArgs e) + { + if (e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry) + Console.WriteLine("extract {0} ", e.CurrentEntry.FileName); + + else if (e.EventType == ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite) + { + ZipEntry entry = e.CurrentEntry; + string response = null; + // Ask the user if he wants overwrite the file + do + { + Console.Write("Overwrite {0} in {1} ? (y/n/C) ", entry.FileName, e.ExtractLocation); + response = Console.ReadLine(); + Console.WriteLine(); + + } while (response != null && response[0]!='Y' && + response[0]!='N' && response[0]!='C'); + + if (response[0]=='C') + e.Cancel = true; + else if (response[0]=='Y') + entry.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently; + else + entry.ExtractExistingFile= ExtractExistingFileAction.DoNotOverwrite; + } + } + + + + + + The action to take when an error is encountered while + opening or reading files as they are saved into a zip archive. + + + + + Errors can occur within a call to ZipFile.Save, as the various files contained + in a ZipFile are being saved into the zip archive. During the + Save, DotNetZip will perform a File.Open on the file + associated to the ZipEntry, and then will read the entire contents of + the file as it is zipped. Either the open or the Read may fail, because + of lock conflicts or other reasons. Using this property, you can + specify the action to take when such errors occur. + + + + Typically you will NOT set this property on individual ZipEntry + instances. Instead, you will set the ZipFile.ZipErrorAction property on + the ZipFile instance, before adding any entries to the + ZipFile. If you do this, errors encountered on behalf of any of + the entries in the ZipFile will be handled the same way. + + + + But, if you use a handler, you will want + to set this property on the ZipEntry within the handler, to + communicate back to DotNetZip what you would like to do with the + particular error. + + + + + + + + + Indicates whether the entry was included in the most recent save. + + + An entry can be excluded or skipped from a save if there is an error + opening or reading the entry. + + + + + + A callback that allows the application to specify the compression to use + for a given entry that is about to be added to the zip archive. + + + + + See + + + + + + Set to indicate whether to use UTF-8 encoding for filenames and comments. + + + + + + If this flag is set, the comment and filename for the entry will be + encoded with UTF-8, as described in the Zip + specification, if necessary. "Necessary" means, the filename or + entry comment (if any) cannot be reflexively encoded and decoded using the + default code page, IBM437. + + + + Setting this flag to true is equivalent to setting to System.Text.Encoding.UTF8. + + + + This flag has no effect or relation to the text encoding used within the + file itself. + + + + + + + The text encoding to use for the FileName and Comment on this ZipEntry, + when the default encoding is insufficient. + + + + + + Don't use this property. See . + + + + + + + Specifies the alternate text encoding used by this ZipEntry + + + + The default text encoding used in Zip files for encoding filenames and + comments is IBM437, which is something like a superset of ASCII. In + cases where this is insufficient, applications can specify an + alternate encoding. + + + When creating a zip file, the usage of the alternate encoding is + governed by the property. + Typically you would set both properties to tell DotNetZip to employ an + encoding that is not IBM437 in the zipfile you are creating. + + + Keep in mind that because the ZIP specification states that the only + valid encodings to use are IBM437 and UTF-8, if you use something + other than that, then zip tools and libraries may not be able to + successfully read the zip archive you generate. + + + The zip specification states that applications should presume that + IBM437 is in use, except when a special bit is set, which indicates + UTF-8. There is no way to specify an arbitrary code page, within the + zip file itself. When you create a zip file encoded with gb2312 or + ibm861 or anything other than IBM437 or UTF-8, then the application + that reads the zip file needs to "know" which code page to use. In + some cases, the code page used when reading is chosen implicitly. For + example, WinRar uses the ambient code page for the host desktop + operating system. The pitfall here is that if you create a zip in + Copenhagen and send it to Tokyo, the reader of the zipfile may not be + able to decode successfully. + + + + This example shows how to create a zipfile encoded with a + language-specific encoding: + + using (var zip = new ZipFile()) + { + zip.AlternateEnoding = System.Text.Encoding.GetEncoding("ibm861"); + zip.AlternateEnodingUsage = ZipOption.Always; + zip.AddFileS(arrayOfFiles); + zip.Save("Myarchive-Encoded-in-IBM861.zip"); + } + + + + + + + Describes if and when this instance should apply + AlternateEncoding to encode the FileName and Comment, when + saving. + + + + + + Indicates whether an entry is marked as a text file. Be careful when + using on this property. Unless you have a good reason, you should + probably ignore this property. + + + + + The ZIP format includes a provision for specifying whether an entry in + the zip archive is a text or binary file. This property exposes that + metadata item. Be careful when using this property: It's not clear + that this property as a firm meaning, across tools and libraries. + + + + To be clear, when reading a zip file, the property value may or may + not be set, and its value may or may not be valid. Not all entries + that you may think of as "text" entries will be so marked, and entries + marked as "text" are not guaranteed in any way to be text entries. + Whether the value is set and set correctly depends entirely on the + application that produced the zip file. + + + + There are many zip tools available, and when creating zip files, some + of them "respect" the IsText metadata field, and some of them do not. + Unfortunately, even when an application tries to do "the right thing", + it's not always clear what "the right thing" is. + + + + There's no firm definition of just what it means to be "a text file", + and the zip specification does not help in this regard. Twenty years + ago, text was ASCII, each byte was less than 127. IsText meant, all + bytes in the file were less than 127. These days, it is not the case + that all text files have all bytes less than 127. Any unicode file + may have bytes that are above 0x7f. The zip specification has nothing + to say on this topic. Therefore, it's not clear what IsText really + means. + + + + This property merely tells a reading application what is stored in the + metadata for an entry, without guaranteeing its validity or its + meaning. + + + + When DotNetZip is used to create a zipfile, it attempts to set this + field "correctly." For example, if a file ends in ".txt", this field + will be set. Your application may override that default setting. When + writing a zip file, you must set the property before calling + Save() on the ZipFile. + + + + When reading a zip file, a more general way to decide just what kind + of file is contained in a particular entry is to use the file type + database stored in the operating system. The operating system stores + a table that says, a file with .jpg extension is a JPG image file, a + file with a .xml extension is an XML document, a file with a .txt is a + pure ASCII text document, and so on. To get this information on + Windows, you + need to read and parse the registry. + + + + + using (var zip = new ZipFile()) + { + var e = zip.UpdateFile("Descriptions.mme", ""); + e.IsText = true; + zip.Save(zipPath); + } + + + + Using zip As New ZipFile + Dim e2 as ZipEntry = zip.AddFile("Descriptions.mme", "") + e.IsText= True + zip.Save(zipPath) + End Using + + + + + Provides a string representation of the instance. + a string representation of the instance. + + + + Extract the entry to the filesystem, starting at the current + working directory. + + + + This method has a bunch of overloads! One of them is sure to + be the right one for you... If you don't like these, check + out the ExtractWithPassword() methods. + + + + + + + + + This method extracts an entry from a zip file into the current + working directory. The path of the entry as extracted is the full + path as specified in the zip archive, relative to the current + working directory. After the file is extracted successfully, the + file attributes and timestamps are set. + + + + The action taken when extraction an entry would overwrite an + existing file is determined by the property. + + + + Within the call to Extract(), the content for the entry is + written into a filesystem file, and then the last modified time of the + file is set according to the property on + the entry. See the remarks the property for + some details about the last modified time. + + + + + + + Extract the entry to a file in the filesystem, using the specified + behavior when extraction would overwrite an existing file. + + + + + See the remarks on the property, for some + details about how the last modified time of the file is set after + extraction. + + + + + The action to take if extraction would overwrite an existing file. + + + + + Extracts the entry to the specified stream. + + + + + The caller can specify any write-able stream, for example a , a , or ASP.NET's + Response.OutputStream. The content will be decrypted and + decompressed as necessary. If the entry is encrypted and no password + is provided, this method will throw. + + + The position on the stream is not reset by this method before it extracts. + You may want to call stream.Seek() before calling ZipEntry.Extract(). + + + + + the stream to which the entry should be extracted. + + + + + + Extract the entry to the filesystem, starting at the specified base + directory. + + + the pathname of the base directory + + + + + + This example extracts only the entries in a zip file that are .txt files, + into a directory called "textfiles". + + using (ZipFile zip = ZipFile.Read("PackedDocuments.zip")) + { + foreach (string s1 in zip.EntryFilenames) + { + if (s1.EndsWith(".txt")) + { + zip[s1].Extract("textfiles"); + } + } + } + + + Using zip As ZipFile = ZipFile.Read("PackedDocuments.zip") + Dim s1 As String + For Each s1 In zip.EntryFilenames + If s1.EndsWith(".txt") Then + zip(s1).Extract("textfiles") + End If + Next + End Using + + + + + + + Using this method, existing entries in the filesystem will not be + overwritten. If you would like to force the overwrite of existing + files, see the property, or call + . + + + + See the remarks on the property, for some + details about how the last modified time of the created file is set. + + + + + + Extract the entry to the filesystem, starting at the specified base + directory, and using the specified behavior when extraction would + overwrite an existing file. + + + + + See the remarks on the property, for some + details about how the last modified time of the created file is set. + + + + + + String sZipPath = "Airborne.zip"; + String sFilePath = "Readme.txt"; + String sRootFolder = "Digado"; + using (ZipFile zip = ZipFile.Read(sZipPath)) + { + if (zip.EntryFileNames.Contains(sFilePath)) + { + // use the string indexer on the zip file + zip[sFileName].Extract(sRootFolder, + ExtractExistingFileAction.OverwriteSilently); + } + } + + + + Dim sZipPath as String = "Airborne.zip" + Dim sFilePath As String = "Readme.txt" + Dim sRootFolder As String = "Digado" + Using zip As ZipFile = ZipFile.Read(sZipPath) + If zip.EntryFileNames.Contains(sFilePath) + ' use the string indexer on the zip file + zip(sFilePath).Extract(sRootFolder, _ + ExtractExistingFileAction.OverwriteSilently) + End If + End Using + + + + the pathname of the base directory + + The action to take if extraction would overwrite an existing file. + + + + + Extract the entry to the filesystem, using the current working directory + and the specified password. + + + + This method has a bunch of overloads! One of them is sure to be + the right one for you... + + + + + + + + + Existing entries in the filesystem will not be overwritten. If you + would like to force the overwrite of existing files, see the property, or call + . + + + + See the remarks on the property for some + details about how the "last modified" time of the created file is + set. + + + + + In this example, entries that use encryption are extracted using a + particular password. + + using (var zip = ZipFile.Read(FilePath)) + { + foreach (ZipEntry e in zip) + { + if (e.UsesEncryption) + e.ExtractWithPassword("Secret!"); + else + e.Extract(); + } + } + + + Using zip As ZipFile = ZipFile.Read(FilePath) + Dim e As ZipEntry + For Each e In zip + If (e.UsesEncryption) + e.ExtractWithPassword("Secret!") + Else + e.Extract + End If + Next + End Using + + + The Password to use for decrypting the entry. + + + + Extract the entry to the filesystem, starting at the specified base + directory, and using the specified password. + + + + + + + + Existing entries in the filesystem will not be overwritten. If you + would like to force the overwrite of existing files, see the property, or call + . + + + + See the remarks on the property, for some + details about how the last modified time of the created file is set. + + + + The pathname of the base directory. + The Password to use for decrypting the entry. + + + + Extract the entry to a file in the filesystem, relative to the + current directory, using the specified behavior when extraction + would overwrite an existing file. + + + + + See the remarks on the property, for some + details about how the last modified time of the created file is set. + + + + The Password to use for decrypting the entry. + + + The action to take if extraction would overwrite an existing file. + + + + + Extract the entry to the filesystem, starting at the specified base + directory, and using the specified behavior when extraction would + overwrite an existing file. + + + + See the remarks on the property, for some + details about how the last modified time of the created file is set. + + + the pathname of the base directory + + The action to take if extraction would + overwrite an existing file. + + The Password to use for decrypting the entry. + + + + Extracts the entry to the specified stream, using the specified + Password. For example, the caller could extract to Console.Out, or + to a MemoryStream. + + + + + The caller can specify any write-able stream, for example a , a , or ASP.NET's + Response.OutputStream. The content will be decrypted and + decompressed as necessary. If the entry is encrypted and no password + is provided, this method will throw. + + + The position on the stream is not reset by this method before it extracts. + You may want to call stream.Seek() before calling ZipEntry.Extract(). + + + + + + the stream to which the entry should be extracted. + + + The password to use for decrypting the entry. + + + + + Opens a readable stream corresponding to the zip entry in the + archive. The stream decompresses and decrypts as necessary, as it + is read. + + + + + + DotNetZip offers a variety of ways to extract entries from a zip + file. This method allows an application to extract an entry by + reading a . + + + + The return value is of type . Use it as you would any + stream for reading. When an application calls on that stream, it will + receive data from the zip entry that is decrypted and decompressed + as necessary. + + + + CrcCalculatorStream adds one additional feature: it keeps a + CRC32 checksum on the bytes of the stream as it is read. The CRC + value is available in the property on the + CrcCalculatorStream. When the read is complete, your + application + should check this CRC against the + property on the ZipEntry to validate the content of the + ZipEntry. You don't have to validate the entry using the CRC, but + you should, to verify integrity. Check the example for how to do + this. + + + + If the entry is protected with a password, then you need to provide + a password prior to calling , either by + setting the property on the entry, or the + property on the ZipFile + itself. Or, you can use , the + overload of OpenReader that accepts a password parameter. + + + + If you want to extract entry data into a write-able stream that is + already opened, like a , do not + use this method. Instead, use . + + + + Your application may use only one stream created by OpenReader() at + a time, and you should not call other Extract methods before + completing your reads on a stream obtained from OpenReader(). This + is because there is really only one source stream for the compressed + content. A call to OpenReader() seeks in the source stream, to the + beginning of the compressed content. A subsequent call to + OpenReader() on a different entry will seek to a different position + in the source stream, as will a call to Extract() or one of its + overloads. This will corrupt the state for the decompressing stream + from the original call to OpenReader(). + + + + The OpenReader() method works only when the ZipEntry is + obtained from an instance of ZipFile. This method will throw + an exception if the ZipEntry is obtained from a . + + + + + This example shows how to open a zip archive, then read in a named + entry via a stream. After the read loop is complete, the code + compares the calculated during the read loop with the expected CRC + on the ZipEntry, to verify the extraction. + + using (ZipFile zip = new ZipFile(ZipFileToRead)) + { + ZipEntry e1= zip["Elevation.mp3"]; + using (Ionic.Zlib.CrcCalculatorStream s = e1.OpenReader()) + { + byte[] buffer = new byte[4096]; + int n, totalBytesRead= 0; + do { + n = s.Read(buffer,0, buffer.Length); + totalBytesRead+=n; + } while (n>0); + if (s.Crc32 != e1.Crc32) + throw new Exception(string.Format("The Zip Entry failed the CRC Check. (0x{0:X8}!=0x{1:X8})", s.Crc32, e1.Crc32)); + if (totalBytesRead != e1.UncompressedSize) + throw new Exception(string.Format("We read an unexpected number of bytes. ({0}!={1})", totalBytesRead, e1.UncompressedSize)); + } + } + + + Using zip As New ZipFile(ZipFileToRead) + Dim e1 As ZipEntry = zip.Item("Elevation.mp3") + Using s As Ionic.Zlib.CrcCalculatorStream = e1.OpenReader + Dim n As Integer + Dim buffer As Byte() = New Byte(4096) {} + Dim totalBytesRead As Integer = 0 + Do + n = s.Read(buffer, 0, buffer.Length) + totalBytesRead = (totalBytesRead + n) + Loop While (n > 0) + If (s.Crc32 <> e1.Crc32) Then + Throw New Exception(String.Format("The Zip Entry failed the CRC Check. (0x{0:X8}!=0x{1:X8})", s.Crc32, e1.Crc32)) + End If + If (totalBytesRead <> e1.UncompressedSize) Then + Throw New Exception(String.Format("We read an unexpected number of bytes. ({0}!={1})", totalBytesRead, e1.UncompressedSize)) + End If + End Using + End Using + + + + The Stream for reading. + + + + Opens a readable stream for an encrypted zip entry in the archive. + The stream decompresses and decrypts as necessary, as it is read. + + + + + See the documentation on the method for + full details. This overload allows the application to specify a + password for the ZipEntry to be read. + + + + The password to use for decrypting the entry. + The Stream for reading. + + + + Pass in either basedir or s, but not both. + In other words, you can extract to a stream or to a directory (filesystem), but not both! + The Password param is required for encrypted entries. + + + + + Extract to a stream + In other words, you can extract to a stream or to a directory (filesystem), but not both! + The Password param is required for encrypted entries. + + + + + Validates that the args are consistent; returning whether the caller can return + because it's done, or not (caller should continue) + + + + + Validates that the args are consistent; returning whether the caller can return + because it's done, or not (caller should continue) + + + + + Reads one ZipEntry from the given stream. The content for + the entry does not get decompressed or decrypted. This method + basically reads metadata, and seeks. + + the ZipContainer this entry belongs to. + + true of this is the first entry being read from the stream. + + the ZipEntry read from the stream. + + + + Finds a particular segment in the given extra field. + This is used when modifying a previously-generated + extra field, in particular when removing the AES crypto + segment in the extra field. + + + + + At current cursor position in the stream, read the extra + field, and set the properties on the ZipEntry instance + appropriately. This can be called when processing the + Extra field in the Central Directory, or in the local + header. + + + + + generate and return a byte array that encodes the filename + for the entry. + + + + side effects: generate and store into _CommentBytes the + byte array for any comment attached to the entry. Also + sets _actualEncoding to indicate the actual encoding + used. The same encoding is used for both filename and + comment. + + + + + + Stores the position of the entry source stream, or, if the position is + already stored, seeks to that position. + + + + + This method is called in prep for reading the source stream. If PKZIP + encryption is used, then we need to calc the CRC32 before doing the + encryption, because the CRC is used in the 12th byte of the PKZIP + encryption header. So, we need to be able to seek backward in the source + when saving the ZipEntry. This method is called from the place that + calculates the CRC, and also from the method that does the encryption of + the file data. + + + + The first time through, this method sets the _sourceStreamOriginalPosition + field. Subsequent calls to this method seek to that position. + + + + + + Copy metadata that may have been changed by the app. We do this when + resetting the zipFile instance. If the app calls Save() on a ZipFile, then + tries to party on that file some more, we may need to Reset() it , which + means re-reading the entries and then copying the metadata. I think. + + + + + Set the input stream and get its length, if possible. The length is + used for progress updates, AND, to allow an optimization in case of + a stream/file of zero length. In that case we skip the Encrypt and + compression Stream. (like DeflateStream or BZip2OutputStream) + + + + + Prepare the given stream for output - wrap it in a CountingStream, and + then in a CRC stream, and an encryptor and deflator as appropriate. + + + + Previously this was used in ZipEntry.Write(), but in an effort to + introduce some efficiencies in that method I've refactored to put the + code inline. This method still gets called by ZipOutputStream. + + + + + + An enum that specifies the type of timestamp available on the ZipEntry. + + + + + + The last modified time of a file can be stored in multiple ways in + a zip file, and they are not mutually exclusive: + + + + + In the so-called "DOS" format, which has a 2-second precision. Values + are rounded to the nearest even second. For example, if the time on the + file is 12:34:43, then it will be stored as 12:34:44. This first value + is accessible via the LastModified property. This value is always + present in the metadata for each zip entry. In some cases the value is + invalid, or zero. + + + + In the so-called "Windows" or "NTFS" format, as an 8-byte integer + quantity expressed as the number of 1/10 milliseconds (in other words + the number of 100 nanosecond units) since January 1, 1601 (UTC). This + format is how Windows represents file times. This time is accessible + via the ModifiedTime property. + + + + In the "Unix" format, a 4-byte quantity specifying the number of seconds since + January 1, 1970 UTC. + + + + In an older format, now deprecated but still used by some current + tools. This format is also a 4-byte quantity specifying the number of + seconds since January 1, 1970 UTC. + + + + + + This bit field describes which of the formats were found in a ZipEntry that was read. + + + + + + + Default value. + + + + + A DOS timestamp with 2-second precision. + + + + + A Windows timestamp with 100-ns precision. + + + + + A Unix timestamp with 1-second precision. + + + + + A Unix timestamp with 1-second precision, stored in InfoZip v1 format. This + format is outdated and is supported for reading archives only. + + + + + The method of compression to use for a particular ZipEntry. + + + + PKWare's + ZIP Specification describes a number of distinct + cmopression methods that can be used within a zip + file. DotNetZip supports a subset of them. + + + + + No compression at all. For COM environments, the value is 0 (zero). + + + + + DEFLATE compression, as described in IETF RFC + 1951. This is the "normal" compression used in zip + files. For COM environments, the value is 8. + + + + + BZip2 compression, a compression algorithm developed by Julian Seward. + For COM environments, the value is 12. + + + + + An enum that specifies the source of the ZipEntry. + + + + + Default value. Invalid on a bonafide ZipEntry. + + + + + The entry was instantiated by calling AddFile() or another method that + added an entry from the filesystem. + + + + + The entry was instantiated via or + . + + + + + The ZipEntry was instantiated by reading a zipfile. + + + + + The content for the ZipEntry will be or was provided by the WriteDelegate. + + + + + The content for the ZipEntry will be obtained from the stream dispensed by the OpenDelegate. + The entry was instantiated via . + + + + + The content for the ZipEntry will be or was obtained from a ZipOutputStream. + + + + + An enum providing the options when an error occurs during opening or reading + of a file or directory that is being saved to a zip file. + + + + + This enum describes the actions that the library can take when an error occurs + opening or reading a file, as it is being saved into a Zip archive. + + + + In some cases an error will occur when DotNetZip tries to open a file to be + added to the zip archive. In other cases, an error might occur after the + file has been successfully opened, while DotNetZip is reading the file. + + + + The first problem might occur when calling AddDirectory() on a directory + that contains a Clipper .dbf file; the file is locked by Clipper and + cannot be opened by another process. An example of the second problem is + the ERROR_LOCK_VIOLATION that results when a file is opened by another + process, but not locked, and a range lock has been taken on the file. + Microsoft Outlook takes range locks on .PST files. + + + + + + Throw an exception when an error occurs while zipping. This is the default + behavior. (For COM clients, this is a 0 (zero).) + + + + + When an error occurs during zipping, for example a file cannot be opened, + skip the file causing the error, and continue zipping. (For COM clients, + this is a 1.) + + + + + When an error occurs during zipping, for example a file cannot be opened, + retry the operation that caused the error. Be careful with this option. If + the error is not temporary, the library will retry forever. (For COM + clients, this is a 2.) + + + + + When an error occurs, invoke the zipError event. The event type used is + . A typical use of this option: + a GUI application may wish to pop up a dialog to allow the user to view the + error that occurred, and choose an appropriate action. After your + processing in the error event, if you want to skip the file, set on the + ZipProgressEventArgs.CurrentEntry to Skip. If you want the + exception to be thrown, set ZipErrorAction on the CurrentEntry + to Throw. If you want to cancel the zip, set + ZipProgressEventArgs.Cancel to true. Cancelling differs from using + Skip in that a cancel will not save any further entries, if there are any. + (For COM clients, the value of this enum is a 3.) + + + + + Options for using ZIP64 extensions when saving zip archives. + + + + + + Designed many years ago, the original zip + specification from PKWARE allowed for 32-bit quantities for the + compressed and uncompressed sizes of zip entries, as well as a 32-bit quantity + for specifying the length of the zip archive itself, and a maximum of 65535 + entries. These limits are now regularly exceeded in many backup and archival + scenarios. Recently, PKWare added extensions to the original zip spec, called + "ZIP64 extensions", to raise those limitations. This property governs whether + DotNetZip will use those extensions when writing zip archives. The use of + these extensions is optional and explicit in DotNetZip because, despite the + status of ZIP64 as a bona fide standard, many other zip tools and libraries do + not support ZIP64, and therefore a zip file with ZIP64 extensions may be + unreadable by some of those other tools. + + + + Set this property to to always use ZIP64 + extensions when saving, regardless of whether your zip archive needs it. + Suppose you add 5 files, each under 100k, to a ZipFile. If you specify Always + for this flag, you will get a ZIP64 archive, though the archive does not need + to use ZIP64 because none of the original zip limits had been exceeded. + + + + Set this property to to tell the DotNetZip + library to never use ZIP64 extensions. This is useful for maximum + compatibility and interoperability, at the expense of the capability of + handling large files or large archives. NB: Windows Explorer in Windows XP + and Windows Vista cannot currently extract files from a zip64 archive, so if + you want to guarantee that a zip archive produced by this library will work in + Windows Explorer, use Never. If you set this property to , and your application creates a zip that would + exceed one of the Zip limits, the library will throw an exception while saving + the zip file. + + + + Set this property to to tell the + DotNetZip library to use the ZIP64 extensions when required by the + entry. After the file is compressed, the original and compressed sizes are + checked, and if they exceed the limits described above, then zip64 can be + used. That is the general idea, but there is an additional wrinkle when saving + to a non-seekable device, like the ASP.NET Response.OutputStream, or + Console.Out. When using non-seekable streams for output, the entry + header - which indicates whether zip64 is in use - is emitted before it is + known if zip64 is necessary. It is only after all entries have been saved + that it can be known if ZIP64 will be required. On seekable output streams, + after saving all entries, the library can seek backward and re-emit the zip + file header to be consistent with the actual ZIP64 requirement. But using a + non-seekable output stream, the library cannot seek backward, so the header + can never be changed. In other words, the archive's use of ZIP64 extensions is + not alterable after the header is emitted. Therefore, when saving to + non-seekable streams, using is the same + as using : it will always produce a zip + archive that uses ZIP64 extensions. + + + + + + + The default behavior, which is "Never". + (For COM clients, this is a 0 (zero).) + + + + + Do not use ZIP64 extensions when writing zip archives. + (For COM clients, this is a 0 (zero).) + + + + + Use ZIP64 extensions when writing zip archives, as necessary. + For example, when a single entry exceeds 0xFFFFFFFF in size, or when the archive as a whole + exceeds 0xFFFFFFFF in size, or when there are more than 65535 entries in an archive. + (For COM clients, this is a 1.) + + + + + Always use ZIP64 extensions when writing zip archives, even when unnecessary. + (For COM clients, this is a 2.) + + + + + An enum representing the values on a three-way toggle switch + for various options in the library. This might be used to + specify whether to employ a particular text encoding, or to use + ZIP64 extensions, or some other option. + + + + + The default behavior. This is the same as "Never". + (For COM clients, this is a 0 (zero).) + + + + + Never use the associated option. + (For COM clients, this is a 0 (zero).) + + + + + Use the associated behavior "as necessary." + (For COM clients, this is a 1.) + + + + + Use the associated behavior Always, whether necessary or not. + (For COM clients, this is a 2.) + + + + + A class for collecting the various options that can be used when + Reading zip files for extraction or update. + + + + + When reading a zip file, there are several options an + application can set, to modify how the file is read, or what + the library does while reading. This class collects those + options into one container. + + + + Pass an instance of the ReadOptions class into the + ZipFile.Read() method. + + + . + . + + + + + An event handler for Read operations. When opening large zip + archives, you may want to display a progress bar or other + indicator of status progress while reading. This parameter + allows you to specify a ReadProgress Event Handler directly. + When you call Read(), the progress event is invoked as + necessary. + + + + + The System.IO.TextWriter to use for writing verbose status messages + during operations on the zip archive. A console application may wish to + pass System.Console.Out to get messages on the Console. A graphical + or headless application may wish to capture the messages in a different + TextWriter, such as a System.IO.StringWriter. + + + + + The System.Text.Encoding to use when reading in the zip archive. Be + careful specifying the encoding. If the value you use here is not the same + as the Encoding used when the zip archive was created (possibly by a + different archiver) you will get unexpected results and possibly exceptions. + + + + + + + + Provides a stream metaphor for reading zip files. + + + + + This class provides an alternative programming model for reading zip files to + the one enabled by the class. Use this when reading zip + files, as an alternative to the class, when you would + like to use a Stream class to read the file. + + + + Some application designs require a readable stream for input. This stream can + be used to read a zip file, and extract entries. + + + + Both the ZipInputStream class and the ZipFile class can be used + to read and extract zip files. Both of them support many of the common zip + features, including Unicode, different compression levels, and ZIP64. The + programming models differ. For example, when extracting entries via calls to + the GetNextEntry() and Read() methods on the + ZipInputStream class, the caller is responsible for creating the file, + writing the bytes into the file, setting the attributes on the file, and + setting the created, last modified, and last accessed timestamps on the + file. All of these things are done automatically by a call to ZipEntry.Extract(). For this reason, the + ZipInputStream is generally recommended for when your application wants + to extract the data, without storing that data into a file. + + + + Aside from the obvious differences in programming model, there are some + differences in capability between the ZipFile class and the + ZipInputStream class. + + + + + ZipFile can be used to create or update zip files, or read and + extract zip files. ZipInputStream can be used only to read and + extract zip files. If you want to use a stream to create zip files, check + out the . + + + + ZipInputStream cannot read segmented or spanned + zip files. + + + + ZipInputStream will not read Zip file comments. + + + + When reading larger files, ZipInputStream will always underperform + ZipFile. This is because the ZipInputStream does a full scan on the + zip file, while the ZipFile class reads the central directory of the + zip file. + + + + + + + + + Create a ZipInputStream, wrapping it around an existing stream. + + + + + + While the class is generally easier + to use, this class provides an alternative to those + applications that want to read from a zipfile directly, + using a . + + + + Both the ZipInputStream class and the ZipFile class can be used + to read and extract zip files. Both of them support many of the common zip + features, including Unicode, different compression levels, and ZIP64. The + programming models differ. For example, when extracting entries via calls to + the GetNextEntry() and Read() methods on the + ZipInputStream class, the caller is responsible for creating the file, + writing the bytes into the file, setting the attributes on the file, and + setting the created, last modified, and last accessed timestamps on the + file. All of these things are done automatically by a call to ZipEntry.Extract(). For this reason, the + ZipInputStream is generally recommended for when your application wants + to extract the data, without storing that data into a file. + + + + Aside from the obvious differences in programming model, there are some + differences in capability between the ZipFile class and the + ZipInputStream class. + + + + + ZipFile can be used to create or update zip files, or read and extract + zip files. ZipInputStream can be used only to read and extract zip + files. If you want to use a stream to create zip files, check out the . + + + + ZipInputStream cannot read segmented or spanned + zip files. + + + + ZipInputStream will not read Zip file comments. + + + + When reading larger files, ZipInputStream will always underperform + ZipFile. This is because the ZipInputStream does a full scan on the + zip file, while the ZipFile class reads the central directory of the + zip file. + + + + + + + + The stream to read. It must be readable. This stream will be closed at + the time the ZipInputStream is closed. + + + + + This example shows how to read a zip file, and extract entries, using the + ZipInputStream class. + + + private void Unzip() + { + byte[] buffer= new byte[2048]; + int n; + using (var raw = File.Open(inputFileName, FileMode.Open, FileAccess.Read)) + { + using (var input= new ZipInputStream(raw)) + { + ZipEntry e; + while (( e = input.GetNextEntry()) != null) + { + if (e.IsDirectory) continue; + string outputPath = Path.Combine(extractDir, e.FileName); + using (var output = File.Open(outputPath, FileMode.Create, FileAccess.ReadWrite)) + { + while ((n= input.Read(buffer, 0, buffer.Length)) > 0) + { + output.Write(buffer,0,n); + } + } + } + } + } + } + + + + Private Sub UnZip() + Dim inputFileName As String = "MyArchive.zip" + Dim extractDir As String = "extract" + Dim buffer As Byte() = New Byte(2048) {} + Using raw As FileStream = File.Open(inputFileName, FileMode.Open, FileAccess.Read) + Using input As ZipInputStream = New ZipInputStream(raw) + Dim e As ZipEntry + Do While (Not e = input.GetNextEntry Is Nothing) + If Not e.IsDirectory Then + Using output As FileStream = File.Open(Path.Combine(extractDir, e.FileName), _ + FileMode.Create, FileAccess.ReadWrite) + Dim n As Integer + Do While (n = input.Read(buffer, 0, buffer.Length) > 0) + output.Write(buffer, 0, n) + Loop + End Using + End If + Loop + End Using + End Using + End Sub + + + + + + Create a ZipInputStream, given the name of an existing zip file. + + + + + + This constructor opens a FileStream for the given zipfile, and + wraps a ZipInputStream around that. See the documentation for the + constructor for full details. + + + + While the class is generally easier + to use, this class provides an alternative to those + applications that want to read from a zipfile directly, + using a . + + + + + + The name of the filesystem file to read. + + + + + This example shows how to read a zip file, and extract entries, using the + ZipInputStream class. + + + private void Unzip() + { + byte[] buffer= new byte[2048]; + int n; + using (var input= new ZipInputStream(inputFileName)) + { + ZipEntry e; + while (( e = input.GetNextEntry()) != null) + { + if (e.IsDirectory) continue; + string outputPath = Path.Combine(extractDir, e.FileName); + using (var output = File.Open(outputPath, FileMode.Create, FileAccess.ReadWrite)) + { + while ((n= input.Read(buffer, 0, buffer.Length)) > 0) + { + output.Write(buffer,0,n); + } + } + } + } + } + + + + Private Sub UnZip() + Dim inputFileName As String = "MyArchive.zip" + Dim extractDir As String = "extract" + Dim buffer As Byte() = New Byte(2048) {} + Using input As ZipInputStream = New ZipInputStream(inputFileName) + Dim e As ZipEntry + Do While (Not e = input.GetNextEntry Is Nothing) + If Not e.IsDirectory Then + Using output As FileStream = File.Open(Path.Combine(extractDir, e.FileName), _ + FileMode.Create, FileAccess.ReadWrite) + Dim n As Integer + Do While (n = input.Read(buffer, 0, buffer.Length) > 0) + output.Write(buffer, 0, n) + Loop + End Using + End If + Loop + End Using + End Sub + + + + + + Create a ZipInputStream, explicitly specifying whether to + keep the underlying stream open. + + + + See the documentation for the ZipInputStream(Stream) + constructor for a discussion of the class, and an example of how to use the class. + + + + The stream to read from. It must be readable. + + + + true if the application would like the stream + to remain open after the ZipInputStream has been closed. + + + + Provides a string representation of the instance. + + + This can be useful for debugging purposes. + + + a string representation of the instance. + + + + The text encoding to use when reading entries into the zip archive, for + those entries whose filenames or comments cannot be encoded with the + default (IBM437) encoding. + + + + + In its + zip specification, PKWare describes two options for encoding + filenames and comments: using IBM437 or UTF-8. But, some archiving tools + or libraries do not follow the specification, and instead encode + characters using the system default code page. For example, WinRAR when + run on a machine in Shanghai may encode filenames with the Big-5 Chinese + (950) code page. This behavior is contrary to the Zip specification, but + it occurs anyway. + + + + When using DotNetZip to read zip archives that use something other than + UTF-8 or IBM437, set this property to specify the code page to use when + reading encoded filenames and comments for each ZipEntry in the zip + file. + + + + This property is "provisional". When the entry in the zip archive is not + explicitly marked as using UTF-8, then IBM437 is used to decode filenames + and comments. If a loss of data would result from using IBM436 - + specifically when encoding and decoding is not reflexive - the codepage + specified here is used. It is possible, therefore, to have a given entry + with a Comment encoded in IBM437 and a FileName encoded with + the specified "provisional" codepage. + + + + When a zip file uses an arbitrary, non-UTF8 code page for encoding, there + is no standard way for the reader application - whether DotNetZip, WinZip, + WinRar, or something else - to know which codepage has been used for the + entries. Readers of zip files are not able to inspect the zip file and + determine the codepage that was used for the entries contained within it. + It is left to the application or user to determine the necessary codepage + when reading zip files encoded this way. If you use an incorrect codepage + when reading a zipfile, you will get entries with filenames that are + incorrect, and the incorrect filenames may even contain characters that + are not legal for use within filenames in Windows. Extracting entries with + illegal characters in the filenames will lead to exceptions. It's too bad, + but this is just the way things are with code pages in zip files. Caveat + Emptor. + + + + + + + Size of the work buffer to use for the ZLIB codec during decompression. + + + + Setting this affects the performance and memory efficiency of compression + and decompression. For larger files, setting this to a larger size may + improve performance, but the exact numbers vary depending on available + memory, and a bunch of other variables. I don't have good firm + recommendations on how to set it. You'll have to test it yourself. Or + just leave it alone and accept the default. + + + + + Sets the password to be used on the ZipInputStream instance. + + + + + + When reading a zip archive, this password is used to read and decrypt the + entries that are encrypted within the zip file. When entries within a zip + file use different passwords, set the appropriate password for the entry + before the first call to Read() for each entry. + + + + When reading an entry that is not encrypted, the value of this property is + ignored. + + + + + + + This example uses the ZipInputStream to read and extract entries from a + zip file, using a potentially different password for each entry. + + + byte[] buffer= new byte[2048]; + int n; + using (var raw = File.Open(_inputFileName, FileMode.Open, FileAccess.Read )) + { + using (var input= new ZipInputStream(raw)) + { + ZipEntry e; + while (( e = input.GetNextEntry()) != null) + { + input.Password = PasswordForEntry(e.FileName); + if (e.IsDirectory) continue; + string outputPath = Path.Combine(_extractDir, e.FileName); + using (var output = File.Open(outputPath, FileMode.Create, FileAccess.ReadWrite)) + { + while ((n= input.Read(buffer,0,buffer.Length)) > 0) + { + output.Write(buffer,0,n); + } + } + } + } + } + + + + + + + Read the data from the stream into the buffer. + + + + + The data for the zipentry will be decrypted and uncompressed, as + necessary, before being copied into the buffer. + + + + You must set the property before calling + Read() the first time for an encrypted entry. To determine if an + entry is encrypted and requires a password, check the ZipEntry.Encryption property. + + + + The buffer to hold the data read from the stream. + the offset within the buffer to copy the first byte read. + the number of bytes to read. + the number of bytes read, after decryption and decompression. + + + + Read the next entry from the zip file. + + + + + Call this method just before calling , + to position the pointer in the zip file to the next entry that can be + read. Subsequent calls to Read(), will decrypt and decompress the + data in the zip file, until Read() returns 0. + + + + Each time you call GetNextEntry(), the pointer in the wrapped + stream is moved to the next entry in the zip file. If you call , and thus re-position the pointer within + the file, you will need to call GetNextEntry() again, to insure + that the file pointer is positioned at the beginning of a zip entry. + + + + This method returns the ZipEntry. Using a stream approach, you will + read the raw bytes for an entry in a zip file via calls to Read(). + Alternatively, you can extract an entry into a file, or a stream, by + calling , or one of its siblings. + + + + + + The ZipEntry read. Returns null (or Nothing in VB) if there are no more + entries in the zip file. + + + + + + Dispose the stream. + + + + + This method disposes the ZipInputStream. It may also close the + underlying stream, depending on which constructor was used. + + + + Typically the application will call Dispose() implicitly, via + a using statement in C#, or a Using statement in VB. + + + + Application code won't call this code directly. This method may + be invoked in two distinct scenarios. If disposing == true, the + method has been called directly or indirectly by a user's code, + for example via the public Dispose() method. In this case, both + managed and unmanaged resources can be referenced and disposed. + If disposing == false, the method has been called by the runtime + from inside the object finalizer and this method should not + reference other objects; in that case only unmanaged resources + must be referenced or disposed. + + + + + true if the Dispose method was invoked by user code. + + + + + Always returns true. + + + + + Returns the value of CanSeek for the underlying (wrapped) stream. + + + + + Always returns false. + + + + + Returns the length of the underlying stream. + + + + + Gets or sets the position of the underlying stream. + + + Setting the position is equivalent to calling Seek(value, SeekOrigin.Begin). + + + + + This is a no-op. + + + + + This method always throws a NotSupportedException. + + ignored + ignored + ignored + + + + This method seeks in the underlying stream. + + + + + Call this method if you want to seek around within the zip file for random access. + + + + Applications can intermix calls to Seek() with calls to . After a call to Seek(), + GetNextEntry() will get the next ZipEntry that falls after + the current position in the input stream. You're on your own for finding + out just where to seek in the stream, to get to the various entries. + + + + + the offset point to seek to + the reference point from which to seek + The new position + + + + This method always throws a NotSupportedException. + + ignored + + + + Provides a stream metaphor for generating zip files. + + + + + This class writes zip files, as defined in the specification + for zip files described by PKWare. The compression for this + implementation is provided by a managed-code version of Zlib, included with + DotNetZip in the classes in the Ionic.Zlib namespace. + + + + This class provides an alternative programming model to the one enabled by the + class. Use this when creating zip files, as an + alternative to the class, when you would like to use a + Stream type to write the zip file. + + + + Both the ZipOutputStream class and the ZipFile class can be used + to create zip files. Both of them support many of the common zip features, + including Unicode, different compression levels, and ZIP64. They provide + very similar performance when creating zip files. + + + + The ZipFile class is generally easier to use than + ZipOutputStream and should be considered a higher-level interface. For + example, when creating a zip file via calls to the PutNextEntry() and + Write() methods on the ZipOutputStream class, the caller is + responsible for opening the file, reading the bytes from the file, writing + those bytes into the ZipOutputStream, setting the attributes on the + ZipEntry, and setting the created, last modified, and last accessed + timestamps on the zip entry. All of these things are done automatically by a + call to ZipFile.AddFile(). + For this reason, the ZipOutputStream is generally recommended for use + only when your application emits arbitrary data, not necessarily data from a + filesystem file, directly into a zip file, and does so using a Stream + metaphor. + + + + Aside from the differences in programming model, there are other + differences in capability between the two classes. + + + + + ZipFile can be used to read and extract zip files, in addition to + creating zip files. ZipOutputStream cannot read zip files. If you want + to use a stream to read zip files, check out the class. + + + + ZipOutputStream does not support the creation of segmented or spanned + zip files. + + + + ZipOutputStream cannot produce a self-extracting archive. + + + + + Be aware that the ZipOutputStream class implements the interface. In order for + ZipOutputStream to produce a valid zip file, you use use it within + a using clause (Using in VB), or call the Dispose() method + explicitly. See the examples for how to employ a using clause. + + + + Also, a note regarding compression performance: On the desktop .NET + Framework, DotNetZip can use a multi-threaded compression implementation + that provides significant speed increases on large files, over 300k or so, + at the cost of increased memory use at runtime. (The output of the + compression is almost exactly the same size). But, the multi-threaded + approach incurs a performance hit on smaller files. There's no way for the + ZipOutputStream to know whether parallel compression will be beneficial, + because the ZipOutputStream does not know how much data you will write + through the stream. You may wish to set the property to zero, if you are compressing + large files through ZipOutputStream. This will cause parallel + compression to be used, always. + + + + + + Create a ZipOutputStream, wrapping an existing stream. + + + + + The class is generally easier to use when creating + zip files. The ZipOutputStream offers a different metaphor for creating a + zip file, based on the class. + + + + + + The stream to wrap. It must be writable. This stream will be closed at + the time the ZipOutputStream is closed. + + + + + This example shows how to create a zip file, using the + ZipOutputStream class. + + + private void Zipup() + { + if (filesToZip.Count == 0) + { + System.Console.WriteLine("Nothing to do."); + return; + } + + using (var raw = File.Open(_outputFileName, FileMode.Create, FileAccess.ReadWrite )) + { + using (var output= new ZipOutputStream(raw)) + { + output.Password = "VerySecret!"; + output.Encryption = EncryptionAlgorithm.WinZipAes256; + + foreach (string inputFileName in filesToZip) + { + System.Console.WriteLine("file: {0}", inputFileName); + + output.PutNextEntry(inputFileName); + using (var input = File.Open(inputFileName, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Write )) + { + byte[] buffer= new byte[2048]; + int n; + while ((n= input.Read(buffer,0,buffer.Length)) > 0) + { + output.Write(buffer,0,n); + } + } + } + } + } + } + + + + Private Sub Zipup() + Dim outputFileName As String = "XmlData.zip" + Dim filesToZip As String() = Directory.GetFiles(".", "*.xml") + If (filesToZip.Length = 0) Then + Console.WriteLine("Nothing to do.") + Else + Using raw As FileStream = File.Open(outputFileName, FileMode.Create, FileAccess.ReadWrite) + Using output As ZipOutputStream = New ZipOutputStream(raw) + output.Password = "VerySecret!" + output.Encryption = EncryptionAlgorithm.WinZipAes256 + Dim inputFileName As String + For Each inputFileName In filesToZip + Console.WriteLine("file: {0}", inputFileName) + output.PutNextEntry(inputFileName) + Using input As FileStream = File.Open(inputFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite) + Dim n As Integer + Dim buffer As Byte() = New Byte(2048) {} + Do While (n = input.Read(buffer, 0, buffer.Length) > 0) + output.Write(buffer, 0, n) + Loop + End Using + Next + End Using + End Using + End If + End Sub + + + + + + Create a ZipOutputStream that writes to a filesystem file. + + + + The class is generally easier to use when creating + zip files. The ZipOutputStream offers a different metaphor for creating a + zip file, based on the class. + + + + The name of the zip file to create. + + + + + This example shows how to create a zip file, using the + ZipOutputStream class. + + + private void Zipup() + { + if (filesToZip.Count == 0) + { + System.Console.WriteLine("Nothing to do."); + return; + } + + using (var output= new ZipOutputStream(outputFileName)) + { + output.Password = "VerySecret!"; + output.Encryption = EncryptionAlgorithm.WinZipAes256; + + foreach (string inputFileName in filesToZip) + { + System.Console.WriteLine("file: {0}", inputFileName); + + output.PutNextEntry(inputFileName); + using (var input = File.Open(inputFileName, FileMode.Open, FileAccess.Read, + FileShare.Read | FileShare.Write )) + { + byte[] buffer= new byte[2048]; + int n; + while ((n= input.Read(buffer,0,buffer.Length)) > 0) + { + output.Write(buffer,0,n); + } + } + } + } + } + + + + Private Sub Zipup() + Dim outputFileName As String = "XmlData.zip" + Dim filesToZip As String() = Directory.GetFiles(".", "*.xml") + If (filesToZip.Length = 0) Then + Console.WriteLine("Nothing to do.") + Else + Using output As ZipOutputStream = New ZipOutputStream(outputFileName) + output.Password = "VerySecret!" + output.Encryption = EncryptionAlgorithm.WinZipAes256 + Dim inputFileName As String + For Each inputFileName In filesToZip + Console.WriteLine("file: {0}", inputFileName) + output.PutNextEntry(inputFileName) + Using input As FileStream = File.Open(inputFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite) + Dim n As Integer + Dim buffer As Byte() = New Byte(2048) {} + Do While (n = input.Read(buffer, 0, buffer.Length) > 0) + output.Write(buffer, 0, n) + Loop + End Using + Next + End Using + End If + End Sub + + + + + + Create a ZipOutputStream. + + + + See the documentation for the ZipOutputStream(Stream) + constructor for an example. + + + + The stream to wrap. It must be writable. + + + + true if the application would like the stream + to remain open after the ZipOutputStream has been closed. + + + + Provides a string representation of the instance. + + + This can be useful for debugging purposes. + + + a string representation of the instance. + + + + Sets the password to be used on the ZipOutputStream instance. + + + + + + When writing a zip archive, this password is applied to the entries, not + to the zip archive itself. It applies to any ZipEntry subsequently + written to the ZipOutputStream. + + + + Using a password does not encrypt or protect the "directory" of the + archive - the list of entries contained in the archive. If you set the + Password property, the password actually applies to individual + entries that are added to the archive, subsequent to the setting of this + property. The list of filenames in the archive that is eventually created + will appear in clear text, but the contents of the individual files are + encrypted. This is how Zip encryption works. + + + + If you set this property, and then add a set of entries to the archive via + calls to PutNextEntry, then each entry is encrypted with that + password. You may also want to change the password between adding + different entries. If you set the password, add an entry, then set the + password to null (Nothing in VB), and add another entry, the + first entry is encrypted and the second is not. + + + + When setting the Password, you may also want to explicitly set the property, to specify how to encrypt the entries added + to the ZipFile. If you set the Password to a non-null value and do not + set , then PKZip 2.0 ("Weak") encryption is used. + This encryption is relatively weak but is very interoperable. If + you set the password to a null value (Nothing in VB), + Encryption is reset to None. + + + + Special case: if you wrap a ZipOutputStream around a non-seekable stream, + and use encryption, and emit an entry of zero bytes, the Close() or + PutNextEntry() following the entry will throw an exception. + + + + + + + The Encryption to use for entries added to the ZipOutputStream. + + + + + The specified Encryption is applied to the entries subsequently + written to the ZipOutputStream instance. + + + + If you set this to something other than + EncryptionAlgorithm.None, you will also need to set the + to a non-null, non-empty value in + order to actually get encryption on the entry. + + + + + ZipOutputStream.Password + ZipEntry.Encryption + + + + Size of the work buffer to use for the ZLIB codec during compression. + + + + Setting this may affect performance. For larger files, setting this to a + larger size may improve performance, but I'm not sure. Sorry, I don't + currently have good recommendations on how to set it. You can test it if + you like. + + + + + The compression strategy to use for all entries. + + + + Set the Strategy used by the ZLIB-compatible compressor, when compressing + data for the entries in the zip archive. Different compression strategies + work better on different sorts of data. The strategy parameter can affect + the compression ratio and the speed of compression but not the correctness + of the compresssion. For more information see . + + + + + The type of timestamp attached to the ZipEntry. + + + + Set this in order to specify the kind of timestamp that should be emitted + into the zip file for each entry. + + + + + Sets the compression level to be used for entries subsequently added to + the zip archive. + + + + + Varying the compression level used on entries can affect the + size-vs-speed tradeoff when compression and decompressing data streams + or files. + + + + As with some other properties on the ZipOutputStream class, like , and , + setting this property on a ZipOutputStream + instance will cause the specified CompressionLevel to be used on all + items that are subsequently added to the + ZipOutputStream instance. + + + + If you do not set this property, the default compression level is used, + which normally gives a good balance of compression efficiency and + compression speed. In some tests, using BestCompression can + double the time it takes to compress, while delivering just a small + increase in compression efficiency. This behavior will vary with the + type of data you compress. If you are in doubt, just leave this setting + alone, and accept the default. + + + + + + The compression method used on each entry added to the ZipOutputStream. + + + + + A comment attached to the zip archive. + + + + + + The application sets this property to specify a comment to be embedded + into the generated zip archive. + + + + According to PKWARE's + zip specification, the comment is not encrypted, even if there is a + password set on the zip file. + + + + The specification does not describe how to indicate the encoding used + on a comment string. Many "compliant" zip tools and libraries use + IBM437 as the code page for comments; DotNetZip, too, follows that + practice. On the other hand, there are situations where you want a + Comment to be encoded with something else, for example using code page + 950 "Big-5 Chinese". To fill that need, DotNetZip will encode the + comment following the same procedure it follows for encoding + filenames: (a) if is + Never, it uses the default encoding (IBM437). (b) if is Always, it always uses the + alternate encoding (). (c) if is AsNecessary, it uses the + alternate encoding only if the default encoding is not sufficient for + encoding the comment - in other words if decoding the result does not + produce the original string. This decision is taken at the time of + the call to ZipFile.Save(). + + + + + + + Specify whether to use ZIP64 extensions when saving a zip archive. + + + + + The default value for the property is . is + safest, in the sense that you will not get an Exception if a + pre-ZIP64 limit is exceeded. + + + + You must set this property before calling Write(). + + + + + + + Indicates whether ZIP64 extensions were used when saving the zip archive. + + + + The value is defined only after the ZipOutputStream has been closed. + + + + + Whether the ZipOutputStream should use case-insensitive comparisons when + checking for uniqueness of zip entries. + + + + + Though the zip specification doesn't prohibit zipfiles with duplicate + entries, Sane zip files have no duplicates, and the DotNetZip library + cannot create zip files with duplicate entries. If an application attempts + to call with a name that duplicates one + already used within the archive, the library will throw an Exception. + + + This property allows the application to specify whether the + ZipOutputStream instance considers ordinal case when checking for + uniqueness of zip entries. + + + + + + Indicates whether to encode entry filenames and entry comments using + Unicode (UTF-8). + + + + + The + PKWare zip specification provides for encoding file names and file + comments in either the IBM437 code page, or in UTF-8. This flag selects + the encoding according to that specification. By default, this flag is + false, and filenames and comments are encoded into the zip file in the + IBM437 codepage. Setting this flag to true will specify that filenames + and comments that cannot be encoded with IBM437 will be encoded with + UTF-8. + + + + Zip files created with strict adherence to the PKWare specification with + respect to UTF-8 encoding can contain entries with filenames containing + any combination of Unicode characters, including the full range of + characters from Chinese, Latin, Hebrew, Greek, Cyrillic, and many other + alphabets. However, because at this time, the UTF-8 portion of the PKWare + specification is not broadly supported by other zip libraries and + utilities, such zip files may not be readable by your favorite zip tool or + archiver. In other words, interoperability will decrease if you set this + flag to true. + + + + In particular, Zip files created with strict adherence to the PKWare + specification with respect to UTF-8 encoding will not work well with + Explorer in Windows XP or Windows Vista, because Windows compressed + folders, as far as I know, do not support UTF-8 in zip files. Vista can + read the zip files, but shows the filenames incorrectly. Unpacking from + Windows Vista Explorer will result in filenames that have rubbish + characters in place of the high-order UTF-8 bytes. + + + + Also, zip files that use UTF-8 encoding will not work well with Java + applications that use the java.util.zip classes, as of v5.0 of the Java + runtime. The Java runtime does not correctly implement the PKWare + specification in this regard. + + + + As a result, we have the unfortunate situation that "correct" behavior by + the DotNetZip library with regard to Unicode encoding of filenames during + zip creation will result in zip files that are readable by strictly + compliant and current tools (for example the most recent release of the + commercial WinZip tool); but these zip files will not be readable by + various other tools or libraries, including Windows Explorer. + + + + The DotNetZip library can read and write zip files with UTF8-encoded + entries, according to the PKware spec. If you use DotNetZip for both + creating and reading the zip file, and you use UTF-8, there will be no + loss of information in the filenames. For example, using a self-extractor + created by this library will allow you to unpack files correctly with no + loss of information in the filenames. + + + + If you do not set this flag, it will remain false. If this flag is false, + the ZipOutputStream will encode all filenames and comments using + the IBM437 codepage. This can cause "loss of information" on some + filenames, but the resulting zipfile will be more interoperable with other + utilities. As an example of the loss of information, diacritics can be + lost. The o-tilde character will be down-coded to plain o. The c with a + cedilla (Unicode 0xE7) used in Portugese will be downcoded to a c. + Likewise, the O-stroke character (Unicode 248), used in Danish and + Norwegian, will be down-coded to plain o. Chinese characters cannot be + represented in codepage IBM437; when using the default encoding, Chinese + characters in filenames will be represented as ?. These are all examples + of "information loss". + + + + The loss of information associated to the use of the IBM437 encoding is + inconvenient, and can also lead to runtime errors. For example, using + IBM437, any sequence of 4 Chinese characters will be encoded as ????. If + your application creates a ZipOutputStream, does not set the + encoding, then adds two files, each with names of four Chinese characters + each, this will result in a duplicate filename exception. In the case + where you add a single file with a name containing four Chinese + characters, the zipfile will save properly, but extracting that file + later, with any zip tool, will result in an error, because the question + mark is not legal for use within filenames on Windows. These are just a + few examples of the problems associated to loss of information. + + + + This flag is independent of the encoding of the content within the entries + in the zip file. Think of the zip file as a container - it supports an + encoding. Within the container are other "containers" - the file entries + themselves. The encoding within those entries is independent of the + encoding of the zip archive container for those entries. + + + + Rather than specify the encoding in a binary fashion using this flag, an + application can specify an arbitrary encoding via the property. Setting the encoding + explicitly when creating zip archives will result in non-compliant zip + files that, curiously, are fairly interoperable. The challenge is, the + PKWare specification does not provide for a way to specify that an entry + in a zip archive uses a code page that is neither IBM437 nor UTF-8. + Therefore if you set the encoding explicitly when creating a zip archive, + you must take care upon reading the zip archive to use the same code page. + If you get it wrong, the behavior is undefined and may result in incorrect + filenames, exceptions, stomach upset, hair loss, and acne. + + + + + + + The text encoding to use when emitting entries into the zip archive, for + those entries whose filenames or comments cannot be encoded with the + default (IBM437) encoding. + + + + + In its + zip specification, PKWare describes two options for encoding + filenames and comments: using IBM437 or UTF-8. But, some archiving tools + or libraries do not follow the specification, and instead encode + characters using the system default code page. For example, WinRAR when + run on a machine in Shanghai may encode filenames with the Big-5 Chinese + (950) code page. This behavior is contrary to the Zip specification, but + it occurs anyway. + + + + When using DotNetZip to write zip archives that will be read by one of + these other archivers, set this property to specify the code page to use + when encoding the and for each ZipEntry in the zip file, for + values that cannot be encoded with the default codepage for zip files, + IBM437. This is why this property is "provisional". In all cases, IBM437 + is used where possible, in other words, where no loss of data would + result. It is possible, therefore, to have a given entry with a + Comment encoded in IBM437 and a FileName encoded with the + specified "provisional" codepage. + + + + Be aware that a zip file created after you've explicitly set the + ProvisionalAlternateEncoding property to a value other than + IBM437 may not be compliant to the PKWare specification, and may not be + readable by compliant archivers. On the other hand, many (most?) + archivers are non-compliant and can read zip files created in arbitrary + code pages. The trick is to use or specify the proper codepage when + reading the zip. + + + + When creating a zip archive using this library, it is possible to change + the value of ProvisionalAlternateEncoding between each entry you + add, and between adding entries and the call to Close(). Don't do + this. It will likely result in a zipfile that is not readable. For best + interoperability, either leave ProvisionalAlternateEncoding + alone, or specify it only once, before adding any entries to the + ZipOutputStream instance. There is one exception to this + recommendation, described later. + + + + When using an arbitrary, non-UTF8 code page for encoding, there is no + standard way for the creator application - whether DotNetZip, WinZip, + WinRar, or something else - to formally specify in the zip file which + codepage has been used for the entries. As a result, readers of zip files + are not able to inspect the zip file and determine the codepage that was + used for the entries contained within it. It is left to the application + or user to determine the necessary codepage when reading zip files encoded + this way. If you use an incorrect codepage when reading a zipfile, you + will get entries with filenames that are incorrect, and the incorrect + filenames may even contain characters that are not legal for use within + filenames in Windows. Extracting entries with illegal characters in the + filenames will lead to exceptions. It's too bad, but this is just the way + things are with code pages in zip files. Caveat Emptor. + + + + One possible approach for specifying the code page for a given zip file is + to describe the code page in a human-readable form in the Zip comment. For + example, the comment may read "Entries in this archive are encoded in the + Big5 code page". For maximum interoperability, the zip comment in this + case should be encoded in the default, IBM437 code page. In this case, + the zip comment is encoded using a different page than the filenames. To + do this, Specify ProvisionalAlternateEncoding to your desired + region-specific code page, once before adding any entries, and then set + the property and reset + ProvisionalAlternateEncoding to IBM437 before calling Close(). + + + + + + A Text Encoding to use when encoding the filenames and comments for + all the ZipEntry items, during a ZipFile.Save() operation. + + + + Whether the encoding specified here is used during the save depends + on . + + + + + + A flag that tells if and when this instance should apply + AlternateEncoding to encode the filenames and comments associated to + of ZipEntry objects contained within this instance. + + + + + The default text encoding used in zip archives. It is numeric 437, also + known as IBM437. + + + + + + The size threshold for an entry, above which a parallel deflate is used. + + + + + + DotNetZip will use multiple threads to compress any ZipEntry, when + the CompressionMethod is Deflate, and if the entry is + larger than the given size. Zero means "always use parallel + deflate", while -1 means "never use parallel deflate". + + + + If the entry size cannot be known before compression, as with any entry + added via a ZipOutputStream, then Parallel deflate will never be + performed, unless the value of this property is zero. + + + + A parallel deflate operations will speed up the compression of + large files, on computers with multiple CPUs or multiple CPU + cores. For files above 1mb, on a dual core or dual-cpu (2p) + machine, the time required to compress the file can be 70% of the + single-threaded deflate. For very large files on 4p machines the + compression can be done in 30% of the normal time. The downside + is that parallel deflate consumes extra memory during the deflate, + and the deflation is slightly less effective. + + + + Parallel deflate tends to not be as effective as single-threaded deflate + because the original data stream is split into multiple independent + buffers, each of which is compressed in parallel. But because they are + treated independently, there is no opportunity to share compression + dictionaries, and additional framing bytes must be added to the output + stream. For that reason, a deflated stream may be slightly larger when + compressed using parallel deflate, as compared to a traditional + single-threaded deflate. For files of about 512k, the increase over the + normal deflate is as much as 5% of the total compressed size. For larger + files, the difference can be as small as 0.1%. + + + + Multi-threaded compression does not give as much an advantage when using + Encryption. This is primarily because encryption tends to slow down + the entire pipeline. Also, multi-threaded compression gives less of an + advantage when using lower compression levels, for example . You may have to perform + some tests to determine the best approach for your situation. + + + + The default value for this property is -1, which means parallel + compression will not be performed unless you set it to zero. + + + + + + + The maximum number of buffer pairs to use when performing + parallel compression. + + + + + This property sets an upper limit on the number of memory + buffer pairs to create when performing parallel + compression. The implementation of the parallel + compression stream allocates multiple buffers to + facilitate parallel compression. As each buffer fills up, + the stream uses + ThreadPool.QueueUserWorkItem() to compress those + buffers in a background threadpool thread. After a buffer + is compressed, it is re-ordered and written to the output + stream. + + + + A higher number of buffer pairs enables a higher degree of + parallelism, which tends to increase the speed of compression on + multi-cpu computers. On the other hand, a higher number of buffer + pairs also implies a larger memory consumption, more active worker + threads, and a higher cpu utilization for any compression. This + property enables the application to limit its memory consumption and + CPU utilization behavior depending on requirements. + + + + For each compression "task" that occurs in parallel, there are 2 + buffers allocated: one for input and one for output. This property + sets a limit for the number of pairs. The total amount of storage + space allocated for buffering will then be (N*S*2), where N is the + number of buffer pairs, S is the size of each buffer (). By default, DotNetZip allocates 4 buffer + pairs per CPU core, so if your machine has 4 cores, and you retain + the default buffer size of 128k, then the + ParallelDeflateOutputStream will use 4 * 4 * 2 * 128kb of buffer + memory in total, or 4mb, in blocks of 128kb. If you then set this + property to 8, then the number will be 8 * 2 * 128kb of buffer + memory, or 2mb. + + + + CPU utilization will also go up with additional buffers, because a + larger number of buffer pairs allows a larger number of background + threads to compress in parallel. If you find that parallel + compression is consuming too much memory or CPU, you can adjust this + value downward. + + + + The default value is 16. Different values may deliver better or + worse results, depending on your priorities and the dynamic + performance characteristics of your storage and compute resources. + + + + This property is not the number of buffer pairs to use; it is an + upper limit. An illustration: Suppose you have an application that + uses the default value of this property (which is 16), and it runs + on a machine with 2 CPU cores. In that case, DotNetZip will allocate + 4 buffer pairs per CPU core, for a total of 8 pairs. The upper + limit specified by this property has no effect. + + + + The application can set this value at any time, but it is + effective only if set before calling + ZipOutputStream.Write() for the first time. + + + + + + + + + Returns true if an entry by the given name has already been written + to the ZipOutputStream. + + + + The name of the entry to scan for. + + + + true if an entry by the given name has already been written. + + + + + Write the data from the buffer to the stream. + + + + As the application writes data into this stream, the data may be + compressed and encrypted before being written out to the underlying + stream, depending on the settings of the + and the properties. + + + The buffer holding data to write to the stream. + the offset within that data array to find the first byte to write. + the number of bytes to write. + + + + Specify the name of the next entry that will be written to the zip file. + + + + + Call this method just before calling , to + specify the name of the entry that the next set of bytes written to + the ZipOutputStream belongs to. All subsequent calls to Write, + until the next call to PutNextEntry, + will be inserted into the named entry in the zip file. + + + + If the used in PutNextEntry() ends in + a slash, then the entry added is marked as a directory. Because directory + entries do not contain data, a call to Write(), before an + intervening additional call to PutNextEntry(), will throw an + exception. + + + + If you don't call Write() between two calls to + PutNextEntry(), the first entry is inserted into the zip file as a + file of zero size. This may be what you want. + + + + Because PutNextEntry() closes out the prior entry, if any, this + method may throw if there is a problem with the prior entry. + + + + This method returns the ZipEntry. You can modify public properties + on the ZipEntry, such as , , and so on, until the first call to + ZipOutputStream.Write(), or until the next call to + PutNextEntry(). If you modify the ZipEntry after + having called Write(), you may get a runtime exception, or you may + silently get an invalid zip archive. + + + + + + + This example shows how to create a zip file, using the + ZipOutputStream class. + + + private void Zipup() + { + using (FileStream fs raw = File.Open(_outputFileName, FileMode.Create, FileAccess.ReadWrite )) + { + using (var output= new ZipOutputStream(fs)) + { + output.Password = "VerySecret!"; + output.Encryption = EncryptionAlgorithm.WinZipAes256; + output.PutNextEntry("entry1.txt"); + byte[] buffer= System.Text.Encoding.ASCII.GetBytes("This is the content for entry #1."); + output.Write(buffer,0,buffer.Length); + output.PutNextEntry("entry2.txt"); // this will be zero length + output.PutNextEntry("entry3.txt"); + buffer= System.Text.Encoding.ASCII.GetBytes("This is the content for entry #3."); + output.Write(buffer,0,buffer.Length); + } + } + } + + + + + The name of the entry to be added, including any path to be used + within the zip file. + + + + The ZipEntry created. + + + + + + Dispose the stream + + + + + This method writes the Zip Central directory, then closes the stream. The + application must call Dispose() (or Close) in order to produce a valid zip file. + + + + Typically the application will call Dispose() implicitly, via a using + statement in C#, or a Using statement in VB. + + + + + set this to true, always. + + + + Always returns false. + + + + + Always returns false. + + + + + Always returns true. + + + + + Always returns a NotSupportedException. + + + + + Setting this property always returns a NotSupportedException. Getting it + returns the value of the Position on the underlying stream. + + + + + This is a no-op. + + + + + This method always throws a NotSupportedException. + + ignored + ignored + ignored + nothing + + + + This method always throws a NotSupportedException. + + ignored + ignored + nothing + + + + This method always throws a NotSupportedException. + + ignored + + + + Sort-of like a factory method, ForUpdate is used only when + the application needs to update the zip entry metadata for + a segmented zip file, when the starting segment is earlier + than the ending segment, for a particular entry. + + + + The update is always contiguous, never rolls over. As a + result, this method doesn't need to return a ZSS; it can + simply return a FileStream. That's why it's "sort of" + like a Factory method. + + + Caller must Close/Dispose the stream object returned by + this method. + + + + + + Name of the filesystem file corresponding to the current segment. + + + + The name is not always the name currently being used in the + filesystem. When rwMode is RwMode.Write, the filesystem file has a + temporary name until the stream is closed or until the next segment is + started. + + + + + + Read from the stream + + the buffer to read + the offset at which to start + the number of bytes to read + the number of bytes actually read + + + + Write to the stream. + + the buffer from which to write + the offset at which to start writing + the number of bytes to write + + + + Enumerates the options for a logical conjunction. This enum is intended for use + internally by the FileSelector class. + + + + + FileSelector encapsulates logic that selects files from a source - a zip file + or the filesystem - based on a set of criteria. This class is used internally + by the DotNetZip library, in particular for the AddSelectedFiles() methods. + This class can also be used independently of the zip capability in DotNetZip. + + + + + + The FileSelector class is used internally by the ZipFile class for selecting + files for inclusion into the ZipFile, when the method, or one of + its overloads, is called. It's also used for the methods. Typically, an + application that creates or manipulates Zip archives will not directly + interact with the FileSelector class. + + + + Some applications may wish to use the FileSelector class directly, to + select files from disk volumes based on a set of criteria, without creating or + querying Zip archives. The file selection criteria include: a pattern to + match the filename; the last modified, created, or last accessed time of the + file; the size of the file; and the attributes of the file. + + + + Consult the documentation for + for more information on specifying the selection criteria. + + + + + + + Constructor that allows the caller to specify file selection criteria. + + + + + This constructor allows the caller to specify a set of criteria for + selection of files. + + + + See for a description of + the syntax of the selectionCriteria string. + + + + By default the FileSelector will traverse NTFS Reparse Points. To + change this, use FileSelector(String, bool). + + + + The criteria for file selection. + + + + Constructor that allows the caller to specify file selection criteria. + + + + + This constructor allows the caller to specify a set of criteria for + selection of files. + + + + See for a description of + the syntax of the selectionCriteria string. + + + + The criteria for file selection. + + whether to traverse NTFS reparse points (junctions). + + + + + The string specifying which files to include when retrieving. + + + + + Specify the criteria in statements of 3 elements: a noun, an operator, + and a value. Consider the string "name != *.doc" . The noun is + "name". The operator is "!=", implying "Not Equal". The value is + "*.doc". That criterion, in English, says "all files with a name that + does not end in the .doc extension." + + + + Supported nouns include "name" (or "filename") for the filename; + "atime", "mtime", and "ctime" for last access time, last modfied time, + and created time of the file, respectively; "attributes" (or "attrs") + for the file attributes; "size" (or "length") for the file length + (uncompressed); and "type" for the type of object, either a file or a + directory. The "attributes", "type", and "name" nouns all support = + and != as operators. The "size", "atime", "mtime", and "ctime" nouns + support = and !=, and >, >=, <, <= as well. The times are + taken to be expressed in local time. + + + + Specify values for the file attributes as a string with one or more of + the characters H,R,S,A,I,L in any order, implying file attributes of + Hidden, ReadOnly, System, Archive, NotContextIndexed, and ReparsePoint + (symbolic link) respectively. + + + + To specify a time, use YYYY-MM-DD-HH:mm:ss or YYYY/MM/DD-HH:mm:ss as + the format. If you omit the HH:mm:ss portion, it is assumed to be + 00:00:00 (midnight). + + + + The value for a size criterion is expressed in integer quantities of + bytes, kilobytes (use k or kb after the number), megabytes (m or mb), + or gigabytes (g or gb). + + + + The value for a name is a pattern to match against the filename, + potentially including wildcards. The pattern follows CMD.exe glob + rules: * implies one or more of any character, while ? implies one + character. If the name pattern contains any slashes, it is matched to + the entire filename, including the path; otherwise, it is matched + against only the filename without the path. This means a pattern of + "*\*.*" matches all files one directory level deep, while a pattern of + "*.*" matches all files in all directories. + + + + To specify a name pattern that includes spaces, use single quotes + around the pattern. A pattern of "'* *.*'" will match all files that + have spaces in the filename. The full criteria string for that would + be "name = '* *.*'" . + + + + The value for a type criterion is either F (implying a file) or D + (implying a directory). + + + + Some examples: + + + + + criteria + Files retrieved + + + + name != *.xls + any file with an extension that is not .xls + + + + + name = *.mp3 + any file with a .mp3 extension. + + + + + *.mp3 + (same as above) any file with a .mp3 extension. + + + + + attributes = A + all files whose attributes include the Archive bit. + + + + + attributes != H + all files whose attributes do not include the Hidden bit. + + + + + mtime > 2009-01-01 + all files with a last modified time after January 1st, 2009. + + + + + ctime > 2009/01/01-03:00:00 + all files with a created time after 3am (local time), + on January 1st, 2009. + + + + + size > 2gb + all files whose uncompressed size is greater than 2gb. + + + + + type = D + all directories in the filesystem. + + + + + + You can combine criteria with the conjunctions AND, OR, and XOR. Using + a string like "name = *.txt AND size >= 100k" for the + selectionCriteria retrieves entries whose names end in .txt, and whose + uncompressed size is greater than or equal to 100 kilobytes. + + + + For more complex combinations of criteria, you can use parenthesis to + group clauses in the boolean logic. Absent parenthesis, the + precedence of the criterion atoms is determined by order of + appearance. Unlike the C# language, the AND conjunction does not take + precendence over the logical OR. This is important only in strings + that contain 3 or more criterion atoms. In other words, "name = *.txt + and size > 1000 or attributes = H" implies "((name = *.txt AND size + > 1000) OR attributes = H)" while "attributes = H OR name = *.txt + and size > 1000" evaluates to "((attributes = H OR name = *.txt) + AND size > 1000)". When in doubt, use parenthesis. + + + + Using time properties requires some extra care. If you want to + retrieve all entries that were last updated on 2009 February 14, + specify "mtime >= 2009-02-14 AND mtime < 2009-02-15". Read this + to say: all files updated after 12:00am on February 14th, until + 12:00am on February 15th. You can use the same bracketing approach to + specify any time period - a year, a month, a week, and so on. + + + + The syntax allows one special case: if you provide a string with no + spaces, it is treated as a pattern to match for the filename. + Therefore a string like "*.xls" will be equivalent to specifying "name + = *.xls". This "shorthand" notation does not work with compound + criteria. + + + + There is no logic in this class that insures that the inclusion + criteria are internally consistent. For example, it's possible to + specify criteria that says the file must have a size of less than 100 + bytes, as well as a size that is greater than 1000 bytes. Obviously + no file will ever satisfy such criteria, but this class does not check + for or detect such inconsistencies. + + + + + + Thrown in the setter if the value has an invalid syntax. + + + + + Indicates whether searches will traverse NTFS reparse points, like Junctions. + + + + + Returns a string representation of the FileSelector object. + + The string representation of the boolean logic statement of the file + selection criteria for this instance. + + + + Returns the names of the files in the specified directory + that fit the selection criteria specified in the FileSelector. + + + + This is equivalent to calling + with recurseDirectories = false. + + + + The name of the directory over which to apply the FileSelector + criteria. + + + + A collection of strings containing fully-qualified pathnames of files + that match the criteria specified in the FileSelector instance. + + + + + Returns the names of the files in the specified directory that fit the + selection criteria specified in the FileSelector, optionally recursing + through subdirectories. + + + + This method applies the file selection criteria contained in the + FileSelector to the files contained in the given directory, and + returns the names of files that conform to the criteria. + + + + The name of the directory over which to apply the FileSelector + criteria. + + + + Whether to recurse through subdirectories when applying the file + selection criteria. + + + + A collection of strings containing fully-qualified pathnames of files + that match the criteria specified in the FileSelector instance. + + + + + Retrieve the ZipEntry items in the ZipFile that conform to the specified criteria. + + + + + This method applies the criteria set in the FileSelector instance (as described in + the ) to the specified ZipFile. Using this + method, for example, you can retrieve all entries from the given ZipFile that + have filenames ending in .txt. + + + + Normally, applications would not call this method directly. This method is used + by the ZipFile class. + + + + Using the appropriate SelectionCriteria, you can retrieve entries based on size, + time, and attributes. See for a + description of the syntax of the SelectionCriteria string. + + + + + The ZipFile from which to retrieve entries. + + a collection of ZipEntry objects that conform to the criteria. + + + + Retrieve the ZipEntry items in the ZipFile that conform to the specified criteria. + + + + + This method applies the criteria set in the FileSelector instance (as described in + the ) to the specified ZipFile. Using this + method, for example, you can retrieve all entries from the given ZipFile that + have filenames ending in .txt. + + + + Normally, applications would not call this method directly. This method is used + by the ZipFile class. + + + + This overload allows the selection of ZipEntry instances from the ZipFile to be restricted + to entries contained within a particular directory in the ZipFile. + + + + Using the appropriate SelectionCriteria, you can retrieve entries based on size, + time, and attributes. See for a + description of the syntax of the SelectionCriteria string. + + + + + The ZipFile from which to retrieve entries. + + + the directory in the archive from which to select entries. If null, then + all directories in the archive are used. + + + a collection of ZipEntry objects that conform to the criteria. + + + + Summary description for EnumUtil. + + + + + Returns the value of the DescriptionAttribute if the specified Enum + value has one. If not, returns the ToString() representation of the + Enum value. + + The Enum to get the description for + + + + + Converts the string representation of the name or numeric value of one + or more enumerated constants to an equivalent enumerated object. + Note: use the DescriptionAttribute on enum values to enable this. + + The System.Type of the enumeration. + + A string containing the name or value to convert. + + + + + + Converts the string representation of the name or numeric value of one + or more enumerated constants to an equivalent enumerated object. A + parameter specified whether the operation is case-sensitive. Note: + use the DescriptionAttribute on enum values to enable this. + + The System.Type of the enumeration. + + A string containing the name or value to convert. + + + Whether the operation is case-sensitive or not. + + + + + Computes a CRC-32. The CRC-32 algorithm is parameterized - you + can set the polynomial and enable or disable bit + reversal. This can be used for GZIP, BZip2, or ZIP. + + + This type is used internally by DotNetZip; it is generally not used + directly by applications wishing to create, read, or manipulate zip + archive files. + + + + + Indicates the total number of bytes applied to the CRC. + + + + + Indicates the current CRC for all blocks slurped in. + + + + + Returns the CRC32 for the specified stream. + + The stream over which to calculate the CRC32 + the CRC32 calculation + + + + Returns the CRC32 for the specified stream, and writes the input into the + output stream. + + The stream over which to calculate the CRC32 + The stream into which to deflate the input + the CRC32 calculation + + + + Get the CRC32 for the given (word,byte) combo. This is a + computation defined by PKzip for PKZIP 2.0 (weak) encryption. + + The word to start with. + The byte to combine it with. + The CRC-ized result. + + + + Update the value for the running CRC32 using the given block of bytes. + This is useful when using the CRC32() class in a Stream. + + block of bytes to slurp + starting point in the block + how many bytes within the block to slurp + + + + Process one byte in the CRC. + + the byte to include into the CRC . + + + + Process a run of N identical bytes into the CRC. + + + + This method serves as an optimization for updating the CRC when a + run of identical bytes is found. Rather than passing in a buffer of + length n, containing all identical bytes b, this method accepts the + byte value and the length of the (virtual) buffer - the length of + the run. + + + the byte to include into the CRC. + the number of times that byte should be repeated. + + + + Combines the given CRC32 value with the current running total. + + + This is useful when using a divide-and-conquer approach to + calculating a CRC. Multiple threads can each calculate a + CRC32 on a segment of the data, and then combine the + individual CRC32 values at the end. + + the crc value to be combined with this one + the length of data the CRC value was calculated on + + + + Create an instance of the CRC32 class using the default settings: no + bit reversal, and a polynomial of 0xEDB88320. + + + + + Create an instance of the CRC32 class, specifying whether to reverse + data bits or not. + + + specify true if the instance should reverse data bits. + + + + In the CRC-32 used by BZip2, the bits are reversed. Therefore if you + want a CRC32 with compatibility with BZip2, you should pass true + here. In the CRC-32 used by GZIP and PKZIP, the bits are not + reversed; Therefore if you want a CRC32 with compatibility with + those, you should pass false. + + + + + + Create an instance of the CRC32 class, specifying the polynomial and + whether to reverse data bits or not. + + + The polynomial to use for the CRC, expressed in the reversed (LSB) + format: the highest ordered bit in the polynomial value is the + coefficient of the 0th power; the second-highest order bit is the + coefficient of the 1 power, and so on. Expressed this way, the + polynomial for the CRC-32C used in IEEE 802.3, is 0xEDB88320. + + + specify true if the instance should reverse data bits. + + + + + In the CRC-32 used by BZip2, the bits are reversed. Therefore if you + want a CRC32 with compatibility with BZip2, you should pass true + here for the reverseBits parameter. In the CRC-32 used by + GZIP and PKZIP, the bits are not reversed; Therefore if you want a + CRC32 with compatibility with those, you should pass false for the + reverseBits parameter. + + + + + + Reset the CRC-32 class - clear the CRC "remainder register." + + + + Use this when employing a single instance of this class to compute + multiple, distinct CRCs on multiple, distinct data blocks. + + + + + + A Stream that calculates a CRC32 (a checksum) on all bytes read, + or on all bytes written. + + + + + This class can be used to verify the CRC of a ZipEntry when + reading from a stream, or to calculate a CRC when writing to a + stream. The stream should be used to either read, or write, but + not both. If you intermix reads and writes, the results are not + defined. + + + + This class is intended primarily for use internally by the + DotNetZip library. + + + + + + The default constructor. + + + + Instances returned from this constructor will leave the underlying + stream open upon Close(). The stream uses the default CRC32 + algorithm, which implies a polynomial of 0xEDB88320. + + + The underlying stream + + + + The constructor allows the caller to specify how to handle the + underlying stream at close. + + + + The stream uses the default CRC32 algorithm, which implies a + polynomial of 0xEDB88320. + + + The underlying stream + true to leave the underlying stream + open upon close of the CrcCalculatorStream; false otherwise. + + + + A constructor allowing the specification of the length of the stream + to read. + + + + The stream uses the default CRC32 algorithm, which implies a + polynomial of 0xEDB88320. + + + Instances returned from this constructor will leave the underlying + stream open upon Close(). + + + The underlying stream + The length of the stream to slurp + + + + A constructor allowing the specification of the length of the stream + to read, as well as whether to keep the underlying stream open upon + Close(). + + + + The stream uses the default CRC32 algorithm, which implies a + polynomial of 0xEDB88320. + + + The underlying stream + The length of the stream to slurp + true to leave the underlying stream + open upon close of the CrcCalculatorStream; false otherwise. + + + + A constructor allowing the specification of the length of the stream + to read, as well as whether to keep the underlying stream open upon + Close(), and the CRC32 instance to use. + + + + The stream uses the specified CRC32 instance, which allows the + application to specify how the CRC gets calculated. + + + The underlying stream + The length of the stream to slurp + true to leave the underlying stream + open upon close of the CrcCalculatorStream; false otherwise. + the CRC32 instance to use to calculate the CRC32 + + + + Gets the total number of bytes run through the CRC32 calculator. + + + + This is either the total number of bytes read, or the total number of + bytes written, depending on the direction of this stream. + + + + + Provides the current CRC for all blocks slurped in. + + + + The running total of the CRC is kept as data is written or read + through the stream. read this property after all reads or writes to + get an accurate CRC for the entire stream. + + + + + + Indicates whether the underlying stream will be left open when the + CrcCalculatorStream is Closed. + + + + Set this at any point before calling . + + + + + + Read from the stream + + the buffer to read + the offset at which to start + the number of bytes to read + the number of bytes actually read + + + + Write to the stream. + + the buffer from which to write + the offset at which to start writing + the number of bytes to write + + + + Indicates whether the stream supports reading. + + + + + Indicates whether the stream supports seeking. + + + + Always returns false. + + + + + + Indicates whether the stream supports writing. + + + + + Flush the stream. + + + + + Returns the length of the underlying stream. + + + + + The getter for this property returns the total bytes read. + If you use the setter, it will throw + . + + + + + Seeking is not supported on this stream. This method always throws + + + N/A + N/A + N/A + + + + This method always throws + + + N/A + + + + Closes the stream. + + + + + A class for compressing and decompressing streams using the Deflate algorithm. + + + + + + The DeflateStream is a Decorator on a . It adds DEFLATE compression or decompression to any + stream. + + + + Using this stream, applications can compress or decompress data via stream + Read and Write operations. Either compresssion or decompression + can occur through either reading or writing. The compression format used is + DEFLATE, which is documented in IETF RFC 1951, "DEFLATE + Compressed Data Format Specification version 1.3.". + + + + This class is similar to , except that + ZlibStream adds the RFC + 1950 - ZLIB framing bytes to a compressed stream when compressing, or + expects the RFC1950 framing bytes when decompressing. The DeflateStream + does not. + + + + + + + + + + Create a DeflateStream using the specified CompressionMode. + + + + When mode is CompressionMode.Compress, the DeflateStream will use + the default compression level. The "captive" stream will be closed when + the DeflateStream is closed. + + + + This example uses a DeflateStream to compress data from a file, and writes + the compressed data to another file. + + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (var raw = System.IO.File.Create(fileToCompress + ".deflated")) + { + using (Stream compressor = new DeflateStream(raw, CompressionMode.Compress)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n; + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + + Using input As Stream = File.OpenRead(fileToCompress) + Using raw As FileStream = File.Create(fileToCompress & ".deflated") + Using compressor As Stream = New DeflateStream(raw, CompressionMode.Compress) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + End Using + + + The stream which will be read or written. + Indicates whether the DeflateStream will compress or decompress. + + + + Create a DeflateStream using the specified CompressionMode and the specified CompressionLevel. + + + + + + When mode is CompressionMode.Decompress, the level parameter is + ignored. The "captive" stream will be closed when the DeflateStream is + closed. + + + + + + + This example uses a DeflateStream to compress data from a file, and writes + the compressed data to another file. + + + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (var raw = System.IO.File.Create(fileToCompress + ".deflated")) + { + using (Stream compressor = new DeflateStream(raw, + CompressionMode.Compress, + CompressionLevel.BestCompression)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n= -1; + while (n != 0) + { + if (n > 0) + compressor.Write(buffer, 0, n); + n= input.Read(buffer, 0, buffer.Length); + } + } + } + } + + + + Using input As Stream = File.OpenRead(fileToCompress) + Using raw As FileStream = File.Create(fileToCompress & ".deflated") + Using compressor As Stream = New DeflateStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + End Using + + + The stream to be read or written while deflating or inflating. + Indicates whether the DeflateStream will compress or decompress. + A tuning knob to trade speed for effectiveness. + + + + Create a DeflateStream using the specified + CompressionMode, and explicitly specify whether the + stream should be left open after Deflation or Inflation. + + + + + + This constructor allows the application to request that the captive stream + remain open after the deflation or inflation occurs. By default, after + Close() is called on the stream, the captive stream is also + closed. In some cases this is not desired, for example if the stream is a + memory stream that will be re-read after compression. Specify true for + the parameter to leave the stream open. + + + + The DeflateStream will use the default compression level. + + + + See the other overloads of this constructor for example code. + + + + + The stream which will be read or written. This is called the + "captive" stream in other places in this documentation. + + + + Indicates whether the DeflateStream will compress or decompress. + + + true if the application would like the stream to + remain open after inflation/deflation. + + + + Create a DeflateStream using the specified CompressionMode + and the specified CompressionLevel, and explicitly specify whether + the stream should be left open after Deflation or Inflation. + + + + + + When mode is CompressionMode.Decompress, the level parameter is ignored. + + + + This constructor allows the application to request that the captive stream + remain open after the deflation or inflation occurs. By default, after + Close() is called on the stream, the captive stream is also + closed. In some cases this is not desired, for example if the stream is a + that will be re-read after + compression. Specify true for the parameter + to leave the stream open. + + + + + + + This example shows how to use a DeflateStream to compress data from + a file, and store the compressed data into another file. + + + using (var output = System.IO.File.Create(fileToCompress + ".deflated")) + { + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (Stream compressor = new DeflateStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, true)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n= -1; + while (n != 0) + { + if (n > 0) + compressor.Write(buffer, 0, n); + n= input.Read(buffer, 0, buffer.Length); + } + } + } + // can write additional data to the output stream here + } + + + + Using output As FileStream = File.Create(fileToCompress & ".deflated") + Using input As Stream = File.OpenRead(fileToCompress) + Using compressor As Stream = New DeflateStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, True) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + ' can write additional data to the output stream here. + End Using + + + The stream which will be read or written. + Indicates whether the DeflateStream will compress or decompress. + true if the application would like the stream to remain open after inflation/deflation. + A tuning knob to trade speed for effectiveness. + + + + This property sets the flush behavior on the stream. + + See the ZLIB documentation for the meaning of the flush behavior. + + + + + The size of the working buffer for the compression codec. + + + + + The working buffer is used for all stream operations. The default size is + 1024 bytes. The minimum size is 128 bytes. You may get better performance + with a larger buffer. Then again, you might not. You would have to test + it. + + + + Set this before the first call to Read() or Write() on the + stream. If you try to set it afterwards, it will throw. + + + + + + The ZLIB strategy to be used during compression. + + + + By tweaking this parameter, you may be able to optimize the compression for + data with particular characteristics. + + + + Returns the total number of bytes input so far. + + + Returns the total number of bytes output so far. + + + + Dispose the stream. + + + + This may or may not result in a Close() call on the captive + stream. See the constructors that have a leaveOpen parameter + for more information. + + + Application code won't call this code directly. This method may be + invoked in two distinct scenarios. If disposing == true, the method + has been called directly or indirectly by a user's code, for example + via the public Dispose() method. In this case, both managed and + unmanaged resources can be referenced and disposed. If disposing == + false, the method has been called by the runtime from inside the + object finalizer and this method should not reference other objects; + in that case only unmanaged resources must be referenced or + disposed. + + + + true if the Dispose method was invoked by user code. + + + + + Indicates whether the stream can be read. + + + The return value depends on whether the captive stream supports reading. + + + + + Indicates whether the stream supports Seek operations. + + + Always returns false. + + + + + Indicates whether the stream can be written. + + + The return value depends on whether the captive stream supports writing. + + + + + Flush the stream. + + + + + Reading this property always throws a . + + + + + The position of the stream pointer. + + + + Setting this property always throws a . Reading will return the total bytes + written out, if used in writing, or the total bytes read in, if used in + reading. The count may refer to compressed bytes or uncompressed bytes, + depending on how you've used the stream. + + + + + Read data from the stream. + + + + + If you wish to use the DeflateStream to compress data while + reading, you can create a DeflateStream with + CompressionMode.Compress, providing an uncompressed data stream. + Then call Read() on that DeflateStream, and the data read will be + compressed as you read. If you wish to use the DeflateStream to + decompress data while reading, you can create a DeflateStream with + CompressionMode.Decompress, providing a readable compressed data + stream. Then call Read() on that DeflateStream, and the data read + will be decompressed as you read. + + + + A DeflateStream can be used for Read() or Write(), but not both. + + + + The buffer into which the read data should be placed. + the offset within that data array to put the first byte read. + the number of bytes to read. + the number of bytes actually read + + + + Calling this method always throws a . + + this is irrelevant, since it will always throw! + this is irrelevant, since it will always throw! + irrelevant! + + + + Calling this method always throws a . + + this is irrelevant, since it will always throw! + + + + Write data to the stream. + + + + + If you wish to use the DeflateStream to compress data while + writing, you can create a DeflateStream with + CompressionMode.Compress, and a writable output stream. Then call + Write() on that DeflateStream, providing uncompressed data + as input. The data sent to the output stream will be the compressed form + of the data written. If you wish to use the DeflateStream to + decompress data while writing, you can create a DeflateStream with + CompressionMode.Decompress, and a writable output stream. Then + call Write() on that stream, providing previously compressed + data. The data sent to the output stream will be the decompressed form of + the data written. + + + + A DeflateStream can be used for Read() or Write(), + but not both. + + + + + The buffer holding data to write to the stream. + the offset within that data array to find the first byte to write. + the number of bytes to write. + + + + Compress a string into a byte array using DEFLATE (RFC 1951). + + + + Uncompress it with . + + + DeflateStream.UncompressString(byte[]) + DeflateStream.CompressBuffer(byte[]) + GZipStream.CompressString(string) + ZlibStream.CompressString(string) + + + A string to compress. The string will first be encoded + using UTF8, then compressed. + + + The string in compressed form + + + + Compress a byte array into a new byte array using DEFLATE. + + + + Uncompress it with . + + + DeflateStream.CompressString(string) + DeflateStream.UncompressBuffer(byte[]) + GZipStream.CompressBuffer(byte[]) + ZlibStream.CompressBuffer(byte[]) + + + A buffer to compress. + + + The data in compressed form + + + + Uncompress a DEFLATE'd byte array into a single string. + + + DeflateStream.CompressString(String) + DeflateStream.UncompressBuffer(byte[]) + GZipStream.UncompressString(byte[]) + ZlibStream.UncompressString(byte[]) + + + A buffer containing DEFLATE-compressed data. + + + The uncompressed string + + + + Uncompress a DEFLATE'd byte array into a byte array. + + + DeflateStream.CompressBuffer(byte[]) + DeflateStream.UncompressString(byte[]) + GZipStream.UncompressBuffer(byte[]) + ZlibStream.UncompressBuffer(byte[]) + + + A buffer containing data that has been compressed with DEFLATE. + + + The data in uncompressed form + + + + A class for compressing and decompressing GZIP streams. + + + + + The GZipStream is a Decorator on a + . It adds GZIP compression or decompression to any + stream. + + + + Like the System.IO.Compression.GZipStream in the .NET Base Class Library, the + Ionic.Zlib.GZipStream can compress while writing, or decompress while + reading, but not vice versa. The compression method used is GZIP, which is + documented in IETF RFC + 1952, "GZIP file format specification version 4.3". + + + A GZipStream can be used to decompress data (through Read()) or + to compress data (through Write()), but not both. + + + + If you wish to use the GZipStream to compress data, you must wrap it + around a write-able stream. As you call Write() on the GZipStream, the + data will be compressed into the GZIP format. If you want to decompress data, + you must wrap the GZipStream around a readable stream that contains an + IETF RFC 1952-compliant stream. The data will be decompressed as you call + Read() on the GZipStream. + + + + Though the GZIP format allows data from multiple files to be concatenated + together, this stream handles only a single segment of GZIP format, typically + representing a single file. + + + + This class is similar to and . + ZlibStream handles RFC1950-compliant streams. + handles RFC1951-compliant streams. This class handles RFC1952-compliant streams. + + + + + + + + + + The comment on the GZIP stream. + + + + + The GZIP format allows for each file to optionally have an associated + comment stored with the file. The comment is encoded with the ISO-8859-1 + code page. To include a comment in a GZIP stream you create, set this + property before calling Write() for the first time on the + GZipStream. + + + + When using GZipStream to decompress, you can retrieve this property + after the first call to Read(). If no comment has been set in the + GZIP bytestream, the Comment property will return null + (Nothing in VB). + + + + + + The FileName for the GZIP stream. + + + + + + The GZIP format optionally allows each file to have an associated + filename. When compressing data (through Write()), set this + FileName before calling Write() the first time on the GZipStream. + The actual filename is encoded into the GZIP bytestream with the + ISO-8859-1 code page, according to RFC 1952. It is the application's + responsibility to insure that the FileName can be encoded and decoded + correctly with this code page. + + + + When decompressing (through Read()), you can retrieve this value + any time after the first Read(). In the case where there was no filename + encoded into the GZIP bytestream, the property will return null (Nothing + in VB). + + + + + + The last modified time for the GZIP stream. + + + + GZIP allows the storage of a last modified time with each GZIP entry. + When compressing data, you can set this before the first call to + Write(). When decompressing, you can retrieve this value any time + after the first call to Read(). + + + + + The CRC on the GZIP stream. + + + This is used for internal error checking. You probably don't need to look at this property. + + + + + Create a GZipStream using the specified CompressionMode. + + + + + When mode is CompressionMode.Compress, the GZipStream will use the + default compression level. + + + + As noted in the class documentation, the CompressionMode (Compress + or Decompress) also establishes the "direction" of the stream. A + GZipStream with CompressionMode.Compress works only through + Write(). A GZipStream with + CompressionMode.Decompress works only through Read(). + + + + + + This example shows how to use a GZipStream to compress data. + + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (var raw = System.IO.File.Create(outputFile)) + { + using (Stream compressor = new GZipStream(raw, CompressionMode.Compress)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n; + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + Dim outputFile As String = (fileToCompress & ".compressed") + Using input As Stream = File.OpenRead(fileToCompress) + Using raw As FileStream = File.Create(outputFile) + Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + End Using + + + + + This example shows how to use a GZipStream to uncompress a file. + + private void GunZipFile(string filename) + { + if (!filename.EndsWith(".gz)) + throw new ArgumentException("filename"); + var DecompressedFile = filename.Substring(0,filename.Length-3); + byte[] working = new byte[WORKING_BUFFER_SIZE]; + int n= 1; + using (System.IO.Stream input = System.IO.File.OpenRead(filename)) + { + using (Stream decompressor= new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, true)) + { + using (var output = System.IO.File.Create(DecompressedFile)) + { + while (n !=0) + { + n= decompressor.Read(working, 0, working.Length); + if (n > 0) + { + output.Write(working, 0, n); + } + } + } + } + } + } + + + + Private Sub GunZipFile(ByVal filename as String) + If Not (filename.EndsWith(".gz)) Then + Throw New ArgumentException("filename") + End If + Dim DecompressedFile as String = filename.Substring(0,filename.Length-3) + Dim working(WORKING_BUFFER_SIZE) as Byte + Dim n As Integer = 1 + Using input As Stream = File.OpenRead(filename) + Using decompressor As Stream = new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, True) + Using output As Stream = File.Create(UncompressedFile) + Do + n= decompressor.Read(working, 0, working.Length) + If n > 0 Then + output.Write(working, 0, n) + End IF + Loop While (n > 0) + End Using + End Using + End Using + End Sub + + + + The stream which will be read or written. + Indicates whether the GZipStream will compress or decompress. + + + + Create a GZipStream using the specified CompressionMode and + the specified CompressionLevel. + + + + + The CompressionMode (Compress or Decompress) also establishes the + "direction" of the stream. A GZipStream with + CompressionMode.Compress works only through Write(). A + GZipStream with CompressionMode.Decompress works only + through Read(). + + + + + + + This example shows how to use a GZipStream to compress a file into a .gz file. + + + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (var raw = System.IO.File.Create(fileToCompress + ".gz")) + { + using (Stream compressor = new GZipStream(raw, + CompressionMode.Compress, + CompressionLevel.BestCompression)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n; + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + + Using input As Stream = File.OpenRead(fileToCompress) + Using raw As FileStream = File.Create(fileToCompress & ".gz") + Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + End Using + + + The stream to be read or written while deflating or inflating. + Indicates whether the GZipStream will compress or decompress. + A tuning knob to trade speed for effectiveness. + + + + Create a GZipStream using the specified CompressionMode, and + explicitly specify whether the stream should be left open after Deflation + or Inflation. + + + + + This constructor allows the application to request that the captive stream + remain open after the deflation or inflation occurs. By default, after + Close() is called on the stream, the captive stream is also + closed. In some cases this is not desired, for example if the stream is a + memory stream that will be re-read after compressed data has been written + to it. Specify true for the parameter to leave + the stream open. + + + + The (Compress or Decompress) also + establishes the "direction" of the stream. A GZipStream with + CompressionMode.Compress works only through Write(). A GZipStream + with CompressionMode.Decompress works only through Read(). + + + + The GZipStream will use the default compression level. If you want + to specify the compression level, see . + + + + See the other overloads of this constructor for example code. + + + + + + The stream which will be read or written. This is called the "captive" + stream in other places in this documentation. + + + Indicates whether the GZipStream will compress or decompress. + + + + true if the application would like the base stream to remain open after + inflation/deflation. + + + + + Create a GZipStream using the specified CompressionMode and the + specified CompressionLevel, and explicitly specify whether the + stream should be left open after Deflation or Inflation. + + + + + + This constructor allows the application to request that the captive stream + remain open after the deflation or inflation occurs. By default, after + Close() is called on the stream, the captive stream is also + closed. In some cases this is not desired, for example if the stream is a + memory stream that will be re-read after compressed data has been written + to it. Specify true for the parameter to + leave the stream open. + + + + As noted in the class documentation, the CompressionMode (Compress + or Decompress) also establishes the "direction" of the stream. A + GZipStream with CompressionMode.Compress works only through + Write(). A GZipStream with CompressionMode.Decompress works only + through Read(). + + + + + + This example shows how to use a GZipStream to compress data. + + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (var raw = System.IO.File.Create(outputFile)) + { + using (Stream compressor = new GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, true)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n; + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + Dim outputFile As String = (fileToCompress & ".compressed") + Using input As Stream = File.OpenRead(fileToCompress) + Using raw As FileStream = File.Create(outputFile) + Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, True) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + End Using + + + The stream which will be read or written. + Indicates whether the GZipStream will compress or decompress. + true if the application would like the stream to remain open after inflation/deflation. + A tuning knob to trade speed for effectiveness. + + + + This property sets the flush behavior on the stream. + + + + + The size of the working buffer for the compression codec. + + + + + The working buffer is used for all stream operations. The default size is + 1024 bytes. The minimum size is 128 bytes. You may get better performance + with a larger buffer. Then again, you might not. You would have to test + it. + + + + Set this before the first call to Read() or Write() on the + stream. If you try to set it afterwards, it will throw. + + + + + Returns the total number of bytes input so far. + + + Returns the total number of bytes output so far. + + + + Dispose the stream. + + + + This may or may not result in a Close() call on the captive + stream. See the constructors that have a leaveOpen parameter + for more information. + + + This method may be invoked in two distinct scenarios. If disposing + == true, the method has been called directly or indirectly by a + user's code, for example via the public Dispose() method. In this + case, both managed and unmanaged resources can be referenced and + disposed. If disposing == false, the method has been called by the + runtime from inside the object finalizer and this method should not + reference other objects; in that case only unmanaged resources must + be referenced or disposed. + + + + indicates whether the Dispose method was invoked by user code. + + + + + Indicates whether the stream can be read. + + + The return value depends on whether the captive stream supports reading. + + + + + Indicates whether the stream supports Seek operations. + + + Always returns false. + + + + + Indicates whether the stream can be written. + + + The return value depends on whether the captive stream supports writing. + + + + + Flush the stream. + + + + + Reading this property always throws a . + + + + + The position of the stream pointer. + + + + Setting this property always throws a . Reading will return the total bytes + written out, if used in writing, or the total bytes read in, if used in + reading. The count may refer to compressed bytes or uncompressed bytes, + depending on how you've used the stream. + + + + + Read and decompress data from the source stream. + + + + With a GZipStream, decompression is done through reading. + + + + + byte[] working = new byte[WORKING_BUFFER_SIZE]; + using (System.IO.Stream input = System.IO.File.OpenRead(_CompressedFile)) + { + using (Stream decompressor= new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, true)) + { + using (var output = System.IO.File.Create(_DecompressedFile)) + { + int n; + while ((n= decompressor.Read(working, 0, working.Length)) !=0) + { + output.Write(working, 0, n); + } + } + } + } + + + The buffer into which the decompressed data should be placed. + the offset within that data array to put the first byte read. + the number of bytes to read. + the number of bytes actually read + + + + Calling this method always throws a . + + irrelevant; it will always throw! + irrelevant; it will always throw! + irrelevant! + + + + Calling this method always throws a . + + irrelevant; this method will always throw! + + + + Write data to the stream. + + + + + If you wish to use the GZipStream to compress data while writing, + you can create a GZipStream with CompressionMode.Compress, and a + writable output stream. Then call Write() on that GZipStream, + providing uncompressed data as input. The data sent to the output stream + will be the compressed form of the data written. + + + + A GZipStream can be used for Read() or Write(), but not + both. Writing implies compression. Reading implies decompression. + + + + The buffer holding data to write to the stream. + the offset within that data array to find the first byte to write. + the number of bytes to write. + + + + Compress a string into a byte array using GZip. + + + + Uncompress it with . + + + + + + + A string to compress. The string will first be encoded + using UTF8, then compressed. + + + The string in compressed form + + + + Compress a byte array into a new byte array using GZip. + + + + Uncompress it with . + + + + + + + A buffer to compress. + + + The data in compressed form + + + + Uncompress a GZip'ed byte array into a single string. + + + + + + + A buffer containing GZIP-compressed data. + + + The uncompressed string + + + + Uncompress a GZip'ed byte array into a byte array. + + + + + + + A buffer containing data that has been compressed with GZip. + + + The data in uncompressed form + + + + A class for compressing streams using the + Deflate algorithm with multiple threads. + + + + + This class performs DEFLATE compression through writing. For + more information on the Deflate algorithm, see IETF RFC 1951, + "DEFLATE Compressed Data Format Specification version 1.3." + + + + This class is similar to , except + that this class is for compression only, and this implementation uses an + approach that employs multiple worker threads to perform the DEFLATE. On + a multi-cpu or multi-core computer, the performance of this class can be + significantly higher than the single-threaded DeflateStream, particularly + for larger streams. How large? Anything over 10mb is a good candidate + for parallel compression. + + + + The tradeoff is that this class uses more memory and more CPU than the + vanilla DeflateStream, and also is less efficient as a compressor. For + large files the size of the compressed data stream can be less than 1% + larger than the size of a compressed data stream from the vanialla + DeflateStream. For smaller files the difference can be larger. The + difference will also be larger if you set the BufferSize to be lower than + the default value. Your mileage may vary. Finally, for small files, the + ParallelDeflateOutputStream can be much slower than the vanilla + DeflateStream, because of the overhead associated to using the thread + pool. + + + + + + + + Create a ParallelDeflateOutputStream. + + + + + This stream compresses data written into it via the DEFLATE + algorithm (see RFC 1951), and writes out the compressed byte stream. + + + + The instance will use the default compression level, the default + buffer sizes and the default number of threads and buffers per + thread. + + + + This class is similar to , + except that this implementation uses an approach that employs + multiple worker threads to perform the DEFLATE. On a multi-cpu or + multi-core computer, the performance of this class can be + significantly higher than the single-threaded DeflateStream, + particularly for larger streams. How large? Anything over 10mb is + a good candidate for parallel compression. + + + + + + + This example shows how to use a ParallelDeflateOutputStream to compress + data. It reads a file, compresses it, and writes the compressed data to + a second, output file. + + + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n= -1; + String outputFile = fileToCompress + ".compressed"; + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (var raw = System.IO.File.Create(outputFile)) + { + using (Stream compressor = new ParallelDeflateOutputStream(raw)) + { + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Dim outputFile As String = (fileToCompress & ".compressed") + Using input As Stream = File.OpenRead(fileToCompress) + Using raw As FileStream = File.Create(outputFile) + Using compressor As Stream = New ParallelDeflateOutputStream(raw) + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + End Using + + + The stream to which compressed data will be written. + + + + Create a ParallelDeflateOutputStream using the specified CompressionLevel. + + + See the + constructor for example code. + + The stream to which compressed data will be written. + A tuning knob to trade speed for effectiveness. + + + + Create a ParallelDeflateOutputStream and specify whether to leave the captive stream open + when the ParallelDeflateOutputStream is closed. + + + See the + constructor for example code. + + The stream to which compressed data will be written. + + true if the application would like the stream to remain open after inflation/deflation. + + + + + Create a ParallelDeflateOutputStream and specify whether to leave the captive stream open + when the ParallelDeflateOutputStream is closed. + + + See the + constructor for example code. + + The stream to which compressed data will be written. + A tuning knob to trade speed for effectiveness. + + true if the application would like the stream to remain open after inflation/deflation. + + + + + Create a ParallelDeflateOutputStream using the specified + CompressionLevel and CompressionStrategy, and specifying whether to + leave the captive stream open when the ParallelDeflateOutputStream is + closed. + + + See the + constructor for example code. + + The stream to which compressed data will be written. + A tuning knob to trade speed for effectiveness. + + By tweaking this parameter, you may be able to optimize the compression for + data with particular characteristics. + + + true if the application would like the stream to remain open after inflation/deflation. + + + + + The ZLIB strategy to be used during compression. + + + + + + The maximum number of buffer pairs to use. + + + + + This property sets an upper limit on the number of memory buffer + pairs to create. The implementation of this stream allocates + multiple buffers to facilitate parallel compression. As each buffer + fills up, this stream uses + ThreadPool.QueueUserWorkItem() + to compress those buffers in a background threadpool thread. After a + buffer is compressed, it is re-ordered and written to the output + stream. + + + + A higher number of buffer pairs enables a higher degree of + parallelism, which tends to increase the speed of compression on + multi-cpu computers. On the other hand, a higher number of buffer + pairs also implies a larger memory consumption, more active worker + threads, and a higher cpu utilization for any compression. This + property enables the application to limit its memory consumption and + CPU utilization behavior depending on requirements. + + + + For each compression "task" that occurs in parallel, there are 2 + buffers allocated: one for input and one for output. This property + sets a limit for the number of pairs. The total amount of storage + space allocated for buffering will then be (N*S*2), where N is the + number of buffer pairs, S is the size of each buffer (). By default, DotNetZip allocates 4 buffer + pairs per CPU core, so if your machine has 4 cores, and you retain + the default buffer size of 128k, then the + ParallelDeflateOutputStream will use 4 * 4 * 2 * 128kb of buffer + memory in total, or 4mb, in blocks of 128kb. If you then set this + property to 8, then the number will be 8 * 2 * 128kb of buffer + memory, or 2mb. + + + + CPU utilization will also go up with additional buffers, because a + larger number of buffer pairs allows a larger number of background + threads to compress in parallel. If you find that parallel + compression is consuming too much memory or CPU, you can adjust this + value downward. + + + + The default value is 16. Different values may deliver better or + worse results, depending on your priorities and the dynamic + performance characteristics of your storage and compute resources. + + + + This property is not the number of buffer pairs to use; it is an + upper limit. An illustration: Suppose you have an application that + uses the default value of this property (which is 16), and it runs + on a machine with 2 CPU cores. In that case, DotNetZip will allocate + 4 buffer pairs per CPU core, for a total of 8 pairs. The upper + limit specified by this property has no effect. + + + + The application can set this value at any time, but it is effective + only before the first call to Write(), which is when the buffers are + allocated. + + + + + + The size of the buffers used by the compressor threads. + + + + + The default buffer size is 128k. The application can set this value + at any time, but it is effective only before the first Write(). + + + + Larger buffer sizes implies larger memory consumption but allows + more efficient compression. Using smaller buffer sizes consumes less + memory but may result in less effective compression. For example, + using the default buffer size of 128k, the compression delivered is + within 1% of the compression delivered by the single-threaded . On the other hand, using a + BufferSize of 8k can result in a compressed data stream that is 5% + larger than that delivered by the single-threaded + DeflateStream. Excessively small buffer sizes can also cause + the speed of the ParallelDeflateOutputStream to drop, because of + larger thread scheduling overhead dealing with many many small + buffers. + + + + The total amount of storage space allocated for buffering will be + (N*S*2), where N is the number of buffer pairs, and S is the size of + each buffer (this property). There are 2 buffers used by the + compressor, one for input and one for output. By default, DotNetZip + allocates 4 buffer pairs per CPU core, so if your machine has 4 + cores, then the number of buffer pairs used will be 16. If you + accept the default value of this property, 128k, then the + ParallelDeflateOutputStream will use 16 * 2 * 128kb of buffer memory + in total, or 4mb, in blocks of 128kb. If you set this property to + 64kb, then the number will be 16 * 2 * 64kb of buffer memory, or + 2mb. + + + + + + + The CRC32 for the data that was written out, prior to compression. + + + This value is meaningful only after a call to Close(). + + + + + The total number of uncompressed bytes processed by the ParallelDeflateOutputStream. + + + This value is meaningful only after a call to Close(). + + + + + Write data to the stream. + + + + + + To use the ParallelDeflateOutputStream to compress data, create a + ParallelDeflateOutputStream with CompressionMode.Compress, passing a + writable output stream. Then call Write() on that + ParallelDeflateOutputStream, providing uncompressed data as input. The + data sent to the output stream will be the compressed form of the data + written. + + + + To decompress data, use the class. + + + + The buffer holding data to write to the stream. + the offset within that data array to find the first byte to write. + the number of bytes to write. + + + + Flush the stream. + + + + + Close the stream. + + + You must call Close on the stream to guarantee that all of the data written in has + been compressed, and the compressed data has been written out. + + + + Dispose the object + + + Because ParallelDeflateOutputStream is IDisposable, the + application must call this method when finished using the instance. + + + This method is generally called implicitly upon exit from + a using scope in C# (Using in VB). + + + + + The Dispose method + + indicates whether the Dispose method was invoked by user code. + + + + + Resets the stream for use with another stream. + + + Because the ParallelDeflateOutputStream is expensive to create, it + has been designed so that it can be recycled and re-used. You have + to call Close() on the stream first, then you can call Reset() on + it, to use it again on another stream. + + + + The new output stream for this era. + + + + + ParallelDeflateOutputStream deflater = null; + foreach (var inputFile in listOfFiles) + { + string outputFile = inputFile + ".compressed"; + using (System.IO.Stream input = System.IO.File.OpenRead(inputFile)) + { + using (var outStream = System.IO.File.Create(outputFile)) + { + if (deflater == null) + deflater = new ParallelDeflateOutputStream(outStream, + CompressionLevel.Best, + CompressionStrategy.Default, + true); + deflater.Reset(outStream); + + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + deflater.Write(buffer, 0, n); + } + } + } + } + + + + + + Indicates whether the stream supports Seek operations. + + + Always returns false. + + + + + Indicates whether the stream supports Read operations. + + + Always returns false. + + + + + Indicates whether the stream supports Write operations. + + + Returns true if the provided stream is writable. + + + + + Reading this property always throws a NotSupportedException. + + + + + Returns the current position of the output stream. + + + + Because the output gets written by a background thread, + the value may change asynchronously. Setting this + property always throws a NotSupportedException. + + + + + + This method always throws a NotSupportedException. + + + The buffer into which data would be read, IF THIS METHOD + ACTUALLY DID ANYTHING. + + + The offset within that data array at which to insert the + data that is read, IF THIS METHOD ACTUALLY DID + ANYTHING. + + + The number of bytes to write, IF THIS METHOD ACTUALLY DID + ANYTHING. + + nothing. + + + + This method always throws a NotSupportedException. + + + The offset to seek to.... + IF THIS METHOD ACTUALLY DID ANYTHING. + + + The reference specifying how to apply the offset.... IF + THIS METHOD ACTUALLY DID ANYTHING. + + nothing. It always throws. + + + + This method always throws a NotSupportedException. + + + The new value for the stream length.... IF + THIS METHOD ACTUALLY DID ANYTHING. + + + + + Map from a distance to a distance code. + + + No side effects. _dist_code[256] and _dist_code[257] are never used. + + + + + Describes how to flush the current deflate operation. + + + The different FlushType values are useful when using a Deflate in a streaming application. + + + + No flush at all. + + + Closes the current block, but doesn't flush it to + the output. Used internally only in hypothetical + scenarios. This was supposed to be removed by Zlib, but it is + still in use in some edge cases. + + + + + Use this during compression to specify that all pending output should be + flushed to the output buffer and the output should be aligned on a byte + boundary. You might use this in a streaming communication scenario, so that + the decompressor can get all input data available so far. When using this + with a ZlibCodec, AvailableBytesIn will be zero after the call if + enough output space has been provided before the call. Flushing will + degrade compression and so it should be used only when necessary. + + + + + Use this during compression to specify that all output should be flushed, as + with FlushType.Sync, but also, the compression state should be reset + so that decompression can restart from this point if previous compressed + data has been damaged or if random access is desired. Using + FlushType.Full too often can significantly degrade the compression. + + + + Signals the end of the compression/decompression stream. + + + + The compression level to be used when using a DeflateStream or ZlibStream with CompressionMode.Compress. + + + + + None means that the data will be simply stored, with no change at all. + If you are producing ZIPs for use on Mac OSX, be aware that archives produced with CompressionLevel.None + cannot be opened with the default zip reader. Use a different CompressionLevel. + + + + + Same as None. + + + + + The fastest but least effective compression. + + + + + A synonym for BestSpeed. + + + + + A little slower, but better, than level 1. + + + + + A little slower, but better, than level 2. + + + + + A little slower, but better, than level 3. + + + + + A little slower than level 4, but with better compression. + + + + + The default compression level, with a good balance of speed and compression efficiency. + + + + + A synonym for Default. + + + + + Pretty good compression! + + + + + Better compression than Level7! + + + + + The "best" compression, where best means greatest reduction in size of the input data stream. + This is also the slowest compression. + + + + + A synonym for BestCompression. + + + + + Describes options for how the compression algorithm is executed. Different strategies + work better on different sorts of data. The strategy parameter can affect the compression + ratio and the speed of compression but not the correctness of the compresssion. + + + + + The default strategy is probably the best for normal data. + + + + + The Filtered strategy is intended to be used most effectively with data produced by a + filter or predictor. By this definition, filtered data consists mostly of small + values with a somewhat random distribution. In this case, the compression algorithm + is tuned to compress them better. The effect of Filtered is to force more Huffman + coding and less string matching; it is a half-step between Default and HuffmanOnly. + + + + + Using HuffmanOnly will force the compressor to do Huffman encoding only, with no + string matching. + + + + + An enum to specify the direction of transcoding - whether to compress or decompress. + + + + + Used to specify that the stream should compress the data. + + + + + Used to specify that the stream should decompress the data. + + + + + A general purpose exception class for exceptions in the Zlib library. + + + + + The ZlibException class captures exception information generated + by the Zlib library. + + + + + This ctor collects a message attached to the exception. + + the message for the exception. + + + + Performs an unsigned bitwise right shift with the specified number + + Number to operate on + Ammount of bits to shift + The resulting number from the shift operation + + + + Reads a number of characters from the current source TextReader and writes + the data to the target array at the specified index. + + + The source TextReader to read from + Contains the array of characteres read from the source TextReader. + The starting index of the target array. + The maximum number of characters to read from the source TextReader. + + + The number of characters read. The number will be less than or equal to + count depending on the data available in the source TextReader. Returns -1 + if the end of the stream is reached. + + + + + Computes an Adler-32 checksum. + + + The Adler checksum is similar to a CRC checksum, but faster to compute, though less + reliable. It is used in producing RFC1950 compressed streams. The Adler checksum + is a required part of the "ZLIB" standard. Applications will almost never need to + use this class directly. + + + + + + + Calculates the Adler32 checksum. + + + + This is used within ZLIB. You probably don't need to use this directly. + + + + To compute an Adler32 checksum on a byte array: + + var adler = Adler.Adler32(0, null, 0, 0); + adler = Adler.Adler32(adler, buffer, index, length); + + + + + + Encoder and Decoder for ZLIB and DEFLATE (IETF RFC1950 and RFC1951). + + + + This class compresses and decompresses data according to the Deflate algorithm + and optionally, the ZLIB format, as documented in RFC 1950 - ZLIB and RFC 1951 - DEFLATE. + + + + + The buffer from which data is taken. + + + + + An index into the InputBuffer array, indicating where to start reading. + + + + + The number of bytes available in the InputBuffer, starting at NextIn. + + + Generally you should set this to InputBuffer.Length before the first Inflate() or Deflate() call. + The class will update this number as calls to Inflate/Deflate are made. + + + + + Total number of bytes read so far, through all calls to Inflate()/Deflate(). + + + + + Buffer to store output data. + + + + + An index into the OutputBuffer array, indicating where to start writing. + + + + + The number of bytes available in the OutputBuffer, starting at NextOut. + + + Generally you should set this to OutputBuffer.Length before the first Inflate() or Deflate() call. + The class will update this number as calls to Inflate/Deflate are made. + + + + + Total number of bytes written to the output so far, through all calls to Inflate()/Deflate(). + + + + + used for diagnostics, when something goes wrong! + + + + + The compression level to use in this codec. Useful only in compression mode. + + + + + The number of Window Bits to use. + + + This gauges the size of the sliding window, and hence the + compression effectiveness as well as memory consumption. It's best to just leave this + setting alone if you don't know what it is. The maximum value is 15 bits, which implies + a 32k window. + + + + + The compression strategy to use. + + + This is only effective in compression. The theory offered by ZLIB is that different + strategies could potentially produce significant differences in compression behavior + for different data sets. Unfortunately I don't have any good recommendations for how + to set it differently. When I tested changing the strategy I got minimally different + compression performance. It's best to leave this property alone if you don't have a + good feel for it. Or, you may want to produce a test harness that runs through the + different strategy options and evaluates them on different file types. If you do that, + let me know your results. + + + + + The Adler32 checksum on the data transferred through the codec so far. You probably don't need to look at this. + + + + + Create a ZlibCodec. + + + If you use this default constructor, you will later have to explicitly call + InitializeInflate() or InitializeDeflate() before using the ZlibCodec to compress + or decompress. + + + + + Create a ZlibCodec that either compresses or decompresses. + + + Indicates whether the codec should compress (deflate) or decompress (inflate). + + + + + Initialize the inflation state. + + + It is not necessary to call this before using the ZlibCodec to inflate data; + It is implicitly called when you call the constructor. + + Z_OK if everything goes well. + + + + Initialize the inflation state with an explicit flag to + govern the handling of RFC1950 header bytes. + + + + By default, the ZLIB header defined in RFC 1950 is expected. If + you want to read a zlib stream you should specify true for + expectRfc1950Header. If you have a deflate stream, you will want to specify + false. It is only necessary to invoke this initializer explicitly if you + want to specify false. + + + whether to expect an RFC1950 header byte + pair when reading the stream of data to be inflated. + + Z_OK if everything goes well. + + + + Initialize the ZlibCodec for inflation, with the specified number of window bits. + + The number of window bits to use. If you need to ask what that is, + then you shouldn't be calling this initializer. + Z_OK if all goes well. + + + + Initialize the inflation state with an explicit flag to govern the handling of + RFC1950 header bytes. + + + + If you want to read a zlib stream you should specify true for + expectRfc1950Header. In this case, the library will expect to find a ZLIB + header, as defined in RFC + 1950, in the compressed stream. If you will be reading a DEFLATE or + GZIP stream, which does not have such a header, you will want to specify + false. + + + whether to expect an RFC1950 header byte pair when reading + the stream of data to be inflated. + The number of window bits to use. If you need to ask what that is, + then you shouldn't be calling this initializer. + Z_OK if everything goes well. + + + + Inflate the data in the InputBuffer, placing the result in the OutputBuffer. + + + You must have set InputBuffer and OutputBuffer, NextIn and NextOut, and AvailableBytesIn and + AvailableBytesOut before calling this method. + + + + private void InflateBuffer() + { + int bufferSize = 1024; + byte[] buffer = new byte[bufferSize]; + ZlibCodec decompressor = new ZlibCodec(); + + Console.WriteLine("\n============================================"); + Console.WriteLine("Size of Buffer to Inflate: {0} bytes.", CompressedBytes.Length); + MemoryStream ms = new MemoryStream(DecompressedBytes); + + int rc = decompressor.InitializeInflate(); + + decompressor.InputBuffer = CompressedBytes; + decompressor.NextIn = 0; + decompressor.AvailableBytesIn = CompressedBytes.Length; + + decompressor.OutputBuffer = buffer; + + // pass 1: inflate + do + { + decompressor.NextOut = 0; + decompressor.AvailableBytesOut = buffer.Length; + rc = decompressor.Inflate(FlushType.None); + + if (rc != ZlibConstants.Z_OK && rc != ZlibConstants.Z_STREAM_END) + throw new Exception("inflating: " + decompressor.Message); + + ms.Write(decompressor.OutputBuffer, 0, buffer.Length - decompressor.AvailableBytesOut); + } + while (decompressor.AvailableBytesIn > 0 || decompressor.AvailableBytesOut == 0); + + // pass 2: finish and flush + do + { + decompressor.NextOut = 0; + decompressor.AvailableBytesOut = buffer.Length; + rc = decompressor.Inflate(FlushType.Finish); + + if (rc != ZlibConstants.Z_STREAM_END && rc != ZlibConstants.Z_OK) + throw new Exception("inflating: " + decompressor.Message); + + if (buffer.Length - decompressor.AvailableBytesOut > 0) + ms.Write(buffer, 0, buffer.Length - decompressor.AvailableBytesOut); + } + while (decompressor.AvailableBytesIn > 0 || decompressor.AvailableBytesOut == 0); + + decompressor.EndInflate(); + } + + + + The flush to use when inflating. + Z_OK if everything goes well. + + + + Ends an inflation session. + + + Call this after successively calling Inflate(). This will cause all buffers to be flushed. + After calling this you cannot call Inflate() without a intervening call to one of the + InitializeInflate() overloads. + + Z_OK if everything goes well. + + + + I don't know what this does! + + Z_OK if everything goes well. + + + + Initialize the ZlibCodec for deflation operation. + + + The codec will use the MAX window bits and the default level of compression. + + + + int bufferSize = 40000; + byte[] CompressedBytes = new byte[bufferSize]; + byte[] DecompressedBytes = new byte[bufferSize]; + + ZlibCodec compressor = new ZlibCodec(); + + compressor.InitializeDeflate(CompressionLevel.Default); + + compressor.InputBuffer = System.Text.ASCIIEncoding.ASCII.GetBytes(TextToCompress); + compressor.NextIn = 0; + compressor.AvailableBytesIn = compressor.InputBuffer.Length; + + compressor.OutputBuffer = CompressedBytes; + compressor.NextOut = 0; + compressor.AvailableBytesOut = CompressedBytes.Length; + + while (compressor.TotalBytesIn != TextToCompress.Length && compressor.TotalBytesOut < bufferSize) + { + compressor.Deflate(FlushType.None); + } + + while (true) + { + int rc= compressor.Deflate(FlushType.Finish); + if (rc == ZlibConstants.Z_STREAM_END) break; + } + + compressor.EndDeflate(); + + + + Z_OK if all goes well. You generally don't need to check the return code. + + + + Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel. + + + The codec will use the maximum window bits (15) and the specified + CompressionLevel. It will emit a ZLIB stream as it compresses. + + The compression level for the codec. + Z_OK if all goes well. + + + + Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel, + and the explicit flag governing whether to emit an RFC1950 header byte pair. + + + The codec will use the maximum window bits (15) and the specified CompressionLevel. + If you want to generate a zlib stream, you should specify true for + wantRfc1950Header. In this case, the library will emit a ZLIB + header, as defined in RFC + 1950, in the compressed stream. + + The compression level for the codec. + whether to emit an initial RFC1950 byte pair in the compressed stream. + Z_OK if all goes well. + + + + Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel, + and the specified number of window bits. + + + The codec will use the specified number of window bits and the specified CompressionLevel. + + The compression level for the codec. + the number of window bits to use. If you don't know what this means, don't use this method. + Z_OK if all goes well. + + + + Initialize the ZlibCodec for deflation operation, using the specified + CompressionLevel, the specified number of window bits, and the explicit flag + governing whether to emit an RFC1950 header byte pair. + + + The compression level for the codec. + whether to emit an initial RFC1950 byte pair in the compressed stream. + the number of window bits to use. If you don't know what this means, don't use this method. + Z_OK if all goes well. + + + + Deflate one batch of data. + + + You must have set InputBuffer and OutputBuffer before calling this method. + + + + private void DeflateBuffer(CompressionLevel level) + { + int bufferSize = 1024; + byte[] buffer = new byte[bufferSize]; + ZlibCodec compressor = new ZlibCodec(); + + Console.WriteLine("\n============================================"); + Console.WriteLine("Size of Buffer to Deflate: {0} bytes.", UncompressedBytes.Length); + MemoryStream ms = new MemoryStream(); + + int rc = compressor.InitializeDeflate(level); + + compressor.InputBuffer = UncompressedBytes; + compressor.NextIn = 0; + compressor.AvailableBytesIn = UncompressedBytes.Length; + + compressor.OutputBuffer = buffer; + + // pass 1: deflate + do + { + compressor.NextOut = 0; + compressor.AvailableBytesOut = buffer.Length; + rc = compressor.Deflate(FlushType.None); + + if (rc != ZlibConstants.Z_OK && rc != ZlibConstants.Z_STREAM_END) + throw new Exception("deflating: " + compressor.Message); + + ms.Write(compressor.OutputBuffer, 0, buffer.Length - compressor.AvailableBytesOut); + } + while (compressor.AvailableBytesIn > 0 || compressor.AvailableBytesOut == 0); + + // pass 2: finish and flush + do + { + compressor.NextOut = 0; + compressor.AvailableBytesOut = buffer.Length; + rc = compressor.Deflate(FlushType.Finish); + + if (rc != ZlibConstants.Z_STREAM_END && rc != ZlibConstants.Z_OK) + throw new Exception("deflating: " + compressor.Message); + + if (buffer.Length - compressor.AvailableBytesOut > 0) + ms.Write(buffer, 0, buffer.Length - compressor.AvailableBytesOut); + } + while (compressor.AvailableBytesIn > 0 || compressor.AvailableBytesOut == 0); + + compressor.EndDeflate(); + + ms.Seek(0, SeekOrigin.Begin); + CompressedBytes = new byte[compressor.TotalBytesOut]; + ms.Read(CompressedBytes, 0, CompressedBytes.Length); + } + + + whether to flush all data as you deflate. Generally you will want to + use Z_NO_FLUSH here, in a series of calls to Deflate(), and then call EndDeflate() to + flush everything. + + Z_OK if all goes well. + + + + End a deflation session. + + + Call this after making a series of one or more calls to Deflate(). All buffers are flushed. + + Z_OK if all goes well. + + + + Reset a codec for another deflation session. + + + Call this to reset the deflation state. For example if a thread is deflating + non-consecutive blocks, you can call Reset() after the Deflate(Sync) of the first + block and before the next Deflate(None) of the second block. + + Z_OK if all goes well. + + + + Set the CompressionStrategy and CompressionLevel for a deflation session. + + the level of compression to use. + the strategy to use for compression. + Z_OK if all goes well. + + + + Set the dictionary to be used for either Inflation or Deflation. + + The dictionary bytes to use. + Z_OK if all goes well. + + + + Set the dictionary to be used for either Inflation or Deflation unconditionally. + + Decoding a MSZip file requires the dictionary state to be set unconditionally + at the end of each block to the previous decoded data + The dictionary bytes to use. + Z_OK if all goes well. + + + + A bunch of constants used in the Zlib interface. + + + + + The maximum number of window bits for the Deflate algorithm. + + + + + The default number of window bits for the Deflate algorithm. + + + + + indicates everything is A-OK + + + + + Indicates that the last operation reached the end of the stream. + + + + + The operation ended in need of a dictionary. + + + + + There was an error with the stream - not enough data, not open and readable, etc. + + + + + There was an error with the data - not enough data, bad data, etc. + + + + + There was an error with the working buffer. + + + + + The size of the working buffer used in the ZlibCodec class. + + + + + The minimum size of the working buffer used in the ZlibCodec class. + + + + + Represents a Zlib stream for compression or decompression. + + + + + The ZlibStream is a Decorator on a . It adds ZLIB compression or decompression to any + stream. + + + Using this stream, applications can compress or decompress data via + stream Read() and Write() operations. Either compresssion or + decompression can occur through either reading or writing. The compression + format used is ZLIB, which is documented in IETF RFC 1950, "ZLIB Compressed + Data Format Specification version 3.3". This implementation of ZLIB always uses + DEFLATE as the compression method. (see IETF RFC 1951, "DEFLATE + Compressed Data Format Specification version 1.3.") + + + The ZLIB format allows for varying compression methods, window sizes, and dictionaries. + This implementation always uses the DEFLATE compression method, a preset dictionary, + and 15 window bits by default. + + + + This class is similar to , except that it adds the + RFC1950 header and trailer bytes to a compressed stream when compressing, or expects + the RFC1950 header and trailer bytes when decompressing. It is also similar to the + . + + + + + + + + Create a ZlibStream using the specified CompressionMode. + + + + + When mode is CompressionMode.Compress, the ZlibStream + will use the default compression level. The "captive" stream will be + closed when the ZlibStream is closed. + + + + + + This example uses a ZlibStream to compress a file, and writes the + compressed data to another file. + + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (var raw = System.IO.File.Create(fileToCompress + ".zlib")) + { + using (Stream compressor = new ZlibStream(raw, CompressionMode.Compress)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n; + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + Using input As Stream = File.OpenRead(fileToCompress) + Using raw As FileStream = File.Create(fileToCompress & ".zlib") + Using compressor As Stream = New ZlibStream(raw, CompressionMode.Compress) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + End Using + + + + The stream which will be read or written. + Indicates whether the ZlibStream will compress or decompress. + + + + Create a ZlibStream using the specified CompressionMode and + the specified CompressionLevel. + + + + + + When mode is CompressionMode.Decompress, the level parameter is ignored. + The "captive" stream will be closed when the ZlibStream is closed. + + + + + + This example uses a ZlibStream to compress data from a file, and writes the + compressed data to another file. + + + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (var raw = System.IO.File.Create(fileToCompress + ".zlib")) + { + using (Stream compressor = new ZlibStream(raw, + CompressionMode.Compress, + CompressionLevel.BestCompression)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n; + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + + Using input As Stream = File.OpenRead(fileToCompress) + Using raw As FileStream = File.Create(fileToCompress & ".zlib") + Using compressor As Stream = New ZlibStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + End Using + + + + The stream to be read or written while deflating or inflating. + Indicates whether the ZlibStream will compress or decompress. + A tuning knob to trade speed for effectiveness. + + + + Create a ZlibStream using the specified CompressionMode, and + explicitly specify whether the captive stream should be left open after + Deflation or Inflation. + + + + + + When mode is CompressionMode.Compress, the ZlibStream will use + the default compression level. + + + + This constructor allows the application to request that the captive stream + remain open after the deflation or inflation occurs. By default, after + Close() is called on the stream, the captive stream is also + closed. In some cases this is not desired, for example if the stream is a + that will be re-read after + compression. Specify true for the parameter to leave the stream + open. + + + + See the other overloads of this constructor for example code. + + + + + The stream which will be read or written. This is called the + "captive" stream in other places in this documentation. + Indicates whether the ZlibStream will compress or decompress. + true if the application would like the stream to remain + open after inflation/deflation. + + + + Create a ZlibStream using the specified CompressionMode + and the specified CompressionLevel, and explicitly specify + whether the stream should be left open after Deflation or Inflation. + + + + + + This constructor allows the application to request that the captive + stream remain open after the deflation or inflation occurs. By + default, after Close() is called on the stream, the captive + stream is also closed. In some cases this is not desired, for example + if the stream is a that will be + re-read after compression. Specify true for the parameter to leave the stream open. + + + + When mode is CompressionMode.Decompress, the level parameter is + ignored. + + + + + + + This example shows how to use a ZlibStream to compress the data from a file, + and store the result into another file. The filestream remains open to allow + additional data to be written to it. + + + using (var output = System.IO.File.Create(fileToCompress + ".zlib")) + { + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (Stream compressor = new ZlibStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, true)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n; + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + compressor.Write(buffer, 0, n); + } + } + } + // can write additional data to the output stream here + } + + + Using output As FileStream = File.Create(fileToCompress & ".zlib") + Using input As Stream = File.OpenRead(fileToCompress) + Using compressor As Stream = New ZlibStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, True) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + ' can write additional data to the output stream here. + End Using + + + + The stream which will be read or written. + + Indicates whether the ZlibStream will compress or decompress. + + + true if the application would like the stream to remain open after + inflation/deflation. + + + + A tuning knob to trade speed for effectiveness. This parameter is + effective only when mode is CompressionMode.Compress. + + + + + This property sets the flush behavior on the stream. + Sorry, though, not sure exactly how to describe all the various settings. + + + + + The size of the working buffer for the compression codec. + + + + + The working buffer is used for all stream operations. The default size is + 1024 bytes. The minimum size is 128 bytes. You may get better performance + with a larger buffer. Then again, you might not. You would have to test + it. + + + + Set this before the first call to Read() or Write() on the + stream. If you try to set it afterwards, it will throw. + + + + + Returns the total number of bytes input so far. + + + Returns the total number of bytes output so far. + + + + Dispose the stream. + + + + This may or may not result in a Close() call on the captive + stream. See the constructors that have a leaveOpen parameter + for more information. + + + This method may be invoked in two distinct scenarios. If disposing + == true, the method has been called directly or indirectly by a + user's code, for example via the public Dispose() method. In this + case, both managed and unmanaged resources can be referenced and + disposed. If disposing == false, the method has been called by the + runtime from inside the object finalizer and this method should not + reference other objects; in that case only unmanaged resources must + be referenced or disposed. + + + + indicates whether the Dispose method was invoked by user code. + + + + + Indicates whether the stream can be read. + + + The return value depends on whether the captive stream supports reading. + + + + + Indicates whether the stream supports Seek operations. + + + Always returns false. + + + + + Indicates whether the stream can be written. + + + The return value depends on whether the captive stream supports writing. + + + + + Flush the stream. + + + + + Reading this property always throws a . + + + + + The position of the stream pointer. + + + + Setting this property always throws a . Reading will return the total bytes + written out, if used in writing, or the total bytes read in, if used in + reading. The count may refer to compressed bytes or uncompressed bytes, + depending on how you've used the stream. + + + + + Read data from the stream. + + + + + + If you wish to use the ZlibStream to compress data while reading, + you can create a ZlibStream with CompressionMode.Compress, + providing an uncompressed data stream. Then call Read() on that + ZlibStream, and the data read will be compressed. If you wish to + use the ZlibStream to decompress data while reading, you can create + a ZlibStream with CompressionMode.Decompress, providing a + readable compressed data stream. Then call Read() on that + ZlibStream, and the data will be decompressed as it is read. + + + + A ZlibStream can be used for Read() or Write(), but + not both. + + + + + + The buffer into which the read data should be placed. + + + the offset within that data array to put the first byte read. + + the number of bytes to read. + + the number of bytes read + + + + Calling this method always throws a . + + + The offset to seek to.... + IF THIS METHOD ACTUALLY DID ANYTHING. + + + The reference specifying how to apply the offset.... IF + THIS METHOD ACTUALLY DID ANYTHING. + + + nothing. This method always throws. + + + + Calling this method always throws a . + + + The new value for the stream length.... IF + THIS METHOD ACTUALLY DID ANYTHING. + + + + + Write data to the stream. + + + + + + If you wish to use the ZlibStream to compress data while writing, + you can create a ZlibStream with CompressionMode.Compress, + and a writable output stream. Then call Write() on that + ZlibStream, providing uncompressed data as input. The data sent to + the output stream will be the compressed form of the data written. If you + wish to use the ZlibStream to decompress data while writing, you + can create a ZlibStream with CompressionMode.Decompress, and a + writable output stream. Then call Write() on that stream, + providing previously compressed data. The data sent to the output stream + will be the decompressed form of the data written. + + + + A ZlibStream can be used for Read() or Write(), but not both. + + + The buffer holding data to write to the stream. + the offset within that data array to find the first byte to write. + the number of bytes to write. + + + + Compress a string into a byte array using ZLIB. + + + + Uncompress it with . + + + + + + + + A string to compress. The string will first be encoded + using UTF8, then compressed. + + + The string in compressed form + + + + Compress a byte array into a new byte array using ZLIB. + + + + Uncompress it with . + + + + + + + A buffer to compress. + + + The data in compressed form + + + + Uncompress a ZLIB-compressed byte array into a single string. + + + + + + + A buffer containing ZLIB-compressed data. + + + The uncompressed string + + + + Uncompress a ZLIB-compressed byte array into a byte array. + + + + + + + A buffer containing ZLIB-compressed data. + + + The data in uncompressed form + +
+
diff --git a/packages/DotNetZip.1.13.4/lib/netstandard2.0/DotNetZip.dll b/packages/DotNetZip.1.13.4/lib/netstandard2.0/DotNetZip.dll new file mode 100644 index 0000000..2c6088a Binary files /dev/null and b/packages/DotNetZip.1.13.4/lib/netstandard2.0/DotNetZip.dll differ diff --git a/packages/DotNetZip.1.13.4/lib/netstandard2.0/DotNetZip.pdb b/packages/DotNetZip.1.13.4/lib/netstandard2.0/DotNetZip.pdb new file mode 100644 index 0000000..a4f5522 Binary files /dev/null and b/packages/DotNetZip.1.13.4/lib/netstandard2.0/DotNetZip.pdb differ diff --git a/packages/DotNetZip.1.13.4/lib/netstandard2.0/DotNetZip.xml b/packages/DotNetZip.1.13.4/lib/netstandard2.0/DotNetZip.xml new file mode 100644 index 0000000..e1f7c2e --- /dev/null +++ b/packages/DotNetZip.1.13.4/lib/netstandard2.0/DotNetZip.xml @@ -0,0 +1,18031 @@ + + + + DotNetZip + + + + + Delivers the remaining bits, left-aligned, in a byte. + + + + This is valid only if NumRemainingBits is less than 8; + in other words it is valid only after a call to Flush(). + + + + + + Reset the BitWriter. + + + + This is useful when the BitWriter writes into a MemoryStream, and + is used by a BZip2Compressor, which itself is re-used for multiple + distinct data blocks. + + + + + + Write some number of bits from the given value, into the output. + + + + The nbits value should be a max of 25, for safety. For performance + reasons, this method does not check! + + + + + + Write a full 8-bit byte into the output. + + + + + Write four 8-bit bytes into the output. + + + + + Write all available byte-aligned bytes. + + + + This method writes no new output, but flushes any accumulated + bits. At completion, the accumulator may contain up to 7 + bits. + + + This is necessary when re-assembling output from N independent + compressors, one for each of N blocks. The output of any + particular compressor will in general have some fragment of a byte + remaining. This fragment needs to be accumulated into the + parent BZip2OutputStream. + + + + + + Writes all available bytes, and emits padding for the final byte as + necessary. This must be the last method invoked on an instance of + BitWriter. + + + + Knuth's increments seem to work better than Incerpi-Sedgewick here. + Possibly because the number of elems to sort is usually small, typically + <= 20. + + + + BZip2Compressor writes its compressed data out via a BitWriter. This + is necessary because BZip2 does byte shredding. + + + + + The number of uncompressed bytes being held in the buffer. + + + + I am thinking this may be useful in a Stream that uses this + compressor class. In the Close() method on the stream it could + check this value to see if anything has been written at all. You + may think the stream could easily track the number of bytes it + wrote, which would eliminate the need for this. But, there is the + case where the stream writes a complete block, and it is full, and + then writes no more. In that case the stream may want to check. + + + + + + Accept new bytes into the compressor data buffer + + + + This method does the first-level (cheap) run-length encoding, and + stores the encoded data into the rle block. + + + + + + Process one input byte into the block. + + + + + To "process" the byte means to do the run-length encoding. + There are 3 possible return values: + + 0 - the byte was not written, in other words, not + encoded into the block. This happens when the + byte b would require the start of a new run, and + the block has no more room for new runs. + + 1 - the byte was written, and the block is not full. + + 2 - the byte was written, and the block is full. + + + + 0 if the byte was not written, non-zero if written. + + + + Append one run to the output block. + + + + + This compressor does run-length-encoding before BWT and etc. This + method simply appends a run to the output block. The append always + succeeds. The return value indicates whether the block is full: + false (not full) implies that at least one additional run could be + processed. + + + true if the block is now full; otherwise false. + + + + Compress the data that has been placed (Run-length-encoded) into the + block. The compressed data goes into the CompressedBytes array. + + + + Side effects: 1. fills the CompressedBytes array. 2. sets the + AvailableBytesOut property. + + + + + This is the most hammered method of this class. + +

+ This is the version using unrolled loops. +

+
+ + Method "mainQSort3", file "blocksort.c", BZip2 1.0.2 + + + Array instance identical to sfmap, both are used only + temporarily and independently, so we do not need to allocate + additional memory. + + + + A read-only decorator stream that performs BZip2 decompression on Read. + + + + + Compressor State + + + + + Create a BZip2InputStream, wrapping it around the given input Stream. + + + + The input stream will be closed when the BZip2InputStream is closed. + + + The stream from which to read compressed data + + + + Create a BZip2InputStream with the given stream, and + specifying whether to leave the wrapped stream open when + the BZip2InputStream is closed. + + The stream from which to read compressed data + + Whether to leave the input stream open, when the BZip2InputStream closes. + + + + + This example reads a bzip2-compressed file, decompresses it, + and writes the decompressed data into a newly created file. + + + var fname = "logfile.log.bz2"; + using (var fs = File.OpenRead(fname)) + { + using (var decompressor = new Ionic.BZip2.BZip2InputStream(fs)) + { + var outFname = fname + ".decompressed"; + using (var output = File.Create(outFname)) + { + byte[] buffer = new byte[2048]; + int n; + while ((n = decompressor.Read(buffer, 0, buffer.Length)) > 0) + { + output.Write(buffer, 0, n); + } + } + } + } + + + + + + Read data from the stream. + + + + + To decompress a BZip2 data stream, create a BZip2InputStream, + providing a stream that reads compressed data. Then call Read() on + that BZip2InputStream, and the data read will be decompressed + as you read. + + + + A BZip2InputStream can be used only for Read(), not for Write(). + + + + The buffer into which the read data should be placed. + the offset within that data array to put the first byte read. + the number of bytes to read. + the number of bytes actually read + + + + Read a single byte from the stream. + + the byte read from the stream, or -1 if EOF + + + + Indicates whether the stream can be read. + + + The return value depends on whether the captive stream supports reading. + + + + + Indicates whether the stream supports Seek operations. + + + Always returns false. + + + + + Indicates whether the stream can be written. + + + The return value depends on whether the captive stream supports writing. + + + + + Flush the stream. + + + + + Reading this property always throws a . + + + + + The position of the stream pointer. + + + + Setting this property always throws a . Reading will return the + total number of uncompressed bytes read in. + + + + + Calling this method always throws a . + + this is irrelevant, since it will always throw! + this is irrelevant, since it will always throw! + irrelevant! + + + + Calling this method always throws a . + + this is irrelevant, since it will always throw! + + + + Calling this method always throws a . + + this parameter is never used + this parameter is never used + this parameter is never used + + + + Dispose the stream. + + + indicates whether the Dispose method was invoked by user code. + + + + + Close the stream. + + + + + Read n bits from input, right justifying the result. + + + + For example, if you read 1 bit, the result is either 0 + or 1. + + + + The number of bits to read, always between 1 and 32. + + + + Called by createHuffmanDecodingTables() exclusively. + + + Called by recvDecodingTables() exclusively. + + + Freq table collected to save a pass over the data during + decompression. + + + Initializes the tt array. + + This method is called when the required length of the array is known. + I don't initialize it at construction time to avoid unneccessary + memory allocation when compressing small files. + + + + A write-only decorator stream that compresses data as it is + written using the BZip2 algorithm. + + + + + Constructs a new BZip2OutputStream, that sends its + compressed output to the given output stream. + + + + The destination stream, to which compressed output will be sent. + + + + + This example reads a file, then compresses it with bzip2 file, + and writes the compressed data into a newly created file. + + + var fname = "logfile.log"; + using (var fs = File.OpenRead(fname)) + { + var outFname = fname + ".bz2"; + using (var output = File.Create(outFname)) + { + using (var compressor = new Ionic.BZip2.BZip2OutputStream(output)) + { + byte[] buffer = new byte[2048]; + int n; + while ((n = fs.Read(buffer, 0, buffer.Length)) > 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + + + + Constructs a new BZip2OutputStream with specified blocksize. + + the destination stream. + + The blockSize in units of 100000 bytes. + The valid range is 1..9. + + + + + Constructs a new BZip2OutputStream. + + the destination stream. + + whether to leave the captive stream open upon closing this stream. + + + + + Constructs a new BZip2OutputStream with specified blocksize, + and explicitly specifies whether to leave the wrapped stream open. + + + the destination stream. + + The blockSize in units of 100000 bytes. + The valid range is 1..9. + + + whether to leave the captive stream open upon closing this stream. + + + + + Close the stream. + + + + This may or may not close the underlying stream. Check the + constructors that accept a bool value. + + + + + + Flush the stream. + + + + + The blocksize parameter specified at construction time. + + + + + Write data to the stream. + + + + + Use the BZip2OutputStream to compress data while writing: + create a BZip2OutputStream with a writable output stream. + Then call Write() on that BZip2OutputStream, providing + uncompressed data as input. The data sent to the output stream will + be the compressed form of the input data. + + + + A BZip2OutputStream can be used only for Write() not for Read(). + + + + + The buffer holding data to write to the stream. + the offset within that data array to find the first byte to write. + the number of bytes to write. + + + + Indicates whether the stream can be read. + + + The return value is always false. + + + + + Indicates whether the stream supports Seek operations. + + + Always returns false. + + + + + Indicates whether the stream can be written. + + + The return value should always be true, unless and until the + object is disposed and closed. + + + + + Reading this property always throws a . + + + + + The position of the stream pointer. + + + + Setting this property always throws a . Reading will return the + total number of uncompressed bytes written through. + + + + + Calling this method always throws a . + + this is irrelevant, since it will always throw! + this is irrelevant, since it will always throw! + irrelevant! + + + + Calling this method always throws a . + + this is irrelevant, since it will always throw! + + + + Calling this method always throws a . + + this parameter is never used + this parameter is never used + this parameter is never used + never returns anything; always throws + + + + A write-only decorator stream that compresses data as it is + written using the BZip2 algorithm. This stream compresses by + block using multiple threads. + + + This class performs BZIP2 compression through writing. For + more information on the BZIP2 algorithm, see + . + + + + This class is similar to , + except that this implementation uses an approach that employs multiple + worker threads to perform the compression. On a multi-cpu or multi-core + computer, the performance of this class can be significantly higher than + the single-threaded BZip2OutputStream, particularly for larger streams. + How large? Anything over 10mb is a good candidate for parallel + compression. + + + + The tradeoff is that this class uses more memory and more CPU than the + vanilla BZip2OutputStream. Also, for small files, the + ParallelBZip2OutputStream can be much slower than the vanilla + BZip2OutputStream, because of the overhead associated to using the + thread pool. + + + + + + + Constructs a new ParallelBZip2OutputStream, that sends its + compressed output to the given output stream. + + + + The destination stream, to which compressed output will be sent. + + + + + This example reads a file, then compresses it with bzip2 file, + and writes the compressed data into a newly created file. + + + var fname = "logfile.log"; + using (var fs = File.OpenRead(fname)) + { + var outFname = fname + ".bz2"; + using (var output = File.Create(outFname)) + { + using (var compressor = new Ionic.BZip2.ParallelBZip2OutputStream(output)) + { + byte[] buffer = new byte[2048]; + int n; + while ((n = fs.Read(buffer, 0, buffer.Length)) > 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + + + + Constructs a new ParallelBZip2OutputStream with specified blocksize. + + the destination stream. + + The blockSize in units of 100000 bytes. + The valid range is 1..9. + + + + + Constructs a new ParallelBZip2OutputStream. + + the destination stream. + + whether to leave the captive stream open upon closing this stream. + + + + + Constructs a new ParallelBZip2OutputStream with specified blocksize, + and explicitly specifies whether to leave the wrapped stream open. + + + the destination stream. + + The blockSize in units of 100000 bytes. + The valid range is 1..9. + + + whether to leave the captive stream open upon closing this stream. + + + + + The maximum number of concurrent compression worker threads to use. + + + + + This property sets an upper limit on the number of concurrent worker + threads to employ for compression. The implementation of this stream + employs multiple threads from the .NET thread pool, via + ThreadPool.QueueUserWorkItem(), to compress the incoming data by + block. As each block of data is compressed, this stream re-orders the + compressed blocks and writes them to the output stream. + + + + A higher number of workers enables a higher degree of + parallelism, which tends to increase the speed of compression on + multi-cpu computers. On the other hand, a higher number of buffer + pairs also implies a larger memory consumption, more active worker + threads, and a higher cpu utilization for any compression. This + property enables the application to limit its memory consumption and + CPU utilization behavior depending on requirements. + + + + By default, DotNetZip allocates 4 workers per CPU core, subject to the + upper limit specified in this property. For example, suppose the + application sets this property to 16. Then, on a machine with 2 + cores, DotNetZip will use 8 workers; that number does not exceed the + upper limit specified by this property, so the actual number of + workers used will be 4 * 2 = 8. On a machine with 4 cores, DotNetZip + will use 16 workers; again, the limit does not apply. On a machine + with 8 cores, DotNetZip will use 16 workers, because of the limit. + + + + For each compression "worker thread" that occurs in parallel, there is + up to 2mb of memory allocated, for buffering and processing. The + actual number depends on the property. + + + + CPU utilization will also go up with additional workers, because a + larger number of buffer pairs allows a larger number of background + threads to compress in parallel. If you find that parallel + compression is consuming too much memory or CPU, you can adjust this + value downward. + + + + The default value is 16. Different values may deliver better or + worse results, depending on your priorities and the dynamic + performance characteristics of your storage and compute resources. + + + + The application can set this value at any time, but it is effective + only before the first call to Write(), which is when the buffers are + allocated. + + + + + + Close the stream. + + + + This may or may not close the underlying stream. Check the + constructors that accept a bool value. + + + + + + Flush the stream. + + + + + The blocksize parameter specified at construction time. + + + + + Write data to the stream. + + + + + Use the ParallelBZip2OutputStream to compress data while + writing: create a ParallelBZip2OutputStream with a writable + output stream. Then call Write() on that + ParallelBZip2OutputStream, providing uncompressed data as + input. The data sent to the output stream will be the compressed + form of the input data. + + + + A ParallelBZip2OutputStream can be used only for + Write() not for Read(). + + + + + The buffer holding data to write to the stream. + the offset within that data array to find the first byte to write. + the number of bytes to write. + + + + Indicates whether the stream can be read. + + + The return value is always false. + + + + + Indicates whether the stream supports Seek operations. + + + Always returns false. + + + + + Indicates whether the stream can be written. + + + The return value depends on whether the captive stream supports writing. + + + + + Reading this property always throws a . + + + + + The position of the stream pointer. + + + + Setting this property always throws a . Reading will return the + total number of uncompressed bytes written through. + + + + + The total number of bytes written out by the stream. + + + This value is meaningful only after a call to Close(). + + + + + Calling this method always throws a . + + this is irrelevant, since it will always throw! + this is irrelevant, since it will always throw! + irrelevant! + + + + Calling this method always throws a . + + this is irrelevant, since it will always throw! + + + + Calling this method always throws a . + + this parameter is never used + this parameter is never used + this parameter is never used + never returns anything; always throws + + + + Returns the "random" number at a specific index. + + the index + the random number + + + + Computes a CRC-32. The CRC-32 algorithm is parameterized - you + can set the polynomial and enable or disable bit + reversal. This can be used for GZIP, BZip2, or ZIP. + + + This type is used internally by DotNetZip; it is generally not used + directly by applications wishing to create, read, or manipulate zip + archive files. + + + + + Indicates the total number of bytes applied to the CRC. + + + + + Indicates the current CRC for all blocks slurped in. + + + + + Returns the CRC32 for the specified stream. + + The stream over which to calculate the CRC32 + the CRC32 calculation + + + + Returns the CRC32 for the specified stream, and writes the input into the + output stream. + + The stream over which to calculate the CRC32 + The stream into which to deflate the input + the CRC32 calculation + + + + Get the CRC32 for the given (word,byte) combo. This is a + computation defined by PKzip for PKZIP 2.0 (weak) encryption. + + The word to start with. + The byte to combine it with. + The CRC-ized result. + + + + Update the value for the running CRC32 using the given block of bytes. + This is useful when using the CRC32() class in a Stream. + + block of bytes to slurp + starting point in the block + how many bytes within the block to slurp + + + + Process one byte in the CRC. + + the byte to include into the CRC . + + + + Process a run of N identical bytes into the CRC. + + + + This method serves as an optimization for updating the CRC when a + run of identical bytes is found. Rather than passing in a buffer of + length n, containing all identical bytes b, this method accepts the + byte value and the length of the (virtual) buffer - the length of + the run. + + + the byte to include into the CRC. + the number of times that byte should be repeated. + + + + Combines the given CRC32 value with the current running total. + + + This is useful when using a divide-and-conquer approach to + calculating a CRC. Multiple threads can each calculate a + CRC32 on a segment of the data, and then combine the + individual CRC32 values at the end. + + the crc value to be combined with this one + the length of data the CRC value was calculated on + + + + Create an instance of the CRC32 class using the default settings: no + bit reversal, and a polynomial of 0xEDB88320. + + + + + Create an instance of the CRC32 class, specifying whether to reverse + data bits or not. + + + specify true if the instance should reverse data bits. + + + + In the CRC-32 used by BZip2, the bits are reversed. Therefore if you + want a CRC32 with compatibility with BZip2, you should pass true + here. In the CRC-32 used by GZIP and PKZIP, the bits are not + reversed; Therefore if you want a CRC32 with compatibility with + those, you should pass false. + + + + + + Create an instance of the CRC32 class, specifying the polynomial and + whether to reverse data bits or not. + + + The polynomial to use for the CRC, expressed in the reversed (LSB) + format: the highest ordered bit in the polynomial value is the + coefficient of the 0th power; the second-highest order bit is the + coefficient of the 1 power, and so on. Expressed this way, the + polynomial for the CRC-32C used in IEEE 802.3, is 0xEDB88320. + + + specify true if the instance should reverse data bits. + + + + + In the CRC-32 used by BZip2, the bits are reversed. Therefore if you + want a CRC32 with compatibility with BZip2, you should pass true + here for the reverseBits parameter. In the CRC-32 used by + GZIP and PKZIP, the bits are not reversed; Therefore if you want a + CRC32 with compatibility with those, you should pass false for the + reverseBits parameter. + + + + + + Reset the CRC-32 class - clear the CRC "remainder register." + + + + Use this when employing a single instance of this class to compute + multiple, distinct CRCs on multiple, distinct data blocks. + + + + + + A Stream that calculates a CRC32 (a checksum) on all bytes read, + or on all bytes written. + + + + + This class can be used to verify the CRC of a ZipEntry when + reading from a stream, or to calculate a CRC when writing to a + stream. The stream should be used to either read, or write, but + not both. If you intermix reads and writes, the results are not + defined. + + + + This class is intended primarily for use internally by the + DotNetZip library. + + + + + + The default constructor. + + + + Instances returned from this constructor will leave the underlying + stream open upon Close(). The stream uses the default CRC32 + algorithm, which implies a polynomial of 0xEDB88320. + + + The underlying stream + + + + The constructor allows the caller to specify how to handle the + underlying stream at close. + + + + The stream uses the default CRC32 algorithm, which implies a + polynomial of 0xEDB88320. + + + The underlying stream + true to leave the underlying stream + open upon close of the CrcCalculatorStream; false otherwise. + + + + A constructor allowing the specification of the length of the stream + to read. + + + + The stream uses the default CRC32 algorithm, which implies a + polynomial of 0xEDB88320. + + + Instances returned from this constructor will leave the underlying + stream open upon Close(). + + + The underlying stream + The length of the stream to slurp + + + + A constructor allowing the specification of the length of the stream + to read, as well as whether to keep the underlying stream open upon + Close(). + + + + The stream uses the default CRC32 algorithm, which implies a + polynomial of 0xEDB88320. + + + The underlying stream + The length of the stream to slurp + true to leave the underlying stream + open upon close of the CrcCalculatorStream; false otherwise. + + + + A constructor allowing the specification of the length of the stream + to read, as well as whether to keep the underlying stream open upon + Close(), and the CRC32 instance to use. + + + + The stream uses the specified CRC32 instance, which allows the + application to specify how the CRC gets calculated. + + + The underlying stream + The length of the stream to slurp + true to leave the underlying stream + open upon close of the CrcCalculatorStream; false otherwise. + the CRC32 instance to use to calculate the CRC32 + + + + Gets the total number of bytes run through the CRC32 calculator. + + + + This is either the total number of bytes read, or the total number of + bytes written, depending on the direction of this stream. + + + + + Provides the current CRC for all blocks slurped in. + + + + The running total of the CRC is kept as data is written or read + through the stream. read this property after all reads or writes to + get an accurate CRC for the entire stream. + + + + + + Indicates whether the underlying stream will be left open when the + CrcCalculatorStream is Closed. + + + + Set this at any point before calling . + + + + + + Read from the stream + + the buffer to read + the offset at which to start + the number of bytes to read + the number of bytes actually read + + + + Write to the stream. + + the buffer from which to write + the offset at which to start writing + the number of bytes to write + + + + Indicates whether the stream supports reading. + + + + + Indicates whether the stream supports seeking. + + + + Always returns false. + + + + + + Indicates whether the stream supports writing. + + + + + Flush the stream. + + + + + Returns the length of the underlying stream. + + + + + The getter for this property returns the total bytes read. + If you use the setter, it will throw + . + + + + + Seeking is not supported on this stream. This method always throws + + + N/A + N/A + N/A + + + + This method always throws + + + N/A + + + + Closes the stream. + + + + + A class for compressing and decompressing streams using the Deflate algorithm. + + + + + + The DeflateStream is a Decorator on a . It adds DEFLATE compression or decompression to any + stream. + + + + Using this stream, applications can compress or decompress data via stream + Read and Write operations. Either compresssion or decompression + can occur through either reading or writing. The compression format used is + DEFLATE, which is documented in IETF RFC 1951, "DEFLATE + Compressed Data Format Specification version 1.3.". + + + + This class is similar to , except that + ZlibStream adds the RFC + 1950 - ZLIB framing bytes to a compressed stream when compressing, or + expects the RFC1950 framing bytes when decompressing. The DeflateStream + does not. + + + + + + + + + + Create a DeflateStream using the specified CompressionMode. + + + + When mode is CompressionMode.Compress, the DeflateStream will use + the default compression level. The "captive" stream will be closed when + the DeflateStream is closed. + + + + This example uses a DeflateStream to compress data from a file, and writes + the compressed data to another file. + + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (var raw = System.IO.File.Create(fileToCompress + ".deflated")) + { + using (Stream compressor = new DeflateStream(raw, CompressionMode.Compress)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n; + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + + Using input As Stream = File.OpenRead(fileToCompress) + Using raw As FileStream = File.Create(fileToCompress & ".deflated") + Using compressor As Stream = New DeflateStream(raw, CompressionMode.Compress) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + End Using + + + The stream which will be read or written. + Indicates whether the DeflateStream will compress or decompress. + + + + Create a DeflateStream using the specified CompressionMode and the specified CompressionLevel. + + + + + + When mode is CompressionMode.Decompress, the level parameter is + ignored. The "captive" stream will be closed when the DeflateStream is + closed. + + + + + + + This example uses a DeflateStream to compress data from a file, and writes + the compressed data to another file. + + + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (var raw = System.IO.File.Create(fileToCompress + ".deflated")) + { + using (Stream compressor = new DeflateStream(raw, + CompressionMode.Compress, + CompressionLevel.BestCompression)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n= -1; + while (n != 0) + { + if (n > 0) + compressor.Write(buffer, 0, n); + n= input.Read(buffer, 0, buffer.Length); + } + } + } + } + + + + Using input As Stream = File.OpenRead(fileToCompress) + Using raw As FileStream = File.Create(fileToCompress & ".deflated") + Using compressor As Stream = New DeflateStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + End Using + + + The stream to be read or written while deflating or inflating. + Indicates whether the DeflateStream will compress or decompress. + A tuning knob to trade speed for effectiveness. + + + + Create a DeflateStream using the specified + CompressionMode, and explicitly specify whether the + stream should be left open after Deflation or Inflation. + + + + + + This constructor allows the application to request that the captive stream + remain open after the deflation or inflation occurs. By default, after + Close() is called on the stream, the captive stream is also + closed. In some cases this is not desired, for example if the stream is a + memory stream that will be re-read after compression. Specify true for + the parameter to leave the stream open. + + + + The DeflateStream will use the default compression level. + + + + See the other overloads of this constructor for example code. + + + + + The stream which will be read or written. This is called the + "captive" stream in other places in this documentation. + + + + Indicates whether the DeflateStream will compress or decompress. + + + true if the application would like the stream to + remain open after inflation/deflation. + + + + Create a DeflateStream using the specified CompressionMode + and the specified CompressionLevel, and explicitly specify whether + the stream should be left open after Deflation or Inflation. + + + + + + When mode is CompressionMode.Decompress, the level parameter is ignored. + + + + This constructor allows the application to request that the captive stream + remain open after the deflation or inflation occurs. By default, after + Close() is called on the stream, the captive stream is also + closed. In some cases this is not desired, for example if the stream is a + that will be re-read after + compression. Specify true for the parameter + to leave the stream open. + + + + + + + This example shows how to use a DeflateStream to compress data from + a file, and store the compressed data into another file. + + + using (var output = System.IO.File.Create(fileToCompress + ".deflated")) + { + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (Stream compressor = new DeflateStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, true)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n= -1; + while (n != 0) + { + if (n > 0) + compressor.Write(buffer, 0, n); + n= input.Read(buffer, 0, buffer.Length); + } + } + } + // can write additional data to the output stream here + } + + + + Using output As FileStream = File.Create(fileToCompress & ".deflated") + Using input As Stream = File.OpenRead(fileToCompress) + Using compressor As Stream = New DeflateStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, True) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + ' can write additional data to the output stream here. + End Using + + + The stream which will be read or written. + Indicates whether the DeflateStream will compress or decompress. + true if the application would like the stream to remain open after inflation/deflation. + A tuning knob to trade speed for effectiveness. + + + + This property sets the flush behavior on the stream. + + See the ZLIB documentation for the meaning of the flush behavior. + + + + + The size of the working buffer for the compression codec. + + + + + The working buffer is used for all stream operations. The default size is + 1024 bytes. The minimum size is 128 bytes. You may get better performance + with a larger buffer. Then again, you might not. You would have to test + it. + + + + Set this before the first call to Read() or Write() on the + stream. If you try to set it afterwards, it will throw. + + + + + + The ZLIB strategy to be used during compression. + + + + By tweaking this parameter, you may be able to optimize the compression for + data with particular characteristics. + + + + Returns the total number of bytes input so far. + + + Returns the total number of bytes output so far. + + + + Dispose the stream. + + + + This may or may not result in a Close() call on the captive + stream. See the constructors that have a leaveOpen parameter + for more information. + + + Application code won't call this code directly. This method may be + invoked in two distinct scenarios. If disposing == true, the method + has been called directly or indirectly by a user's code, for example + via the public Dispose() method. In this case, both managed and + unmanaged resources can be referenced and disposed. If disposing == + false, the method has been called by the runtime from inside the + object finalizer and this method should not reference other objects; + in that case only unmanaged resources must be referenced or + disposed. + + + + true if the Dispose method was invoked by user code. + + + + + Indicates whether the stream can be read. + + + The return value depends on whether the captive stream supports reading. + + + + + Indicates whether the stream supports Seek operations. + + + Always returns false. + + + + + Indicates whether the stream can be written. + + + The return value depends on whether the captive stream supports writing. + + + + + Flush the stream. + + + + + Reading this property always throws a . + + + + + The position of the stream pointer. + + + + Setting this property always throws a . Reading will return the total bytes + written out, if used in writing, or the total bytes read in, if used in + reading. The count may refer to compressed bytes or uncompressed bytes, + depending on how you've used the stream. + + + + + Read data from the stream. + + + + + If you wish to use the DeflateStream to compress data while + reading, you can create a DeflateStream with + CompressionMode.Compress, providing an uncompressed data stream. + Then call Read() on that DeflateStream, and the data read will be + compressed as you read. If you wish to use the DeflateStream to + decompress data while reading, you can create a DeflateStream with + CompressionMode.Decompress, providing a readable compressed data + stream. Then call Read() on that DeflateStream, and the data read + will be decompressed as you read. + + + + A DeflateStream can be used for Read() or Write(), but not both. + + + + The buffer into which the read data should be placed. + the offset within that data array to put the first byte read. + the number of bytes to read. + the number of bytes actually read + + + + Calling this method always throws a . + + this is irrelevant, since it will always throw! + this is irrelevant, since it will always throw! + irrelevant! + + + + Calling this method always throws a . + + this is irrelevant, since it will always throw! + + + + Write data to the stream. + + + + + If you wish to use the DeflateStream to compress data while + writing, you can create a DeflateStream with + CompressionMode.Compress, and a writable output stream. Then call + Write() on that DeflateStream, providing uncompressed data + as input. The data sent to the output stream will be the compressed form + of the data written. If you wish to use the DeflateStream to + decompress data while writing, you can create a DeflateStream with + CompressionMode.Decompress, and a writable output stream. Then + call Write() on that stream, providing previously compressed + data. The data sent to the output stream will be the decompressed form of + the data written. + + + + A DeflateStream can be used for Read() or Write(), + but not both. + + + + + The buffer holding data to write to the stream. + the offset within that data array to find the first byte to write. + the number of bytes to write. + + + + Compress a string into a byte array using DEFLATE (RFC 1951). + + + + Uncompress it with . + + + DeflateStream.UncompressString(byte[]) + DeflateStream.CompressBuffer(byte[]) + GZipStream.CompressString(string) + ZlibStream.CompressString(string) + + + A string to compress. The string will first be encoded + using UTF8, then compressed. + + + The string in compressed form + + + + Compress a byte array into a new byte array using DEFLATE. + + + + Uncompress it with . + + + DeflateStream.CompressString(string) + DeflateStream.UncompressBuffer(byte[]) + GZipStream.CompressBuffer(byte[]) + ZlibStream.CompressBuffer(byte[]) + + + A buffer to compress. + + + The data in compressed form + + + + Uncompress a DEFLATE'd byte array into a single string. + + + DeflateStream.CompressString(String) + DeflateStream.UncompressBuffer(byte[]) + GZipStream.UncompressString(byte[]) + ZlibStream.UncompressString(byte[]) + + + A buffer containing DEFLATE-compressed data. + + + The uncompressed string + + + + Uncompress a DEFLATE'd byte array into a byte array. + + + DeflateStream.CompressBuffer(byte[]) + DeflateStream.UncompressString(byte[]) + GZipStream.UncompressBuffer(byte[]) + ZlibStream.UncompressBuffer(byte[]) + + + A buffer containing data that has been compressed with DEFLATE. + + + The data in uncompressed form + + + + A class for compressing and decompressing GZIP streams. + + + + + The GZipStream is a Decorator on a + . It adds GZIP compression or decompression to any + stream. + + + + Like the System.IO.Compression.GZipStream in the .NET Base Class Library, the + Ionic.Zlib.GZipStream can compress while writing, or decompress while + reading, but not vice versa. The compression method used is GZIP, which is + documented in IETF RFC + 1952, "GZIP file format specification version 4.3". + + + A GZipStream can be used to decompress data (through Read()) or + to compress data (through Write()), but not both. + + + + If you wish to use the GZipStream to compress data, you must wrap it + around a write-able stream. As you call Write() on the GZipStream, the + data will be compressed into the GZIP format. If you want to decompress data, + you must wrap the GZipStream around a readable stream that contains an + IETF RFC 1952-compliant stream. The data will be decompressed as you call + Read() on the GZipStream. + + + + Though the GZIP format allows data from multiple files to be concatenated + together, this stream handles only a single segment of GZIP format, typically + representing a single file. + + + + This class is similar to and . + ZlibStream handles RFC1950-compliant streams. + handles RFC1951-compliant streams. This class handles RFC1952-compliant streams. + + + + + + + + + + The comment on the GZIP stream. + + + + + The GZIP format allows for each file to optionally have an associated + comment stored with the file. The comment is encoded with the ISO-8859-1 + code page. To include a comment in a GZIP stream you create, set this + property before calling Write() for the first time on the + GZipStream. + + + + When using GZipStream to decompress, you can retrieve this property + after the first call to Read(). If no comment has been set in the + GZIP bytestream, the Comment property will return null + (Nothing in VB). + + + + + + The FileName for the GZIP stream. + + + + + + The GZIP format optionally allows each file to have an associated + filename. When compressing data (through Write()), set this + FileName before calling Write() the first time on the GZipStream. + The actual filename is encoded into the GZIP bytestream with the + ISO-8859-1 code page, according to RFC 1952. It is the application's + responsibility to insure that the FileName can be encoded and decoded + correctly with this code page. + + + + When decompressing (through Read()), you can retrieve this value + any time after the first Read(). In the case where there was no filename + encoded into the GZIP bytestream, the property will return null (Nothing + in VB). + + + + + + The last modified time for the GZIP stream. + + + + GZIP allows the storage of a last modified time with each GZIP entry. + When compressing data, you can set this before the first call to + Write(). When decompressing, you can retrieve this value any time + after the first call to Read(). + + + + + The CRC on the GZIP stream. + + + This is used for internal error checking. You probably don't need to look at this property. + + + + + Create a GZipStream using the specified CompressionMode. + + + + + When mode is CompressionMode.Compress, the GZipStream will use the + default compression level. + + + + As noted in the class documentation, the CompressionMode (Compress + or Decompress) also establishes the "direction" of the stream. A + GZipStream with CompressionMode.Compress works only through + Write(). A GZipStream with + CompressionMode.Decompress works only through Read(). + + + + + + This example shows how to use a GZipStream to compress data. + + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (var raw = System.IO.File.Create(outputFile)) + { + using (Stream compressor = new GZipStream(raw, CompressionMode.Compress)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n; + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + Dim outputFile As String = (fileToCompress & ".compressed") + Using input As Stream = File.OpenRead(fileToCompress) + Using raw As FileStream = File.Create(outputFile) + Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + End Using + + + + + This example shows how to use a GZipStream to uncompress a file. + + private void GunZipFile(string filename) + { + if (!filename.EndsWith(".gz)) + throw new ArgumentException("filename"); + var DecompressedFile = filename.Substring(0,filename.Length-3); + byte[] working = new byte[WORKING_BUFFER_SIZE]; + int n= 1; + using (System.IO.Stream input = System.IO.File.OpenRead(filename)) + { + using (Stream decompressor= new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, true)) + { + using (var output = System.IO.File.Create(DecompressedFile)) + { + while (n !=0) + { + n= decompressor.Read(working, 0, working.Length); + if (n > 0) + { + output.Write(working, 0, n); + } + } + } + } + } + } + + + + Private Sub GunZipFile(ByVal filename as String) + If Not (filename.EndsWith(".gz)) Then + Throw New ArgumentException("filename") + End If + Dim DecompressedFile as String = filename.Substring(0,filename.Length-3) + Dim working(WORKING_BUFFER_SIZE) as Byte + Dim n As Integer = 1 + Using input As Stream = File.OpenRead(filename) + Using decompressor As Stream = new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, True) + Using output As Stream = File.Create(UncompressedFile) + Do + n= decompressor.Read(working, 0, working.Length) + If n > 0 Then + output.Write(working, 0, n) + End IF + Loop While (n > 0) + End Using + End Using + End Using + End Sub + + + + The stream which will be read or written. + Indicates whether the GZipStream will compress or decompress. + + + + Create a GZipStream using the specified CompressionMode and + the specified CompressionLevel. + + + + + The CompressionMode (Compress or Decompress) also establishes the + "direction" of the stream. A GZipStream with + CompressionMode.Compress works only through Write(). A + GZipStream with CompressionMode.Decompress works only + through Read(). + + + + + + + This example shows how to use a GZipStream to compress a file into a .gz file. + + + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (var raw = System.IO.File.Create(fileToCompress + ".gz")) + { + using (Stream compressor = new GZipStream(raw, + CompressionMode.Compress, + CompressionLevel.BestCompression)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n; + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + + Using input As Stream = File.OpenRead(fileToCompress) + Using raw As FileStream = File.Create(fileToCompress & ".gz") + Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + End Using + + + The stream to be read or written while deflating or inflating. + Indicates whether the GZipStream will compress or decompress. + A tuning knob to trade speed for effectiveness. + + + + Create a GZipStream using the specified CompressionMode, and + explicitly specify whether the stream should be left open after Deflation + or Inflation. + + + + + This constructor allows the application to request that the captive stream + remain open after the deflation or inflation occurs. By default, after + Close() is called on the stream, the captive stream is also + closed. In some cases this is not desired, for example if the stream is a + memory stream that will be re-read after compressed data has been written + to it. Specify true for the parameter to leave + the stream open. + + + + The (Compress or Decompress) also + establishes the "direction" of the stream. A GZipStream with + CompressionMode.Compress works only through Write(). A GZipStream + with CompressionMode.Decompress works only through Read(). + + + + The GZipStream will use the default compression level. If you want + to specify the compression level, see . + + + + See the other overloads of this constructor for example code. + + + + + + The stream which will be read or written. This is called the "captive" + stream in other places in this documentation. + + + Indicates whether the GZipStream will compress or decompress. + + + + true if the application would like the base stream to remain open after + inflation/deflation. + + + + + Create a GZipStream using the specified CompressionMode and the + specified CompressionLevel, and explicitly specify whether the + stream should be left open after Deflation or Inflation. + + + + + + This constructor allows the application to request that the captive stream + remain open after the deflation or inflation occurs. By default, after + Close() is called on the stream, the captive stream is also + closed. In some cases this is not desired, for example if the stream is a + memory stream that will be re-read after compressed data has been written + to it. Specify true for the parameter to + leave the stream open. + + + + As noted in the class documentation, the CompressionMode (Compress + or Decompress) also establishes the "direction" of the stream. A + GZipStream with CompressionMode.Compress works only through + Write(). A GZipStream with CompressionMode.Decompress works only + through Read(). + + + + + + This example shows how to use a GZipStream to compress data. + + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (var raw = System.IO.File.Create(outputFile)) + { + using (Stream compressor = new GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, true)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n; + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + Dim outputFile As String = (fileToCompress & ".compressed") + Using input As Stream = File.OpenRead(fileToCompress) + Using raw As FileStream = File.Create(outputFile) + Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, True) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + End Using + + + The stream which will be read or written. + Indicates whether the GZipStream will compress or decompress. + true if the application would like the stream to remain open after inflation/deflation. + A tuning knob to trade speed for effectiveness. + + + + This property sets the flush behavior on the stream. + + + + + The size of the working buffer for the compression codec. + + + + + The working buffer is used for all stream operations. The default size is + 1024 bytes. The minimum size is 128 bytes. You may get better performance + with a larger buffer. Then again, you might not. You would have to test + it. + + + + Set this before the first call to Read() or Write() on the + stream. If you try to set it afterwards, it will throw. + + + + + Returns the total number of bytes input so far. + + + Returns the total number of bytes output so far. + + + + Dispose the stream. + + + + This may or may not result in a Close() call on the captive + stream. See the constructors that have a leaveOpen parameter + for more information. + + + This method may be invoked in two distinct scenarios. If disposing + == true, the method has been called directly or indirectly by a + user's code, for example via the public Dispose() method. In this + case, both managed and unmanaged resources can be referenced and + disposed. If disposing == false, the method has been called by the + runtime from inside the object finalizer and this method should not + reference other objects; in that case only unmanaged resources must + be referenced or disposed. + + + + indicates whether the Dispose method was invoked by user code. + + + + + Indicates whether the stream can be read. + + + The return value depends on whether the captive stream supports reading. + + + + + Indicates whether the stream supports Seek operations. + + + Always returns false. + + + + + Indicates whether the stream can be written. + + + The return value depends on whether the captive stream supports writing. + + + + + Flush the stream. + + + + + Reading this property always throws a . + + + + + The position of the stream pointer. + + + + Setting this property always throws a . Reading will return the total bytes + written out, if used in writing, or the total bytes read in, if used in + reading. The count may refer to compressed bytes or uncompressed bytes, + depending on how you've used the stream. + + + + + Read and decompress data from the source stream. + + + + With a GZipStream, decompression is done through reading. + + + + + byte[] working = new byte[WORKING_BUFFER_SIZE]; + using (System.IO.Stream input = System.IO.File.OpenRead(_CompressedFile)) + { + using (Stream decompressor= new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, true)) + { + using (var output = System.IO.File.Create(_DecompressedFile)) + { + int n; + while ((n= decompressor.Read(working, 0, working.Length)) !=0) + { + output.Write(working, 0, n); + } + } + } + } + + + The buffer into which the decompressed data should be placed. + the offset within that data array to put the first byte read. + the number of bytes to read. + the number of bytes actually read + + + + Calling this method always throws a . + + irrelevant; it will always throw! + irrelevant; it will always throw! + irrelevant! + + + + Calling this method always throws a . + + irrelevant; this method will always throw! + + + + Write data to the stream. + + + + + If you wish to use the GZipStream to compress data while writing, + you can create a GZipStream with CompressionMode.Compress, and a + writable output stream. Then call Write() on that GZipStream, + providing uncompressed data as input. The data sent to the output stream + will be the compressed form of the data written. + + + + A GZipStream can be used for Read() or Write(), but not + both. Writing implies compression. Reading implies decompression. + + + + The buffer holding data to write to the stream. + the offset within that data array to find the first byte to write. + the number of bytes to write. + + + + Compress a string into a byte array using GZip. + + + + Uncompress it with . + + + + + + + A string to compress. The string will first be encoded + using UTF8, then compressed. + + + The string in compressed form + + + + Compress a byte array into a new byte array using GZip. + + + + Uncompress it with . + + + + + + + A buffer to compress. + + + The data in compressed form + + + + Uncompress a GZip'ed byte array into a single string. + + + + + + + A buffer containing GZIP-compressed data. + + + The uncompressed string + + + + Uncompress a GZip'ed byte array into a byte array. + + + + + + + A buffer containing data that has been compressed with GZip. + + + The data in uncompressed form + + + + A class for compressing streams using the + Deflate algorithm with multiple threads. + + + + + This class performs DEFLATE compression through writing. For + more information on the Deflate algorithm, see IETF RFC 1951, + "DEFLATE Compressed Data Format Specification version 1.3." + + + + This class is similar to , except + that this class is for compression only, and this implementation uses an + approach that employs multiple worker threads to perform the DEFLATE. On + a multi-cpu or multi-core computer, the performance of this class can be + significantly higher than the single-threaded DeflateStream, particularly + for larger streams. How large? Anything over 10mb is a good candidate + for parallel compression. + + + + The tradeoff is that this class uses more memory and more CPU than the + vanilla DeflateStream, and also is less efficient as a compressor. For + large files the size of the compressed data stream can be less than 1% + larger than the size of a compressed data stream from the vanialla + DeflateStream. For smaller files the difference can be larger. The + difference will also be larger if you set the BufferSize to be lower than + the default value. Your mileage may vary. Finally, for small files, the + ParallelDeflateOutputStream can be much slower than the vanilla + DeflateStream, because of the overhead associated to using the thread + pool. + + + + + + + + Create a ParallelDeflateOutputStream. + + + + + This stream compresses data written into it via the DEFLATE + algorithm (see RFC 1951), and writes out the compressed byte stream. + + + + The instance will use the default compression level, the default + buffer sizes and the default number of threads and buffers per + thread. + + + + This class is similar to , + except that this implementation uses an approach that employs + multiple worker threads to perform the DEFLATE. On a multi-cpu or + multi-core computer, the performance of this class can be + significantly higher than the single-threaded DeflateStream, + particularly for larger streams. How large? Anything over 10mb is + a good candidate for parallel compression. + + + + + + + This example shows how to use a ParallelDeflateOutputStream to compress + data. It reads a file, compresses it, and writes the compressed data to + a second, output file. + + + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n= -1; + String outputFile = fileToCompress + ".compressed"; + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (var raw = System.IO.File.Create(outputFile)) + { + using (Stream compressor = new ParallelDeflateOutputStream(raw)) + { + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Dim outputFile As String = (fileToCompress & ".compressed") + Using input As Stream = File.OpenRead(fileToCompress) + Using raw As FileStream = File.Create(outputFile) + Using compressor As Stream = New ParallelDeflateOutputStream(raw) + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + End Using + + + The stream to which compressed data will be written. + + + + Create a ParallelDeflateOutputStream using the specified CompressionLevel. + + + See the + constructor for example code. + + The stream to which compressed data will be written. + A tuning knob to trade speed for effectiveness. + + + + Create a ParallelDeflateOutputStream and specify whether to leave the captive stream open + when the ParallelDeflateOutputStream is closed. + + + See the + constructor for example code. + + The stream to which compressed data will be written. + + true if the application would like the stream to remain open after inflation/deflation. + + + + + Create a ParallelDeflateOutputStream and specify whether to leave the captive stream open + when the ParallelDeflateOutputStream is closed. + + + See the + constructor for example code. + + The stream to which compressed data will be written. + A tuning knob to trade speed for effectiveness. + + true if the application would like the stream to remain open after inflation/deflation. + + + + + Create a ParallelDeflateOutputStream using the specified + CompressionLevel and CompressionStrategy, and specifying whether to + leave the captive stream open when the ParallelDeflateOutputStream is + closed. + + + See the + constructor for example code. + + The stream to which compressed data will be written. + A tuning knob to trade speed for effectiveness. + + By tweaking this parameter, you may be able to optimize the compression for + data with particular characteristics. + + + true if the application would like the stream to remain open after inflation/deflation. + + + + + The ZLIB strategy to be used during compression. + + + + + + The maximum number of buffer pairs to use. + + + + + This property sets an upper limit on the number of memory buffer + pairs to create. The implementation of this stream allocates + multiple buffers to facilitate parallel compression. As each buffer + fills up, this stream uses + ThreadPool.QueueUserWorkItem() + to compress those buffers in a background threadpool thread. After a + buffer is compressed, it is re-ordered and written to the output + stream. + + + + A higher number of buffer pairs enables a higher degree of + parallelism, which tends to increase the speed of compression on + multi-cpu computers. On the other hand, a higher number of buffer + pairs also implies a larger memory consumption, more active worker + threads, and a higher cpu utilization for any compression. This + property enables the application to limit its memory consumption and + CPU utilization behavior depending on requirements. + + + + For each compression "task" that occurs in parallel, there are 2 + buffers allocated: one for input and one for output. This property + sets a limit for the number of pairs. The total amount of storage + space allocated for buffering will then be (N*S*2), where N is the + number of buffer pairs, S is the size of each buffer (). By default, DotNetZip allocates 4 buffer + pairs per CPU core, so if your machine has 4 cores, and you retain + the default buffer size of 128k, then the + ParallelDeflateOutputStream will use 4 * 4 * 2 * 128kb of buffer + memory in total, or 4mb, in blocks of 128kb. If you then set this + property to 8, then the number will be 8 * 2 * 128kb of buffer + memory, or 2mb. + + + + CPU utilization will also go up with additional buffers, because a + larger number of buffer pairs allows a larger number of background + threads to compress in parallel. If you find that parallel + compression is consuming too much memory or CPU, you can adjust this + value downward. + + + + The default value is 16. Different values may deliver better or + worse results, depending on your priorities and the dynamic + performance characteristics of your storage and compute resources. + + + + This property is not the number of buffer pairs to use; it is an + upper limit. An illustration: Suppose you have an application that + uses the default value of this property (which is 16), and it runs + on a machine with 2 CPU cores. In that case, DotNetZip will allocate + 4 buffer pairs per CPU core, for a total of 8 pairs. The upper + limit specified by this property has no effect. + + + + The application can set this value at any time, but it is effective + only before the first call to Write(), which is when the buffers are + allocated. + + + + + + The size of the buffers used by the compressor threads. + + + + + The default buffer size is 128k. The application can set this value + at any time, but it is effective only before the first Write(). + + + + Larger buffer sizes implies larger memory consumption but allows + more efficient compression. Using smaller buffer sizes consumes less + memory but may result in less effective compression. For example, + using the default buffer size of 128k, the compression delivered is + within 1% of the compression delivered by the single-threaded . On the other hand, using a + BufferSize of 8k can result in a compressed data stream that is 5% + larger than that delivered by the single-threaded + DeflateStream. Excessively small buffer sizes can also cause + the speed of the ParallelDeflateOutputStream to drop, because of + larger thread scheduling overhead dealing with many many small + buffers. + + + + The total amount of storage space allocated for buffering will be + (N*S*2), where N is the number of buffer pairs, and S is the size of + each buffer (this property). There are 2 buffers used by the + compressor, one for input and one for output. By default, DotNetZip + allocates 4 buffer pairs per CPU core, so if your machine has 4 + cores, then the number of buffer pairs used will be 16. If you + accept the default value of this property, 128k, then the + ParallelDeflateOutputStream will use 16 * 2 * 128kb of buffer memory + in total, or 4mb, in blocks of 128kb. If you set this property to + 64kb, then the number will be 16 * 2 * 64kb of buffer memory, or + 2mb. + + + + + + + The CRC32 for the data that was written out, prior to compression. + + + This value is meaningful only after a call to Close(). + + + + + The total number of uncompressed bytes processed by the ParallelDeflateOutputStream. + + + This value is meaningful only after a call to Close(). + + + + + Write data to the stream. + + + + + + To use the ParallelDeflateOutputStream to compress data, create a + ParallelDeflateOutputStream with CompressionMode.Compress, passing a + writable output stream. Then call Write() on that + ParallelDeflateOutputStream, providing uncompressed data as input. The + data sent to the output stream will be the compressed form of the data + written. + + + + To decompress data, use the class. + + + + The buffer holding data to write to the stream. + the offset within that data array to find the first byte to write. + the number of bytes to write. + + + + Flush the stream. + + + + + Close the stream. + + + You must call Close on the stream to guarantee that all of the data written in has + been compressed, and the compressed data has been written out. + + + + Dispose the object + + + Because ParallelDeflateOutputStream is IDisposable, the + application must call this method when finished using the instance. + + + This method is generally called implicitly upon exit from + a using scope in C# (Using in VB). + + + + + The Dispose method + + indicates whether the Dispose method was invoked by user code. + + + + + Resets the stream for use with another stream. + + + Because the ParallelDeflateOutputStream is expensive to create, it + has been designed so that it can be recycled and re-used. You have + to call Close() on the stream first, then you can call Reset() on + it, to use it again on another stream. + + + + The new output stream for this era. + + + + + ParallelDeflateOutputStream deflater = null; + foreach (var inputFile in listOfFiles) + { + string outputFile = inputFile + ".compressed"; + using (System.IO.Stream input = System.IO.File.OpenRead(inputFile)) + { + using (var outStream = System.IO.File.Create(outputFile)) + { + if (deflater == null) + deflater = new ParallelDeflateOutputStream(outStream, + CompressionLevel.Best, + CompressionStrategy.Default, + true); + deflater.Reset(outStream); + + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + deflater.Write(buffer, 0, n); + } + } + } + } + + + + + + Indicates whether the stream supports Seek operations. + + + Always returns false. + + + + + Indicates whether the stream supports Read operations. + + + Always returns false. + + + + + Indicates whether the stream supports Write operations. + + + Returns true if the provided stream is writable. + + + + + Reading this property always throws a NotSupportedException. + + + + + Returns the current position of the output stream. + + + + Because the output gets written by a background thread, + the value may change asynchronously. Setting this + property always throws a NotSupportedException. + + + + + + This method always throws a NotSupportedException. + + + The buffer into which data would be read, IF THIS METHOD + ACTUALLY DID ANYTHING. + + + The offset within that data array at which to insert the + data that is read, IF THIS METHOD ACTUALLY DID + ANYTHING. + + + The number of bytes to write, IF THIS METHOD ACTUALLY DID + ANYTHING. + + nothing. + + + + This method always throws a NotSupportedException. + + + The offset to seek to.... + IF THIS METHOD ACTUALLY DID ANYTHING. + + + The reference specifying how to apply the offset.... IF + THIS METHOD ACTUALLY DID ANYTHING. + + nothing. It always throws. + + + + This method always throws a NotSupportedException. + + + The new value for the stream length.... IF + THIS METHOD ACTUALLY DID ANYTHING. + + + + + Map from a distance to a distance code. + + + No side effects. _dist_code[256] and _dist_code[257] are never used. + + + + + Describes how to flush the current deflate operation. + + + The different FlushType values are useful when using a Deflate in a streaming application. + + + + No flush at all. + + + Closes the current block, but doesn't flush it to + the output. Used internally only in hypothetical + scenarios. This was supposed to be removed by Zlib, but it is + still in use in some edge cases. + + + + + Use this during compression to specify that all pending output should be + flushed to the output buffer and the output should be aligned on a byte + boundary. You might use this in a streaming communication scenario, so that + the decompressor can get all input data available so far. When using this + with a ZlibCodec, AvailableBytesIn will be zero after the call if + enough output space has been provided before the call. Flushing will + degrade compression and so it should be used only when necessary. + + + + + Use this during compression to specify that all output should be flushed, as + with FlushType.Sync, but also, the compression state should be reset + so that decompression can restart from this point if previous compressed + data has been damaged or if random access is desired. Using + FlushType.Full too often can significantly degrade the compression. + + + + Signals the end of the compression/decompression stream. + + + + The compression level to be used when using a DeflateStream or ZlibStream with CompressionMode.Compress. + + + + + None means that the data will be simply stored, with no change at all. + If you are producing ZIPs for use on Mac OSX, be aware that archives produced with CompressionLevel.None + cannot be opened with the default zip reader. Use a different CompressionLevel. + + + + + Same as None. + + + + + The fastest but least effective compression. + + + + + A synonym for BestSpeed. + + + + + A little slower, but better, than level 1. + + + + + A little slower, but better, than level 2. + + + + + A little slower, but better, than level 3. + + + + + A little slower than level 4, but with better compression. + + + + + The default compression level, with a good balance of speed and compression efficiency. + + + + + A synonym for Default. + + + + + Pretty good compression! + + + + + Better compression than Level7! + + + + + The "best" compression, where best means greatest reduction in size of the input data stream. + This is also the slowest compression. + + + + + A synonym for BestCompression. + + + + + Describes options for how the compression algorithm is executed. Different strategies + work better on different sorts of data. The strategy parameter can affect the compression + ratio and the speed of compression but not the correctness of the compresssion. + + + + + The default strategy is probably the best for normal data. + + + + + The Filtered strategy is intended to be used most effectively with data produced by a + filter or predictor. By this definition, filtered data consists mostly of small + values with a somewhat random distribution. In this case, the compression algorithm + is tuned to compress them better. The effect of Filtered is to force more Huffman + coding and less string matching; it is a half-step between Default and HuffmanOnly. + + + + + Using HuffmanOnly will force the compressor to do Huffman encoding only, with no + string matching. + + + + + An enum to specify the direction of transcoding - whether to compress or decompress. + + + + + Used to specify that the stream should compress the data. + + + + + Used to specify that the stream should decompress the data. + + + + + A general purpose exception class for exceptions in the Zlib library. + + + + + The ZlibException class captures exception information generated + by the Zlib library. + + + + + This ctor collects a message attached to the exception. + + the message for the exception. + + + + Performs an unsigned bitwise right shift with the specified number + + Number to operate on + Ammount of bits to shift + The resulting number from the shift operation + + + + Reads a number of characters from the current source TextReader and writes + the data to the target array at the specified index. + + + The source TextReader to read from + Contains the array of characteres read from the source TextReader. + The starting index of the target array. + The maximum number of characters to read from the source TextReader. + + + The number of characters read. The number will be less than or equal to + count depending on the data available in the source TextReader. Returns -1 + if the end of the stream is reached. + + + + + Computes an Adler-32 checksum. + + + The Adler checksum is similar to a CRC checksum, but faster to compute, though less + reliable. It is used in producing RFC1950 compressed streams. The Adler checksum + is a required part of the "ZLIB" standard. Applications will almost never need to + use this class directly. + + + + + + + Calculates the Adler32 checksum. + + + + This is used within ZLIB. You probably don't need to use this directly. + + + + To compute an Adler32 checksum on a byte array: + + var adler = Adler.Adler32(0, null, 0, 0); + adler = Adler.Adler32(adler, buffer, index, length); + + + + + + Encoder and Decoder for ZLIB and DEFLATE (IETF RFC1950 and RFC1951). + + + + This class compresses and decompresses data according to the Deflate algorithm + and optionally, the ZLIB format, as documented in RFC 1950 - ZLIB and RFC 1951 - DEFLATE. + + + + + The buffer from which data is taken. + + + + + An index into the InputBuffer array, indicating where to start reading. + + + + + The number of bytes available in the InputBuffer, starting at NextIn. + + + Generally you should set this to InputBuffer.Length before the first Inflate() or Deflate() call. + The class will update this number as calls to Inflate/Deflate are made. + + + + + Total number of bytes read so far, through all calls to Inflate()/Deflate(). + + + + + Buffer to store output data. + + + + + An index into the OutputBuffer array, indicating where to start writing. + + + + + The number of bytes available in the OutputBuffer, starting at NextOut. + + + Generally you should set this to OutputBuffer.Length before the first Inflate() or Deflate() call. + The class will update this number as calls to Inflate/Deflate are made. + + + + + Total number of bytes written to the output so far, through all calls to Inflate()/Deflate(). + + + + + used for diagnostics, when something goes wrong! + + + + + The compression level to use in this codec. Useful only in compression mode. + + + + + The number of Window Bits to use. + + + This gauges the size of the sliding window, and hence the + compression effectiveness as well as memory consumption. It's best to just leave this + setting alone if you don't know what it is. The maximum value is 15 bits, which implies + a 32k window. + + + + + The compression strategy to use. + + + This is only effective in compression. The theory offered by ZLIB is that different + strategies could potentially produce significant differences in compression behavior + for different data sets. Unfortunately I don't have any good recommendations for how + to set it differently. When I tested changing the strategy I got minimally different + compression performance. It's best to leave this property alone if you don't have a + good feel for it. Or, you may want to produce a test harness that runs through the + different strategy options and evaluates them on different file types. If you do that, + let me know your results. + + + + + The Adler32 checksum on the data transferred through the codec so far. You probably don't need to look at this. + + + + + Create a ZlibCodec. + + + If you use this default constructor, you will later have to explicitly call + InitializeInflate() or InitializeDeflate() before using the ZlibCodec to compress + or decompress. + + + + + Create a ZlibCodec that either compresses or decompresses. + + + Indicates whether the codec should compress (deflate) or decompress (inflate). + + + + + Initialize the inflation state. + + + It is not necessary to call this before using the ZlibCodec to inflate data; + It is implicitly called when you call the constructor. + + Z_OK if everything goes well. + + + + Initialize the inflation state with an explicit flag to + govern the handling of RFC1950 header bytes. + + + + By default, the ZLIB header defined in RFC 1950 is expected. If + you want to read a zlib stream you should specify true for + expectRfc1950Header. If you have a deflate stream, you will want to specify + false. It is only necessary to invoke this initializer explicitly if you + want to specify false. + + + whether to expect an RFC1950 header byte + pair when reading the stream of data to be inflated. + + Z_OK if everything goes well. + + + + Initialize the ZlibCodec for inflation, with the specified number of window bits. + + The number of window bits to use. If you need to ask what that is, + then you shouldn't be calling this initializer. + Z_OK if all goes well. + + + + Initialize the inflation state with an explicit flag to govern the handling of + RFC1950 header bytes. + + + + If you want to read a zlib stream you should specify true for + expectRfc1950Header. In this case, the library will expect to find a ZLIB + header, as defined in RFC + 1950, in the compressed stream. If you will be reading a DEFLATE or + GZIP stream, which does not have such a header, you will want to specify + false. + + + whether to expect an RFC1950 header byte pair when reading + the stream of data to be inflated. + The number of window bits to use. If you need to ask what that is, + then you shouldn't be calling this initializer. + Z_OK if everything goes well. + + + + Inflate the data in the InputBuffer, placing the result in the OutputBuffer. + + + You must have set InputBuffer and OutputBuffer, NextIn and NextOut, and AvailableBytesIn and + AvailableBytesOut before calling this method. + + + + private void InflateBuffer() + { + int bufferSize = 1024; + byte[] buffer = new byte[bufferSize]; + ZlibCodec decompressor = new ZlibCodec(); + + Console.WriteLine("\n============================================"); + Console.WriteLine("Size of Buffer to Inflate: {0} bytes.", CompressedBytes.Length); + MemoryStream ms = new MemoryStream(DecompressedBytes); + + int rc = decompressor.InitializeInflate(); + + decompressor.InputBuffer = CompressedBytes; + decompressor.NextIn = 0; + decompressor.AvailableBytesIn = CompressedBytes.Length; + + decompressor.OutputBuffer = buffer; + + // pass 1: inflate + do + { + decompressor.NextOut = 0; + decompressor.AvailableBytesOut = buffer.Length; + rc = decompressor.Inflate(FlushType.None); + + if (rc != ZlibConstants.Z_OK && rc != ZlibConstants.Z_STREAM_END) + throw new Exception("inflating: " + decompressor.Message); + + ms.Write(decompressor.OutputBuffer, 0, buffer.Length - decompressor.AvailableBytesOut); + } + while (decompressor.AvailableBytesIn > 0 || decompressor.AvailableBytesOut == 0); + + // pass 2: finish and flush + do + { + decompressor.NextOut = 0; + decompressor.AvailableBytesOut = buffer.Length; + rc = decompressor.Inflate(FlushType.Finish); + + if (rc != ZlibConstants.Z_STREAM_END && rc != ZlibConstants.Z_OK) + throw new Exception("inflating: " + decompressor.Message); + + if (buffer.Length - decompressor.AvailableBytesOut > 0) + ms.Write(buffer, 0, buffer.Length - decompressor.AvailableBytesOut); + } + while (decompressor.AvailableBytesIn > 0 || decompressor.AvailableBytesOut == 0); + + decompressor.EndInflate(); + } + + + + The flush to use when inflating. + Z_OK if everything goes well. + + + + Ends an inflation session. + + + Call this after successively calling Inflate(). This will cause all buffers to be flushed. + After calling this you cannot call Inflate() without a intervening call to one of the + InitializeInflate() overloads. + + Z_OK if everything goes well. + + + + I don't know what this does! + + Z_OK if everything goes well. + + + + Initialize the ZlibCodec for deflation operation. + + + The codec will use the MAX window bits and the default level of compression. + + + + int bufferSize = 40000; + byte[] CompressedBytes = new byte[bufferSize]; + byte[] DecompressedBytes = new byte[bufferSize]; + + ZlibCodec compressor = new ZlibCodec(); + + compressor.InitializeDeflate(CompressionLevel.Default); + + compressor.InputBuffer = System.Text.ASCIIEncoding.ASCII.GetBytes(TextToCompress); + compressor.NextIn = 0; + compressor.AvailableBytesIn = compressor.InputBuffer.Length; + + compressor.OutputBuffer = CompressedBytes; + compressor.NextOut = 0; + compressor.AvailableBytesOut = CompressedBytes.Length; + + while (compressor.TotalBytesIn != TextToCompress.Length && compressor.TotalBytesOut < bufferSize) + { + compressor.Deflate(FlushType.None); + } + + while (true) + { + int rc= compressor.Deflate(FlushType.Finish); + if (rc == ZlibConstants.Z_STREAM_END) break; + } + + compressor.EndDeflate(); + + + + Z_OK if all goes well. You generally don't need to check the return code. + + + + Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel. + + + The codec will use the maximum window bits (15) and the specified + CompressionLevel. It will emit a ZLIB stream as it compresses. + + The compression level for the codec. + Z_OK if all goes well. + + + + Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel, + and the explicit flag governing whether to emit an RFC1950 header byte pair. + + + The codec will use the maximum window bits (15) and the specified CompressionLevel. + If you want to generate a zlib stream, you should specify true for + wantRfc1950Header. In this case, the library will emit a ZLIB + header, as defined in RFC + 1950, in the compressed stream. + + The compression level for the codec. + whether to emit an initial RFC1950 byte pair in the compressed stream. + Z_OK if all goes well. + + + + Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel, + and the specified number of window bits. + + + The codec will use the specified number of window bits and the specified CompressionLevel. + + The compression level for the codec. + the number of window bits to use. If you don't know what this means, don't use this method. + Z_OK if all goes well. + + + + Initialize the ZlibCodec for deflation operation, using the specified + CompressionLevel, the specified number of window bits, and the explicit flag + governing whether to emit an RFC1950 header byte pair. + + + The compression level for the codec. + whether to emit an initial RFC1950 byte pair in the compressed stream. + the number of window bits to use. If you don't know what this means, don't use this method. + Z_OK if all goes well. + + + + Deflate one batch of data. + + + You must have set InputBuffer and OutputBuffer before calling this method. + + + + private void DeflateBuffer(CompressionLevel level) + { + int bufferSize = 1024; + byte[] buffer = new byte[bufferSize]; + ZlibCodec compressor = new ZlibCodec(); + + Console.WriteLine("\n============================================"); + Console.WriteLine("Size of Buffer to Deflate: {0} bytes.", UncompressedBytes.Length); + MemoryStream ms = new MemoryStream(); + + int rc = compressor.InitializeDeflate(level); + + compressor.InputBuffer = UncompressedBytes; + compressor.NextIn = 0; + compressor.AvailableBytesIn = UncompressedBytes.Length; + + compressor.OutputBuffer = buffer; + + // pass 1: deflate + do + { + compressor.NextOut = 0; + compressor.AvailableBytesOut = buffer.Length; + rc = compressor.Deflate(FlushType.None); + + if (rc != ZlibConstants.Z_OK && rc != ZlibConstants.Z_STREAM_END) + throw new Exception("deflating: " + compressor.Message); + + ms.Write(compressor.OutputBuffer, 0, buffer.Length - compressor.AvailableBytesOut); + } + while (compressor.AvailableBytesIn > 0 || compressor.AvailableBytesOut == 0); + + // pass 2: finish and flush + do + { + compressor.NextOut = 0; + compressor.AvailableBytesOut = buffer.Length; + rc = compressor.Deflate(FlushType.Finish); + + if (rc != ZlibConstants.Z_STREAM_END && rc != ZlibConstants.Z_OK) + throw new Exception("deflating: " + compressor.Message); + + if (buffer.Length - compressor.AvailableBytesOut > 0) + ms.Write(buffer, 0, buffer.Length - compressor.AvailableBytesOut); + } + while (compressor.AvailableBytesIn > 0 || compressor.AvailableBytesOut == 0); + + compressor.EndDeflate(); + + ms.Seek(0, SeekOrigin.Begin); + CompressedBytes = new byte[compressor.TotalBytesOut]; + ms.Read(CompressedBytes, 0, CompressedBytes.Length); + } + + + whether to flush all data as you deflate. Generally you will want to + use Z_NO_FLUSH here, in a series of calls to Deflate(), and then call EndDeflate() to + flush everything. + + Z_OK if all goes well. + + + + End a deflation session. + + + Call this after making a series of one or more calls to Deflate(). All buffers are flushed. + + Z_OK if all goes well. + + + + Reset a codec for another deflation session. + + + Call this to reset the deflation state. For example if a thread is deflating + non-consecutive blocks, you can call Reset() after the Deflate(Sync) of the first + block and before the next Deflate(None) of the second block. + + Z_OK if all goes well. + + + + Set the CompressionStrategy and CompressionLevel for a deflation session. + + the level of compression to use. + the strategy to use for compression. + Z_OK if all goes well. + + + + Set the dictionary to be used for either Inflation or Deflation. + + The dictionary bytes to use. + Z_OK if all goes well. + + + + Set the dictionary to be used for either Inflation or Deflation unconditionally. + + Decoding a MSZip file requires the dictionary state to be set unconditionally + at the end of each block to the previous decoded data + The dictionary bytes to use. + Z_OK if all goes well. + + + + A bunch of constants used in the Zlib interface. + + + + + The maximum number of window bits for the Deflate algorithm. + + + + + The default number of window bits for the Deflate algorithm. + + + + + indicates everything is A-OK + + + + + Indicates that the last operation reached the end of the stream. + + + + + The operation ended in need of a dictionary. + + + + + There was an error with the stream - not enough data, not open and readable, etc. + + + + + There was an error with the data - not enough data, bad data, etc. + + + + + There was an error with the working buffer. + + + + + The size of the working buffer used in the ZlibCodec class. + + + + + The minimum size of the working buffer used in the ZlibCodec class. + + + + + Represents a Zlib stream for compression or decompression. + + + + + The ZlibStream is a Decorator on a . It adds ZLIB compression or decompression to any + stream. + + + Using this stream, applications can compress or decompress data via + stream Read() and Write() operations. Either compresssion or + decompression can occur through either reading or writing. The compression + format used is ZLIB, which is documented in IETF RFC 1950, "ZLIB Compressed + Data Format Specification version 3.3". This implementation of ZLIB always uses + DEFLATE as the compression method. (see IETF RFC 1951, "DEFLATE + Compressed Data Format Specification version 1.3.") + + + The ZLIB format allows for varying compression methods, window sizes, and dictionaries. + This implementation always uses the DEFLATE compression method, a preset dictionary, + and 15 window bits by default. + + + + This class is similar to , except that it adds the + RFC1950 header and trailer bytes to a compressed stream when compressing, or expects + the RFC1950 header and trailer bytes when decompressing. It is also similar to the + . + + + + + + + + Create a ZlibStream using the specified CompressionMode. + + + + + When mode is CompressionMode.Compress, the ZlibStream + will use the default compression level. The "captive" stream will be + closed when the ZlibStream is closed. + + + + + + This example uses a ZlibStream to compress a file, and writes the + compressed data to another file. + + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (var raw = System.IO.File.Create(fileToCompress + ".zlib")) + { + using (Stream compressor = new ZlibStream(raw, CompressionMode.Compress)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n; + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + Using input As Stream = File.OpenRead(fileToCompress) + Using raw As FileStream = File.Create(fileToCompress & ".zlib") + Using compressor As Stream = New ZlibStream(raw, CompressionMode.Compress) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + End Using + + + + The stream which will be read or written. + Indicates whether the ZlibStream will compress or decompress. + + + + Create a ZlibStream using the specified CompressionMode and + the specified CompressionLevel. + + + + + + When mode is CompressionMode.Decompress, the level parameter is ignored. + The "captive" stream will be closed when the ZlibStream is closed. + + + + + + This example uses a ZlibStream to compress data from a file, and writes the + compressed data to another file. + + + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (var raw = System.IO.File.Create(fileToCompress + ".zlib")) + { + using (Stream compressor = new ZlibStream(raw, + CompressionMode.Compress, + CompressionLevel.BestCompression)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n; + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + compressor.Write(buffer, 0, n); + } + } + } + } + + + + Using input As Stream = File.OpenRead(fileToCompress) + Using raw As FileStream = File.Create(fileToCompress & ".zlib") + Using compressor As Stream = New ZlibStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + End Using + + + + The stream to be read or written while deflating or inflating. + Indicates whether the ZlibStream will compress or decompress. + A tuning knob to trade speed for effectiveness. + + + + Create a ZlibStream using the specified CompressionMode, and + explicitly specify whether the captive stream should be left open after + Deflation or Inflation. + + + + + + When mode is CompressionMode.Compress, the ZlibStream will use + the default compression level. + + + + This constructor allows the application to request that the captive stream + remain open after the deflation or inflation occurs. By default, after + Close() is called on the stream, the captive stream is also + closed. In some cases this is not desired, for example if the stream is a + that will be re-read after + compression. Specify true for the parameter to leave the stream + open. + + + + See the other overloads of this constructor for example code. + + + + + The stream which will be read or written. This is called the + "captive" stream in other places in this documentation. + Indicates whether the ZlibStream will compress or decompress. + true if the application would like the stream to remain + open after inflation/deflation. + + + + Create a ZlibStream using the specified CompressionMode + and the specified CompressionLevel, and explicitly specify + whether the stream should be left open after Deflation or Inflation. + + + + + + This constructor allows the application to request that the captive + stream remain open after the deflation or inflation occurs. By + default, after Close() is called on the stream, the captive + stream is also closed. In some cases this is not desired, for example + if the stream is a that will be + re-read after compression. Specify true for the parameter to leave the stream open. + + + + When mode is CompressionMode.Decompress, the level parameter is + ignored. + + + + + + + This example shows how to use a ZlibStream to compress the data from a file, + and store the result into another file. The filestream remains open to allow + additional data to be written to it. + + + using (var output = System.IO.File.Create(fileToCompress + ".zlib")) + { + using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress)) + { + using (Stream compressor = new ZlibStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, true)) + { + byte[] buffer = new byte[WORKING_BUFFER_SIZE]; + int n; + while ((n= input.Read(buffer, 0, buffer.Length)) != 0) + { + compressor.Write(buffer, 0, n); + } + } + } + // can write additional data to the output stream here + } + + + Using output As FileStream = File.Create(fileToCompress & ".zlib") + Using input As Stream = File.OpenRead(fileToCompress) + Using compressor As Stream = New ZlibStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, True) + Dim buffer As Byte() = New Byte(4096) {} + Dim n As Integer = -1 + Do While (n <> 0) + If (n > 0) Then + compressor.Write(buffer, 0, n) + End If + n = input.Read(buffer, 0, buffer.Length) + Loop + End Using + End Using + ' can write additional data to the output stream here. + End Using + + + + The stream which will be read or written. + + Indicates whether the ZlibStream will compress or decompress. + + + true if the application would like the stream to remain open after + inflation/deflation. + + + + A tuning knob to trade speed for effectiveness. This parameter is + effective only when mode is CompressionMode.Compress. + + + + + This property sets the flush behavior on the stream. + Sorry, though, not sure exactly how to describe all the various settings. + + + + + The size of the working buffer for the compression codec. + + + + + The working buffer is used for all stream operations. The default size is + 1024 bytes. The minimum size is 128 bytes. You may get better performance + with a larger buffer. Then again, you might not. You would have to test + it. + + + + Set this before the first call to Read() or Write() on the + stream. If you try to set it afterwards, it will throw. + + + + + Returns the total number of bytes input so far. + + + Returns the total number of bytes output so far. + + + + Dispose the stream. + + + + This may or may not result in a Close() call on the captive + stream. See the constructors that have a leaveOpen parameter + for more information. + + + This method may be invoked in two distinct scenarios. If disposing + == true, the method has been called directly or indirectly by a + user's code, for example via the public Dispose() method. In this + case, both managed and unmanaged resources can be referenced and + disposed. If disposing == false, the method has been called by the + runtime from inside the object finalizer and this method should not + reference other objects; in that case only unmanaged resources must + be referenced or disposed. + + + + indicates whether the Dispose method was invoked by user code. + + + + + Indicates whether the stream can be read. + + + The return value depends on whether the captive stream supports reading. + + + + + Indicates whether the stream supports Seek operations. + + + Always returns false. + + + + + Indicates whether the stream can be written. + + + The return value depends on whether the captive stream supports writing. + + + + + Flush the stream. + + + + + Reading this property always throws a . + + + + + The position of the stream pointer. + + + + Setting this property always throws a . Reading will return the total bytes + written out, if used in writing, or the total bytes read in, if used in + reading. The count may refer to compressed bytes or uncompressed bytes, + depending on how you've used the stream. + + + + + Read data from the stream. + + + + + + If you wish to use the ZlibStream to compress data while reading, + you can create a ZlibStream with CompressionMode.Compress, + providing an uncompressed data stream. Then call Read() on that + ZlibStream, and the data read will be compressed. If you wish to + use the ZlibStream to decompress data while reading, you can create + a ZlibStream with CompressionMode.Decompress, providing a + readable compressed data stream. Then call Read() on that + ZlibStream, and the data will be decompressed as it is read. + + + + A ZlibStream can be used for Read() or Write(), but + not both. + + + + + + The buffer into which the read data should be placed. + + + the offset within that data array to put the first byte read. + + the number of bytes to read. + + the number of bytes read + + + + Calling this method always throws a . + + + The offset to seek to.... + IF THIS METHOD ACTUALLY DID ANYTHING. + + + The reference specifying how to apply the offset.... IF + THIS METHOD ACTUALLY DID ANYTHING. + + + nothing. This method always throws. + + + + Calling this method always throws a . + + + The new value for the stream length.... IF + THIS METHOD ACTUALLY DID ANYTHING. + + + + + Write data to the stream. + + + + + + If you wish to use the ZlibStream to compress data while writing, + you can create a ZlibStream with CompressionMode.Compress, + and a writable output stream. Then call Write() on that + ZlibStream, providing uncompressed data as input. The data sent to + the output stream will be the compressed form of the data written. If you + wish to use the ZlibStream to decompress data while writing, you + can create a ZlibStream with CompressionMode.Decompress, and a + writable output stream. Then call Write() on that stream, + providing previously compressed data. The data sent to the output stream + will be the decompressed form of the data written. + + + + A ZlibStream can be used for Read() or Write(), but not both. + + + The buffer holding data to write to the stream. + the offset within that data array to find the first byte to write. + the number of bytes to write. + + + + Compress a string into a byte array using ZLIB. + + + + Uncompress it with . + + + + + + + + A string to compress. The string will first be encoded + using UTF8, then compressed. + + + The string in compressed form + + + + Compress a byte array into a new byte array using ZLIB. + + + + Uncompress it with . + + + + + + + A buffer to compress. + + + The data in compressed form + + + + Uncompress a ZLIB-compressed byte array into a single string. + + + + + + + A buffer containing ZLIB-compressed data. + + + The uncompressed string + + + + Uncompress a ZLIB-compressed byte array into a byte array. + + + + + + + A buffer containing ZLIB-compressed data. + + + The data in uncompressed form + + + + This class exposes a set of COM-accessible wrappers for static + methods available on the ZipFile class. You don't need this + class unless you are using DotNetZip from a COM environment. + + + + + A wrapper for ZipFile.IsZipFile(string) + + The filename to of the zip file to check. + true if the file contains a valid zip file. + + + + A wrapper for ZipFile.IsZipFile(string, bool) + + + We cannot use "overloaded" Method names in COM interop. + So, here, we use a unique name. + + The filename to of the zip file to check. + true if the file contains a valid zip file. + + + + A wrapper for ZipFile.CheckZip(string) + + The filename to of the zip file to check. + + true if the named zip file checks OK. Otherwise, false. + + + + A COM-friendly wrapper for the static method . + + + The filename to of the zip file to check. + + The password to check. + + true if the named zip file checks OK. Otherwise, false. + + + + A wrapper for ZipFile.FixZipDirectory(string) + + The filename to of the zip file to fix. + + + + A wrapper for ZipFile.LibraryVersion + + + the version number on the DotNetZip assembly, formatted as a string. + + + + + An enum that provides the various encryption algorithms supported by this + library. + + + + + + PkzipWeak implies the use of Zip 2.0 encryption, which is known to be + weak and subvertible. + + + + A note on interoperability: Values of PkzipWeak and None are + specified in PKWARE's zip + specification, and are considered to be "standard". Zip archives + produced using these options will be interoperable with many other zip tools + and libraries, including Windows Explorer. + + + + Values of WinZipAes128 and WinZipAes256 are not part of the Zip + specification, but rather imply the use of a vendor-specific extension from + WinZip. If you want to produce interoperable Zip archives, do not use these + values. For example, if you produce a zip archive using WinZipAes256, you + will be able to open it in Windows Explorer on Windows XP and Vista, but you + will not be able to extract entries; trying this will lead to an "unspecified + error". For this reason, some people have said that a zip archive that uses + WinZip's AES encryption is not actually a zip archive at all. A zip archive + produced this way will be readable with the WinZip tool (Version 11 and + beyond). + + + + There are other third-party tools and libraries, both commercial and + otherwise, that support WinZip's AES encryption. These will be able to read + AES-encrypted zip archives produced by DotNetZip, and conversely applications + that use DotNetZip to read zip archives will be able to read AES-encrypted + archives produced by those tools or libraries. Consult the documentation for + those other tools and libraries to find out if WinZip's AES encryption is + supported. + + + + In case you care: According to the WinZip specification, the + actual AES key used is derived from the via an + algorithm that complies with RFC 2898, using an iteration + count of 1000. The algorithm is sometimes referred to as PBKDF2, which stands + for "Password Based Key Derivation Function #2". + + + + A word about password strength and length: The AES encryption technology is + very good, but any system is only as secure as the weakest link. If you want + to secure your data, be sure to use a password that is hard to guess. To make + it harder to guess (increase its "entropy"), you should make it longer. If + you use normal characters from an ASCII keyboard, a password of length 20 will + be strong enough that it will be impossible to guess. For more information on + that, I'd encourage you to read this + article. + + + + + + + No encryption at all. + + + + + Traditional or Classic pkzip encryption. + + + + + WinZip AES encryption (128 key bits). + + + + + WinZip AES encryption (256 key bits). + + + + + An encryption algorithm that is not supported by DotNetZip. + + + + + Delegate in which the application writes the ZipEntry content for the named entry. + + + The name of the entry that must be written. + The stream to which the entry data should be written. + + + When you add an entry and specify a WriteDelegate, via , the application + code provides the logic that writes the entry data directly into the zip file. + + + + + This example shows how to define a WriteDelegate that obtains a DataSet, and then + writes the XML for the DataSet into the zip archive. There's no need to + save the XML to a disk file first. + + + private void WriteEntry (String filename, Stream output) + { + DataSet ds1 = ObtainDataSet(); + ds1.WriteXml(output); + } + + private void Run() + { + using (var zip = new ZipFile()) + { + zip.AddEntry(zipEntryName, WriteEntry); + zip.Save(zipFileName); + } + } + + + + Private Sub WriteEntry (ByVal filename As String, ByVal output As Stream) + DataSet ds1 = ObtainDataSet() + ds1.WriteXml(stream) + End Sub + + Public Sub Run() + Using zip = New ZipFile + zip.AddEntry(zipEntryName, New WriteDelegate(AddressOf WriteEntry)) + zip.Save(zipFileName) + End Using + End Sub + + + + + + + Delegate in which the application opens the stream, just-in-time, for the named entry. + + + + The name of the ZipEntry that the application should open the stream for. + + + + When you add an entry via , the application code provides the logic that + opens and closes the stream for the given ZipEntry. + + + + + + + Delegate in which the application closes the stream, just-in-time, for the named entry. + + + + The name of the ZipEntry that the application should close the stream for. + + + The stream to be closed. + + + When you add an entry via , the application code provides the logic that + opens and closes the stream for the given ZipEntry. + + + + + + + Delegate for the callback by which the application tells the + library the CompressionLevel to use for a file. + + + + + Using this callback, the application can, for example, specify that + previously-compressed files (.mp3, .png, .docx, etc) should use a + CompressionLevel of None, or can set the compression level based + on any other factor. + + + + + + + In an EventArgs type, indicates which sort of progress event is being + reported. + + + There are events for reading, events for saving, and events for + extracting. This enumeration allows a single EventArgs type to be sued to + describe one of multiple subevents. For example, a SaveProgress event is + invoked before, after, and during the saving of a single entry. The value + of an enum with this type, specifies which event is being triggered. The + same applies to Extraction, Reading and Adding events. + + + + + Indicates that a Add() operation has started. + + + + + Indicates that an individual entry in the archive has been added. + + + + + Indicates that a Add() operation has completed. + + + + + Indicates that a Read() operation has started. + + + + + Indicates that an individual entry in the archive is about to be read. + + + + + Indicates that an individual entry in the archive has just been read. + + + + + Indicates that a Read() operation has completed. + + + + + The given event reports the number of bytes read so far + during a Read() operation. + + + + + Indicates that a Save() operation has started. + + + + + Indicates that an individual entry in the archive is about to be written. + + + + + Indicates that an individual entry in the archive has just been saved. + + + + + Indicates that a Save() operation has completed. + + + + + Indicates that the zip archive has been created in a + temporary location during a Save() operation. + + + + + Indicates that the temporary file is about to be renamed to the final archive + name during a Save() operation. + + + + + Indicates that the temporary file is has just been renamed to the final archive + name during a Save() operation. + + + + + Indicates that the self-extracting archive has been compiled + during a Save() operation. + + + + + The given event is reporting the number of source bytes that have run through the compressor so far + during a Save() operation. + + + + + Indicates that an entry is about to be extracted. + + + + + Indicates that an entry has just been extracted. + + + + + Indicates that extraction of an entry would overwrite an existing + filesystem file. You must use + + ExtractExistingFileAction.InvokeExtractProgressEvent in the call + to ZipEntry.Extract() in order to receive this event. + + + + + The given event is reporting the number of bytes written so far for + the current entry during an Extract() operation. + + + + + Indicates that an ExtractAll operation is about to begin. + + + + + Indicates that an ExtractAll operation has completed. + + + + + Indicates that an error has occurred while saving a zip file. + This generally means the file cannot be opened, because it has been + removed, or because it is locked by another process. It can also + mean that the file cannot be Read, because of a range lock conflict. + + + + + Provides information about the progress of a save, read, or extract operation. + This is a base class; you will probably use one of the classes derived from this one. + + + + + The total number of entries to be saved or extracted. + + + + + The name of the last entry saved or extracted. + + + + + In an event handler, set this to cancel the save or extract + operation that is in progress. + + + + + The type of event being reported. + + + + + Returns the archive name associated to this event. + + + + + The number of bytes read or written so far for this entry. + + + + + Total number of bytes that will be read or written for this entry. + This number will be -1 if the value cannot be determined. + + + + + Provides information about the progress of a Read operation. + + + + + Provides information about the progress of a Add operation. + + + + + Provides information about the progress of a save operation. + + + + + Constructor for the SaveProgressEventArgs. + + the name of the zip archive. + whether this is before saving the entry, or after + The total number of entries in the zip archive. + Number of entries that have been saved. + The entry involved in the event. + + + + Number of entries saved so far. + + + + + Provides information about the progress of the extract operation. + + + + + Constructor for the ExtractProgressEventArgs. + + the name of the zip archive. + whether this is before saving the entry, or after + The total number of entries in the zip archive. + Number of entries that have been extracted. + The entry involved in the event. + The location to which entries are extracted. + + + + Number of entries extracted so far. This is set only if the + EventType is Extracting_BeforeExtractEntry or Extracting_AfterExtractEntry, and + the Extract() is occurring witin the scope of a call to ExtractAll(). + + + + + Returns the extraction target location, a filesystem path. + + + + + Provides information about the an error that occurred while zipping. + + + + + Returns the exception that occurred, if any. + + + + + Returns the name of the file that caused the exception, if any. + + + + + Issued when an ZipEntry.ExtractWithPassword() method is invoked + with an incorrect password. + + + + + Default ctor. + + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + The innerException for this exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The serialization info for the exception. + The streaming context from which to deserialize. + + + + Indicates that a read was attempted on a stream, and bad or incomplete data was + received. + + + + + Default ctor. + + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + The innerException for this exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The serialization info for the exception. + The streaming context from which to deserialize. + + + + Issued when an CRC check fails upon extracting an entry from a zip archive. + + + + + Default ctor. + + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The serialization info for the exception. + The streaming context from which to deserialize. + + + + Issued when errors occur saving a self-extracting archive. + + + + + Default ctor. + + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The serialization info for the exception. + The streaming context from which to deserialize. + + + + Indicates that an operation was attempted on a ZipFile which was not possible + given the state of the instance. For example, if you call Save() on a ZipFile + which has no filename set, you can get this exception. + + + + + Default ctor. + + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + The innerException for this exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The serialization info for the exception. + The streaming context from which to deserialize. + + + + Base class for all exceptions defined by and throw by the Zip library. + + + + + Default ctor. + + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The message in the exception. + The innerException for this exception. + + + + Come on, you know how exceptions work. Why are you looking at this documentation? + + The serialization info for the exception. + The streaming context from which to deserialize. + + + + An enum for the options when extracting an entry would overwrite an existing file. + + + + + This enum describes the actions that the library can take when an + Extract() or ExtractWithPassword() method is called to extract an + entry to a filesystem, and the extraction would overwrite an existing filesystem + file. + + + + + + + Throw an exception when extraction would overwrite an existing file. (For + COM clients, this is a 0 (zero).) + + + + + When extraction would overwrite an existing file, overwrite the file silently. + The overwrite will happen even if the target file is marked as read-only. + (For COM clients, this is a 1.) + + + + + When extraction would overwrite an existing file, don't overwrite the file, silently. + (For COM clients, this is a 2.) + + + + + When extraction would overwrite an existing file, invoke the ExtractProgress + event, using an event type of . In + this way, the application can decide, just-in-time, whether to overwrite the + file. For example, a GUI application may wish to pop up a dialog to allow + the user to choose. You may want to examine the property before making + the decision. If, after your processing in the Extract progress event, you + want to NOT extract the file, set + on the ZipProgressEventArgs.CurrentEntry to DoNotOverwrite. + If you do want to extract the file, set ZipEntry.ExtractExistingFile + to OverwriteSilently. If you want to cancel the Extraction, set + ZipProgressEventArgs.Cancel to true. Cancelling differs from using + DoNotOverwrite in that a cancel will not extract any further entries, if + there are any. (For COM clients, the value of this enum is a 3.) + + + + + Collects general purpose utility methods. + + + + private null constructor + + + + Utility routine for transforming path names from filesystem format (on Windows that means backslashes) to + a format suitable for use within zipfiles. This means trimming the volume letter and colon (if any) And + swapping backslashes for forward slashes. + + source path. + transformed path + + + + Sanitize paths in zip files. This means making sure that relative paths in a zip file don't go outside + the top directory. Entries like something/../../../../Temp/evil.txt get sanitized to Temp/evil.txt + when extracting + + A path with forward slashes as directory separator + sanitized path + + + + Finds a signature in the zip stream. This is useful for finding + the end of a zip entry, for example, or the beginning of the next ZipEntry. + + + + + Scans through 64k at a time. + + + + If the method fails to find the requested signature, the stream Position + after completion of this method is unchanged. If the method succeeds in + finding the requested signature, the stream position after completion is + direct AFTER the signature found in the stream. + + + + The stream to search + The 4-byte signature to find + The number of bytes read + + + + Create a pseudo-random filename, suitable for use as a temporary + file, and open it. + + + + This method produces a filename of the form + DotNetZip-xxxxxxxx.tmp, where xxxxxxxx is replaced by randomly + chosen characters, and creates that file. + + + + + + Workitem 7889: handle ERROR_LOCK_VIOLATION during read + + + This could be gracefully handled with an extension attribute, but + This assembly used to be built for .NET 2.0, so could not use + extension methods. + + + + + A decorator stream. It wraps another stream, and performs bookkeeping + to keep track of the stream Position. + + + + In some cases, it is not possible to get the Position of a stream, let's + say, on a write-only output stream like ASP.NET's + Response.OutputStream, or on a different write-only stream + provided as the destination for the zip by the application. In this + case, programmers can use this counting stream to count the bytes read + or written. + + + Consider the scenario of an application that saves a self-extracting + archive (SFX), that uses a custom SFX stub. + + + Saving to a filesystem file, the application would open the + filesystem file (getting a FileStream), save the custom sfx stub + into it, and then call ZipFile.Save(), specifying the same + FileStream. ZipFile.Save() does the right thing for the zipentry + offsets, by inquiring the Position of the FileStream before writing + any data, and then adding that initial offset into any ZipEntry + offsets in the zip directory. Everything works fine. + + + Now suppose the application is an ASPNET application and it saves + directly to Response.OutputStream. It's not possible for DotNetZip to + inquire the Position, so the offsets for the SFX will be wrong. + + + The workaround is for the application to use this class to wrap + HttpResponse.OutputStream, then write the SFX stub and the ZipFile + into that wrapper stream. Because ZipFile.Save() can inquire the + Position, it will then do the right thing with the offsets. + + + + + + The constructor. + + The underlying stream + + + + Gets the wrapped stream. + + + + + The count of bytes written out to the stream. + + + + + the count of bytes that have been read from the stream. + + + + + Adjust the byte count on the stream. + + + + the number of bytes to subtract from the count. + + + + + Subtract delta from the count of bytes written to the stream. + This is necessary when seeking back, and writing additional data, + as happens in some cases when saving Zip files. + + + + + + The read method. + + The buffer to hold the data read from the stream. + the offset within the buffer to copy the first byte read. + the number of bytes to read. + the number of bytes read, after decryption and decompression. + + + + Write data into the stream. + + The buffer holding data to write to the stream. + the offset within that data array to find the first byte to write. + the number of bytes to write. + + + + Whether the stream can be read. + + + + + Whether it is possible to call Seek() on the stream. + + + + + Whether it is possible to call Write() on the stream. + + + + + Flushes the underlying stream. + + + + + The length of the underlying stream. + + + + + Returns the sum of number of bytes written, plus the initial + offset before writing. + + + + + The Position of the stream. + + + + + Seek in the stream. + + the offset point to seek to + the reference point from which to seek + The new position + + + + Set the length of the underlying stream. Be careful with this! + + + the length to set on the underlying stream. + + + + This is a helper class supporting WinZip AES encryption. + This class is intended for use only by the DotNetZip library. + + + + Most uses of the DotNetZip library will not involve direct calls into + the WinZipAesCrypto class. Instead, the WinZipAesCrypto class is + instantiated and used by the ZipEntry() class when WinZip AES + encryption or decryption on an entry is employed. + + + + + A stream that encrypts as it writes, or decrypts as it reads. The + Crypto is AES in CTR (counter) mode, which is compatible with the AES + encryption employed by WinZip 12.0. + + + + The AES/CTR encryption protocol used by WinZip works like this: + + - start with a counter, initialized to zero. + + - to encrypt, take the data by 16-byte blocks. For each block: + - apply the transform to the counter + - increement the counter + - XOR the result of the transform with the plaintext to + get the ciphertext. + - compute the mac on the encrypted bytes + - when finished with all blocks, store the computed MAC. + + - to decrypt, take the data by 16-byte blocks. For each block: + - compute the mac on the encrypted bytes, + - apply the transform to the counter + - increement the counter + - XOR the result of the transform with the ciphertext to + get the plaintext. + - when finished with all blocks, compare the computed MAC against + the stored MAC + + + + + + + The constructor. + + The underlying stream + To either encrypt or decrypt. + The pre-initialized WinZipAesCrypto object. + The maximum number of bytes to read from the stream. + + + + Returns the final HMAC-SHA1-80 for the data that was encrypted. + + + + + Close the stream. + + + + + Returns true if the stream can be read. + + + + + Always returns false. + + + + + Returns true if the CryptoMode is Encrypt. + + + + + Flush the content in the stream. + + + + + Getting this property throws a NotImplementedException. + + + + + Getting or Setting this property throws a NotImplementedException. + + + + + This method throws a NotImplementedException. + + + + + This method throws a NotImplementedException. + + + + + This class implements the "traditional" or "classic" PKZip encryption, + which today is considered to be weak. On the other hand it is + ubiquitous. This class is intended for use only by the DotNetZip + library. + + + + Most uses of the DotNetZip library will not involve direct calls into + the ZipCrypto class. Instead, the ZipCrypto class is instantiated and + used by the ZipEntry() class when encryption or decryption on an entry + is employed. If for some reason you really wanted to use a weak + encryption algorithm in some other application, you might use this + library. But you would be much better off using one of the built-in + strong encryption libraries in the .NET Framework, like the AES + algorithm or SHA. + + + + + The default constructor for ZipCrypto. + + + + This class is intended for internal use by the library only. It's + probably not useful to you. Seriously. Stop reading this + documentation. It's a waste of your time. Go do something else. + Check the football scores. Go get an ice cream with a friend. + Seriously. + + + + + + From AppNote.txt: + unsigned char decrypt_byte() + local unsigned short temp + temp :=- Key(2) | 2 + decrypt_byte := (temp * (temp ^ 1)) bitshift-right 8 + end decrypt_byte + + + + + Call this method on a cipher text to render the plaintext. You must + first initialize the cipher with a call to InitCipher. + + + + + var cipher = new ZipCrypto(); + cipher.InitCipher(Password); + // Decrypt the header. This has a side effect of "further initializing the + // encryption keys" in the traditional zip encryption. + byte[] DecryptedMessage = cipher.DecryptMessage(EncryptedMessage); + + + + The encrypted buffer. + + The number of bytes to encrypt. + Should be less than or equal to CipherText.Length. + + + The plaintext. + + + + This is the converse of DecryptMessage. It encrypts the plaintext + and produces a ciphertext. + + + The plain text buffer. + + + The number of bytes to encrypt. + Should be less than or equal to plainText.Length. + + + The ciphertext. + + + + This initializes the cipher with the given password. + See AppNote.txt for details. + + + + The passphrase for encrypting or decrypting with this cipher. + + + + + Step 1 - Initializing the encryption keys + ----------------------------------------- + Start with these keys: + Key(0) := 305419896 (0x12345678) + Key(1) := 591751049 (0x23456789) + Key(2) := 878082192 (0x34567890) + + Then, initialize the keys with a password: + + loop for i from 0 to length(password)-1 + update_keys(password(i)) + end loop + + Where update_keys() is defined as: + + update_keys(char): + Key(0) := crc32(key(0),char) + Key(1) := Key(1) + (Key(0) bitwiseAND 000000ffH) + Key(1) := Key(1) * 134775813 + 1 + Key(2) := crc32(key(2),key(1) rightshift 24) + end update_keys + + Where crc32(old_crc,char) is a routine that given a CRC value and a + character, returns an updated CRC value after applying the CRC-32 + algorithm described elsewhere in this document. + + + + + After the keys are initialized, then you can use the cipher to + encrypt the plaintext. + + + + Essentially we encrypt the password with the keys, then discard the + ciphertext for the password. This initializes the keys for later use. + + + + + + + A Stream for reading and concurrently decrypting data from a zip file, + or for writing and concurrently encrypting data to a zip file. + + + + The constructor. + The underlying stream + To either encrypt or decrypt. + The pre-initialized ZipCrypto object. + + + + Represents a single entry in a ZipFile. Typically, applications get a ZipEntry + by enumerating the entries within a ZipFile, or by adding an entry to a ZipFile. + + + + + True if the referenced entry is a directory. + + + + + Provides a human-readable string with information about the ZipEntry. + + + + + Reads one entry from the zip directory structure in the zip file. + + + + The zipfile for which a directory entry will be read. From this param, the + method gets the ReadStream and the expected text encoding + (ProvisionalAlternateEncoding) which is used if the entry is not marked + UTF-8. + + + + a list of previously seen entry names; used to prevent duplicates. + + + the entry read from the archive. + + + + Returns true if the passed-in value is a valid signature for a ZipDirEntry. + + the candidate 4-byte signature value. + true, if the signature is valid according to the PKWare spec. + + + + Default constructor. + + + Applications should never need to call this directly. It is exposed to + support COM Automation environments. + + + + + The time and date at which the file indicated by the ZipEntry was + last modified. + + + + + The DotNetZip library sets the LastModified value for an entry, equal to + the Last Modified time of the file in the filesystem. If an entry is + added from a stream, the library uses System.DateTime.Now for this + value, for the given entry. + + + + This property allows the application to retrieve and possibly set the + LastModified value on an entry, to an arbitrary value. values with a + setting of DateTimeKind.Unspecified are taken to be expressed as + DateTimeKind.Local. + + + + Be aware that because of the way PKWare's + Zip specification describes how times are stored in the zip file, + the full precision of the System.DateTime datatype is not stored + for the last modified time when saving zip files. For more information on + how times are formatted, see the PKZip specification. + + + + The actual last modified time of a file can be stored in multiple ways in + the zip file, and they are not mutually exclusive: + + + + + In the so-called "DOS" format, which has a 2-second precision. Values + are rounded to the nearest even second. For example, if the time on the + file is 12:34:43, then it will be stored as 12:34:44. This first value + is accessible via the LastModified property. This value is always + present in the metadata for each zip entry. In some cases the value is + invalid, or zero. + + + + In the so-called "Windows" or "NTFS" format, as an 8-byte integer + quantity expressed as the number of 1/10 milliseconds (in other words + the number of 100 nanosecond units) since January 1, 1601 (UTC). This + format is how Windows represents file times. This time is accessible + via the ModifiedTime property. + + + + In the "Unix" format, a 4-byte quantity specifying the number of seconds since + January 1, 1970 UTC. + + + + In an older format, now deprecated but still used by some current + tools. This format is also a 4-byte quantity specifying the number of + seconds since January 1, 1970 UTC. + + + + + + Zip tools and libraries will always at least handle (read or write) the + DOS time, and may also handle the other time formats. Keep in mind that + while the names refer to particular operating systems, there is nothing in + the time formats themselves that prevents their use on other operating + systems. + + + + When reading ZIP files, the DotNetZip library reads the Windows-formatted + time, if it is stored in the entry, and sets both LastModified and + ModifiedTime to that value. When writing ZIP files, the DotNetZip + library by default will write both time quantities. It can also emit the + Unix-formatted time if desired (See .) + + + + The last modified time of the file created upon a call to + ZipEntry.Extract() may be adjusted during extraction to compensate + for differences in how the .NET Base Class Library deals with daylight + saving time (DST) versus how the Windows filesystem deals with daylight + saving time. Raymond Chen provides + some good context. + + + + In a nutshell: Daylight savings time rules change regularly. In 2007, for + example, the inception week of DST changed. In 1977, DST was in place all + year round. In 1945, likewise. And so on. Win32 does not attempt to + guess which time zone rules were in effect at the time in question. It + will render a time as "standard time" and allow the app to change to DST + as necessary. .NET makes a different choice. + + + + Compare the output of FileInfo.LastWriteTime.ToString("f") with what you + see in the Windows Explorer property sheet for a file that was last + written to on the other side of the DST transition. For example, suppose + the file was last modified on October 17, 2003, during DST but DST is not + currently in effect. Explorer's file properties reports Thursday, October + 17, 2003, 8:45:38 AM, but .NETs FileInfo reports Thursday, October 17, + 2003, 9:45 AM. + + + + Win32 says, "Thursday, October 17, 2002 8:45:38 AM PST". Note: Pacific + STANDARD Time. Even though October 17 of that year occurred during Pacific + Daylight Time, Win32 displays the time as standard time because that's + what time it is NOW. + + + + .NET BCL assumes that the current DST rules were in place at the time in + question. So, .NET says, "Well, if the rules in effect now were also in + effect on October 17, 2003, then that would be daylight time" so it + displays "Thursday, October 17, 2003, 9:45 AM PDT" - daylight time. + + + + So .NET gives a value which is more intuitively correct, but is also + potentially incorrect, and which is not invertible. Win32 gives a value + which is intuitively incorrect, but is strictly correct. + + + + Because of this funkiness, this library adds one hour to the LastModified + time on the extracted file, if necessary. That is to say, if the time in + question had occurred in what the .NET Base Class Library assumed to be + DST. This assumption may be wrong given the constantly changing DST rules, + but it is the best we can do. + + + + + + + + Ability to set Last Modified DOS time to zero + (for using with EmitTimesInWindowsFormatWhenSaving+EmitTimesInUnixFormatWhenSaving setted to false) + some flasher hardware use as marker of first binary + + + + + Last Modified time for the file represented by the entry. + + + + + + This value corresponds to the "last modified" time in the NTFS file times + as described in the Zip + specification. When getting this property, the value may be + different from . When setting the property, + the property also gets set, but with a lower + precision. + + + + Let me explain. It's going to take a while, so get + comfortable. Originally, waaaaay back in 1989 when the ZIP specification + was originally described by the esteemed Mr. Phil Katz, the dominant + operating system of the time was MS-DOS. MSDOS stored file times with a + 2-second precision, because, c'mon, who is ever going to need better + resolution than THAT? And so ZIP files, regardless of the platform on + which the zip file was created, store file times in exactly the same format that DOS used + in 1989. + + + + Since then, the ZIP spec has evolved, but the internal format for file + timestamps remains the same. Despite the fact that the way times are + stored in a zip file is rooted in DOS heritage, any program on any + operating system can format a time in this way, and most zip tools and + libraries DO - they round file times to the nearest even second and store + it just like DOS did 25+ years ago. + + + + PKWare extended the ZIP specification to allow a zip file to store what + are called "NTFS Times" and "Unix(tm) times" for a file. These are the + last write, last access, and file creation + times of a particular file. These metadata are not actually specific + to NTFS or Unix. They are tracked for each file by NTFS and by various + Unix filesystems, but they are also tracked by other filesystems, too. + The key point is that the times are formatted in the zip file + in the same way that NTFS formats the time (ticks since win32 epoch), + or in the same way that Unix formats the time (seconds since Unix + epoch). As with the DOS time, any tool or library running on any + operating system is capable of formatting a time in one of these ways + and embedding it into the zip file. + + + + These extended times are higher precision quantities than the DOS time. + As described above, the (DOS) LastModified has a precision of 2 seconds. + The Unix time is stored with a precision of 1 second. The NTFS time is + stored with a precision of 0.0000001 seconds. The quantities are easily + convertible, except for the loss of precision you may incur. + + + + A zip archive can store the {C,A,M} times in NTFS format, in Unix format, + or not at all. Often a tool running on Unix or Mac will embed the times + in Unix format (1 second precision), while WinZip running on Windows might + embed the times in NTFS format (precision of of 0.0000001 seconds). When + reading a zip file with these "extended" times, in either format, + DotNetZip represents the values with the + ModifiedTime, AccessedTime and CreationTime + properties on the ZipEntry. + + + + While any zip application or library, regardless of the platform it + runs on, could use any of the time formats allowed by the ZIP + specification, not all zip tools or libraries do support all these + formats. Storing the higher-precision times for each entry is + optional for zip files, and many tools and libraries don't use the + higher precision quantities at all. The old DOS time, represented by + , is guaranteed to be present, though it + sometimes unset. + + + + Ok, getting back to the question about how the LastModified + property relates to this ModifiedTime + property... LastModified is always set, while + ModifiedTime is not. (The other times stored in the NTFS + times extension, CreationTime and AccessedTime also + may not be set on an entry that is read from an existing zip file.) + When reading a zip file, then LastModified takes the DOS time + that is stored with the file. If the DOS time has been stored as zero + in the zipfile, then this library will use DateTime.Now for the + LastModified value. If the ZIP file was created by an evolved + tool, then there will also be higher precision NTFS or Unix times in + the zip file. In that case, this library will read those times, and + set LastModified and ModifiedTime to the same value, the + one corresponding to the last write time of the file. If there are no + higher precision times stored for the entry, then ModifiedTime + remains unset (likewise AccessedTime and CreationTime), + and LastModified keeps its DOS time. + + + + When creating zip files with this library, by default the extended time + properties (ModifiedTime, AccessedTime, and + CreationTime) are set on the ZipEntry instance, and these data are + stored in the zip archive for each entry, in NTFS format. If you add an + entry from an actual filesystem file, then the entry gets the actual file + times for that file, to NTFS-level precision. If you add an entry from a + stream, or a string, then the times get the value DateTime.Now. In + this case LastModified and ModifiedTime will be identical, + to 2 seconds of precision. You can explicitly set the + CreationTime, AccessedTime, and ModifiedTime of an + entry using the property setters. If you want to set all of those + quantities, it's more efficient to use the method. Those + changes are not made permanent in the zip file until you call or one of its cousins. + + + + When creating a zip file, you can override the default behavior of + this library for formatting times in the zip file, disabling the + embedding of file times in NTFS format or enabling the storage of file + times in Unix format, or both. You may want to do this, for example, + when creating a zip file on Windows, that will be consumed on a Mac, + by an application that is not hip to the "NTFS times" format. To do + this, use the and + properties. A valid zip + file may store the file times in both formats. But, there are no + guarantees that a program running on Mac or Linux will gracefully + handle the NTFS-formatted times when Unix times are present, or that a + non-DotNetZip-powered application running on Windows will be able to + handle file times in Unix format. DotNetZip will always do something + reasonable; other libraries or tools may not. When in doubt, test. + + + + I'll bet you didn't think one person could type so much about time, eh? + And reading it was so enjoyable, too! Well, in appreciation, maybe you + should donate? + + + + + + + + + + + Last Access time for the file represented by the entry. + + + This value may or may not be meaningful. If the ZipEntry was read from an existing + Zip archive, this information may not be available. For an explanation of why, see + . + + + + + + + + The file creation time for the file represented by the entry. + + + + This value may or may not be meaningful. If the ZipEntry was read + from an existing zip archive, and the creation time was not set on the entry + when the zip file was created, then this property may be meaningless. For an + explanation of why, see . + + + + + + + + Sets the NTFS Creation, Access, and Modified times for the given entry. + + + + + When adding an entry from a file or directory, the Creation, Access, and + Modified times for the given entry are automatically set from the + filesystem values. When adding an entry from a stream or string, the + values are implicitly set to DateTime.Now. The application may wish to + set these values to some arbitrary value, before saving the archive, and + can do so using the various setters. If you want to set all of the times, + this method is more efficient. + + + + The values you set here will be retrievable with the , and properties. + + + + When this method is called, if both and are false, then the + EmitTimesInWindowsFormatWhenSaving flag is automatically set. + + + + DateTime values provided here without a DateTimeKind are assumed to be Local Time. + + + + the creation time of the entry. + the last access time of the entry. + the last modified time of the entry. + + + + + + + + + + Specifies whether the Creation, Access, and Modified times for the given + entry will be emitted in "Windows format" when the zip archive is saved. + + + + + An application creating a zip archive can use this flag to explicitly + specify that the file times for the entry should or should not be stored + in the zip archive in the format used by Windows. The default value of + this property is true. + + + + When adding an entry from a file or directory, the Creation (), Access (), and Modified + () times for the given entry are automatically + set from the filesystem values. When adding an entry from a stream or + string, all three values are implicitly set to DateTime.Now. Applications + can also explicitly set those times by calling . + + + + PKWARE's + zip specification describes multiple ways to format these times in a + zip file. One is the format Windows applications normally use: 100ns ticks + since Jan 1, 1601 UTC. The other is a format Unix applications typically + use: seconds since January 1, 1970 UTC. Each format can be stored in an + "extra field" in the zip entry when saving the zip archive. The former + uses an extra field with a Header Id of 0x000A, while the latter uses a + header ID of 0x5455. + + + + Not all zip tools and libraries can interpret these fields. Windows + compressed folders is one that can read the Windows Format timestamps, + while I believe the Infozip + tools can read the Unix format timestamps. Although the time values are + easily convertible, subject to a loss of precision, some tools and + libraries may be able to read only one or the other. DotNetZip can read or + write times in either or both formats. + + + + The times stored are taken from , , and . + + + + This property is not mutually exclusive from the property. It is + possible that a zip entry can embed the timestamps in both forms, one + form, or neither. But, there are no guarantees that a program running on + Mac or Linux will gracefully handle NTFS Formatted times, or that a + non-DotNetZip-powered application running on Windows will be able to + handle file times in Unix format. When in doubt, test. + + + + Normally you will use the ZipFile.EmitTimesInWindowsFormatWhenSaving + property, to specify the behavior for all entries in a zip, rather than + the property on each individual entry. + + + + + + + + + + + + + Specifies whether the Creation, Access, and Modified times for the given + entry will be emitted in "Unix(tm) format" when the zip archive is saved. + + + + + An application creating a zip archive can use this flag to explicitly + specify that the file times for the entry should or should not be stored + in the zip archive in the format used by Unix. By default this flag is + false, meaning the Unix-format times are not stored in the zip + archive. + + + + When adding an entry from a file or directory, the Creation (), Access (), and Modified + () times for the given entry are automatically + set from the filesystem values. When adding an entry from a stream or + string, all three values are implicitly set to DateTime.Now. Applications + can also explicitly set those times by calling . + + + + PKWARE's + zip specification describes multiple ways to format these times in a + zip file. One is the format Windows applications normally use: 100ns ticks + since Jan 1, 1601 UTC. The other is a format Unix applications typically + use: seconds since Jan 1, 1970 UTC. Each format can be stored in an + "extra field" in the zip entry when saving the zip archive. The former + uses an extra field with a Header Id of 0x000A, while the latter uses a + header ID of 0x5455. + + + + Not all tools and libraries can interpret these fields. Windows + compressed folders is one that can read the Windows Format timestamps, + while I believe the Infozip + tools can read the Unix format timestamps. Although the time values are + easily convertible, subject to a loss of precision, some tools and + libraries may be able to read only one or the other. DotNetZip can read or + write times in either or both formats. + + + + The times stored are taken from , , and . + + + + This property is not mutually exclusive from the property. It is + possible that a zip entry can embed the timestamps in both forms, one + form, or neither. But, there are no guarantees that a program running on + Mac or Linux will gracefully handle NTFS Formatted times, or that a + non-DotNetZip-powered application running on Windows will be able to + handle file times in Unix format. When in doubt, test. + + + + Normally you will use the ZipFile.EmitTimesInUnixFormatWhenSaving + property, to specify the behavior for all entries, rather than the + property on each individual entry. + + + + + + + + + + + + + The type of timestamp attached to the ZipEntry. + + + + This property is valid only for a ZipEntry that was read from a zip archive. + It indicates the type of timestamp attached to the entry. + + + + + + + + The file attributes for the entry. + + + + + + The attributes in NTFS include + ReadOnly, Archive, Hidden, System, and Indexed. When adding a + ZipEntry to a ZipFile, these attributes are set implicitly when + adding an entry from the filesystem. When adding an entry from a stream + or string, the Attributes are not set implicitly. Regardless of the way + an entry was added to a ZipFile, you can set the attributes + explicitly if you like. + + + + When reading a ZipEntry from a ZipFile, the attributes are + set according to the data stored in the ZipFile. If you extract the + entry from the archive to a filesystem file, DotNetZip will set the + attributes on the resulting file accordingly. + + + + The attributes can be set explicitly by the application. For example the + application may wish to set the FileAttributes.ReadOnly bit for all + entries added to an archive, so that on unpack, this attribute will be set + on the extracted file. Any changes you make to this property are made + permanent only when you call a Save() method on the ZipFile + instance that contains the ZipEntry. + + + + For example, an application may wish to zip up a directory and set the + ReadOnly bit on every file in the archive, so that upon later extraction, + the resulting files will be marked as ReadOnly. Not every extraction tool + respects these attributes, but if you unpack with DotNetZip, as for + example in a self-extracting archive, then the attributes will be set as + they are stored in the ZipFile. + + + + These attributes may not be interesting or useful if the resulting archive + is extracted on a non-Windows platform. How these attributes get used + upon extraction depends on the platform and tool used. + + + + + + + The name of the filesystem file, referred to by the ZipEntry. + + + + + This property specifies the thing-to-be-zipped on disk, and is set only + when the ZipEntry is being created from a filesystem file. If the + ZipFile is instantiated by reading an existing .zip archive, then + the LocalFileName will be null (Nothing in VB). + + + + When it is set, the value of this property may be different than , which is the path used in the archive itself. If you + call Zip.AddFile("foop.txt", AlternativeDirectory), then the path + used for the ZipEntry within the zip archive will be different + than this path. + + + + If the entry is being added from a stream, then this is null (Nothing in VB). + + + + + + + + The name of the file contained in the ZipEntry. + + + + + + This is the name of the entry in the ZipFile itself. When creating + a zip archive, if the ZipEntry has been created from a filesystem + file, via a call to or , or a related overload, the value + of this property is derived from the name of that file. The + FileName property does not include drive letters, and may include a + different directory path, depending on the value of the + directoryPathInArchive parameter used when adding the entry into + the ZipFile. + + + + In some cases there is no related filesystem file - for example when a + ZipEntry is created using or one of the similar overloads. In this case, the value of + this property is derived from the fileName and the directory path passed + to that method. + + + + When reading a zip file, this property takes the value of the entry name + as stored in the zip file. If you extract such an entry, the extracted + file will take the name given by this property. + + + + Applications can set this property when creating new zip archives or when + reading existing archives. When setting this property, the actual value + that is set will replace backslashes with forward slashes, in accordance + with the Zip + specification, for compatibility with Unix(tm) and ... get + this.... Amiga! + + + + If an application reads a ZipFile via or a related overload, and then explicitly + sets the FileName on an entry contained within the ZipFile, and + then calls , the application will effectively + rename the entry within the zip archive. + + + + If an application sets the value of FileName, then calls + Extract() on the entry, the entry is extracted to a file using the + newly set value as the filename. The FileName value is made + permanent in the zip archive only after a call to one of the + ZipFile.Save() methods on the ZipFile that contains the + ZipEntry. + + + + If an application attempts to set the FileName to a value that + would result in a duplicate entry in the ZipFile, an exception is + thrown. + + + + When a ZipEntry is contained within a ZipFile, applications + cannot rename the entry within the context of a foreach (For + Each in VB) loop, because of the way the ZipFile stores + entries. If you need to enumerate through all the entries and rename one + or more of them, use ZipFile.EntriesSorted as the + collection. See also, ZipFile.GetEnumerator(). + + + + + + + The stream that provides content for the ZipEntry. + + + + + + The application can use this property to set the input stream for an + entry on a just-in-time basis. Imagine a scenario where the application + creates a ZipFile comprised of content obtained from hundreds of + files, via calls to AddFile(). The DotNetZip library opens streams + on these files on a just-in-time basis, only when writing the entry out to + an external store within the scope of a ZipFile.Save() call. Only + one input stream is opened at a time, as each entry is being written out. + + + + Now imagine a different application that creates a ZipFile + with content obtained from hundreds of streams, added through . Normally the + application would supply an open stream to that call. But when large + numbers of streams are being added, this can mean many open streams at one + time, unnecessarily. + + + + To avoid this, call and specify delegates that open and close the stream at + the time of Save. + + + + + Setting the value of this property when the entry was not added from a + stream (for example, when the ZipEntry was added with or , or when the entry was added by + reading an existing zip archive) will throw an exception. + + + + + + + + A flag indicating whether the InputStream was provided Just-in-time. + + + + + + When creating a zip archive, an application can obtain content for one or + more of the ZipEntry instances from streams, using the method. At the time + of calling that method, the application can supply null as the value of + the stream parameter. By doing so, the application indicates to the + library that it will provide a stream for the entry on a just-in-time + basis, at the time one of the ZipFile.Save() methods is called and + the data for the various entries are being compressed and written out. + + + + In this case, the application can set the + property, typically within the SaveProgress event (event type: ) for that entry. + + + + The application will later want to call Close() and Dispose() on that + stream. In the SaveProgress event, when the event type is , the application can + do so. This flag indicates that the stream has been provided by the + application on a just-in-time basis and that it is the application's + responsibility to call Close/Dispose on that stream. + + + + + + + + An enum indicating the source of the ZipEntry. + + + + + The version of the zip engine needed to read the ZipEntry. + + + + + This is a readonly property, indicating the version of the Zip + specification that the extracting tool or library must support to + extract the given entry. Generally higher versions indicate newer + features. Older zip engines obviously won't know about new features, and + won't be able to extract entries that depend on those newer features. + + + + + value + Features + + + + 20 + a basic Zip Entry, potentially using PKZIP encryption. + + + + + 45 + The ZIP64 extension is used on the entry. + + + + + 46 + File is compressed using BZIP2 compression* + + + + 50 + File is encrypted using PkWare's DES, 3DES, (broken) RC2 or RC4 + + + + 51 + File is encrypted using PKWare's AES encryption or corrected RC2 encryption. + + + + 52 + File is encrypted using corrected RC2-64 encryption** + + + + 61 + File is encrypted using non-OAEP key wrapping*** + + + + 63 + File is compressed using LZMA, PPMd+, Blowfish, or Twofish + + + + + + There are other values possible, not listed here. DotNetZip supports + regular PKZip encryption, and ZIP64 extensions. DotNetZip cannot extract + entries that require a zip engine higher than 45. + + + + This value is set upon reading an existing zip file, or after saving a zip + archive. + + + + + + The comment attached to the ZipEntry. + + + + + Each entry in a zip file can optionally have a comment associated to + it. The comment might be displayed by a zip tool during extraction, for + example. + + + + By default, the Comment is encoded in IBM437 code page. You can + specify an alternative with and + . + + + + + + + + Indicates whether the entry requires ZIP64 extensions. + + + + + + This property is null (Nothing in VB) until a Save() method on the + containing instance has been called. The property is + non-null (HasValue is true) only after a Save() method has + been called. + + + + After the containing ZipFile has been saved, the Value of this + property is true if any of the following three conditions holds: the + uncompressed size of the entry is larger than 0xFFFFFFFF; the compressed + size of the entry is larger than 0xFFFFFFFF; the relative offset of the + entry within the zip archive is larger than 0xFFFFFFFF. These quantities + are not known until a Save() is attempted on the zip archive and + the compression is applied. + + + + If none of the three conditions holds, then the Value is false. + + + + A Value of false does not indicate that the entry, as saved in the + zip archive, does not use ZIP64. It merely indicates that ZIP64 is + not required. An entry may use ZIP64 even when not required if + the property on the containing + ZipFile instance is set to , or if + the property on the containing + ZipFile instance is set to + and the output stream was not seekable. + + + + + + + + Indicates whether the entry actually used ZIP64 extensions, as it was most + recently written to the output file or stream. + + + + + + This Nullable property is null (Nothing in VB) until a Save() + method on the containing instance has been + called. HasValue is true only after a Save() method has been + called. + + + + The value of this property for a particular ZipEntry may change + over successive calls to Save() methods on the containing ZipFile, + even if the file that corresponds to the ZipEntry does not. This + may happen if other entries contained in the ZipFile expand, + causing the offset for this particular entry to exceed 0xFFFFFFFF. + + + + + + + The bitfield for the entry as defined in the zip spec. You probably + never need to look at this. + + + + + You probably do not need to concern yourself with the contents of this + property, but in case you do: + + + + + bit + meaning + + + + 0 + set if encryption is used. + + + + 1-2 + + set to determine whether normal, max, fast deflation. DotNetZip library + always leaves these bits unset when writing (indicating "normal" + deflation"), but can read an entry with any value here. + + + + + 3 + + Indicates that the Crc32, Compressed and Uncompressed sizes are zero in the + local header. This bit gets set on an entry during writing a zip file, when + it is saved to a non-seekable output stream. + + + + + + 4 + reserved for "enhanced deflating". This library doesn't do enhanced deflating. + + + + 5 + set to indicate the zip is compressed patched data. This library doesn't do that. + + + + 6 + + set if PKWare's strong encryption is used (must also set bit 1 if bit 6 is + set). This bit is not set if WinZip's AES encryption is set. + + + + 7 + not used + + + + 8 + not used + + + + 9 + not used + + + + 10 + not used + + + + 11 + + Language encoding flag (EFS). If this bit is set, the filename and comment + fields for this file must be encoded using UTF-8. This library currently + does not support UTF-8. + + + + + 12 + Reserved by PKWARE for enhanced compression. + + + + 13 + + Used when encrypting the Central Directory to indicate selected data + values in the Local Header are masked to hide their actual values. See + the section in the Zip + specification describing the Strong Encryption Specification for + details. + + + + + 14 + Reserved by PKWARE. + + + + 15 + Reserved by PKWARE. + + + + + + + + + The compression method employed for this ZipEntry. + + + + + + The + Zip specification allows a variety of compression methods. This + library supports just two: 0x08 = Deflate. 0x00 = Store (no compression), + for reading or writing. + + + + When reading an entry from an existing zipfile, the value you retrieve + here indicates the compression method used on the entry by the original + creator of the zip. When writing a zipfile, you can specify either 0x08 + (Deflate) or 0x00 (None). If you try setting something else, you will get + an exception. + + + + You may wish to set CompressionMethod to CompressionMethod.None (0) + when zipping already-compressed data like a jpg, png, or mp3 file. + This can save time and cpu cycles. + + + + When setting this property on a ZipEntry that is read from an + existing zip file, calling ZipFile.Save() will cause the new + CompressionMethod to be used on the entry in the newly saved zip file. + + + + Setting this property may have the side effect of modifying the + CompressionLevel property. If you set the CompressionMethod to a + value other than None, and CompressionLevel is previously + set to None, then CompressionLevel will be set to + Default. + + + + + + + In this example, the first entry added to the zip archive uses the default + behavior - compression is used where it makes sense. The second entry, + the MP3 file, is added to the archive without being compressed. + + using (ZipFile zip = new ZipFile(ZipFileToCreate)) + { + ZipEntry e1= zip.AddFile(@"notes\Readme.txt"); + ZipEntry e2= zip.AddFile(@"music\StopThisTrain.mp3"); + e2.CompressionMethod = CompressionMethod.None; + zip.Save(); + } + + + + Using zip As New ZipFile(ZipFileToCreate) + zip.AddFile("notes\Readme.txt") + Dim e2 as ZipEntry = zip.AddFile("music\StopThisTrain.mp3") + e2.CompressionMethod = CompressionMethod.None + zip.Save + End Using + + + + + + Sets the compression level to be used for the entry when saving the zip + archive. This applies only for CompressionMethod = DEFLATE. + + + + + When using the DEFLATE compression method, Varying the compression + level used on entries can affect the size-vs-speed tradeoff when + compression and decompressing data streams or files. + + + + If you do not set this property, the default compression level is used, + which normally gives a good balance of compression efficiency and + compression speed. In some tests, using BestCompression can + double the time it takes to compress, while delivering just a small + increase in compression efficiency. This behavior will vary with the + type of data you compress. If you are in doubt, just leave this setting + alone, and accept the default. + + + + When setting this property on a ZipEntry that is read from an + existing zip file, calling ZipFile.Save() will cause the new + CompressionLevel to be used on the entry in the newly saved zip file. + + + + Setting this property may have the side effect of modifying the + CompressionMethod property. If you set the CompressionLevel + to a value other than None, CompressionMethod will be set + to Deflate, if it was previously None. + + + + Setting this property has no effect if the CompressionMethod is something + other than Deflate or None. + + + + + + + + The compressed size of the file, in bytes, within the zip archive. + + + + When reading a ZipFile, this value is read in from the existing + zip file. When creating or updating a ZipFile, the compressed + size is computed during compression. Therefore the value on a + ZipEntry is valid after a call to Save() (or one of its + overloads) in that case. + + + + + + + The size of the file, in bytes, before compression, or after extraction. + + + + When reading a ZipFile, this value is read in from the existing + zip file. When creating or updating a ZipFile, the uncompressed + size is computed during compression. Therefore the value on a + ZipEntry is valid after a call to Save() (or one of its + overloads) in that case. + + + + + + + The ratio of compressed size to uncompressed size of the ZipEntry. + + + + + This is a ratio of the compressed size to the uncompressed size of the + entry, expressed as a double in the range of 0 to 100+. A value of 100 + indicates no compression at all. It could be higher than 100 when the + compression algorithm actually inflates the data, as may occur for small + files, or uncompressible data that is encrypted. + + + + You could format it for presentation to a user via a format string of + "{3,5:F0}%" to see it as a percentage. + + + + If the size of the original uncompressed file is 0, implying a + denominator of 0, the return value will be zero. + + + + This property is valid after reading in an existing zip file, or after + saving the ZipFile that contains the ZipEntry. You cannot know the + effect of a compression transform until you try it. + + + + + + + The 32-bit CRC (Cyclic Redundancy Check) on the contents of the ZipEntry. + + + + + You probably don't need to concern yourself with this. It is used + internally by DotNetZip to verify files or streams upon extraction. + + The value is a 32-bit + CRC using 0xEDB88320 for the polynomial. This is the same CRC-32 used in + PNG, MPEG-2, and other protocols and formats. It is a read-only property; when + creating a Zip archive, the CRC for each entry is set only after a call to + Save() on the containing ZipFile. When reading an existing zip file, the value + of this property reflects the stored CRC for the entry. + + + + + + True if the entry is a directory (not a file). + This is a readonly property on the entry. + + + + + A derived property that is true if the entry uses encryption. + + + + + This is a readonly property on the entry. When reading a zip file, + the value for the ZipEntry is determined by the data read + from the zip file. After saving a ZipFile, the value of this + property for each ZipEntry indicates whether encryption was + actually used (which will have been true if the was set and the property + was something other than . + + + + + + Set this to specify which encryption algorithm to use for the entry when + saving it to a zip archive. + + + + + + Set this property in order to encrypt the entry when the ZipFile is + saved. When setting this property, you must also set a on the entry. If you set a value other than on this property and do not set a + Password then the entry will not be encrypted. The ZipEntry + data is encrypted as the ZipFile is saved, when you call or one of its cousins on the containing + ZipFile instance. You do not need to specify the Encryption + when extracting entries from an archive. + + + + The Zip specification from PKWare defines a set of encryption algorithms, + and the data formats for the zip archive that support them, and PKWare + supports those algorithms in the tools it produces. Other vendors of tools + and libraries, such as WinZip or Xceed, typically support a + subset of the algorithms specified by PKWare. These tools can + sometimes support additional different encryption algorithms and data + formats, not specified by PKWare. The AES Encryption specified and + supported by WinZip is the most popular example. This library supports a + subset of the complete set of algorithms specified by PKWare and other + vendors. + + + + There is no common, ubiquitous multi-vendor standard for strong encryption + within zip files. There is broad support for so-called "traditional" Zip + encryption, sometimes called Zip 2.0 encryption, as specified + by PKWare, but this encryption is considered weak and + breakable. This library currently supports the Zip 2.0 "weak" encryption, + and also a stronger WinZip-compatible AES encryption, using either 128-bit + or 256-bit key strength. If you want DotNetZip to support an algorithm + that is not currently supported, call the author of this library and maybe + we can talk business. + + + + The class also has a property. In most cases you will use + that property when setting encryption. This property takes + precedence over any Encryption set on the ZipFile itself. + Typically, you would use the per-entry Encryption when most entries in the + zip archive use one encryption algorithm, and a few entries use a + different one. If all entries in the zip file use the same Encryption, + then it is simpler to just set this property on the ZipFile itself, when + creating a zip archive. + + + + Some comments on updating archives: If you read a ZipFile, you can + modify the Encryption on an encrypted entry: you can remove encryption + from an entry that was encrypted; you can encrypt an entry that was not + encrypted previously; or, you can change the encryption algorithm. The + changes in encryption are not made permanent until you call Save() on the + ZipFile. To effect changes in encryption, the entry content is + streamed through several transformations, depending on the modification + the application has requested. For example if the entry is not encrypted + and the application sets Encryption to PkzipWeak, then at + the time of Save(), the original entry is read and decompressed, + then re-compressed and encrypted. Conversely, if the original entry is + encrypted with PkzipWeak encryption, and the application sets the + Encryption property to WinZipAes128, then at the time of + Save(), the original entry is decrypted via PKZIP encryption and + decompressed, then re-compressed and re-encrypted with AES. This all + happens automatically within the library, but it can be time-consuming for + large entries. + + + + Additionally, when updating archives, it is not possible to change the + password when changing the encryption algorithm. To change both the + algorithm and the password, you need to Save() the zipfile twice. First + set the Encryption to None, then call Save(). Then set the + Encryption to the new value (not "None"), then call Save() + once again. + + + + The WinZip AES encryption algorithms are not supported on the .NET Compact + Framework. + + + + + + This example creates a zip archive that uses encryption, and then extracts + entries from the archive. When creating the zip archive, the ReadMe.txt + file is zipped without using a password or encryption. The other file + uses encryption. + + + // Create a zip archive with AES Encryption. + using (ZipFile zip = new ZipFile()) + { + zip.AddFile("ReadMe.txt") + ZipEntry e1= zip.AddFile("2008-Regional-Sales-Report.pdf"); + e1.Encryption= EncryptionAlgorithm.WinZipAes256; + e1.Password= "Top.Secret.No.Peeking!"; + zip.Save("EncryptedArchive.zip"); + } + + // Extract a zip archive that uses AES Encryption. + // You do not need to specify the algorithm during extraction. + using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip")) + { + // Specify the password that is used during extraction, for + // all entries that require a password: + zip.Password= "Top.Secret.No.Peeking!"; + zip.ExtractAll("extractDirectory"); + } + + + + ' Create a zip that uses Encryption. + Using zip As New ZipFile() + zip.AddFile("ReadMe.txt") + Dim e1 as ZipEntry + e1= zip.AddFile("2008-Regional-Sales-Report.pdf") + e1.Encryption= EncryptionAlgorithm.WinZipAes256 + e1.Password= "Top.Secret.No.Peeking!" + zip.Save("EncryptedArchive.zip") + End Using + + ' Extract a zip archive that uses AES Encryption. + ' You do not need to specify the algorithm during extraction. + Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip")) + ' Specify the password that is used during extraction, for + ' all entries that require a password: + zip.Password= "Top.Secret.No.Peeking!" + zip.ExtractAll("extractDirectory") + End Using + + + + + + Thrown in the setter if EncryptionAlgorithm.Unsupported is specified. + + + ZipEntry.Password + ZipFile.Encryption + + + + The Password to be used when encrypting a ZipEntry upon + ZipFile.Save(), or when decrypting an entry upon Extract(). + + + + + This is a write-only property on the entry. Set this to request that the + entry be encrypted when writing the zip archive, or set it to specify the + password to be used when extracting an existing entry that is encrypted. + + + + The password set here is implicitly used to encrypt the entry during the + operation, or to decrypt during the or operation. If you set + the Password on a ZipEntry after calling Save(), there is no + effect. + + + + Consider setting the property when using a + password. Answering concerns that the standard password protection + supported by all zip tools is weak, WinZip has extended the ZIP + specification with a way to use AES Encryption to protect entries in the + Zip file. Unlike the "PKZIP 2.0" encryption specified in the PKZIP + specification, AES + Encryption uses a standard, strong, tested, encryption + algorithm. DotNetZip can create zip archives that use WinZip-compatible + AES encryption, if you set the property. But, + archives created that use AES encryption may not be readable by all other + tools and libraries. For example, Windows Explorer cannot read a + "compressed folder" (a zip file) that uses AES encryption, though it can + read a zip file that uses "PKZIP encryption." + + + + The class also has a + property. This property takes precedence over any password set on the + ZipFile itself. Typically, you would use the per-entry Password when most + entries in the zip archive use one password, and a few entries use a + different password. If all entries in the zip file use the same password, + then it is simpler to just set this property on the ZipFile itself, + whether creating a zip archive or extracting a zip archive. + + + + Some comments on updating archives: If you read a ZipFile, you + cannot modify the password on any encrypted entry, except by extracting + the entry with the original password (if any), removing the original entry + via , and then adding a new + entry with a new Password. + + + + For example, suppose you read a ZipFile, and there is an encrypted + entry. Setting the Password property on that ZipEntry and then + calling Save() on the ZipFile does not update the password + on that entry in the archive. Neither is an exception thrown. Instead, + what happens during the Save() is the existing entry is copied + through to the new zip archive, in its original encrypted form. Upon + re-reading that archive, the entry can be decrypted with its original + password. + + + + If you read a ZipFile, and there is an un-encrypted entry, you can set the + Password on the entry and then call Save() on the ZipFile, and get + encryption on that entry. + + + + + + + This example creates a zip file with two entries, and then extracts the + entries from the zip file. When creating the zip file, the two files are + added to the zip file using password protection. Each entry uses a + different password. During extraction, each file is extracted with the + appropriate password. + + + // create a file with encryption + using (ZipFile zip = new ZipFile()) + { + ZipEntry entry; + entry= zip.AddFile("Declaration.txt"); + entry.Password= "123456!"; + entry = zip.AddFile("Report.xls"); + entry.Password= "1Secret!"; + zip.Save("EncryptedArchive.zip"); + } + + // extract entries that use encryption + using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip")) + { + ZipEntry entry; + entry = zip["Declaration.txt"]; + entry.Password = "123456!"; + entry.Extract("extractDir"); + entry = zip["Report.xls"]; + entry.Password = "1Secret!"; + entry.Extract("extractDir"); + } + + + + + Using zip As New ZipFile + Dim entry as ZipEntry + entry= zip.AddFile("Declaration.txt") + entry.Password= "123456!" + entry = zip.AddFile("Report.xls") + entry.Password= "1Secret!" + zip.Save("EncryptedArchive.zip") + End Using + + + ' extract entries that use encryption + Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip")) + Dim entry as ZipEntry + entry = zip("Declaration.txt") + entry.Password = "123456!" + entry.Extract("extractDir") + entry = zip("Report.xls") + entry.Password = "1Secret!" + entry.Extract("extractDir") + End Using + + + + + + + ZipFile.Password + + + + The action the library should take when extracting a file that already exists. + + + + + This property affects the behavior of the Extract methods (one of the + Extract() or ExtractWithPassword() overloads), when + extraction would would overwrite an existing filesystem file. If you do + not set this property, the library throws an exception when extracting + an entry would overwrite an existing file. + + + + This property has no effect when extracting to a stream, or when the file to be + extracted does not already exist. + + + + + + + This example shows how to set the ExtractExistingFile property in + an ExtractProgress event, in response to user input. The + ExtractProgress event is invoked if and only if the + ExtractExistingFile property was previously set to + ExtractExistingFileAction.InvokeExtractProgressEvent. + + public static void ExtractProgress(object sender, ExtractProgressEventArgs e) + { + if (e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry) + Console.WriteLine("extract {0} ", e.CurrentEntry.FileName); + + else if (e.EventType == ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite) + { + ZipEntry entry = e.CurrentEntry; + string response = null; + // Ask the user if he wants overwrite the file + do + { + Console.Write("Overwrite {0} in {1} ? (y/n/C) ", entry.FileName, e.ExtractLocation); + response = Console.ReadLine(); + Console.WriteLine(); + + } while (response != null && response[0]!='Y' && + response[0]!='N' && response[0]!='C'); + + if (response[0]=='C') + e.Cancel = true; + else if (response[0]=='Y') + entry.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently; + else + entry.ExtractExistingFile= ExtractExistingFileAction.DoNotOverwrite; + } + } + + + + + + The action to take when an error is encountered while + opening or reading files as they are saved into a zip archive. + + + + + Errors can occur within a call to ZipFile.Save, as the various files contained + in a ZipFile are being saved into the zip archive. During the + Save, DotNetZip will perform a File.Open on the file + associated to the ZipEntry, and then will read the entire contents of + the file as it is zipped. Either the open or the Read may fail, because + of lock conflicts or other reasons. Using this property, you can + specify the action to take when such errors occur. + + + + Typically you will NOT set this property on individual ZipEntry + instances. Instead, you will set the ZipFile.ZipErrorAction property on + the ZipFile instance, before adding any entries to the + ZipFile. If you do this, errors encountered on behalf of any of + the entries in the ZipFile will be handled the same way. + + + + But, if you use a handler, you will want + to set this property on the ZipEntry within the handler, to + communicate back to DotNetZip what you would like to do with the + particular error. + + + + + + + + + Indicates whether the entry was included in the most recent save. + + + An entry can be excluded or skipped from a save if there is an error + opening or reading the entry. + + + + + + A callback that allows the application to specify the compression to use + for a given entry that is about to be added to the zip archive. + + + + + See + + + + + + Set to indicate whether to use UTF-8 encoding for filenames and comments. + + + + + + If this flag is set, the comment and filename for the entry will be + encoded with UTF-8, as described in the Zip + specification, if necessary. "Necessary" means, the filename or + entry comment (if any) cannot be reflexively encoded and decoded using the + default code page, IBM437. + + + + Setting this flag to true is equivalent to setting to System.Text.Encoding.UTF8. + + + + This flag has no effect or relation to the text encoding used within the + file itself. + + + + + + + The text encoding to use for the FileName and Comment on this ZipEntry, + when the default encoding is insufficient. + + + + + + Don't use this property. See . + + + + + + + Specifies the alternate text encoding used by this ZipEntry + + + + The default text encoding used in Zip files for encoding filenames and + comments is IBM437, which is something like a superset of ASCII. In + cases where this is insufficient, applications can specify an + alternate encoding. + + + When creating a zip file, the usage of the alternate encoding is + governed by the property. + Typically you would set both properties to tell DotNetZip to employ an + encoding that is not IBM437 in the zipfile you are creating. + + + Keep in mind that because the ZIP specification states that the only + valid encodings to use are IBM437 and UTF-8, if you use something + other than that, then zip tools and libraries may not be able to + successfully read the zip archive you generate. + + + The zip specification states that applications should presume that + IBM437 is in use, except when a special bit is set, which indicates + UTF-8. There is no way to specify an arbitrary code page, within the + zip file itself. When you create a zip file encoded with gb2312 or + ibm861 or anything other than IBM437 or UTF-8, then the application + that reads the zip file needs to "know" which code page to use. In + some cases, the code page used when reading is chosen implicitly. For + example, WinRar uses the ambient code page for the host desktop + operating system. The pitfall here is that if you create a zip in + Copenhagen and send it to Tokyo, the reader of the zipfile may not be + able to decode successfully. + + + + This example shows how to create a zipfile encoded with a + language-specific encoding: + + using (var zip = new ZipFile()) + { + zip.AlternateEnoding = System.Text.Encoding.GetEncoding("ibm861"); + zip.AlternateEnodingUsage = ZipOption.Always; + zip.AddFileS(arrayOfFiles); + zip.Save("Myarchive-Encoded-in-IBM861.zip"); + } + + + + + + + Describes if and when this instance should apply + AlternateEncoding to encode the FileName and Comment, when + saving. + + + + + + Indicates whether an entry is marked as a text file. Be careful when + using on this property. Unless you have a good reason, you should + probably ignore this property. + + + + + The ZIP format includes a provision for specifying whether an entry in + the zip archive is a text or binary file. This property exposes that + metadata item. Be careful when using this property: It's not clear + that this property as a firm meaning, across tools and libraries. + + + + To be clear, when reading a zip file, the property value may or may + not be set, and its value may or may not be valid. Not all entries + that you may think of as "text" entries will be so marked, and entries + marked as "text" are not guaranteed in any way to be text entries. + Whether the value is set and set correctly depends entirely on the + application that produced the zip file. + + + + There are many zip tools available, and when creating zip files, some + of them "respect" the IsText metadata field, and some of them do not. + Unfortunately, even when an application tries to do "the right thing", + it's not always clear what "the right thing" is. + + + + There's no firm definition of just what it means to be "a text file", + and the zip specification does not help in this regard. Twenty years + ago, text was ASCII, each byte was less than 127. IsText meant, all + bytes in the file were less than 127. These days, it is not the case + that all text files have all bytes less than 127. Any unicode file + may have bytes that are above 0x7f. The zip specification has nothing + to say on this topic. Therefore, it's not clear what IsText really + means. + + + + This property merely tells a reading application what is stored in the + metadata for an entry, without guaranteeing its validity or its + meaning. + + + + When DotNetZip is used to create a zipfile, it attempts to set this + field "correctly." For example, if a file ends in ".txt", this field + will be set. Your application may override that default setting. When + writing a zip file, you must set the property before calling + Save() on the ZipFile. + + + + When reading a zip file, a more general way to decide just what kind + of file is contained in a particular entry is to use the file type + database stored in the operating system. The operating system stores + a table that says, a file with .jpg extension is a JPG image file, a + file with a .xml extension is an XML document, a file with a .txt is a + pure ASCII text document, and so on. To get this information on + Windows, you + need to read and parse the registry. + + + + + using (var zip = new ZipFile()) + { + var e = zip.UpdateFile("Descriptions.mme", ""); + e.IsText = true; + zip.Save(zipPath); + } + + + + Using zip As New ZipFile + Dim e2 as ZipEntry = zip.AddFile("Descriptions.mme", "") + e.IsText= True + zip.Save(zipPath) + End Using + + + + + Provides a string representation of the instance. + a string representation of the instance. + + + + Extract the entry to the filesystem, starting at the current + working directory. + + + + This method has a bunch of overloads! One of them is sure to + be the right one for you... If you don't like these, check + out the ExtractWithPassword() methods. + + + + + + + + + This method extracts an entry from a zip file into the current + working directory. The path of the entry as extracted is the full + path as specified in the zip archive, relative to the current + working directory. After the file is extracted successfully, the + file attributes and timestamps are set. + + + + The action taken when extraction an entry would overwrite an + existing file is determined by the property. + + + + Within the call to Extract(), the content for the entry is + written into a filesystem file, and then the last modified time of the + file is set according to the property on + the entry. See the remarks the property for + some details about the last modified time. + + + + + + + Extract the entry to a file in the filesystem, using the specified + behavior when extraction would overwrite an existing file. + + + + + See the remarks on the property, for some + details about how the last modified time of the file is set after + extraction. + + + + + The action to take if extraction would overwrite an existing file. + + + + + Extracts the entry to the specified stream. + + + + + The caller can specify any write-able stream, for example a , a , or ASP.NET's + Response.OutputStream. The content will be decrypted and + decompressed as necessary. If the entry is encrypted and no password + is provided, this method will throw. + + + The position on the stream is not reset by this method before it extracts. + You may want to call stream.Seek() before calling ZipEntry.Extract(). + + + + + the stream to which the entry should be extracted. + + + + + + Extract the entry to the filesystem, starting at the specified base + directory. + + + the pathname of the base directory + + + + + + This example extracts only the entries in a zip file that are .txt files, + into a directory called "textfiles". + + using (ZipFile zip = ZipFile.Read("PackedDocuments.zip")) + { + foreach (string s1 in zip.EntryFilenames) + { + if (s1.EndsWith(".txt")) + { + zip[s1].Extract("textfiles"); + } + } + } + + + Using zip As ZipFile = ZipFile.Read("PackedDocuments.zip") + Dim s1 As String + For Each s1 In zip.EntryFilenames + If s1.EndsWith(".txt") Then + zip(s1).Extract("textfiles") + End If + Next + End Using + + + + + + + Using this method, existing entries in the filesystem will not be + overwritten. If you would like to force the overwrite of existing + files, see the property, or call + . + + + + See the remarks on the property, for some + details about how the last modified time of the created file is set. + + + + + + Extract the entry to the filesystem, starting at the specified base + directory, and using the specified behavior when extraction would + overwrite an existing file. + + + + + See the remarks on the property, for some + details about how the last modified time of the created file is set. + + + + + + String sZipPath = "Airborne.zip"; + String sFilePath = "Readme.txt"; + String sRootFolder = "Digado"; + using (ZipFile zip = ZipFile.Read(sZipPath)) + { + if (zip.EntryFileNames.Contains(sFilePath)) + { + // use the string indexer on the zip file + zip[sFileName].Extract(sRootFolder, + ExtractExistingFileAction.OverwriteSilently); + } + } + + + + Dim sZipPath as String = "Airborne.zip" + Dim sFilePath As String = "Readme.txt" + Dim sRootFolder As String = "Digado" + Using zip As ZipFile = ZipFile.Read(sZipPath) + If zip.EntryFileNames.Contains(sFilePath) + ' use the string indexer on the zip file + zip(sFilePath).Extract(sRootFolder, _ + ExtractExistingFileAction.OverwriteSilently) + End If + End Using + + + + the pathname of the base directory + + The action to take if extraction would overwrite an existing file. + + + + + Extract the entry to the filesystem, using the current working directory + and the specified password. + + + + This method has a bunch of overloads! One of them is sure to be + the right one for you... + + + + + + + + + Existing entries in the filesystem will not be overwritten. If you + would like to force the overwrite of existing files, see the property, or call + . + + + + See the remarks on the property for some + details about how the "last modified" time of the created file is + set. + + + + + In this example, entries that use encryption are extracted using a + particular password. + + using (var zip = ZipFile.Read(FilePath)) + { + foreach (ZipEntry e in zip) + { + if (e.UsesEncryption) + e.ExtractWithPassword("Secret!"); + else + e.Extract(); + } + } + + + Using zip As ZipFile = ZipFile.Read(FilePath) + Dim e As ZipEntry + For Each e In zip + If (e.UsesEncryption) + e.ExtractWithPassword("Secret!") + Else + e.Extract + End If + Next + End Using + + + The Password to use for decrypting the entry. + + + + Extract the entry to the filesystem, starting at the specified base + directory, and using the specified password. + + + + + + + + Existing entries in the filesystem will not be overwritten. If you + would like to force the overwrite of existing files, see the property, or call + . + + + + See the remarks on the property, for some + details about how the last modified time of the created file is set. + + + + The pathname of the base directory. + The Password to use for decrypting the entry. + + + + Extract the entry to a file in the filesystem, relative to the + current directory, using the specified behavior when extraction + would overwrite an existing file. + + + + + See the remarks on the property, for some + details about how the last modified time of the created file is set. + + + + The Password to use for decrypting the entry. + + + The action to take if extraction would overwrite an existing file. + + + + + Extract the entry to the filesystem, starting at the specified base + directory, and using the specified behavior when extraction would + overwrite an existing file. + + + + See the remarks on the property, for some + details about how the last modified time of the created file is set. + + + the pathname of the base directory + + The action to take if extraction would + overwrite an existing file. + + The Password to use for decrypting the entry. + + + + Extracts the entry to the specified stream, using the specified + Password. For example, the caller could extract to Console.Out, or + to a MemoryStream. + + + + + The caller can specify any write-able stream, for example a , a , or ASP.NET's + Response.OutputStream. The content will be decrypted and + decompressed as necessary. If the entry is encrypted and no password + is provided, this method will throw. + + + The position on the stream is not reset by this method before it extracts. + You may want to call stream.Seek() before calling ZipEntry.Extract(). + + + + + + the stream to which the entry should be extracted. + + + The password to use for decrypting the entry. + + + + + Opens a readable stream corresponding to the zip entry in the + archive. The stream decompresses and decrypts as necessary, as it + is read. + + + + + + DotNetZip offers a variety of ways to extract entries from a zip + file. This method allows an application to extract an entry by + reading a . + + + + The return value is of type . Use it as you would any + stream for reading. When an application calls on that stream, it will + receive data from the zip entry that is decrypted and decompressed + as necessary. + + + + CrcCalculatorStream adds one additional feature: it keeps a + CRC32 checksum on the bytes of the stream as it is read. The CRC + value is available in the property on the + CrcCalculatorStream. When the read is complete, your + application + should check this CRC against the + property on the ZipEntry to validate the content of the + ZipEntry. You don't have to validate the entry using the CRC, but + you should, to verify integrity. Check the example for how to do + this. + + + + If the entry is protected with a password, then you need to provide + a password prior to calling , either by + setting the property on the entry, or the + property on the ZipFile + itself. Or, you can use , the + overload of OpenReader that accepts a password parameter. + + + + If you want to extract entry data into a write-able stream that is + already opened, like a , do not + use this method. Instead, use . + + + + Your application may use only one stream created by OpenReader() at + a time, and you should not call other Extract methods before + completing your reads on a stream obtained from OpenReader(). This + is because there is really only one source stream for the compressed + content. A call to OpenReader() seeks in the source stream, to the + beginning of the compressed content. A subsequent call to + OpenReader() on a different entry will seek to a different position + in the source stream, as will a call to Extract() or one of its + overloads. This will corrupt the state for the decompressing stream + from the original call to OpenReader(). + + + + The OpenReader() method works only when the ZipEntry is + obtained from an instance of ZipFile. This method will throw + an exception if the ZipEntry is obtained from a . + + + + + This example shows how to open a zip archive, then read in a named + entry via a stream. After the read loop is complete, the code + compares the calculated during the read loop with the expected CRC + on the ZipEntry, to verify the extraction. + + using (ZipFile zip = new ZipFile(ZipFileToRead)) + { + ZipEntry e1= zip["Elevation.mp3"]; + using (Ionic.Zlib.CrcCalculatorStream s = e1.OpenReader()) + { + byte[] buffer = new byte[4096]; + int n, totalBytesRead= 0; + do { + n = s.Read(buffer,0, buffer.Length); + totalBytesRead+=n; + } while (n>0); + if (s.Crc32 != e1.Crc32) + throw new Exception(string.Format("The Zip Entry failed the CRC Check. (0x{0:X8}!=0x{1:X8})", s.Crc32, e1.Crc32)); + if (totalBytesRead != e1.UncompressedSize) + throw new Exception(string.Format("We read an unexpected number of bytes. ({0}!={1})", totalBytesRead, e1.UncompressedSize)); + } + } + + + Using zip As New ZipFile(ZipFileToRead) + Dim e1 As ZipEntry = zip.Item("Elevation.mp3") + Using s As Ionic.Zlib.CrcCalculatorStream = e1.OpenReader + Dim n As Integer + Dim buffer As Byte() = New Byte(4096) {} + Dim totalBytesRead As Integer = 0 + Do + n = s.Read(buffer, 0, buffer.Length) + totalBytesRead = (totalBytesRead + n) + Loop While (n > 0) + If (s.Crc32 <> e1.Crc32) Then + Throw New Exception(String.Format("The Zip Entry failed the CRC Check. (0x{0:X8}!=0x{1:X8})", s.Crc32, e1.Crc32)) + End If + If (totalBytesRead <> e1.UncompressedSize) Then + Throw New Exception(String.Format("We read an unexpected number of bytes. ({0}!={1})", totalBytesRead, e1.UncompressedSize)) + End If + End Using + End Using + + + + The Stream for reading. + + + + Opens a readable stream for an encrypted zip entry in the archive. + The stream decompresses and decrypts as necessary, as it is read. + + + + + See the documentation on the method for + full details. This overload allows the application to specify a + password for the ZipEntry to be read. + + + + The password to use for decrypting the entry. + The Stream for reading. + + + + Pass in either basedir or s, but not both. + In other words, you can extract to a stream or to a directory (filesystem), but not both! + The Password param is required for encrypted entries. + + + + + Extract to a stream + In other words, you can extract to a stream or to a directory (filesystem), but not both! + The Password param is required for encrypted entries. + + + + + Validates that the args are consistent; returning whether the caller can return + because it's done, or not (caller should continue) + + + + + Validates that the args are consistent; returning whether the caller can return + because it's done, or not (caller should continue) + + + + + Reads one ZipEntry from the given stream. The content for + the entry does not get decompressed or decrypted. This method + basically reads metadata, and seeks. + + the ZipContainer this entry belongs to. + + true of this is the first entry being read from the stream. + + the ZipEntry read from the stream. + + + + Finds a particular segment in the given extra field. + This is used when modifying a previously-generated + extra field, in particular when removing the AES crypto + segment in the extra field. + + + + + At current cursor position in the stream, read the extra + field, and set the properties on the ZipEntry instance + appropriately. This can be called when processing the + Extra field in the Central Directory, or in the local + header. + + + + + generate and return a byte array that encodes the filename + for the entry. + + + + side effects: generate and store into _CommentBytes the + byte array for any comment attached to the entry. Also + sets _actualEncoding to indicate the actual encoding + used. The same encoding is used for both filename and + comment. + + + + + + Stores the position of the entry source stream, or, if the position is + already stored, seeks to that position. + + + + + This method is called in prep for reading the source stream. If PKZIP + encryption is used, then we need to calc the CRC32 before doing the + encryption, because the CRC is used in the 12th byte of the PKZIP + encryption header. So, we need to be able to seek backward in the source + when saving the ZipEntry. This method is called from the place that + calculates the CRC, and also from the method that does the encryption of + the file data. + + + + The first time through, this method sets the _sourceStreamOriginalPosition + field. Subsequent calls to this method seek to that position. + + + + + + Copy metadata that may have been changed by the app. We do this when + resetting the zipFile instance. If the app calls Save() on a ZipFile, then + tries to party on that file some more, we may need to Reset() it , which + means re-reading the entries and then copying the metadata. I think. + + + + + Set the input stream and get its length, if possible. The length is + used for progress updates, AND, to allow an optimization in case of + a stream/file of zero length. In that case we skip the Encrypt and + compression Stream. (like DeflateStream or BZip2OutputStream) + + + + + Prepare the given stream for output - wrap it in a CountingStream, and + then in a CRC stream, and an encryptor and deflator as appropriate. + + + + Previously this was used in ZipEntry.Write(), but in an effort to + introduce some efficiencies in that method I've refactored to put the + code inline. This method still gets called by ZipOutputStream. + + + + + + An enum that specifies the type of timestamp available on the ZipEntry. + + + + + + The last modified time of a file can be stored in multiple ways in + a zip file, and they are not mutually exclusive: + + + + + In the so-called "DOS" format, which has a 2-second precision. Values + are rounded to the nearest even second. For example, if the time on the + file is 12:34:43, then it will be stored as 12:34:44. This first value + is accessible via the LastModified property. This value is always + present in the metadata for each zip entry. In some cases the value is + invalid, or zero. + + + + In the so-called "Windows" or "NTFS" format, as an 8-byte integer + quantity expressed as the number of 1/10 milliseconds (in other words + the number of 100 nanosecond units) since January 1, 1601 (UTC). This + format is how Windows represents file times. This time is accessible + via the ModifiedTime property. + + + + In the "Unix" format, a 4-byte quantity specifying the number of seconds since + January 1, 1970 UTC. + + + + In an older format, now deprecated but still used by some current + tools. This format is also a 4-byte quantity specifying the number of + seconds since January 1, 1970 UTC. + + + + + + This bit field describes which of the formats were found in a ZipEntry that was read. + + + + + + + Default value. + + + + + A DOS timestamp with 2-second precision. + + + + + A Windows timestamp with 100-ns precision. + + + + + A Unix timestamp with 1-second precision. + + + + + A Unix timestamp with 1-second precision, stored in InfoZip v1 format. This + format is outdated and is supported for reading archives only. + + + + + The method of compression to use for a particular ZipEntry. + + + + PKWare's + ZIP Specification describes a number of distinct + cmopression methods that can be used within a zip + file. DotNetZip supports a subset of them. + + + + + No compression at all. For COM environments, the value is 0 (zero). + + + + + DEFLATE compression, as described in IETF RFC + 1951. This is the "normal" compression used in zip + files. For COM environments, the value is 8. + + + + + BZip2 compression, a compression algorithm developed by Julian Seward. + For COM environments, the value is 12. + + + + + An enum that specifies the source of the ZipEntry. + + + + + Default value. Invalid on a bonafide ZipEntry. + + + + + The entry was instantiated by calling AddFile() or another method that + added an entry from the filesystem. + + + + + The entry was instantiated via or + . + + + + + The ZipEntry was instantiated by reading a zipfile. + + + + + The content for the ZipEntry will be or was provided by the WriteDelegate. + + + + + The content for the ZipEntry will be obtained from the stream dispensed by the OpenDelegate. + The entry was instantiated via . + + + + + The content for the ZipEntry will be or was obtained from a ZipOutputStream. + + + + + An enum providing the options when an error occurs during opening or reading + of a file or directory that is being saved to a zip file. + + + + + This enum describes the actions that the library can take when an error occurs + opening or reading a file, as it is being saved into a Zip archive. + + + + In some cases an error will occur when DotNetZip tries to open a file to be + added to the zip archive. In other cases, an error might occur after the + file has been successfully opened, while DotNetZip is reading the file. + + + + The first problem might occur when calling AddDirectory() on a directory + that contains a Clipper .dbf file; the file is locked by Clipper and + cannot be opened by another process. An example of the second problem is + the ERROR_LOCK_VIOLATION that results when a file is opened by another + process, but not locked, and a range lock has been taken on the file. + Microsoft Outlook takes range locks on .PST files. + + + + + + Throw an exception when an error occurs while zipping. This is the default + behavior. (For COM clients, this is a 0 (zero).) + + + + + When an error occurs during zipping, for example a file cannot be opened, + skip the file causing the error, and continue zipping. (For COM clients, + this is a 1.) + + + + + When an error occurs during zipping, for example a file cannot be opened, + retry the operation that caused the error. Be careful with this option. If + the error is not temporary, the library will retry forever. (For COM + clients, this is a 2.) + + + + + When an error occurs, invoke the zipError event. The event type used is + . A typical use of this option: + a GUI application may wish to pop up a dialog to allow the user to view the + error that occurred, and choose an appropriate action. After your + processing in the error event, if you want to skip the file, set on the + ZipProgressEventArgs.CurrentEntry to Skip. If you want the + exception to be thrown, set ZipErrorAction on the CurrentEntry + to Throw. If you want to cancel the zip, set + ZipProgressEventArgs.Cancel to true. Cancelling differs from using + Skip in that a cancel will not save any further entries, if there are any. + (For COM clients, the value of this enum is a 3.) + + + + + The ZipFile type represents a zip archive file. + + + + + This is the main type in the DotNetZip class library. This class reads and + writes zip files, as defined in the specification + for zip files described by PKWare. The compression for this + implementation is provided by a managed-code version of Zlib, included with + DotNetZip in the classes in the Ionic.Zlib namespace. + + + + This class provides a general purpose zip file capability. Use it to read, + create, or update zip files. When you want to create zip files using a + Stream type to write the zip file, you may want to consider the class. + + + + Both the ZipOutputStream class and the ZipFile class can + be used to create zip files. Both of them support many of the common zip + features, including Unicode, different compression methods and levels, + and ZIP64. They provide very similar performance when creating zip + files. + + + + The ZipFile class is generally easier to use than + ZipOutputStream and should be considered a higher-level interface. For + example, when creating a zip file via calls to the PutNextEntry() and + Write() methods on the ZipOutputStream class, the caller is + responsible for opening the file, reading the bytes from the file, writing + those bytes into the ZipOutputStream, setting the attributes on the + ZipEntry, and setting the created, last modified, and last accessed + timestamps on the zip entry. All of these things are done automatically by a + call to ZipFile.AddFile(). + For this reason, the ZipOutputStream is generally recommended for use + only when your application emits arbitrary data, not necessarily data from a + filesystem file, directly into a zip file, and does so using a Stream + metaphor. + + + + Aside from the differences in programming model, there are other + differences in capability between the two classes. + + + + + ZipFile can be used to read and extract zip files, in addition to + creating zip files. ZipOutputStream cannot read zip files. If you want + to use a stream to read zip files, check out the class. + + + + ZipOutputStream does not support the creation of segmented or spanned + zip files. + + + + ZipOutputStream cannot produce a self-extracting archive. + + + + + Be aware that the ZipFile class implements the interface. In order for ZipFile to + produce a valid zip file, you use use it within a using clause (Using + in VB), or call the Dispose() method explicitly. See the examples + for how to employ a using clause. + + + + + + + Adds an item, either a file or a directory, to a zip file archive. + + + + + This method is handy if you are adding things to zip archive and don't + want to bother distinguishing between directories or files. Any files are + added as single entries. A directory added through this method is added + recursively: all files and subdirectories contained within the directory + are added to the ZipFile. + + + + The name of the item may be a relative path or a fully-qualified + path. Remember, the items contained in ZipFile instance get written + to the disk only when you call or a similar + save method. + + + + The directory name used for the file within the archive is the same + as the directory name (potentially a relative path) specified in the + . + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + + + This method has two overloads. + + the name of the file or directory to add. + + The ZipEntry added. + + + + Adds an item, either a file or a directory, to a zip file archive, + explicitly specifying the directory path to be used in the archive. + + + + + If adding a directory, the add is recursive on all files and + subdirectories contained within it. + + + The name of the item may be a relative path or a fully-qualified path. + The item added by this call to the ZipFile is not read from the + disk nor written to the zip file archive until the application calls + Save() on the ZipFile. + + + + This version of the method allows the caller to explicitly specify the + directory path to be used in the archive, which would override the + "natural" path of the filesystem file. + + + + Encryption will be used on the file data if the Password has + been set on the ZipFile object, prior to calling this method. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + Thrown if the file or directory passed in does not exist. + + + the name of the file or directory to add. + + + + The name of the directory path to use within the zip archive. This path + need not refer to an extant directory in the current filesystem. If the + files within the zip are later extracted, this is the path used for the + extracted file. Passing null (Nothing in VB) will use the + path on the fileOrDirectoryName. Passing the empty string ("") will + insert the item at the root path within the archive. + + + + + + + + This example shows how to zip up a set of files into a flat hierarchy, + regardless of where in the filesystem the files originated. The resulting + zip archive will contain a toplevel directory named "flat", which itself + will contain files Readme.txt, MyProposal.docx, and Image1.jpg. A + subdirectory under "flat" called SupportFiles will contain all the files + in the "c:\SupportFiles" directory on disk. + + + String[] itemnames= { + "c:\\fixedContent\\Readme.txt", + "MyProposal.docx", + "c:\\SupportFiles", // a directory + "images\\Image1.jpg" + }; + + try + { + using (ZipFile zip = new ZipFile()) + { + for (int i = 1; i < itemnames.Length; i++) + { + // will add Files or Dirs, recurses and flattens subdirectories + zip.AddItem(itemnames[i],"flat"); + } + zip.Save(ZipToCreate); + } + } + catch (System.Exception ex1) + { + System.Console.Error.WriteLine("exception: {0}", ex1); + } + + + + Dim itemnames As String() = _ + New String() { "c:\fixedContent\Readme.txt", _ + "MyProposal.docx", _ + "SupportFiles", _ + "images\Image1.jpg" } + Try + Using zip As New ZipFile + Dim i As Integer + For i = 1 To itemnames.Length - 1 + ' will add Files or Dirs, recursing and flattening subdirectories. + zip.AddItem(itemnames(i), "flat") + Next i + zip.Save(ZipToCreate) + End Using + Catch ex1 As Exception + Console.Error.WriteLine("exception: {0}", ex1.ToString()) + End Try + + + The ZipEntry added. + + + + Adds a File to a Zip file archive. + + + + + This call collects metadata for the named file in the filesystem, + including the file attributes and the timestamp, and inserts that metadata + into the resulting ZipEntry. Only when the application calls Save() on + the ZipFile, does DotNetZip read the file from the filesystem and + then write the content to the zip file archive. + + + + This method will throw an exception if an entry with the same name already + exists in the ZipFile. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + In this example, three files are added to a Zip archive. The ReadMe.txt + file will be placed in the root of the archive. The .png file will be + placed in a folder within the zip called photos\personal. The pdf file + will be included into a folder within the zip called Desktop. + + + try + { + using (ZipFile zip = new ZipFile()) + { + zip.AddFile("c:\\photos\\personal\\7440-N49th.png"); + zip.AddFile("c:\\Desktop\\2008-Regional-Sales-Report.pdf"); + zip.AddFile("ReadMe.txt"); + + zip.Save("Package.zip"); + } + } + catch (System.Exception ex1) + { + System.Console.Error.WriteLine("exception: " + ex1); + } + + + + Try + Using zip As ZipFile = New ZipFile + zip.AddFile("c:\photos\personal\7440-N49th.png") + zip.AddFile("c:\Desktop\2008-Regional-Sales-Report.pdf") + zip.AddFile("ReadMe.txt") + zip.Save("Package.zip") + End Using + Catch ex1 As Exception + Console.Error.WriteLine("exception: {0}", ex1.ToString) + End Try + + + + This method has two overloads. + + + + + + + The name of the file to add. It should refer to a file in the filesystem. + The name of the file may be a relative path or a fully-qualified path. + + The ZipEntry corresponding to the File added. + + + + Adds a File to a Zip file archive, potentially overriding the path to be + used within the zip archive. + + + + + The file added by this call to the ZipFile is not written to the + zip file archive until the application calls Save() on the ZipFile. + + + + This method will throw an exception if an entry with the same name already + exists in the ZipFile. + + + + This version of the method allows the caller to explicitly specify the + directory path to be used in the archive. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + In this example, three files are added to a Zip archive. The ReadMe.txt + file will be placed in the root of the archive. The .png file will be + placed in a folder within the zip called images. The pdf file will be + included into a folder within the zip called files\docs, and will be + encrypted with the given password. + + + try + { + using (ZipFile zip = new ZipFile()) + { + // the following entry will be inserted at the root in the archive. + zip.AddFile("c:\\datafiles\\ReadMe.txt", ""); + // this image file will be inserted into the "images" directory in the archive. + zip.AddFile("c:\\photos\\personal\\7440-N49th.png", "images"); + // the following will result in a password-protected file called + // files\\docs\\2008-Regional-Sales-Report.pdf in the archive. + zip.Password = "EncryptMe!"; + zip.AddFile("c:\\Desktop\\2008-Regional-Sales-Report.pdf", "files\\docs"); + zip.Save("Archive.zip"); + } + } + catch (System.Exception ex1) + { + System.Console.Error.WriteLine("exception: {0}", ex1); + } + + + + Try + Using zip As ZipFile = New ZipFile + ' the following entry will be inserted at the root in the archive. + zip.AddFile("c:\datafiles\ReadMe.txt", "") + ' this image file will be inserted into the "images" directory in the archive. + zip.AddFile("c:\photos\personal\7440-N49th.png", "images") + ' the following will result in a password-protected file called + ' files\\docs\\2008-Regional-Sales-Report.pdf in the archive. + zip.Password = "EncryptMe!" + zip.AddFile("c:\Desktop\2008-Regional-Sales-Report.pdf", "files\documents") + zip.Save("Archive.zip") + End Using + Catch ex1 As Exception + Console.Error.WriteLine("exception: {0}", ex1) + End Try + + + + + + + + + The name of the file to add. The name of the file may be a relative path + or a fully-qualified path. + + + + Specifies a directory path to use to override any path in the fileName. + This path may, or may not, correspond to a real directory in the current + filesystem. If the files within the zip are later extracted, this is the + path used for the extracted file. Passing null (Nothing in + VB) will use the path on the fileName, if any. Passing the empty string + ("") will insert the item at the root path within the archive. + + + The ZipEntry corresponding to the file added. + + + + This method removes a collection of entries from the ZipFile. + + + + A collection of ZipEntry instances from this zip file to be removed. For + example, you can pass in an array of ZipEntry instances; or you can call + SelectEntries(), and then add or remove entries from that + ICollection<ZipEntry> (ICollection(Of ZipEntry) in VB), and pass + that ICollection to this method. + + + + + + + + This method removes a collection of entries from the ZipFile, by name. + + + + A collection of strings that refer to names of entries to be removed + from the ZipFile. For example, you can pass in an array or a + List of Strings that provide the names of entries to be removed. + + + + + + + + This method adds a set of files to the ZipFile. + + + + + Use this method to add a set of files to the zip archive, in one call. + For example, a list of files received from + System.IO.Directory.GetFiles() can be added to a zip archive in one + call. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to each + ZipEntry added. + + + + + The collection of names of the files to add. Each string should refer to a + file in the filesystem. The name of the file may be a relative path or a + fully-qualified path. + + + + This example shows how to create a zip file, and add a few files into it. + + String ZipFileToCreate = "archive1.zip"; + String DirectoryToZip = "c:\\reports"; + using (ZipFile zip = new ZipFile()) + { + // Store all files found in the top level directory, into the zip archive. + String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip); + zip.AddFiles(filenames); + zip.Save(ZipFileToCreate); + } + + + + Dim ZipFileToCreate As String = "archive1.zip" + Dim DirectoryToZip As String = "c:\reports" + Using zip As ZipFile = New ZipFile + ' Store all files found in the top level directory, into the zip archive. + Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip) + zip.AddFiles(filenames) + zip.Save(ZipFileToCreate) + End Using + + + + + + + + Adds or updates a set of files in the ZipFile. + + + + + Any files that already exist in the archive are updated. Any files that + don't yet exist in the archive are added. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to each + ZipEntry added. + + + + + The collection of names of the files to update. Each string should refer to a file in + the filesystem. The name of the file may be a relative path or a fully-qualified path. + + + + + + Adds a set of files to the ZipFile, using the + specified directory path in the archive. + + + + + Any directory structure that may be present in the + filenames contained in the list is "flattened" in the + archive. Each file in the list is added to the archive in + the specified top-level directory. + + + + For ZipFile properties including , , , , , , and , their respective values at the + time of this call will be applied to each ZipEntry added. + + + + + The names of the files to add. Each string should refer to + a file in the filesystem. The name of the file may be a + relative path or a fully-qualified path. + + + + Specifies a directory path to use to override any path in the file name. + Th is path may, or may not, correspond to a real directory in the current + filesystem. If the files within the zip are later extracted, this is the + path used for the extracted file. Passing null (Nothing in + VB) will use the path on each of the fileNames, if any. Passing + the empty string ("") will insert the item at the root path within the + archive. + + + + + + + Adds a set of files to the ZipFile, using the specified directory + path in the archive, and preserving the full directory structure in the + filenames. + + + + + + Think of the as a "root" or + base directory used in the archive for the files that get added. when + is true, the hierarchy of files + found in the filesystem will be placed, with the hierarchy intact, + starting at that root in the archive. When preserveDirHierarchy + is false, the path hierarchy of files is flattned, and the flattened + set of files gets placed in the root within the archive as specified in + directoryPathInArchive. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to each + ZipEntry added. + + + + + + The names of the files to add. Each string should refer to a file in the + filesystem. The name of the file may be a relative path or a + fully-qualified path. + + + + Specifies a directory path to use as a prefix for each entry name. + This path may, or may not, correspond to a real directory in the current + filesystem. If the files within the zip are later extracted, this is the + path used for the extracted file. Passing null (Nothing in + VB) will use the path on each of the fileNames, if any. Passing + the empty string ("") will insert the item at the root path within the + archive. + + + + whether the entries in the zip archive will reflect the directory + hierarchy that is present in the various filenames. For example, if + includes two paths, + \Animalia\Chordata\Mammalia\Info.txt and + \Plantae\Magnoliophyta\Dicotyledon\Info.txt, then calling this method + with = false will + result in an exception because of a duplicate entry name, while + calling this method with = + true will result in the full direcory paths being included in + the entries added to the ZipFile. + + + + + + Adds or updates a set of files to the ZipFile, using the specified + directory path in the archive. + + + + + + Any files that already exist in the archive are updated. Any files that + don't yet exist in the archive are added. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to each + ZipEntry added. + + + + + The names of the files to add or update. Each string should refer to a + file in the filesystem. The name of the file may be a relative path or a + fully-qualified path. + + + + Specifies a directory path to use to override any path in the file name. + This path may, or may not, correspond to a real directory in the current + filesystem. If the files within the zip are later extracted, this is the + path used for the extracted file. Passing null (Nothing in + VB) will use the path on each of the fileNames, if any. Passing + the empty string ("") will insert the item at the root path within the + archive. + + + + + + + Adds or Updates a File in a Zip file archive. + + + + + This method adds a file to a zip archive, or, if the file already exists + in the zip archive, this method Updates the content of that given filename + in the zip archive. The UpdateFile method might more accurately be + called "AddOrUpdateFile". + + + + Upon success, there is no way for the application to learn whether the file + was added versus updated. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + This example shows how to Update an existing entry in a zipfile. The first + call to UpdateFile adds the file to the newly-created zip archive. The + second call to UpdateFile updates the content for that file in the zip + archive. + + + using (ZipFile zip1 = new ZipFile()) + { + // UpdateFile might more accurately be called "AddOrUpdateFile" + zip1.UpdateFile("MyDocuments\\Readme.txt"); + zip1.UpdateFile("CustomerList.csv"); + zip1.Comment = "This zip archive has been created."; + zip1.Save("Content.zip"); + } + + using (ZipFile zip2 = ZipFile.Read("Content.zip")) + { + zip2.UpdateFile("Updates\\Readme.txt"); + zip2.Comment = "This zip archive has been updated: The Readme.txt file has been changed."; + zip2.Save(); + } + + + + Using zip1 As New ZipFile + ' UpdateFile might more accurately be called "AddOrUpdateFile" + zip1.UpdateFile("MyDocuments\Readme.txt") + zip1.UpdateFile("CustomerList.csv") + zip1.Comment = "This zip archive has been created." + zip1.Save("Content.zip") + End Using + + Using zip2 As ZipFile = ZipFile.Read("Content.zip") + zip2.UpdateFile("Updates\Readme.txt") + zip2.Comment = "This zip archive has been updated: The Readme.txt file has been changed." + zip2.Save + End Using + + + + + + + + + The name of the file to add or update. It should refer to a file in the + filesystem. The name of the file may be a relative path or a + fully-qualified path. + + + + The ZipEntry corresponding to the File that was added or updated. + + + + + Adds or Updates a File in a Zip file archive. + + + + + This method adds a file to a zip archive, or, if the file already exists + in the zip archive, this method Updates the content of that given filename + in the zip archive. + + + + This version of the method allows the caller to explicitly specify the + directory path to be used in the archive. The entry to be added or + updated is found by using the specified directory path, combined with the + basename of the specified filename. + + + + Upon success, there is no way for the application to learn if the file was + added versus updated. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + + + The name of the file to add or update. It should refer to a file in the + filesystem. The name of the file may be a relative path or a + fully-qualified path. + + + + Specifies a directory path to use to override any path in the + fileName. This path may, or may not, correspond to a real + directory in the current filesystem. If the files within the zip are + later extracted, this is the path used for the extracted file. Passing + null (Nothing in VB) will use the path on the + fileName, if any. Passing the empty string ("") will insert the + item at the root path within the archive. + + + + The ZipEntry corresponding to the File that was added or updated. + + + + + Add or update a directory in a zip archive. + + + + If the specified directory does not exist in the archive, then this method + is equivalent to calling AddDirectory(). If the specified + directory already exists in the archive, then this method updates any + existing entries, and adds any new entries. Any entries that are in the + zip archive but not in the specified directory, are left alone. In other + words, the contents of the zip file will be a union of the previous + contents and the new files. + + + + + + + + The path to the directory to be added to the zip archive, or updated in + the zip archive. + + + + The ZipEntry corresponding to the Directory that was added or updated. + + + + + Add or update a directory in the zip archive at the specified root + directory in the archive. + + + + If the specified directory does not exist in the archive, then this method + is equivalent to calling AddDirectory(). If the specified + directory already exists in the archive, then this method updates any + existing entries, and adds any new entries. Any entries that are in the + zip archive but not in the specified directory, are left alone. In other + words, the contents of the zip file will be a union of the previous + contents and the new files. + + + + + + + + The path to the directory to be added to the zip archive, or updated + in the zip archive. + + + + Specifies a directory path to use to override any path in the + directoryName. This path may, or may not, correspond to a real + directory in the current filesystem. If the files within the zip are + later extracted, this is the path used for the extracted file. Passing + null (Nothing in VB) will use the path on the + directoryName, if any. Passing the empty string ("") will insert + the item at the root path within the archive. + + + + The ZipEntry corresponding to the Directory that was added or updated. + + + + + Add or update a file or directory in the zip archive. + + + + + This is useful when the application is not sure or does not care if the + item to be added is a file or directory, and does not know or does not + care if the item already exists in the ZipFile. Calling this method + is equivalent to calling RemoveEntry() if an entry by the same name + already exists, followed calling by AddItem(). + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + + + the path to the file or directory to be added or updated. + + + + + Add or update a file or directory. + + + + + This method is useful when the application is not sure or does not care if + the item to be added is a file or directory, and does not know or does not + care if the item already exists in the ZipFile. Calling this method + is equivalent to calling RemoveEntry(), if an entry by that name + exists, and then calling AddItem(). + + + + This version of the method allows the caller to explicitly specify the + directory path to be used for the item being added to the archive. The + entry or entries that are added or updated will use the specified + DirectoryPathInArchive. Extracting the entry from the archive will + result in a file stored in that directory path. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + + + The path for the File or Directory to be added or updated. + + + Specifies a directory path to use to override any path in the + itemName. This path may, or may not, correspond to a real + directory in the current filesystem. If the files within the zip are + later extracted, this is the path used for the extracted file. Passing + null (Nothing in VB) will use the path on the + itemName, if any. Passing the empty string ("") will insert the + item at the root path within the archive. + + + + + Adds a named entry into the zip archive, taking content for the entry + from a string. + + + + Calling this method creates an entry using the given fileName and + directory path within the archive. There is no need for a file by the + given name to exist in the filesystem; the name is used within the zip + archive only. The content for the entry is encoded using the default text + encoding for the machine. + + + + The content of the file, should it be extracted from the zip. + + + + The name, including any path, to use for the entry within the archive. + + + The ZipEntry added. + + + + This example shows how to add an entry to the zipfile, using a string as + content for that entry. + + + string Content = "This string will be the content of the Readme.txt file in the zip archive."; + using (ZipFile zip1 = new ZipFile()) + { + zip1.AddFile("MyDocuments\\Resume.doc", "files"); + zip1.AddEntry("Readme.txt", Content); + zip1.Comment = "This zip file was created at " + System.DateTime.Now.ToString("G"); + zip1.Save("Content.zip"); + } + + + + Public Sub Run() + Dim Content As String = "This string will be the content of the Readme.txt file in the zip archive." + Using zip1 As ZipFile = New ZipFile + zip1.AddEntry("Readme.txt", Content) + zip1.AddFile("MyDocuments\Resume.doc", "files") + zip1.Comment = ("This zip file was created at " & DateTime.Now.ToString("G")) + zip1.Save("Content.zip") + End Using + End Sub + + + + + + Adds a named entry into the zip archive, taking content for the entry + from a string, and using the specified text encoding. + + + + + + Calling this method creates an entry using the given fileName and + directory path within the archive. There is no need for a file by the + given name to exist in the filesystem; the name is used within the zip + archive only. + + + + The content for the entry, a string value, is encoded using the given + text encoding. A BOM (byte-order-mark) is emitted into the file, if the + Encoding parameter is set for that. + + + + Most Encoding classes support a constructor that accepts a boolean, + indicating whether to emit a BOM or not. For example see . + + + + + + The name, including any path, to use within the archive for the entry. + + + + The content of the file, should it be extracted from the zip. + + + + The text encoding to use when encoding the string. Be aware: This is + distinct from the text encoding used to encode the fileName, as specified + in . + + + The ZipEntry added. + + + + + Create an entry in the ZipFile using the given Stream + as input. The entry will have the given filename. + + + + + + The application should provide an open, readable stream; in this case it + will be read during the call to or one of + its overloads. + + + + The passed stream will be read from its current position. If + necessary, callers should set the position in the stream before + calling AddEntry(). This might be appropriate when using this method + with a MemoryStream, for example. + + + + In cases where a large number of streams will be added to the + ZipFile, the application may wish to avoid maintaining all of the + streams open simultaneously. To handle this situation, the application + should use the + overload. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + This example adds a single entry to a ZipFile via a Stream. + + + + String zipToCreate = "Content.zip"; + String fileNameInArchive = "Content-From-Stream.bin"; + using (System.IO.Stream streamToRead = MyStreamOpener()) + { + using (ZipFile zip = new ZipFile()) + { + ZipEntry entry= zip.AddEntry(fileNameInArchive, streamToRead); + zip.AddFile("Readme.txt"); + zip.Save(zipToCreate); // the stream is read implicitly here + } + } + + + + Dim zipToCreate As String = "Content.zip" + Dim fileNameInArchive As String = "Content-From-Stream.bin" + Using streamToRead as System.IO.Stream = MyStreamOpener() + Using zip As ZipFile = New ZipFile() + Dim entry as ZipEntry = zip.AddEntry(fileNameInArchive, streamToRead) + zip.AddFile("Readme.txt") + zip.Save(zipToCreate) '' the stream is read implicitly, here + End Using + End Using + + + + + + + The name, including any path, which is shown in the zip file for the added + entry. + + + The input stream from which to grab content for the file + + The ZipEntry added. + + + + Add a ZipEntry for which content is written directly by the application. + + + + + When the application needs to write the zip entry data, use this + method to add the ZipEntry. For example, in the case that the + application wishes to write the XML representation of a DataSet into + a ZipEntry, the application can use this method to do so. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + About progress events: When using the WriteDelegate, DotNetZip does + not issue any SaveProgress events with EventType = + Saving_EntryBytesRead. (This is because it is the + application's code that runs in WriteDelegate - there's no way for + DotNetZip to know when to issue a EntryBytesRead event.) + Applications that want to update a progress bar or similar status + indicator should do so from within the WriteDelegate + itself. DotNetZip will issue the other SaveProgress events, + including + Saving_Started, + + Saving_BeforeWriteEntry, and + Saving_AfterWriteEntry. + + + + Note: When you use PKZip encryption, it's normally necessary to + compute the CRC of the content to be encrypted, before compressing or + encrypting it. Therefore, when using PKZip encryption with a + WriteDelegate, the WriteDelegate CAN BE called twice: once to compute + the CRC, and the second time to potentially compress and + encrypt. Surprising, but true. This is because PKWARE specified that + the encryption initialization data depends on the CRC. + If this happens, for each call of the delegate, your + application must stream the same entry data in its entirety. If your + application writes different data during the second call, it will + result in a corrupt zip file. + + + + The double-read behavior happens with all types of entries, not only + those that use WriteDelegate. It happens if you add an entry from a + filesystem file, or using a string, or a stream, or an opener/closer + pair. But in those cases, DotNetZip takes care of reading twice; in + the case of the WriteDelegate, the application code gets invoked + twice. Be aware. + + + + As you can imagine, this can cause performance problems for large + streams, and it can lead to correctness problems when you use a + WriteDelegate. This is a pretty big pitfall. There are two + ways to avoid it. First, and most preferred: don't use PKZIP + encryption. If you use the WinZip AES encryption, this problem + doesn't occur, because the encryption protocol doesn't require the CRC + up front. Second: if you do choose to use PKZIP encryption, write out + to a non-seekable stream (like standard output, or the + Response.OutputStream in an ASP.NET application). In this case, + DotNetZip will use an alternative encryption protocol that does not + rely on the CRC of the content. This also implies setting bit 3 in + the zip entry, which still presents problems for some zip tools. + + + + In the future I may modify DotNetZip to *always* use bit 3 when PKZIP + encryption is in use. This seems like a win overall, but there will + be some work involved. If you feel strongly about it, visit the + DotNetZip forums and vote up the Workitem + tracking this issue. + + + + + the name of the entry to add + the delegate which will write the entry content + the ZipEntry added + + + + This example shows an application filling a DataSet, then saving the + contents of that DataSet as XML, into a ZipEntry in a ZipFile, using an + anonymous delegate in C#. The DataSet XML is never saved to a disk file. + + + var c1= new System.Data.SqlClient.SqlConnection(connstring1); + var da = new System.Data.SqlClient.SqlDataAdapter() + { + SelectCommand= new System.Data.SqlClient.SqlCommand(strSelect, c1) + }; + + DataSet ds1 = new DataSet(); + da.Fill(ds1, "Invoices"); + + using(Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile()) + { + zip.AddEntry(zipEntryName, (name,stream) => ds1.WriteXml(stream) ); + zip.Save(zipFileName); + } + + + + + + This example uses an anonymous method in C# as the WriteDelegate to provide + the data for the ZipEntry. The example is a bit contrived - the + AddFile() method is a simpler way to insert the contents of a file + into an entry in a zip file. On the other hand, if there is some sort of + processing or transformation of the file contents required before writing, + the application could use the WriteDelegate to do it, in this way. + + + using (var input = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite )) + { + using(Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile()) + { + zip.AddEntry(zipEntryName, (name,output) => + { + byte[] buffer = new byte[BufferSize]; + int n; + while ((n = input.Read(buffer, 0, buffer.Length)) != 0) + { + // could transform the data here... + output.Write(buffer, 0, n); + // could update a progress bar here + } + }); + + zip.Save(zipFileName); + } + } + + + + + + This example uses a named delegate in VB to write data for the given + ZipEntry (VB9 does not have anonymous delegates). The example here is a bit + contrived - a simpler way to add the contents of a file to a ZipEntry is to + simply use the appropriate AddFile() method. The key scenario for + which the WriteDelegate makes sense is saving a DataSet, in XML + format, to the zip file. The DataSet can write XML to a stream, and the + WriteDelegate is the perfect place to write into the zip file. There may be + other data structures that can write to a stream, but cannot be read as a + stream. The WriteDelegate would be appropriate for those cases as + well. + + + Private Sub WriteEntry (ByVal name As String, ByVal output As Stream) + Using input As FileStream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite) + Dim n As Integer = -1 + Dim buffer As Byte() = New Byte(BufferSize){} + Do While n <> 0 + n = input.Read(buffer, 0, buffer.Length) + output.Write(buffer, 0, n) + Loop + End Using + End Sub + + Public Sub Run() + Using zip = New ZipFile + zip.AddEntry(zipEntryName, New WriteDelegate(AddressOf WriteEntry)) + zip.Save(zipFileName) + End Using + End Sub + + + + + + Add an entry, for which the application will provide a stream + containing the entry data, on a just-in-time basis. + + + + + In cases where the application wishes to open the stream that + holds the content for the ZipEntry, on a just-in-time basis, the + application can use this method. The application provides an + opener delegate that will be called by the DotNetZip library to + obtain a readable stream that can be read to get the bytes for + the given entry. Typically, this delegate opens a stream. + Optionally, the application can provide a closer delegate as + well, which will be called by DotNetZip when all bytes have been + read from the entry. + + + + These delegates are called from within the scope of the call to + ZipFile.Save(). + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + This example uses anonymous methods in C# to open and close the + source stream for the content for a zip entry. + + + using(Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile()) + { + zip.AddEntry(zipEntryName, + (name) => File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ), + (name, stream) => stream.Close() + ); + + zip.Save(zipFileName); + } + + + + + + + This example uses delegates in VB.NET to open and close the + the source stream for the content for a zip entry. VB 9.0 lacks + support for "Sub" lambda expressions, and so the CloseDelegate must + be an actual, named Sub. + + + + Function MyStreamOpener(ByVal entryName As String) As Stream + '' This simply opens a file. You probably want to do somethinig + '' more involved here: open a stream to read from a database, + '' open a stream on an HTTP connection, and so on. + Return File.OpenRead(entryName) + End Function + + Sub MyStreamCloser(entryName As String, stream As Stream) + stream.Close() + End Sub + + Public Sub Run() + Dim dirToZip As String = "fodder" + Dim zipFileToCreate As String = "Archive.zip" + Dim opener As OpenDelegate = AddressOf MyStreamOpener + Dim closer As CloseDelegate = AddressOf MyStreamCloser + Dim numFilestoAdd As Int32 = 4 + Using zip As ZipFile = New ZipFile + Dim i As Integer + For i = 0 To numFilesToAdd - 1 + zip.AddEntry(String.Format("content-{0:000}.txt"), opener, closer) + Next i + zip.Save(zipFileToCreate) + End Using + End Sub + + + + + the name of the entry to add + + the delegate that will be invoked by ZipFile.Save() to get the + readable stream for the given entry. ZipFile.Save() will call + read on this stream to obtain the data for the entry. This data + will then be compressed and written to the newly created zip + file. + + + the delegate that will be invoked to close the stream. This may + be null (Nothing in VB), in which case no call is makde to close + the stream. + + the ZipEntry added + + + + + Updates the given entry in the ZipFile, using the given + string as content for the ZipEntry. + + + + + + Calling this method is equivalent to removing the ZipEntry for + the given file name and directory path, if it exists, and then calling + . See the documentation for + that method for further explanation. The string content is encoded + using the default encoding for the machine. This encoding is distinct + from the encoding used for the filename itself. See + . + + + + + + The name, including any path, to use within the archive for the entry. + + + + The content of the file, should it be extracted from the zip. + + + The ZipEntry added. + + + + + Updates the given entry in the ZipFile, using the given string as + content for the ZipEntry. + + + + Calling this method is equivalent to removing the ZipEntry for the + given file name and directory path, if it exists, and then calling . See the + documentation for that method for further explanation. + + + + The name, including any path, to use within the archive for the entry. + + + + The content of the file, should it be extracted from the zip. + + + + The text encoding to use when encoding the string. Be aware: This is + distinct from the text encoding used to encode the filename. See . + + + The ZipEntry added. + + + + + Updates the given entry in the ZipFile, using the given delegate + as the source for content for the ZipEntry. + + + + Calling this method is equivalent to removing the ZipEntry for the + given file name and directory path, if it exists, and then calling . See the + documentation for that method for further explanation. + + + + The name, including any path, to use within the archive for the entry. + + + the delegate which will write the entry content. + + The ZipEntry added. + + + + + Updates the given entry in the ZipFile, using the given delegates + to open and close the stream that provides the content for the ZipEntry. + + + + Calling this method is equivalent to removing the ZipEntry for the + given file name and directory path, if it exists, and then calling . See the + documentation for that method for further explanation. + + + + The name, including any path, to use within the archive for the entry. + + + + the delegate that will be invoked to open the stream + + + the delegate that will be invoked to close the stream + + + The ZipEntry added or updated. + + + + + Updates the given entry in the ZipFile, using the given stream as + input, and the given filename and given directory Path. + + + + + Calling the method is equivalent to calling RemoveEntry() if an + entry by the same name already exists, and then calling AddEntry() + with the given fileName and stream. + + + + The stream must be open and readable during the call to + ZipFile.Save. You can dispense the stream on a just-in-time basis + using the property. Check the + documentation of that property for more information. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to the + ZipEntry added. + + + + + + + + + The name, including any path, to use within the archive for the entry. + + + The input stream from which to read file data. + The ZipEntry added. + + + + Add an entry into the zip archive using the given filename and + directory path within the archive, and the given content for the + file. No file is created in the filesystem. + + + The data to use for the entry. + + + The name, including any path, to use within the archive for the entry. + + + The ZipEntry added. + + + + Updates the given entry in the ZipFile, using the given byte + array as content for the entry. + + + + Calling this method is equivalent to removing the ZipEntry + for the given filename and directory path, if it exists, and then + calling . See the + documentation for that method for further explanation. + + + + The name, including any path, to use within the archive for the entry. + + + The content to use for the ZipEntry. + + The ZipEntry added. + + + + + Adds the contents of a filesystem directory to a Zip file archive. + + + + + + The name of the directory may be a relative path or a fully-qualified + path. Any files within the named directory are added to the archive. Any + subdirectories within the named directory are also added to the archive, + recursively. + + + + Top-level entries in the named directory will appear as top-level entries + in the zip archive. Entries in subdirectories in the named directory will + result in entries in subdirectories in the zip archive. + + + + If you want the entries to appear in a containing directory in the zip + archive itself, then you should call the AddDirectory() overload that + allows you to explicitly specify a directory path for use in the archive. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to each + ZipEntry added. + + + + + + + + + + This method has 2 overloads. + + The name of the directory to add. + The ZipEntry added. + + + + Adds the contents of a filesystem directory to a Zip file archive, + overriding the path to be used for entries in the archive. + + + + + The name of the directory may be a relative path or a fully-qualified + path. The add operation is recursive, so that any files or subdirectories + within the name directory are also added to the archive. + + + + Top-level entries in the named directory will appear as top-level entries + in the zip archive. Entries in subdirectories in the named directory will + result in entries in subdirectories in the zip archive. + + + + For ZipFile properties including , , , , , + , and , their + respective values at the time of this call will be applied to each + ZipEntry added. + + + + + + + In this code, calling the ZipUp() method with a value of "c:\reports" for + the directory parameter will result in a zip file structure in which all + entries are contained in a toplevel "reports" directory. + + + + public void ZipUp(string targetZip, string directory) + { + using (var zip = new ZipFile()) + { + zip.AddDirectory(directory, System.IO.Path.GetFileName(directory)); + zip.Save(targetZip); + } + } + + + + + + + + The name of the directory to add. + + + Specifies a directory path to use to override any path in the + DirectoryName. This path may, or may not, correspond to a real directory + in the current filesystem. If the zip is later extracted, this is the + path used for the extracted file or directory. Passing null + (Nothing in VB) or the empty string ("") will insert the items at + the root path within the archive. + + + The ZipEntry added. + + + + Creates a directory in the zip archive. + + + + + + Use this when you want to create a directory in the archive but there is + no corresponding filesystem representation for that directory. + + + + You will probably not need to do this in your code. One of the only times + you will want to do this is if you want an empty directory in the zip + archive. The reason: if you add a file to a zip archive that is stored + within a multi-level directory, all of the directory tree is implicitly + created in the zip archive. + + + + + + The name of the directory to create in the archive. + + The ZipEntry added. + + + + Checks a zip file to see if its directory is consistent. + + + + + + In cases of data error, the directory within a zip file can get out + of synch with the entries in the zip file. This method checks the + given zip file and returns true if this has occurred. + + + This method may take a long time to run for large zip files. + + + This method is not supported in the Reduced version of DotNetZip. + + + + Developers using COM can use the ComHelper.CheckZip(String) + method. + + + + + The filename to of the zip file to check. + + true if the named zip file checks OK. Otherwise, false. + + + + + + + Checks a zip file to see if its directory is consistent, + and optionally fixes the directory if necessary. + + + + + + In cases of data error, the directory within a zip file can get out of + synch with the entries in the zip file. This method checks the given + zip file, and returns true if this has occurred. It also optionally + fixes the zipfile, saving the fixed copy in Name_Fixed.zip. + + + + This method may take a long time to run for large zip files. It + will take even longer if the file actually needs to be fixed, and if + fixIfNecessary is true. + + + + This method is not supported in the Reduced version of DotNetZip. + + + + + The filename to of the zip file to check. + + If true, the method will fix the zip file if + necessary. + + + a TextWriter in which messages generated while checking will be written. + + + true if the named zip is OK; false if the file needs to be fixed. + + + + + + + Rewrite the directory within a zipfile. + + + + + + In cases of data error, the directory in a zip file can get out of + synch with the entries in the zip file. This method attempts to fix + the zip file if this has occurred. + + + This can take a long time for large zip files. + + This won't work if the zip file uses a non-standard + code page - neither IBM437 nor UTF-8. + + + This method is not supported in the Reduced or Compact Framework + versions of DotNetZip. + + + + Developers using COM can use the ComHelper.FixZipDirectory(String) + method. + + + + + The filename to of the zip file to fix. + + + + + + + Verify the password on a zip file. + + + + + Keep in mind that passwords in zipfiles are applied to + zip entries, not to the entire zip file. So testing a + zipfile for a particular password doesn't work in the + general case. On the other hand, it's often the case + that a single password will be used on all entries in a + zip file. This method works for that case. + + + There is no way to check a password without doing the + decryption. So this code decrypts and extracts the given + zipfile into + + + + The filename to of the zip file to fix. + + The password to check. + + a bool indicating whether the password matches. + + + + Provides a human-readable string with information about the ZipFile. + + + + + The information string contains 10 lines or so, about each ZipEntry, + describing whether encryption is in use, the compressed and uncompressed + length of the entry, the offset of the entry, and so on. As a result the + information string can be very long for zip files that contain many + entries. + + + This information is mostly useful for diagnostic purposes. + + + + + + Indicates whether to perform a full scan of the zip file when reading it. + + + + + + You almost never want to use this property. + + + + When reading a zip file, if this flag is true (True in + VB), the entire zip archive will be scanned and searched for entries. + For large archives, this can take a very, long time. The much more + efficient default behavior is to read the zip directory, which is + stored at the end of the zip file. But, in some cases the directory is + corrupted and you need to perform a full scan of the zip file to + determine the contents of the zip file. This property lets you do + that, when necessary. + + + + This flag is effective only when calling . Normally you would read a ZipFile with the + static ZipFile.Read + method. But you can't set the FullScan property on the + ZipFile instance when you use a static factory method like + ZipFile.Read. + + + + + + + This example shows how to read a zip file using the full scan approach, + and then save it, thereby producing a corrected zip file. + + + using (var zip = new ZipFile()) + { + zip.FullScan = true; + zip.Initialize(zipFileName); + zip.Save(newName); + } + + + + Using zip As New ZipFile + zip.FullScan = True + zip.Initialize(zipFileName) + zip.Save(newName) + End Using + + + + + + + Whether to sort the ZipEntries before saving the file. + + + + The default is false. If you have a large number of zip entries, the sort + alone can consume significant time. + + + + + using (var zip = new ZipFile()) + { + zip.AddFiles(filesToAdd); + zip.SortEntriesBeforeSaving = true; + zip.Save(name); + } + + + + Using zip As New ZipFile + zip.AddFiles(filesToAdd) + zip.SortEntriesBeforeSaving = True + zip.Save(name) + End Using + + + + + + + Indicates whether NTFS Reparse Points, like junctions, should be + traversed during calls to AddDirectory(). + + + + By default, calls to AddDirectory() will traverse NTFS reparse + points, like mounted volumes, and directory junctions. An example + of a junction is the "My Music" directory in Windows Vista. In some + cases you may not want DotNetZip to traverse those directories. In + that case, set this property to false. + + + + + using (var zip = new ZipFile()) + { + zip.AddDirectoryWillTraverseReparsePoints = false; + zip.AddDirectory(dirToZip,"fodder"); + zip.Save(zipFileToCreate); + } + + + + + + Size of the IO buffer used while saving. + + + + + + First, let me say that you really don't need to bother with this. It is + here to allow for optimizations that you probably won't make! It will work + fine if you don't set or get this property at all. Ok? + + + + Now that we have that out of the way, the fine print: This + property affects the size of the buffer that is used for I/O for each + entry contained in the zip file. When a file is read in to be compressed, + it uses a buffer given by the size here. When you update a zip file, the + data for unmodified entries is copied from the first zip file to the + other, through a buffer given by the size here. + + + + Changing the buffer size affects a few things: first, for larger buffer + sizes, the memory used by the ZipFile, obviously, will be larger + during I/O operations. This may make operations faster for very much + larger files. Last, for any given entry, when you use a larger buffer + there will be fewer progress events during I/O operations, because there's + one progress event generated for each time the buffer is filled and then + emptied. + + + + The default buffer size is 8k. Increasing the buffer size may speed + things up as you compress larger files. But there are no hard-and-fast + rules here, eh? You won't know til you test it. And there will be a + limit where ever larger buffers actually slow things down. So as I said + in the beginning, it's probably best if you don't set or get this property + at all. + + + + + + This example shows how you might set a large buffer size for efficiency when + dealing with zip entries that are larger than 1gb. + + using (ZipFile zip = new ZipFile()) + { + zip.SaveProgress += this.zip1_SaveProgress; + zip.AddDirectory(directoryToZip, ""); + zip.UseZip64WhenSaving = Zip64Option.Always; + zip.BufferSize = 65536*8; // 65536 * 8 = 512k + zip.Save(ZipFileToCreate); + } + + + + + + Size of the work buffer to use for the ZLIB codec during compression. + + + + + When doing ZLIB or Deflate compression, the library fills a buffer, + then passes it to the compressor for compression. Then the library + reads out the compressed bytes. This happens repeatedly until there + is no more uncompressed data to compress. This property sets the + size of the buffer that will be used for chunk-wise compression. In + order for the setting to take effect, your application needs to set + this property before calling one of the ZipFile.Save() + overloads. + + + Setting this affects the performance and memory efficiency of + compression and decompression. For larger files, setting this to a + larger size may improve compression performance, but the exact + numbers vary depending on available memory, the size of the streams + you are compressing, and a bunch of other variables. I don't have + good firm recommendations on how to set it. You'll have to test it + yourself. Or just leave it alone and accept the default. + + + + + + Indicates whether extracted files should keep their paths as + stored in the zip archive. + + + + + This property affects Extraction. It is not used when creating zip + archives. + + + + With this property set to false, the default, extracting entries + from a zip file will create files in the filesystem that have the full + path associated to the entry within the zip file. With this property set + to true, extracting entries from the zip file results in files + with no path: the folders are "flattened." + + + + An example: suppose the zip file contains entries /directory1/file1.txt and + /directory2/file2.txt. With FlattenFoldersOnExtract set to false, + the files created will be \directory1\file1.txt and \directory2\file2.txt. + With the property set to true, the files created are file1.txt and file2.txt. + + + + + + + The compression strategy to use for all entries. + + + + Set the Strategy used by the ZLIB-compatible compressor, when + compressing entries using the DEFLATE method. Different compression + strategies work better on different sorts of data. The strategy + parameter can affect the compression ratio and the speed of + compression but not the correctness of the compresssion. For more + information see Ionic.Zlib.CompressionStrategy. + + + + + The name of the ZipFile, on disk. + + + + + + When the ZipFile instance was created by reading an archive using + one of the ZipFile.Read methods, this property represents the name + of the zip file that was read. When the ZipFile instance was + created by using the no-argument constructor, this value is null + (Nothing in VB). + + + + If you use the no-argument constructor, and you then explicitly set this + property, when you call , this name will + specify the name of the zip file created. Doing so is equivalent to + calling . When instantiating a + ZipFile by reading from a stream or byte array, the Name + property remains null. When saving to a stream, the Name + property is implicitly set to null. + + + + + + Sets the compression level to be used for entries subsequently added to + the zip archive. + + + + + Varying the compression level used on entries can affect the + size-vs-speed tradeoff when compression and decompressing data streams + or files. + + + + As with some other properties on the ZipFile class, like , , and , setting this property on a ZipFile + instance will cause the specified CompressionLevel to be used on all + items that are subsequently added to the + ZipFile instance. If you set this property after you have added + items to the ZipFile, but before you have called Save(), + those items will not use the specified compression level. + + + + If you do not set this property, the default compression level is used, + which normally gives a good balance of compression efficiency and + compression speed. In some tests, using BestCompression can + double the time it takes to compress, while delivering just a small + increase in compression efficiency. This behavior will vary with the + type of data you compress. If you are in doubt, just leave this setting + alone, and accept the default. + + + + + + The compression method for the zipfile. + + + + By default, the compression method is CompressionMethod.Deflate. + + + + + + + A comment attached to the zip archive. + + + + + + This property is read/write. It allows the application to specify a + comment for the ZipFile, or read the comment for the + ZipFile. After setting this property, changes are only made + permanent when you call a Save() method. + + + + According to PKWARE's + zip specification, the comment is not encrypted, even if there is a + password set on the zip file. + + + + The specification does not describe how to indicate the encoding used + on a comment string. Many "compliant" zip tools and libraries use + IBM437 as the code page for comments; DotNetZip, too, follows that + practice. On the other hand, there are situations where you want a + Comment to be encoded with something else, for example using code page + 950 "Big-5 Chinese". To fill that need, DotNetZip will encode the + comment following the same procedure it follows for encoding + filenames: (a) if is + Never, it uses the default encoding (IBM437). (b) if is Always, it always uses the + alternate encoding (). (c) if is AsNecessary, it uses the + alternate encoding only if the default encoding is not sufficient for + encoding the comment - in other words if decoding the result does not + produce the original string. This decision is taken at the time of + the call to ZipFile.Save(). + + + + When creating a zip archive using this library, it is possible to change + the value of between each + entry you add, and between adding entries and the call to + Save(). Don't do this. It will likely result in a zip file that is + not readable by any tool or application. For best interoperability, leave + alone, or specify it only + once, before adding any entries to the ZipFile instance. + + + + + + + Specifies whether the Creation, Access, and Modified times for entries + added to the zip file will be emitted in “Windows format” + when the zip archive is saved. + + + + + An application creating a zip archive can use this flag to explicitly + specify that the file times for the entries should or should not be stored + in the zip archive in the format used by Windows. By default this flag is + true, meaning the Windows-format times are stored in the zip + archive. + + + + When adding an entry from a file or directory, the Creation (), Access (), and Modified () times for the given entry are + automatically set from the filesystem values. When adding an entry from a + stream or string, all three values are implicitly set to + DateTime.Now. Applications can also explicitly set those times by + calling . + + + + PKWARE's + zip specification describes multiple ways to format these times in a + zip file. One is the format Windows applications normally use: 100ns ticks + since January 1, 1601 UTC. The other is a format Unix applications typically + use: seconds since January 1, 1970 UTC. Each format can be stored in an + "extra field" in the zip entry when saving the zip archive. The former + uses an extra field with a Header Id of 0x000A, while the latter uses a + header ID of 0x5455, although you probably don't need to know that. + + + + Not all tools and libraries can interpret these fields. Windows + compressed folders is one that can read the Windows Format timestamps, + while I believe the Infozip + tools can read the Unix format timestamps. Some tools and libraries + may be able to read only one or the other. DotNetZip can read or write + times in either or both formats. + + + + The times stored are taken from , , and . + + + + The value set here applies to all entries subsequently added to the + ZipFile. + + + + This property is not mutually exclusive of the property. It is possible and + legal and valid to produce a zip file that contains timestamps encoded in + the Unix format as well as in the Windows format, in addition to the LastModified time attached to each + entry in the archive, a time that is always stored in "DOS format". And, + notwithstanding the names PKWare uses for these time formats, any of them + can be read and written by any computer, on any operating system. But, + there are no guarantees that a program running on Mac or Linux will + gracefully handle a zip file with "Windows" formatted times, or that an + application that does not use DotNetZip but runs on Windows will be able to + handle file times in Unix format. + + + + When in doubt, test. Sorry, I haven't got a complete list of tools and + which sort of timestamps they can use and will tolerate. If you get any + good information and would like to pass it on, please do so and I will + include that information in this documentation. + + + + + This example shows how to save a zip file that contains file timestamps + in a format normally used by Unix. + + using (var zip = new ZipFile()) + { + // produce a zip file the Mac will like + zip.EmitTimesInWindowsFormatWhenSaving = false; + zip.EmitTimesInUnixFormatWhenSaving = true; + zip.AddDirectory(directoryToZip, "files"); + zip.Save(outputFile); + } + + + + Using zip As New ZipFile + '' produce a zip file the Mac will like + zip.EmitTimesInWindowsFormatWhenSaving = False + zip.EmitTimesInUnixFormatWhenSaving = True + zip.AddDirectory(directoryToZip, "files") + zip.Save(outputFile) + End Using + + + + + + + + + Specifies whether the Creation, Access, and Modified times + for entries added to the zip file will be emitted in "Unix(tm) + format" when the zip archive is saved. + + + + + An application creating a zip archive can use this flag to explicitly + specify that the file times for the entries should or should not be stored + in the zip archive in the format used by Unix. By default this flag is + false, meaning the Unix-format times are not stored in the zip + archive. + + + + When adding an entry from a file or directory, the Creation (), Access (), and Modified () times for the given entry are + automatically set from the filesystem values. When adding an entry from a + stream or string, all three values are implicitly set to DateTime.Now. + Applications can also explicitly set those times by calling . + + + + PKWARE's + zip specification describes multiple ways to format these times in a + zip file. One is the format Windows applications normally use: 100ns ticks + since January 1, 1601 UTC. The other is a format Unix applications + typically use: seconds since January 1, 1970 UTC. Each format can be + stored in an "extra field" in the zip entry when saving the zip + archive. The former uses an extra field with a Header Id of 0x000A, while + the latter uses a header ID of 0x5455, although you probably don't need to + know that. + + + + Not all tools and libraries can interpret these fields. Windows + compressed folders is one that can read the Windows Format timestamps, + while I believe the Infozip + tools can read the Unix format timestamps. Some tools and libraries may be + able to read only one or the other. DotNetZip can read or write times in + either or both formats. + + + + The times stored are taken from , , and . + + + + This property is not mutually exclusive of the property. It is possible and + legal and valid to produce a zip file that contains timestamps encoded in + the Unix format as well as in the Windows format, in addition to the LastModified time attached to each + entry in the zip archive, a time that is always stored in "DOS + format". And, notwithstanding the names PKWare uses for these time + formats, any of them can be read and written by any computer, on any + operating system. But, there are no guarantees that a program running on + Mac or Linux will gracefully handle a zip file with "Windows" formatted + times, or that an application that does not use DotNetZip but runs on + Windows will be able to handle file times in Unix format. + + + + When in doubt, test. Sorry, I haven't got a complete list of tools and + which sort of timestamps they can use and will tolerate. If you get any + good information and would like to pass it on, please do so and I will + include that information in this documentation. + + + + + + + + + Indicates whether verbose output is sent to the during AddXxx() and + ReadXxx() operations. + + + + This is a synthetic property. It returns true if the is non-null. + + + + + Returns true if an entry by the given name exists in the ZipFile. + + + the name of the entry to find + true if an entry with the given name exists; otherwise false. + + + + + Indicates whether to perform case-sensitive matching on the filename when + retrieving entries in the zipfile via the string-based indexer. + + + + The default value is false, which means don't do case-sensitive + matching. In other words, retrieving zip["ReadMe.Txt"] is the same as + zip["readme.txt"]. It really makes sense to set this to true only + if you are not running on Windows, which has case-insensitive + filenames. But since this library is not built for non-Windows platforms, + in most cases you should just leave this property alone. + + + + + Indicates whether to ignore duplicate files (report only the first entry) + when loading a zipfile. + + + + The default value is false, which will try to make all files + available (duplicates will have a "copy" suffix appended to their name). + Setting this to true prior to using Initialize to read a + zipfile will prevent this and instead just ignore the duplicates. + + + + + Indicates whether to encode entry filenames and entry comments using Unicode + (UTF-8). + + + + + The + PKWare zip specification provides for encoding file names and file + comments in either the IBM437 code page, or in UTF-8. This flag selects + the encoding according to that specification. By default, this flag is + false, and filenames and comments are encoded into the zip file in the + IBM437 codepage. Setting this flag to true will specify that filenames + and comments that cannot be encoded with IBM437 will be encoded with + UTF-8. + + + + Zip files created with strict adherence to the PKWare specification with + respect to UTF-8 encoding can contain entries with filenames containing + any combination of Unicode characters, including the full range of + characters from Chinese, Latin, Hebrew, Greek, Cyrillic, and many other + alphabets. However, because at this time, the UTF-8 portion of the PKWare + specification is not broadly supported by other zip libraries and + utilities, such zip files may not be readable by your favorite zip tool or + archiver. In other words, interoperability will decrease if you set this + flag to true. + + + + In particular, Zip files created with strict adherence to the PKWare + specification with respect to UTF-8 encoding will not work well with + Explorer in Windows XP or Windows Vista, because Windows compressed + folders, as far as I know, do not support UTF-8 in zip files. Vista can + read the zip files, but shows the filenames incorrectly. Unpacking from + Windows Vista Explorer will result in filenames that have rubbish + characters in place of the high-order UTF-8 bytes. + + + + Also, zip files that use UTF-8 encoding will not work well with Java + applications that use the java.util.zip classes, as of v5.0 of the Java + runtime. The Java runtime does not correctly implement the PKWare + specification in this regard. + + + + As a result, we have the unfortunate situation that "correct" behavior by + the DotNetZip library with regard to Unicode encoding of filenames during + zip creation will result in zip files that are readable by strictly + compliant and current tools (for example the most recent release of the + commercial WinZip tool); but these zip files will not be readable by + various other tools or libraries, including Windows Explorer. + + + + The DotNetZip library can read and write zip files with UTF8-encoded + entries, according to the PKware spec. If you use DotNetZip for both + creating and reading the zip file, and you use UTF-8, there will be no + loss of information in the filenames. For example, using a self-extractor + created by this library will allow you to unpack files correctly with no + loss of information in the filenames. + + + + If you do not set this flag, it will remain false. If this flag is false, + your ZipFile will encode all filenames and comments using the + IBM437 codepage. This can cause "loss of information" on some filenames, + but the resulting zipfile will be more interoperable with other + utilities. As an example of the loss of information, diacritics can be + lost. The o-tilde character will be down-coded to plain o. The c with a + cedilla (Unicode 0xE7) used in Portugese will be downcoded to a c. + Likewise, the O-stroke character (Unicode 248), used in Danish and + Norwegian, will be down-coded to plain o. Chinese characters cannot be + represented in codepage IBM437; when using the default encoding, Chinese + characters in filenames will be represented as ?. These are all examples + of "information loss". + + + + The loss of information associated to the use of the IBM437 encoding is + inconvenient, and can also lead to runtime errors. For example, using + IBM437, any sequence of 4 Chinese characters will be encoded as ????. If + your application creates a ZipFile, then adds two files, each with + names of four Chinese characters each, this will result in a duplicate + filename exception. In the case where you add a single file with a name + containing four Chinese characters, calling Extract() on the entry that + has question marks in the filename will result in an exception, because + the question mark is not legal for use within filenames on Windows. These + are just a few examples of the problems associated to loss of information. + + + + This flag is independent of the encoding of the content within the entries + in the zip file. Think of the zip file as a container - it supports an + encoding. Within the container are other "containers" - the file entries + themselves. The encoding within those entries is independent of the + encoding of the zip archive container for those entries. + + + + Rather than specify the encoding in a binary fashion using this flag, an + application can specify an arbitrary encoding via the property. Setting the encoding + explicitly when creating zip archives will result in non-compliant zip + files that, curiously, are fairly interoperable. The challenge is, the + PKWare specification does not provide for a way to specify that an entry + in a zip archive uses a code page that is neither IBM437 nor UTF-8. + Therefore if you set the encoding explicitly when creating a zip archive, + you must take care upon reading the zip archive to use the same code page. + If you get it wrong, the behavior is undefined and may result in incorrect + filenames, exceptions, stomach upset, hair loss, and acne. + + + + + + + Specify whether to use ZIP64 extensions when saving a zip archive. + + + + + + When creating a zip file, the default value for the property is . is + safest, in the sense that you will not get an Exception if a pre-ZIP64 + limit is exceeded. + + + + You may set the property at any time before calling Save(). + + + + When reading a zip file via the Zipfile.Read() method, DotNetZip + will properly read ZIP64-endowed zip archives, regardless of the value of + this property. DotNetZip will always read ZIP64 archives. This property + governs only whether DotNetZip will write them. Therefore, when updating + archives, be careful about setting this property after reading an archive + that may use ZIP64 extensions. + + + + An interesting question is, if you have set this property to + AsNecessary, and then successfully saved, does the resulting + archive use ZIP64 extensions or not? To learn this, check the property, after calling Save(). + + + + Have you thought about + donating? + + + + + + + + Indicates whether the archive requires ZIP64 extensions. + + + + + + This property is null (or Nothing in VB) if the archive has + not been saved, and there are fewer than 65334 ZipEntry items + contained in the archive. + + + + The Value is true if any of the following four conditions holds: + the uncompressed size of any entry is larger than 0xFFFFFFFF; the + compressed size of any entry is larger than 0xFFFFFFFF; the relative + offset of any entry within the zip archive is larger than 0xFFFFFFFF; or + there are more than 65534 entries in the archive. (0xFFFFFFFF = + 4,294,967,295). The result may not be known until a Save() is attempted + on the zip archive. The Value of this + property may be set only AFTER one of the Save() methods has been called. + + + + If none of the four conditions holds, and the archive has been saved, then + the Value is false. + + + + A Value of false does not indicate that the zip archive, as saved, + does not use ZIP64. It merely indicates that ZIP64 is not required. An + archive may use ZIP64 even when not required if the property is set to , or if the property is set to and the output stream was not + seekable. Use the property to determine if + the most recent Save() method resulted in an archive that utilized + the ZIP64 extensions. + + + + + + + + + Indicates whether the most recent Save() operation used ZIP64 extensions. + + + + + The use of ZIP64 extensions within an archive is not always necessary, and + for interoperability concerns, it may be desired to NOT use ZIP64 if + possible. The property can be + set to use ZIP64 extensions only when necessary. In those cases, + Sometimes applications want to know whether a Save() actually used ZIP64 + extensions. Applications can query this read-only property to learn + whether ZIP64 has been used in a just-saved ZipFile. + + + + The value is null (or Nothing in VB) if the archive has not + been saved. + + + + Non-null values (HasValue is true) indicate whether ZIP64 + extensions were used during the most recent Save() operation. The + ZIP64 extensions may have been used as required by any particular entry + because of its uncompressed or compressed size, or because the archive is + larger than 4294967295 bytes, or because there are more than 65534 entries + in the archive, or because the UseZip64WhenSaving property was set + to , or because the + UseZip64WhenSaving property was set to and the output stream was not seekable. + The value of this property does not indicate the reason the ZIP64 + extensions were used. + + + + + + + + + Indicates whether the most recent Read() operation read a zip file that uses + ZIP64 extensions. + + + + This property will return null (Nothing in VB) if you've added an entry after reading + the zip file. + + + + + The text encoding to use when writing new entries to the ZipFile, + for those entries that cannot be encoded with the default (IBM437) + encoding; or, the text encoding that was used when reading the entries + from the ZipFile. + + + + + In its + zip specification, PKWare describes two options for encoding + filenames and comments: using IBM437 or UTF-8. But, some archiving tools + or libraries do not follow the specification, and instead encode + characters using the system default code page. For example, WinRAR when + run on a machine in Shanghai may encode filenames with the Big-5 Chinese + (950) code page. This behavior is contrary to the Zip specification, but + it occurs anyway. + + + + When using DotNetZip to write zip archives that will be read by one of + these other archivers, set this property to specify the code page to use + when encoding the and for each ZipEntry in the zip file, for + values that cannot be encoded with the default codepage for zip files, + IBM437. This is why this property is "provisional". In all cases, IBM437 + is used where possible, in other words, where no loss of data would + result. It is possible, therefore, to have a given entry with a + Comment encoded in IBM437 and a FileName encoded with the + specified "provisional" codepage. + + + + Be aware that a zip file created after you've explicitly set the property to a value other than + IBM437 may not be compliant to the PKWare specification, and may not be + readable by compliant archivers. On the other hand, many (most?) + archivers are non-compliant and can read zip files created in arbitrary + code pages. The trick is to use or specify the proper codepage when + reading the zip. + + + + When creating a zip archive using this library, it is possible to change + the value of between each + entry you add, and between adding entries and the call to + Save(). Don't do this. It will likely result in a zipfile that is + not readable. For best interoperability, either leave alone, or specify it only once, + before adding any entries to the ZipFile instance. There is one + exception to this recommendation, described later. + + + + When using an arbitrary, non-UTF8 code page for encoding, there is no + standard way for the creator application - whether DotNetZip, WinZip, + WinRar, or something else - to formally specify in the zip file which + codepage has been used for the entries. As a result, readers of zip files + are not able to inspect the zip file and determine the codepage that was + used for the entries contained within it. It is left to the application + or user to determine the necessary codepage when reading zip files encoded + this way. In other words, if you explicitly specify the codepage when you + create the zipfile, you must explicitly specify the same codepage when + reading the zipfile. + + + + The way you specify the code page to use when reading a zip file varies + depending on the tool or library you use to read the zip. In DotNetZip, + you use a ZipFile.Read() method that accepts an encoding parameter. It + isn't possible with Windows Explorer, as far as I know, to specify an + explicit codepage to use when reading a zip. If you use an incorrect + codepage when reading a zipfile, you will get entries with filenames that + are incorrect, and the incorrect filenames may even contain characters + that are not legal for use within filenames in Windows. Extracting entries + with illegal characters in the filenames will lead to exceptions. It's too + bad, but this is just the way things are with code pages in zip + files. Caveat Emptor. + + + + Example: Suppose you create a zipfile that contains entries with + filenames that have Danish characters. If you use equal to "iso-8859-1" (cp 28591), + the filenames will be correctly encoded in the zip. But, to read that + zipfile correctly, you have to specify the same codepage at the time you + read it. If try to read that zip file with Windows Explorer or another + application that is not flexible with respect to the codepage used to + decode filenames in zipfiles, you will get a filename like "Inf�.txt". + + + + When using DotNetZip to read a zip archive, and the zip archive uses an + arbitrary code page, you must specify the encoding to use before or when + the Zipfile is READ. This means you must use a ZipFile.Read() + method that allows you to specify a System.Text.Encoding parameter. Setting + the ProvisionalAlternateEncoding property after your application has read in + the zip archive will not affect the entry names of entries that have already + been read in. + + + + And now, the exception to the rule described above. One strategy for + specifying the code page for a given zip file is to describe the code page + in a human-readable form in the Zip comment. For example, the comment may + read "Entries in this archive are encoded in the Big5 code page". For + maximum interoperability, the zip comment in this case should be encoded + in the default, IBM437 code page. In this case, the zip comment is + encoded using a different page than the filenames. To do this, Specify + ProvisionalAlternateEncoding to your desired region-specific code + page, once before adding any entries, and then reset + ProvisionalAlternateEncoding to IBM437 before setting the property and calling Save(). + + + + + This example shows how to read a zip file using the Big-5 Chinese code page + (950), and extract each entry in the zip file. For this code to work as + desired, the Zipfile must have been created using the big5 code page + (CP950). This is typical, for example, when using WinRar on a machine with + CP950 set as the default code page. In that case, the names of entries + within the Zip archive will be stored in that code page, and reading the zip + archive must be done using that code page. If the application did not use + the correct code page in ZipFile.Read(), then names of entries within the + zip archive would not be correctly retrieved. + + using (var zip = ZipFile.Read(zipFileName, System.Text.Encoding.GetEncoding("big5"))) + { + // retrieve and extract an entry using a name encoded with CP950 + zip[MyDesiredEntry].Extract("unpack"); + } + + + + Using zip As ZipFile = ZipFile.Read(ZipToExtract, System.Text.Encoding.GetEncoding("big5")) + ' retrieve and extract an entry using a name encoded with CP950 + zip(MyDesiredEntry).Extract("unpack") + End Using + + + + DefaultEncoding + + + + A Text Encoding to use when encoding the filenames and comments for + all the ZipEntry items, during a ZipFile.Save() operation. + + + + Whether the encoding specified here is used during the save depends + on . + + + + + + A flag that tells if and when this instance should apply + AlternateEncoding to encode the filenames and comments associated to + of ZipEntry objects contained within this instance. + + + + + Gets or sets the TextWriter to which status messages are delivered + for the instance. + + + + If the TextWriter is set to a non-null value, then verbose output is sent + to the TextWriter during Add, Read, Save and + Extract operations. Typically, console applications might use + Console.Out and graphical or headless applications might use a + System.IO.StringWriter. The output of this is suitable for viewing + by humans. + + + + + In this example, a console application instantiates a ZipFile, then + sets the StatusMessageTextWriter to Console.Out. At that + point, all verbose status messages for that ZipFile are sent to the + console. + + + + using (ZipFile zip= ZipFile.Read(FilePath)) + { + zip.StatusMessageTextWriter= System.Console.Out; + // messages are sent to the console during extraction + zip.ExtractAll(); + } + + + + 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 + + + + In this example, a Windows Forms application instantiates a + ZipFile, then sets the StatusMessageTextWriter to a + StringWriter. At that point, all verbose status messages for that + ZipFile are sent to the StringWriter. + + + + var sw = new System.IO.StringWriter(); + using (ZipFile zip= ZipFile.Read(FilePath)) + { + zip.StatusMessageTextWriter= sw; + zip.ExtractAll(); + } + Console.WriteLine("{0}", sw.ToString()); + + + + Dim sw as New System.IO.StringWriter + Using zip As ZipFile = ZipFile.Read(FilePath) + zip.StatusMessageTextWriter= sw + zip.ExtractAll() + End Using + 'Status Messages are now available in sw + + + + + + + Gets or sets the name for the folder to store the temporary file + this library writes when saving a zip archive. + + + + + This library will create a temporary file when saving a Zip archive to a + file. This file is written when calling one of the Save() methods + that does not save to a stream, or one of the SaveSelfExtractor() + methods. + + + + By default, the library will create the temporary file in the directory + specified for the file itself, via the property or via + the method. + + + + Setting this property allows applications to override this default + behavior, so that the library will create the temporary file in the + specified folder. For example, to have the library create the temporary + file in the current working directory, regardless where the ZipFile + is saved, specfy ".". To revert to the default behavior, set this + property to null (Nothing in VB). + + + + When setting the property to a non-null value, the folder specified must + exist; if it does not an exception is thrown. The application should have + write and delete permissions on the folder. The permissions are not + explicitly checked ahead of time; if the application does not have the + appropriate rights, an exception will be thrown at the time Save() + is called. + + + + There is no temporary file created when reading a zip archive. When + saving to a Stream, there is no temporary file created. For example, if + the application is an ASP.NET application and calls Save() + specifying the Response.OutputStream as the output stream, there is + no temporary file created. + + + + + Thrown when setting the property if the directory does not exist. + + + + + + Sets the password to be used on the ZipFile instance. + + + + + + When writing a zip archive, this password is applied to the entries, not + to the zip archive itself. It applies to any ZipEntry subsequently + added to the ZipFile, using one of the AddFile, + AddDirectory, AddEntry, or AddItem methods, etc. + When reading a zip archive, this property applies to any entry + subsequently extracted from the ZipFile using one of the Extract + methods on the ZipFile class. + + + + When writing a zip archive, keep this in mind: though the password is set + on the ZipFile object, according to the Zip spec, the "directory" of the + archive - in other words the list of entries or files contained in the archive - is + not encrypted with the password, or protected in any way. If you set the + Password property, the password actually applies to individual entries + that are added to the archive, subsequent to the setting of this property. + The list of filenames in the archive that is eventually created will + appear in clear text, but the contents of the individual files are + encrypted. This is how Zip encryption works. + + + + One simple way around this limitation is to simply double-wrap sensitive + filenames: Store the files in a zip file, and then store that zip file + within a second, "outer" zip file. If you apply a password to the outer + zip file, then readers will be able to see that the outer zip file + contains an inner zip file. But readers will not be able to read the + directory or file list of the inner zip file. + + + + If you set the password on the ZipFile, and then add a set of files + to the archive, then each entry is encrypted with that password. You may + also want to change the password between adding different entries. If you + set the password, add an entry, then set the password to null + (Nothing in VB), and add another entry, the first entry is + encrypted and the second is not. If you call AddFile(), then set + the Password property, then call ZipFile.Save, the file + added will not be password-protected, and no warning will be generated. + + + + When setting the Password, you may also want to explicitly set the property, to specify how to encrypt the entries added + to the ZipFile. If you set the Password to a non-null value and do not + set , then PKZip 2.0 ("Weak") encryption is used. + This encryption is relatively weak but is very interoperable. If you set + the password to a null value (Nothing in VB), Encryption is + reset to None. + + + + All of the preceding applies to writing zip archives, in other words when + you use one of the Save methods. To use this property when reading or an + existing ZipFile, do the following: set the Password property on the + ZipFile, then call one of the Extract() overloads on the . In this case, the entry is extracted using the + Password that is specified on the ZipFile instance. If you + have not set the Password property, then the password is + null, and the entry is extracted with no password. + + + + If you set the Password property on the ZipFile, then call + Extract() an entry that has not been encrypted with a password, the + password is not used for that entry, and the ZipEntry is extracted + as normal. In other words, the password is used only if necessary. + + + + The class also has a Password property. It takes precedence + over this property on the ZipFile. Typically, you would use the + per-entry Password when most entries in the zip archive use one password, + and a few entries use a different password. If all entries in the zip + file use the same password, then it is simpler to just set this property + on the ZipFile itself, whether creating a zip archive or extracting + a zip archive. + + + + + + + This example creates a zip file, using password protection for the + entries, and then extracts the entries from the zip file. When creating + the zip file, the Readme.txt file is not protected with a password, but + the other two are password-protected as they are saved. During extraction, + each file is extracted with the appropriate password. + + + // create a file with encryption + using (ZipFile zip = new ZipFile()) + { + zip.AddFile("ReadMe.txt"); + zip.Password= "!Secret1"; + zip.AddFile("MapToTheSite-7440-N49th.png"); + zip.AddFile("2008-Regional-Sales-Report.pdf"); + zip.Save("EncryptedArchive.zip"); + } + + // extract entries that use encryption + using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip")) + { + zip.Password= "!Secret1"; + zip.ExtractAll("extractDir"); + } + + + + + Using zip As New ZipFile + zip.AddFile("ReadMe.txt") + zip.Password = "123456!" + zip.AddFile("MapToTheSite-7440-N49th.png") + zip.Password= "!Secret1"; + zip.AddFile("2008-Regional-Sales-Report.pdf") + zip.Save("EncryptedArchive.zip") + End Using + + + ' extract entries that use encryption + Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip")) + zip.Password= "!Secret1" + zip.ExtractAll("extractDir") + End Using + + + + + + ZipFile.Encryption + ZipEntry.Password + + + + The action the library should take when extracting a file that already + exists. + + + + + This property affects the behavior of the Extract methods (one of the + Extract() or ExtractWithPassword() overloads), when + extraction would would overwrite an existing filesystem file. If you do + not set this property, the library throws an exception when extracting an + entry would overwrite an existing file. + + + + This property has no effect when extracting to a stream, or when the file + to be extracted does not already exist. + + + + + + + The action the library should take when an error is encountered while + opening or reading files as they are saved into a zip archive. + + + + + Errors can occur as a file is being saved to the zip archive. For + example, the File.Open may fail, or a File.Read may fail, because of + lock conflicts or other reasons. + + + + The first problem might occur after having called AddDirectory() on a + directory that contains a Clipper .dbf file; the file is locked by + Clipper and cannot be opened for read by another process. An example of + the second problem might occur when trying to zip a .pst file that is in + use by Microsoft Outlook. Outlook locks a range on the file, which allows + other processes to open the file, but not read it in its entirety. + + + + This property tells DotNetZip what you would like to do in the case of + these errors. The primary options are: ZipErrorAction.Throw to + throw an exception (this is the default behavior if you don't set this + property); ZipErrorAction.Skip to Skip the file for which there + was an error and continue saving; ZipErrorAction.Retry to Retry + the entry that caused the problem; or + ZipErrorAction.InvokeErrorEvent to invoke an event handler. + + + + This property is implicitly set to ZipErrorAction.InvokeErrorEvent + if you add a handler to the event. If you set + this property to something other than + ZipErrorAction.InvokeErrorEvent, then the ZipError + event is implicitly cleared. What it means is you can set one or the + other (or neither), depending on what you want, but you never need to set + both. + + + + As with some other properties on the ZipFile class, like , , and , setting this property on a ZipFile + instance will cause the specified ZipErrorAction to be used on all + items that are subsequently added to the + ZipFile instance. If you set this property after you have added + items to the ZipFile, but before you have called Save(), + those items will not use the specified error handling action. + + + + If you want to handle any errors that occur with any entry in the zip + file in the same way, then set this property once, before adding any + entries to the zip archive. + + + + If you set this property to ZipErrorAction.Skip and you'd like to + learn which files may have been skipped after a Save(), you can + set the on the ZipFile before + calling Save(). A message will be emitted into that writer for + each skipped file, if any. + + + + + + This example shows how to tell DotNetZip to skip any files for which an + error is generated during the Save(). + + Public Sub SaveZipFile() + Dim SourceFolder As String = "fodder" + Dim DestFile As String = "eHandler.zip" + Dim sw as New StringWriter + Using zipArchive As ZipFile = New ZipFile + ' Tell DotNetZip to skip any files for which it encounters an error + zipArchive.ZipErrorAction = ZipErrorAction.Skip + zipArchive.StatusMessageTextWriter = sw + zipArchive.AddDirectory(SourceFolder) + zipArchive.Save(DestFile) + End Using + ' examine sw here to see any messages + End Sub + + + + + + + + + + The Encryption to use for entries added to the ZipFile. + + + + + Set this when creating a zip archive, or when updating a zip archive. The + specified Encryption is applied to the entries subsequently added to the + ZipFile instance. Applications do not need to set the + Encryption property when reading or extracting a zip archive. + + + + If you set this to something other than EncryptionAlgorithm.None, you + will also need to set the . + + + + As with some other properties on the ZipFile class, like and , setting this + property on a ZipFile instance will cause the specified + EncryptionAlgorithm to be used on all items + that are subsequently added to the ZipFile instance. In other + words, if you set this property after you have added items to the + ZipFile, but before you have called Save(), those items will + not be encrypted or protected with a password in the resulting zip + archive. To get a zip archive with encrypted entries, set this property, + along with the property, before calling + AddFile, AddItem, or AddDirectory (etc.) on the + ZipFile instance. + + + + If you read a ZipFile, you can modify the Encryption on an + encrypted entry, only by setting the Encryption property on the + ZipEntry itself. Setting the Encryption property on the + ZipFile, once it has been created via a call to + ZipFile.Read(), does not affect entries that were previously read. + + + + For example, suppose you read a ZipFile, and there is an encrypted + entry. Setting the Encryption property on that ZipFile and + then calling Save() on the ZipFile does not update the + Encryption used for the entries in the archive. Neither is an + exception thrown. Instead, what happens during the Save() is that + all previously existing entries are copied through to the new zip archive, + with whatever encryption and password that was used when originally + creating the zip archive. Upon re-reading that archive, to extract + entries, applications should use the original password or passwords, if + any. + + + + Suppose an application reads a ZipFile, and there is an encrypted + entry. Setting the Encryption property on that ZipFile and + then adding new entries (via AddFile(), AddEntry(), etc) + and then calling Save() on the ZipFile does not update the + Encryption on any of the entries that had previously been in the + ZipFile. The Encryption property applies only to the + newly-added entries. + + + + + + + This example creates a zip archive that uses encryption, and then extracts + entries from the archive. When creating the zip archive, the ReadMe.txt + file is zipped without using a password or encryption. The other files + use encryption. + + + + // Create a zip archive with AES Encryption. + using (ZipFile zip = new ZipFile()) + { + zip.AddFile("ReadMe.txt"); + zip.Encryption= EncryptionAlgorithm.WinZipAes256; + zip.Password= "Top.Secret.No.Peeking!"; + zip.AddFile("7440-N49th.png"); + zip.AddFile("2008-Regional-Sales-Report.pdf"); + zip.Save("EncryptedArchive.zip"); + } + + // Extract a zip archive that uses AES Encryption. + // You do not need to specify the algorithm during extraction. + using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip")) + { + zip.Password= "Top.Secret.No.Peeking!"; + zip.ExtractAll("extractDirectory"); + } + + + + ' Create a zip that uses Encryption. + Using zip As New ZipFile() + zip.Encryption= EncryptionAlgorithm.WinZipAes256 + zip.Password= "Top.Secret.No.Peeking!" + zip.AddFile("ReadMe.txt") + zip.AddFile("7440-N49th.png") + zip.AddFile("2008-Regional-Sales-Report.pdf") + zip.Save("EncryptedArchive.zip") + End Using + + ' Extract a zip archive that uses AES Encryption. + ' You do not need to specify the algorithm during extraction. + Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip")) + zip.Password= "Top.Secret.No.Peeking!" + zip.ExtractAll("extractDirectory") + End Using + + + + + ZipFile.Password + ZipEntry.Encryption + + + + A callback that allows the application to specify the compression level + to use for entries subsequently added to the zip archive. + + + + + + With this callback, the DotNetZip library allows the application to + determine whether compression will be used, at the time of the + Save. This may be useful if the application wants to favor + speed over size, and wants to defer the decision until the time of + Save. + + + + Typically applications set the property on + the ZipFile or on each ZipEntry to determine the level of + compression used. This is done at the time the entry is added to the + ZipFile. Setting the property to + Ionic.Zlib.CompressionLevel.None means no compression will be used. + + + + This callback allows the application to defer the decision on the + CompressionLevel to use, until the time of the call to + ZipFile.Save(). The callback is invoked once per ZipEntry, + at the time the data for the entry is being written out as part of a + Save() operation. The application can use whatever criteria it + likes in determining the level to return. For example, an application may + wish that no .mp3 files should be compressed, because they are already + compressed and the extra compression is not worth the CPU time incurred, + and so can return None for all .mp3 entries. + + + + The library determines whether compression will be attempted for an entry + this way: If the entry is a zero length file, or a directory, no + compression is used. Otherwise, if this callback is set, it is invoked + and the CompressionLevel is set to the return value. If this + callback has not been set, then the previously set value for + CompressionLevel is used. + + + + + + + The maximum size of an output segment, when saving a split Zip file. + + + + Make sure you do not read from this field if you've set the value using + + + + Set this to a non-zero value before calling or to specify that the ZipFile should be saved as a + split archive, also sometimes called a spanned archive. Some also + call them multi-file archives. + + + + A split zip archive is saved in a set of discrete filesystem files, + rather than in a single file. This is handy when transmitting the + archive in email or some other mechanism that has a limit to the size of + each file. The first file in a split archive will be named + basename.z01, the second will be named basename.z02, and + so on. The final file is named basename.zip. According to the zip + specification from PKWare, the minimum value is 65536, for a 64k segment + size. The maximum number of segments allows in a split archive is 99. + + + + The value of this property determines the maximum size of a split + segment when writing a split archive. For example, suppose you have a + ZipFile that would save to a single file of 200k. If you set the + MaxOutputSegmentSize to 65536 before calling Save(), you + will get four distinct output files. On the other hand if you set this + property to 256k, then you will get a single-file archive for that + ZipFile. + + + + The size of each split output file will be as large as possible, up to + the maximum size set here. The zip specification requires that some data + fields in a zip archive may not span a split boundary, and an output + segment may be smaller than the maximum if necessary to avoid that + problem. Also, obviously the final segment of the archive may be smaller + than the maximum segment size. Segments will never be larger than the + value set with this property. + + + + You can save a split Zip file only when saving to a regular filesystem + file. It's not possible to save a split zip file as a self-extracting + archive, nor is it possible to save a split zip file to a stream. When + saving to a SFX or to a Stream, this property is ignored. + + + + About interoperability: Split or spanned zip files produced by DotNetZip + can be read by WinZip or PKZip, and vice-versa. Segmented zip files may + not be readable by other tools, if those other tools don't support zip + spanning or splitting. When in doubt, test. I don't believe Windows + Explorer can extract a split archive. + + + + This property has no effect when reading a split archive. You can read + a split archive in the normal way with DotNetZip. + + + + When saving a zip file, if you want a regular zip file rather than a + split zip file, don't set this property, or set it to Zero. + + + + If you read a split archive, with and + then subsequently call ZipFile.Save(), unless you set this + property before calling Save(), you will get a normal, + single-file archive. + + + + + + + + The maximum size of an output segment, when saving a split Zip file. + + + + If you set this value, make sure you do not accidently use in your code + + + + Set this to a non-zero value before calling or to specify that the ZipFile should be saved as a + split archive, also sometimes called a spanned archive. Some also + call them multi-file archives. + + + + A split zip archive is saved in a set of discrete filesystem files, + rather than in a single file. This is handy when transmitting the + archive in email or some other mechanism that has a limit to the size of + each file. The first file in a split archive will be named + basename.z01, the second will be named basename.z02, and + so on. The final file is named basename.zip. According to the zip + specification from PKWare, the minimum value is 65536, for a 64k segment + size. The maximum number of segments allows in a split archive is 99. + + + + The value of this property determines the maximum size of a split + segment when writing a split archive. For example, suppose you have a + ZipFile that would save to a single file of 200k. If you set the + MaxOutputSegmentSize to 65536 before calling Save(), you + will get four distinct output files. On the other hand if you set this + property to 256k, then you will get a single-file archive for that + ZipFile. + + + + The size of each split output file will be as large as possible, up to + the maximum size set here. The zip specification requires that some data + fields in a zip archive may not span a split boundary, and an output + segment may be smaller than the maximum if necessary to avoid that + problem. Also, obviously the final segment of the archive may be smaller + than the maximum segment size. Segments will never be larger than the + value set with this property. + + + + You can save a split Zip file only when saving to a regular filesystem + file. It's not possible to save a split zip file as a self-extracting + archive, nor is it possible to save a split zip file to a stream. When + saving to a SFX or to a Stream, this property is ignored. + + + + About interoperability: Split or spanned zip files produced by DotNetZip + can be read by WinZip or PKZip, and vice-versa. Segmented zip files may + not be readable by other tools, if those other tools don't support zip + spanning or splitting. When in doubt, test. I don't believe Windows + Explorer can extract a split archive. + + + + This property has no effect when reading a split archive. You can read + a split archive in the normal way with DotNetZip. + + + + When saving a zip file, if you want a regular zip file rather than a + split zip file, don't set this property, or set it to Zero. + + + + If you read a split archive, with and + then subsequently call ZipFile.Save(), unless you set this + property before calling Save(), you will get a normal, + single-file archive. + + + + + + + + Returns the number of segments used in the most recent Save() operation. + + + + This is normally zero, unless you have set the property. If you have set , and then you save a file, after the call to + Save() completes, you can read this value to learn the number of segments that + were created. + + + If you call Save("Archive.zip"), and it creates 5 segments, then you + will have filesystem files named Archive.z01, Archive.z02, Archive.z03, + Archive.z04, and Archive.zip, and the value of this property will be 5. + + + + + + + The size threshold for an entry, above which a parallel deflate is used. + + + + + + DotNetZip will use multiple threads to compress any ZipEntry, + if the entry is larger than the given size. Zero means "always + use parallel deflate", while -1 means "never use parallel + deflate". The default value for this property is 512k. Aside + from the special values of 0 and 1, the minimum value is 65536. + + + + If the entry size cannot be known before compression, as with a + read-forward stream, then Parallel deflate will never be + performed, unless the value of this property is zero. + + + + A parallel deflate operations will speed up the compression of + large files, on computers with multiple CPUs or multiple CPU + cores. For files above 1mb, on a dual core or dual-cpu (2p) + machine, the time required to compress the file can be 70% of the + single-threaded deflate. For very large files on 4p machines the + compression can be done in 30% of the normal time. The downside + is that parallel deflate consumes extra memory during the deflate, + and the deflation is not as effective. + + + + Parallel deflate tends to yield slightly less compression when + compared to as single-threaded deflate; this is because the original + data stream is split into multiple independent buffers, each of which + is compressed in parallel. But because they are treated + independently, there is no opportunity to share compression + dictionaries. For that reason, a deflated stream may be slightly + larger when compressed using parallel deflate, as compared to a + traditional single-threaded deflate. Sometimes the increase over the + normal deflate is as much as 5% of the total compressed size. For + larger files it can be as small as 0.1%. + + + + Multi-threaded compression does not give as much an advantage when + using Encryption. This is primarily because encryption tends to slow + down the entire pipeline. Also, multi-threaded compression gives less + of an advantage when using lower compression levels, for example . You may have to + perform some tests to determine the best approach for your situation. + + + + + + + + + + The maximum number of buffer pairs to use when performing + parallel compression. + + + + + This property sets an upper limit on the number of memory + buffer pairs to create when performing parallel + compression. The implementation of the parallel + compression stream allocates multiple buffers to + facilitate parallel compression. As each buffer fills up, + the stream uses + ThreadPool.QueueUserWorkItem() to compress those + buffers in a background threadpool thread. After a buffer + is compressed, it is re-ordered and written to the output + stream. + + + + A higher number of buffer pairs enables a higher degree of + parallelism, which tends to increase the speed of compression on + multi-cpu computers. On the other hand, a higher number of buffer + pairs also implies a larger memory consumption, more active worker + threads, and a higher cpu utilization for any compression. This + property enables the application to limit its memory consumption and + CPU utilization behavior depending on requirements. + + + + For each compression "task" that occurs in parallel, there are 2 + buffers allocated: one for input and one for output. This property + sets a limit for the number of pairs. The total amount of storage + space allocated for buffering will then be (N*S*2), where N is the + number of buffer pairs, S is the size of each buffer (). By default, DotNetZip allocates 4 buffer + pairs per CPU core, so if your machine has 4 cores, and you retain + the default buffer size of 128k, then the + ParallelDeflateOutputStream will use 4 * 4 * 2 * 128kb of buffer + memory in total, or 4mb, in blocks of 128kb. If you then set this + property to 8, then the number will be 8 * 2 * 128kb of buffer + memory, or 2mb. + + + + CPU utilization will also go up with additional buffers, because a + larger number of buffer pairs allows a larger number of background + threads to compress in parallel. If you find that parallel + compression is consuming too much memory or CPU, you can adjust this + value downward. + + + + The default value is 16. Different values may deliver better or + worse results, depending on your priorities and the dynamic + performance characteristics of your storage and compute resources. + + + + This property is not the number of buffer pairs to use; it is an + upper limit. An illustration: Suppose you have an application that + uses the default value of this property (which is 16), and it runs + on a machine with 2 CPU cores. In that case, DotNetZip will allocate + 4 buffer pairs per CPU core, for a total of 8 pairs. The upper + limit specified by this property has no effect. + + + + The application can set this value at any time + before calling ZipFile.Save(). + + + + + + + + Provides a string representation of the instance. + a string representation of the instance. + + + + Returns the version number on the DotNetZip assembly. + + + + + This property is exposed as a convenience. Callers could also get the + version value by retrieving GetName().Version on the + System.Reflection.Assembly object pointing to the DotNetZip + assembly. But sometimes it is not clear which assembly is being loaded. + This property makes it clear. + + + This static property is primarily useful for diagnostic purposes. + + + + + + Creates a new ZipFile instance, using the specified filename. + + + + + Applications can use this constructor to create a new ZipFile for writing, + or to slurp in an existing zip archive for read and update purposes. + + + + To create a new zip archive, an application can call this constructor, + passing the name of a file that does not exist. The name may be a fully + qualified path. Then the application can add directories or files to the + ZipFile via AddDirectory(), AddFile(), AddItem() + and then write the zip archive to the disk by calling Save(). The + zip file is not actually opened and written to the disk until the + application calls ZipFile.Save(). At that point the new zip file + with the given name is created. + + + + If you won't know the name of the Zipfile until the time you call + ZipFile.Save(), or if you plan to save to a stream (which has no + name), then you should use the no-argument constructor. + + + + The application can also call this constructor to read an existing zip + archive. passing the name of a valid zip file that does exist. But, it's + better form to use the static method, + passing the name of the zip file, because using ZipFile.Read() in + your code communicates very clearly what you are doing. In either case, + the file is then read into the ZipFile instance. The app can then + enumerate the entries or can modify the zip file, for example adding + entries, removing entries, changing comments, and so on. + + + + One advantage to this parameterized constructor: it allows applications to + use the same code to add items to a zip archive, regardless of whether the + zip file exists. + + + + Instances of the ZipFile class are not multi-thread safe. You may + not party on a single instance with multiple threads. You may have + multiple threads that each use a distinct ZipFile instance, or you + can synchronize multi-thread access to a single instance. + + + + By the way, since DotNetZip is so easy to use, don't you think you should + donate $5 or $10? + + + + + + Thrown if name refers to an existing file that is not a valid zip file. + + + + This example shows how to create a zipfile, and add a few files into it. + + String ZipFileToCreate = "archive1.zip"; + String DirectoryToZip = "c:\\reports"; + using (ZipFile zip = new ZipFile()) + { + // Store all files found in the top level directory, into the zip archive. + String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip); + zip.AddFiles(filenames, "files"); + zip.Save(ZipFileToCreate); + } + + + + Dim ZipFileToCreate As String = "archive1.zip" + Dim DirectoryToZip As String = "c:\reports" + Using zip As ZipFile = New ZipFile() + Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip) + zip.AddFiles(filenames, "files") + zip.Save(ZipFileToCreate) + End Using + + + + The filename to use for the new zip archive. + + + + + Creates a new ZipFile instance, using the specified name for the + filename, and the specified Encoding. + + + + + See the documentation on the ZipFile + constructor that accepts a single string argument for basic + information on all the ZipFile constructors. + + + + The Encoding is used as the default alternate encoding for entries with + filenames or comments that cannot be encoded with the IBM437 code page. + This is equivalent to setting the property on the ZipFile + instance after construction. + + + + Instances of the ZipFile class are not multi-thread safe. You may + not party on a single instance with multiple threads. You may have + multiple threads that each use a distinct ZipFile instance, or you + can synchronize multi-thread access to a single instance. + + + + + + Thrown if name refers to an existing file that is not a valid zip file. + + + The filename to use for the new zip archive. + The Encoding is used as the default alternate + encoding for entries with filenames or comments that cannot be encoded + with the IBM437 code page. + + + + Create a zip file, without specifying a target filename or stream to save to. + + + + + See the documentation on the ZipFile + constructor that accepts a single string argument for basic + information on all the ZipFile constructors. + + + + After instantiating with this constructor and adding entries to the + archive, the application should call or + to save to a file or a + stream, respectively. The application can also set the + property and then call the no-argument method. (This + is the preferred approach for applications that use the library through + COM interop.) If you call the no-argument method + without having set the Name of the ZipFile, either through + the parameterized constructor or through the explicit property , the + Save() will throw, because there is no place to save the file. + + + Instances of the ZipFile class are not multi-thread safe. You may + have multiple threads that each use a distinct ZipFile instance, or + you can synchronize multi-thread access to a single instance. + + + + + This example creates a Zip archive called Backup.zip, containing all the files + in the directory DirectoryToZip. Files within subdirectories are not zipped up. + + using (ZipFile zip = new ZipFile()) + { + // Store all files found in the top level directory, into the zip archive. + // note: this code does not recurse subdirectories! + String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip); + zip.AddFiles(filenames, "files"); + zip.Save("Backup.zip"); + } + + + + Using zip As New ZipFile + ' Store all files found in the top level directory, into the zip archive. + ' note: this code does not recurse subdirectories! + Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip) + zip.AddFiles(filenames, "files") + zip.Save("Backup.zip") + End Using + + + + + + Create a zip file, specifying a text Encoding, but without specifying a + target filename or stream to save to. + + + + + See the documentation on the ZipFile + constructor that accepts a single string argument for basic + information on all the ZipFile constructors. + + + + + + The Encoding is used as the default alternate encoding for entries with + filenames or comments that cannot be encoded with the IBM437 code page. + + + + + Creates a new ZipFile instance, using the specified name for the + filename, and the specified status message writer. + + + + + See the documentation on the ZipFile + constructor that accepts a single string argument for basic + information on all the ZipFile constructors. + + + + This version of the constructor allows the caller to pass in a TextWriter, + to which verbose messages will be written during extraction or creation of + the zip archive. A console application may wish to pass + System.Console.Out to get messages on the Console. A graphical or headless + application may wish to capture the messages in a different + TextWriter, for example, a StringWriter, and then display + the messages in a TextBox, or generate an audit log of ZipFile operations. + + + + To encrypt the data for the files added to the ZipFile instance, + set the Password property after creating the ZipFile instance. + + + + Instances of the ZipFile class are not multi-thread safe. You may + not party on a single instance with multiple threads. You may have + multiple threads that each use a distinct ZipFile instance, or you + can synchronize multi-thread access to a single instance. + + + + + + Thrown if name refers to an existing file that is not a valid zip file. + + + + + using (ZipFile zip = new ZipFile("Backup.zip", Console.Out)) + { + // Store all files found in the top level directory, into the zip archive. + // note: this code does not recurse subdirectories! + // Status messages will be written to Console.Out + String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip); + zip.AddFiles(filenames); + zip.Save(); + } + + + + Using zip As New ZipFile("Backup.zip", Console.Out) + ' Store all files found in the top level directory, into the zip archive. + ' note: this code does not recurse subdirectories! + ' Status messages will be written to Console.Out + Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip) + zip.AddFiles(filenames) + zip.Save() + End Using + + + + The filename to use for the new zip archive. + A TextWriter to use for writing + verbose status messages. + + + + Creates a new ZipFile instance, using the specified name for the + filename, the specified status message writer, and the specified Encoding. + + + + + This constructor works like the ZipFile + constructor that accepts a single string argument. See that + reference for detail on what this constructor does. + + + + This version of the constructor allows the caller to pass in a + TextWriter, and an Encoding. The TextWriter will collect + verbose messages that are generated by the library during extraction or + creation of the zip archive. A console application may wish to pass + System.Console.Out to get messages on the Console. A graphical or + headless application may wish to capture the messages in a different + TextWriter, for example, a StringWriter, and then display + the messages in a TextBox, or generate an audit log of + ZipFile operations. + + + + The Encoding is used as the default alternate encoding for entries + with filenames or comments that cannot be encoded with the IBM437 code + page. This is a equivalent to setting the property on the ZipFile + instance after construction. + + + + To encrypt the data for the files added to the ZipFile instance, + set the Password property after creating the ZipFile + instance. + + + + Instances of the ZipFile class are not multi-thread safe. You may + not party on a single instance with multiple threads. You may have + multiple threads that each use a distinct ZipFile instance, or you + can synchronize multi-thread access to a single instance. + + + + + + Thrown if fileName refers to an existing file that is not a valid zip file. + + + The filename to use for the new zip archive. + A TextWriter to use for writing verbose + status messages. + + The Encoding is used as the default alternate encoding for entries with + filenames or comments that cannot be encoded with the IBM437 code page. + + + + + Initialize a ZipFile instance by reading in a zip file. + + + + + + This method is primarily useful from COM Automation environments, when + reading or extracting zip files. In COM, it is not possible to invoke + parameterized constructors for a class. A COM Automation application can + update a zip file by using the default (no argument) + constructor, then calling Initialize() to read the contents + of an on-disk zip archive into the ZipFile instance. + + + + .NET applications are encouraged to use the ZipFile.Read() methods + for better clarity. + + + + the name of the existing zip file to read in. + + + + This is an integer indexer into the Zip archive. + + + + + This property is read-only. + + + + Internally, the ZipEntry instances that belong to the + ZipFile are stored in a Dictionary. When you use this + indexer the first time, it creates a read-only + List<ZipEntry> from the Dictionary.Values Collection. + If at any time you modify the set of entries in the ZipFile, + either by adding an entry, removing an entry, or renaming an + entry, a new List will be created, and the numeric indexes for the + remaining entries may be different. + + + + This means you cannot rename any ZipEntry from + inside an enumeration of the zip file. + + + + The index value. + + + + + + The ZipEntry within the Zip archive at the specified index. If the + entry does not exist in the archive, this indexer throws. + + + + + + This is a name-based indexer into the Zip archive. + + + + + This property is read-only. + + + + The property on the ZipFile + determines whether retrieval via this indexer is done via case-sensitive + comparisons. By default, retrieval is not case sensitive. This makes + sense on Windows, in which filesystems are not case sensitive. + + + + Regardless of case-sensitivity, it is not always the case that + this[value].FileName == value. In other words, the FileName + property of the ZipEntry retrieved with this indexer, may or may + not be equal to the index value. + + + + This is because DotNetZip performs a normalization of filenames passed to + this indexer, before attempting to retrieve the item. That normalization + includes: removal of a volume letter and colon, swapping backward slashes + for forward slashes. So, zip["dir1\\entry1.txt"].FileName == + "dir1/entry.txt". + + + + Directory entries in the zip file may be retrieved via this indexer only + with names that have a trailing slash. DotNetZip automatically appends a + trailing slash to the names of any directory entries added to a zip. + + + + + + This example extracts only the entries in a zip file that are .txt files. + + using (ZipFile zip = ZipFile.Read("PackedDocuments.zip")) + { + foreach (string s1 in zip.EntryFilenames) + { + if (s1.EndsWith(".txt")) + zip[s1].Extract("textfiles"); + } + } + + + Using zip As ZipFile = ZipFile.Read("PackedDocuments.zip") + Dim s1 As String + For Each s1 In zip.EntryFilenames + If s1.EndsWith(".txt") Then + zip(s1).Extract("textfiles") + End If + Next + End Using + + + + + + Thrown if the caller attempts to assign a non-null value to the indexer. + + + + The name of the file, including any directory path, to retrieve from the + zip. The filename match is not case-sensitive by default; you can use the + property to change this behavior. The + pathname can use forward-slashes or backward slashes. + + + + The ZipEntry within the Zip archive, given by the specified + filename. If the named entry does not exist in the archive, this indexer + returns null (Nothing in VB). + + + + + + The list of filenames for the entries contained within the zip archive. + + + + According to the ZIP specification, the names of the entries use forward + slashes in pathnames. If you are scanning through the list, you may have + to swap forward slashes for backslashes. + + + + + + This example shows one way to test if a filename is already contained + within a zip archive. + + String zipFileToRead= "PackedDocuments.zip"; + string candidate = "DatedMaterial.xps"; + using (ZipFile zip = new ZipFile(zipFileToRead)) + { + if (zip.EntryFilenames.Contains(candidate)) + Console.WriteLine("The file '{0}' exists in the zip archive '{1}'", + candidate, + zipFileName); + else + Console.WriteLine("The file, '{0}', does not exist in the zip archive '{1}'", + candidate, + zipFileName); + Console.WriteLine(); + } + + + Dim zipFileToRead As String = "PackedDocuments.zip" + Dim candidate As String = "DatedMaterial.xps" + Using zip As ZipFile.Read(ZipFileToRead) + If zip.EntryFilenames.Contains(candidate) Then + Console.WriteLine("The file '{0}' exists in the zip archive '{1}'", _ + candidate, _ + zipFileName) + Else + Console.WriteLine("The file, '{0}', does not exist in the zip archive '{1}'", _ + candidate, _ + zipFileName) + End If + Console.WriteLine + End Using + + + + + The list of strings for the filenames contained within the Zip archive. + + + + + + Returns the readonly collection of entries in the Zip archive. + + + + + + If there are no entries in the current ZipFile, the value returned is a + non-null zero-element collection. If there are entries in the zip file, + the elements are returned in no particular order. + + + This is the implied enumerator on the ZipFile class. If you use a + ZipFile instance in a context that expects an enumerator, you will + get this collection. + + + + + + + Returns a readonly collection of entries in the Zip archive, sorted by FileName. + + + + If there are no entries in the current ZipFile, the value returned + is a non-null zero-element collection. If there are entries in the zip + file, the elements are returned sorted by the name of the entry. + + + + + This example fills a Windows Forms ListView with the entries in a zip file. + + + using (ZipFile zip = ZipFile.Read(zipFile)) + { + foreach (ZipEntry entry in zip.EntriesSorted) + { + ListViewItem item = new ListViewItem(n.ToString()); + n++; + string[] subitems = new string[] { + entry.FileName.Replace("/","\\"), + entry.LastModified.ToString("yyyy-MM-dd HH:mm:ss"), + entry.UncompressedSize.ToString(), + String.Format("{0,5:F0}%", entry.CompressionRatio), + entry.CompressedSize.ToString(), + (entry.UsesEncryption) ? "Y" : "N", + String.Format("{0:X8}", entry.Crc)}; + + foreach (String s in subitems) + { + ListViewItem.ListViewSubItem subitem = new ListViewItem.ListViewSubItem(); + subitem.Text = s; + item.SubItems.Add(subitem); + } + + this.listView1.Items.Add(item); + } + } + + + + + + + + Returns the number of entries in the Zip archive. + + + + + Removes the given ZipEntry from the zip archive. + + + + + After calling RemoveEntry, the application must call Save to + make the changes permanent. + + + + + Thrown if the specified ZipEntry does not exist in the ZipFile. + + + + In this example, all entries in the zip archive dating from before + December 31st, 2007, are removed from the archive. This is actually much + easier if you use the RemoveSelectedEntries method. But I needed an + example for RemoveEntry, so here it is. + + String ZipFileToRead = "ArchiveToModify.zip"; + System.DateTime Threshold = new System.DateTime(2007,12,31); + using (ZipFile zip = ZipFile.Read(ZipFileToRead)) + { + var EntriesToRemove = new System.Collections.Generic.List<ZipEntry>(); + foreach (ZipEntry e in zip) + { + if (e.LastModified < Threshold) + { + // We cannot remove the entry from the list, within the context of + // an enumeration of said list. + // So we add the doomed entry to a list to be removed later. + EntriesToRemove.Add(e); + } + } + + // actually remove the doomed entries. + foreach (ZipEntry zombie in EntriesToRemove) + zip.RemoveEntry(zombie); + + zip.Comment= String.Format("This zip archive was updated at {0}.", + System.DateTime.Now.ToString("G")); + + // save with a different name + zip.Save("Archive-Updated.zip"); + } + + + + Dim ZipFileToRead As String = "ArchiveToModify.zip" + Dim Threshold As New DateTime(2007, 12, 31) + Using zip As ZipFile = ZipFile.Read(ZipFileToRead) + Dim EntriesToRemove As New System.Collections.Generic.List(Of ZipEntry) + Dim e As ZipEntry + For Each e In zip + If (e.LastModified < Threshold) Then + ' We cannot remove the entry from the list, within the context of + ' an enumeration of said list. + ' So we add the doomed entry to a list to be removed later. + EntriesToRemove.Add(e) + End If + Next + + ' actually remove the doomed entries. + Dim zombie As ZipEntry + For Each zombie In EntriesToRemove + zip.RemoveEntry(zombie) + Next + zip.Comment = String.Format("This zip archive was updated at {0}.", DateTime.Now.ToString("G")) + 'save as a different name + zip.Save("Archive-Updated.zip") + End Using + + + + + The ZipEntry to remove from the zip. + + + + + + + + Removes the ZipEntry with the given filename from the zip archive. + + + + + After calling RemoveEntry, the application must call Save to + make the changes permanent. + + + + + + Thrown if the ZipFile is not updatable. + + + + Thrown if a ZipEntry with the specified filename does not exist in + the ZipFile. + + + + + This example shows one way to remove an entry with a given filename from + an existing zip archive. + + + String zipFileToRead= "PackedDocuments.zip"; + string candidate = "DatedMaterial.xps"; + using (ZipFile zip = ZipFile.Read(zipFileToRead)) + { + if (zip.EntryFilenames.Contains(candidate)) + { + zip.RemoveEntry(candidate); + zip.Comment= String.Format("The file '{0}' has been removed from this archive.", + Candidate); + zip.Save(); + } + } + + + Dim zipFileToRead As String = "PackedDocuments.zip" + Dim candidate As String = "DatedMaterial.xps" + Using zip As ZipFile = ZipFile.Read(zipFileToRead) + If zip.EntryFilenames.Contains(candidate) Then + zip.RemoveEntry(candidate) + zip.Comment = String.Format("The file '{0}' has been removed from this archive.", Candidate) + zip.Save + End If + End Using + + + + + The name of the file, including any directory path, to remove from the zip. + The filename match is not case-sensitive by default; you can use the + CaseSensitiveRetrieval property to change this behavior. The + pathname can use forward-slashes or backward slashes. + + + + + + Closes the read and write streams associated + to the ZipFile, if necessary. + + + + The Dispose() method is generally employed implicitly, via a using(..) {..} + statement. (Using...End Using in VB) If you do not employ a using + statement, insure that your application calls Dispose() explicitly. For + example, in a Powershell application, or an application that uses the COM + interop interface, you must call Dispose() explicitly. + + + + This example extracts an entry selected by name, from the Zip file to the + Console. + + using (ZipFile zip = ZipFile.Read(zipfile)) + { + foreach (ZipEntry e in zip) + { + if (WantThisEntry(e.FileName)) + zip.Extract(e.FileName, Console.OpenStandardOutput()); + } + } // Dispose() is called implicitly here. + + + + Using zip As ZipFile = ZipFile.Read(zipfile) + Dim e As ZipEntry + For Each e In zip + If WantThisEntry(e.FileName) Then + zip.Extract(e.FileName, Console.OpenStandardOutput()) + End If + Next + End Using ' Dispose is implicity called here + + + + + + Disposes any managed resources, if the flag is set, then marks the + instance disposed. This method is typically not called explicitly from + application code. + + + + Applications should call the no-arg Dispose method. + + + + indicates whether the method should dispose streams or not. + + + + + Default size of the buffer used for IO. + + + + + An event handler invoked when a Save() starts, before and after each + entry has been written to the archive, when a Save() completes, and + during other Save events. + + + + + Depending on the particular event, different properties on the parameter are set. The following + table summarizes the available EventTypes and the conditions under + which this event handler is invoked with a + SaveProgressEventArgs with the given EventType. + + + + + value of EntryType + Meaning and conditions + + + + ZipProgressEventType.Saving_Started + Fired when ZipFile.Save() begins. + + + + + ZipProgressEventType.Saving_BeforeSaveEntry + + Fired within ZipFile.Save(), just before writing data for each + particular entry. + + + + + ZipProgressEventType.Saving_AfterSaveEntry + + Fired within ZipFile.Save(), just after having finished writing data + for each particular entry. + + + + + ZipProgressEventType.Saving_Completed + Fired when ZipFile.Save() has completed. + + + + + ZipProgressEventType.Saving_AfterSaveTempArchive + + Fired after the temporary file has been created. This happens only + when saving to a disk file. This event will not be invoked when + saving to a stream. + + + + + ZipProgressEventType.Saving_BeforeRenameTempArchive + + Fired just before renaming the temporary file to the permanent + location. This happens only when saving to a disk file. This event + will not be invoked when saving to a stream. + + + + + ZipProgressEventType.Saving_AfterRenameTempArchive + + Fired just after renaming the temporary file to the permanent + location. This happens only when saving to a disk file. This event + will not be invoked when saving to a stream. + + + + + ZipProgressEventType.Saving_AfterCompileSelfExtractor + + Fired after a self-extracting archive has finished compiling. This + EventType is used only within SaveSelfExtractor(). + + + + + ZipProgressEventType.Saving_BytesRead + + Set during the save of a particular entry, to update progress of the + Save(). When this EventType is set, the BytesTransferred is the + number of bytes that have been read from the source stream. The + TotalBytesToTransfer is the number of bytes in the uncompressed + file. + + + + + + + + + This example uses an anonymous method to handle the + SaveProgress event, by updating a progress bar. + + + progressBar1.Value = 0; + progressBar1.Max = listbox1.Items.Count; + using (ZipFile zip = new ZipFile()) + { + // listbox1 contains a list of filenames + zip.AddFiles(listbox1.Items); + + // do the progress bar: + zip.SaveProgress += (sender, e) => { + if (e.EventType == ZipProgressEventType.Saving_BeforeWriteEntry) { + progressBar1.PerformStep(); + } + }; + + zip.Save(fs); + } + + + + + This example uses a named method as the + SaveProgress event handler, to update the user, in a + console-based application. + + + static bool justHadByteUpdate= false; + public static void SaveProgress(object sender, SaveProgressEventArgs e) + { + if (e.EventType == ZipProgressEventType.Saving_Started) + Console.WriteLine("Saving: {0}", e.ArchiveName); + + else if (e.EventType == ZipProgressEventType.Saving_Completed) + { + justHadByteUpdate= false; + Console.WriteLine(); + Console.WriteLine("Done: {0}", e.ArchiveName); + } + + else if (e.EventType == ZipProgressEventType.Saving_BeforeWriteEntry) + { + if (justHadByteUpdate) + Console.WriteLine(); + Console.WriteLine(" Writing: {0} ({1}/{2})", + e.CurrentEntry.FileName, e.EntriesSaved, e.EntriesTotal); + justHadByteUpdate= false; + } + + else if (e.EventType == ZipProgressEventType.Saving_EntryBytesRead) + { + if (justHadByteUpdate) + Console.SetCursorPosition(0, Console.CursorTop); + Console.Write(" {0}/{1} ({2:N0}%)", e.BytesTransferred, e.TotalBytesToTransfer, + e.BytesTransferred / (0.01 * e.TotalBytesToTransfer )); + justHadByteUpdate= true; + } + } + + public static ZipUp(string targetZip, string directory) + { + using (var zip = new ZipFile()) { + zip.SaveProgress += SaveProgress; + zip.AddDirectory(directory); + zip.Save(targetZip); + } + } + + + + + Public Sub ZipUp(ByVal targetZip As String, ByVal directory As String) + Using zip As ZipFile = New ZipFile + AddHandler zip.SaveProgress, AddressOf MySaveProgress + zip.AddDirectory(directory) + zip.Save(targetZip) + End Using + End Sub + + Private Shared justHadByteUpdate As Boolean = False + + Public Shared Sub MySaveProgress(ByVal sender As Object, ByVal e As SaveProgressEventArgs) + If (e.EventType Is ZipProgressEventType.Saving_Started) Then + Console.WriteLine("Saving: {0}", e.ArchiveName) + + ElseIf (e.EventType Is ZipProgressEventType.Saving_Completed) Then + justHadByteUpdate = False + Console.WriteLine + Console.WriteLine("Done: {0}", e.ArchiveName) + + ElseIf (e.EventType Is ZipProgressEventType.Saving_BeforeWriteEntry) Then + If justHadByteUpdate Then + Console.WriteLine + End If + Console.WriteLine(" Writing: {0} ({1}/{2})", e.CurrentEntry.FileName, e.EntriesSaved, e.EntriesTotal) + justHadByteUpdate = False + + ElseIf (e.EventType Is ZipProgressEventType.Saving_EntryBytesRead) Then + If justHadByteUpdate Then + Console.SetCursorPosition(0, Console.CursorTop) + End If + Console.Write(" {0}/{1} ({2:N0}%)", e.BytesTransferred, _ + e.TotalBytesToTransfer, _ + (CDbl(e.BytesTransferred) / (0.01 * e.TotalBytesToTransfer))) + justHadByteUpdate = True + End If + End Sub + + + + + + This is a more complete example of using the SaveProgress + events in a Windows Forms application, with a + Thread object. + + + delegate void SaveEntryProgress(SaveProgressEventArgs e); + delegate void ButtonClick(object sender, EventArgs e); + + public class WorkerOptions + { + public string ZipName; + public string Folder; + public string Encoding; + public string Comment; + public int ZipFlavor; + public Zip64Option Zip64; + } + + private int _progress2MaxFactor; + private bool _saveCanceled; + private long _totalBytesBeforeCompress; + private long _totalBytesAfterCompress; + private Thread _workerThread; + + + private void btnZipup_Click(object sender, EventArgs e) + { + KickoffZipup(); + } + + private void btnCancel_Click(object sender, EventArgs e) + { + if (this.lblStatus.InvokeRequired) + { + this.lblStatus.Invoke(new ButtonClick(this.btnCancel_Click), new object[] { sender, e }); + } + else + { + _saveCanceled = true; + lblStatus.Text = "Canceled..."; + ResetState(); + } + } + + private void KickoffZipup() + { + _folderName = tbDirName.Text; + + if (_folderName == null || _folderName == "") return; + if (this.tbZipName.Text == null || this.tbZipName.Text == "") return; + + // check for existence of the zip file: + if (System.IO.File.Exists(this.tbZipName.Text)) + { + var dlgResult = MessageBox.Show(String.Format("The file you have specified ({0}) already exists." + + " Do you want to overwrite this file?", this.tbZipName.Text), + "Confirmation is Required", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (dlgResult != DialogResult.Yes) return; + System.IO.File.Delete(this.tbZipName.Text); + } + + _saveCanceled = false; + _nFilesCompleted = 0; + _totalBytesAfterCompress = 0; + _totalBytesBeforeCompress = 0; + this.btnOk.Enabled = false; + this.btnOk.Text = "Zipping..."; + this.btnCancel.Enabled = true; + lblStatus.Text = "Zipping..."; + + var options = new WorkerOptions + { + ZipName = this.tbZipName.Text, + Folder = _folderName, + Encoding = "ibm437" + }; + + if (this.comboBox1.SelectedIndex != 0) + { + options.Encoding = this.comboBox1.SelectedItem.ToString(); + } + + if (this.radioFlavorSfxCmd.Checked) + options.ZipFlavor = 2; + else if (this.radioFlavorSfxGui.Checked) + options.ZipFlavor = 1; + else options.ZipFlavor = 0; + + if (this.radioZip64AsNecessary.Checked) + options.Zip64 = Zip64Option.AsNecessary; + else if (this.radioZip64Always.Checked) + options.Zip64 = Zip64Option.Always; + else options.Zip64 = Zip64Option.Never; + + options.Comment = String.Format("Encoding:{0} || Flavor:{1} || ZIP64:{2}\r\nCreated at {3} || {4}\r\n", + options.Encoding, + FlavorToString(options.ZipFlavor), + options.Zip64.ToString(), + System.DateTime.Now.ToString("yyyy-MMM-dd HH:mm:ss"), + this.Text); + + if (this.tbComment.Text != TB_COMMENT_NOTE) + options.Comment += this.tbComment.Text; + + _workerThread = new Thread(this.DoSave); + _workerThread.Name = "Zip Saver thread"; + _workerThread.Start(options); + this.Cursor = Cursors.WaitCursor; + } + + + private void DoSave(Object p) + { + WorkerOptions options = p as WorkerOptions; + try + { + using (var zip1 = new ZipFile()) + { + zip1.ProvisionalAlternateEncoding = System.Text.Encoding.GetEncoding(options.Encoding); + zip1.Comment = options.Comment; + zip1.AddDirectory(options.Folder); + _entriesToZip = zip1.EntryFileNames.Count; + SetProgressBars(); + zip1.SaveProgress += this.zip1_SaveProgress; + + zip1.UseZip64WhenSaving = options.Zip64; + + if (options.ZipFlavor == 1) + zip1.SaveSelfExtractor(options.ZipName, SelfExtractorFlavor.WinFormsApplication); + else if (options.ZipFlavor == 2) + zip1.SaveSelfExtractor(options.ZipName, SelfExtractorFlavor.ConsoleApplication); + else + zip1.Save(options.ZipName); + } + } + catch (System.Exception exc1) + { + MessageBox.Show(String.Format("Exception while zipping: {0}", exc1.Message)); + btnCancel_Click(null, null); + } + } + + + + void zip1_SaveProgress(object sender, SaveProgressEventArgs e) + { + switch (e.EventType) + { + case ZipProgressEventType.Saving_AfterWriteEntry: + StepArchiveProgress(e); + break; + case ZipProgressEventType.Saving_EntryBytesRead: + StepEntryProgress(e); + break; + case ZipProgressEventType.Saving_Completed: + SaveCompleted(); + break; + case ZipProgressEventType.Saving_AfterSaveTempArchive: + // this event only occurs when saving an SFX file + TempArchiveSaved(); + break; + } + if (_saveCanceled) + e.Cancel = true; + } + + + + private void StepArchiveProgress(SaveProgressEventArgs e) + { + if (this.progressBar1.InvokeRequired) + { + this.progressBar1.Invoke(new SaveEntryProgress(this.StepArchiveProgress), new object[] { e }); + } + else + { + if (!_saveCanceled) + { + _nFilesCompleted++; + this.progressBar1.PerformStep(); + _totalBytesAfterCompress += e.CurrentEntry.CompressedSize; + _totalBytesBeforeCompress += e.CurrentEntry.UncompressedSize; + + // reset the progress bar for the entry: + this.progressBar2.Value = this.progressBar2.Maximum = 1; + + this.Update(); + } + } + } + + + private void StepEntryProgress(SaveProgressEventArgs e) + { + if (this.progressBar2.InvokeRequired) + { + this.progressBar2.Invoke(new SaveEntryProgress(this.StepEntryProgress), new object[] { e }); + } + else + { + if (!_saveCanceled) + { + if (this.progressBar2.Maximum == 1) + { + // reset + Int64 max = e.TotalBytesToTransfer; + _progress2MaxFactor = 0; + while (max > System.Int32.MaxValue) + { + max /= 2; + _progress2MaxFactor++; + } + this.progressBar2.Maximum = (int)max; + lblStatus.Text = String.Format("{0} of {1} files...({2})", + _nFilesCompleted + 1, _entriesToZip, e.CurrentEntry.FileName); + } + + int xferred = e.BytesTransferred >> _progress2MaxFactor; + + this.progressBar2.Value = (xferred >= this.progressBar2.Maximum) + ? this.progressBar2.Maximum + : xferred; + + this.Update(); + } + } + } + + private void SaveCompleted() + { + if (this.lblStatus.InvokeRequired) + { + this.lblStatus.Invoke(new MethodInvoker(this.SaveCompleted)); + } + else + { + lblStatus.Text = String.Format("Done, Compressed {0} files, {1:N0}% of original.", + _nFilesCompleted, (100.00 * _totalBytesAfterCompress) / _totalBytesBeforeCompress); + ResetState(); + } + } + + private void ResetState() + { + this.btnCancel.Enabled = false; + this.btnOk.Enabled = true; + this.btnOk.Text = "Zip it!"; + this.progressBar1.Value = 0; + this.progressBar2.Value = 0; + this.Cursor = Cursors.Default; + if (!_workerThread.IsAlive) + _workerThread.Join(); + } + + + + + + + + + + + An event handler invoked before, during, and after the reading of a zip archive. + + + + + Depending on the particular event being signaled, different properties on the + parameter are set. The following table + summarizes the available EventTypes and the conditions under which this + event handler is invoked with a ReadProgressEventArgs with the given EventType. + + + + + value of EntryType + Meaning and conditions + + + + ZipProgressEventType.Reading_Started + Fired just as ZipFile.Read() begins. Meaningful properties: ArchiveName. + + + + + ZipProgressEventType.Reading_Completed + Fired when ZipFile.Read() has completed. Meaningful properties: ArchiveName. + + + + + ZipProgressEventType.Reading_ArchiveBytesRead + Fired while reading, updates the number of bytes read for the entire archive. + Meaningful properties: ArchiveName, CurrentEntry, BytesTransferred, TotalBytesToTransfer. + + + + + ZipProgressEventType.Reading_BeforeReadEntry + Indicates an entry is about to be read from the archive. + Meaningful properties: ArchiveName, EntriesTotal. + + + + + ZipProgressEventType.Reading_AfterReadEntry + Indicates an entry has just been read from the archive. + Meaningful properties: ArchiveName, EntriesTotal, CurrentEntry. + + + + + + + + + + + + + An event handler invoked before, during, and after extraction of + entries in the zip archive. + + + + + Depending on the particular event, different properties on the parameter are set. The following + table summarizes the available EventTypes and the conditions under + which this event handler is invoked with a + ExtractProgressEventArgs with the given EventType. + + + + + value of EntryType + Meaning and conditions + + + + ZipProgressEventType.Extracting_BeforeExtractAll + + Set when ExtractAll() begins. The ArchiveName, Overwrite, and + ExtractLocation properties are meaningful. + + + + ZipProgressEventType.Extracting_AfterExtractAll + + Set when ExtractAll() has completed. The ArchiveName, Overwrite, + and ExtractLocation properties are meaningful. + + + + + ZipProgressEventType.Extracting_BeforeExtractEntry + + Set when an Extract() on an entry in the ZipFile has begun. + Properties that are meaningful: ArchiveName, EntriesTotal, + CurrentEntry, Overwrite, ExtractLocation, EntriesExtracted. + + + + + ZipProgressEventType.Extracting_AfterExtractEntry + + Set when an Extract() on an entry in the ZipFile has completed. + Properties that are meaningful: ArchiveName, EntriesTotal, + CurrentEntry, Overwrite, ExtractLocation, EntriesExtracted. + + + + + ZipProgressEventType.Extracting_EntryBytesWritten + + Set within a call to Extract() on an entry in the ZipFile, as data + is extracted for the entry. Properties that are meaningful: + ArchiveName, CurrentEntry, BytesTransferred, TotalBytesToTransfer. + + + + + ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite + + Set within a call to Extract() on an entry in the ZipFile, when the + extraction would overwrite an existing file. This event type is used + only when ExtractExistingFileAction on the ZipFile or + ZipEntry is set to InvokeExtractProgressEvent. + + + + + + + + + + private static bool justHadByteUpdate = false; + public static void ExtractProgress(object sender, ExtractProgressEventArgs e) + { + if(e.EventType == ZipProgressEventType.Extracting_EntryBytesWritten) + { + if (justHadByteUpdate) + Console.SetCursorPosition(0, Console.CursorTop); + + Console.Write(" {0}/{1} ({2:N0}%)", e.BytesTransferred, e.TotalBytesToTransfer, + e.BytesTransferred / (0.01 * e.TotalBytesToTransfer )); + justHadByteUpdate = true; + } + else if(e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry) + { + if (justHadByteUpdate) + Console.WriteLine(); + Console.WriteLine("Extracting: {0}", e.CurrentEntry.FileName); + justHadByteUpdate= false; + } + } + + public static ExtractZip(string zipToExtract, string directory) + { + string TargetDirectory= "extract"; + using (var zip = ZipFile.Read(zipToExtract)) { + zip.ExtractProgress += ExtractProgress; + foreach (var e in zip1) + { + e.Extract(TargetDirectory, true); + } + } + } + + + + Public Shared Sub Main(ByVal args As String()) + Dim ZipToUnpack As String = "C1P3SML.zip" + Dim TargetDir As String = "ExtractTest_Extract" + Console.WriteLine("Extracting file {0} to {1}", ZipToUnpack, TargetDir) + Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack) + AddHandler zip1.ExtractProgress, AddressOf MyExtractProgress + Dim e As ZipEntry + For Each e In zip1 + e.Extract(TargetDir, True) + Next + End Using + End Sub + + Private Shared justHadByteUpdate As Boolean = False + + Public Shared Sub MyExtractProgress(ByVal sender As Object, ByVal e As ExtractProgressEventArgs) + If (e.EventType = ZipProgressEventType.Extracting_EntryBytesWritten) Then + If ExtractTest.justHadByteUpdate Then + Console.SetCursorPosition(0, Console.CursorTop) + End If + Console.Write(" {0}/{1} ({2:N0}%)", e.BytesTransferred, e.TotalBytesToTransfer, (CDbl(e.BytesTransferred) / (0.01 * e.TotalBytesToTransfer))) + ExtractTest.justHadByteUpdate = True + ElseIf (e.EventType = ZipProgressEventType.Extracting_BeforeExtractEntry) Then + If ExtractTest.justHadByteUpdate Then + Console.WriteLine + End If + Console.WriteLine("Extracting: {0}", e.CurrentEntry.FileName) + ExtractTest.justHadByteUpdate = False + End If + End Sub + + + + + + + + + + An event handler invoked before, during, and after Adding entries to a zip archive. + + + + Adding a large number of entries to a zip file can take a long + time. For example, when calling on a + directory that contains 50,000 files, it could take 3 minutes or so. + This event handler allws an application to track the progress of the Add + operation, and to optionally cancel a lengthy Add operation. + + + + + + int _numEntriesToAdd= 0; + int _numEntriesAdded= 0; + void AddProgressHandler(object sender, AddProgressEventArgs e) + { + switch (e.EventType) + { + case ZipProgressEventType.Adding_Started: + Console.WriteLine("Adding files to the zip..."); + break; + case ZipProgressEventType.Adding_AfterAddEntry: + _numEntriesAdded++; + Console.WriteLine(String.Format("Adding file {0}/{1} :: {2}", + _numEntriesAdded, _numEntriesToAdd, e.CurrentEntry.FileName)); + break; + case ZipProgressEventType.Adding_Completed: + Console.WriteLine("Added all files"); + break; + } + } + + void CreateTheZip() + { + using (ZipFile zip = new ZipFile()) + { + zip.AddProgress += AddProgressHandler; + zip.AddDirectory(System.IO.Path.GetFileName(DirToZip)); + zip.Save(ZipFileToCreate); + } + } + + + + + + Private Sub AddProgressHandler(ByVal sender As Object, ByVal e As AddProgressEventArgs) + Select Case e.EventType + Case ZipProgressEventType.Adding_Started + Console.WriteLine("Adding files to the zip...") + Exit Select + Case ZipProgressEventType.Adding_AfterAddEntry + Console.WriteLine(String.Format("Adding file {0}", e.CurrentEntry.FileName)) + Exit Select + Case ZipProgressEventType.Adding_Completed + Console.WriteLine("Added all files") + Exit Select + End Select + End Sub + + Sub CreateTheZip() + Using zip as ZipFile = New ZipFile + AddHandler zip.AddProgress, AddressOf AddProgressHandler + zip.AddDirectory(System.IO.Path.GetFileName(DirToZip)) + zip.Save(ZipFileToCreate); + End Using + End Sub + + + + + + + + + + + + An event that is raised when an error occurs during open or read of files + while saving a zip archive. + + + + + Errors can occur as a file is being saved to the zip archive. For + example, the File.Open may fail, or a File.Read may fail, because of + lock conflicts or other reasons. If you add a handler to this event, + you can handle such errors in your own code. If you don't add a + handler, the library will throw an exception if it encounters an I/O + error during a call to Save(). + + + + Setting a handler implicitly sets to + ZipErrorAction.InvokeErrorEvent. + + + + The handler you add applies to all items that are + subsequently added to the ZipFile instance. If you set this + property after you have added items to the ZipFile, but before you + have called Save(), errors that occur while saving those items + will not cause the error handler to be invoked. + + + + If you want to handle any errors that occur with any entry in the zip + file using the same error handler, then add your error handler once, + before adding any entries to the zip archive. + + + + In the error handler method, you need to set the property on the + ZipErrorEventArgs.CurrentEntry. This communicates back to + DotNetZip what you would like to do with this particular error. Within + an error handler, if you set the ZipEntry.ZipErrorAction property + on the ZipEntry to ZipErrorAction.InvokeErrorEvent or if + you don't set it at all, the library will throw the exception. (It is the + same as if you had set the ZipEntry.ZipErrorAction property on the + ZipEntry to ZipErrorAction.Throw.) If you set the + ZipErrorEventArgs.Cancel to true, the entire Save() will be + canceled. + + + + In the case that you use ZipErrorAction.Skip, implying that + you want to skip the entry for which there's been an error, DotNetZip + tries to seek backwards in the output stream, and truncate all bytes + written on behalf of that particular entry. This works only if the + output stream is seekable. It will not work, for example, when using + ASPNET's Response.OutputStream. + + + + + + + This example shows how to use an event handler to handle + errors during save of the zip file. + + + public static void MyZipError(object sender, ZipErrorEventArgs e) + { + Console.WriteLine("Error saving {0}...", e.FileName); + Console.WriteLine(" Exception: {0}", e.exception); + ZipEntry entry = e.CurrentEntry; + string response = null; + // Ask the user whether he wants to skip this error or not + do + { + Console.Write("Retry, Skip, Throw, or Cancel ? (R/S/T/C) "); + response = Console.ReadLine(); + Console.WriteLine(); + + } while (response != null && + response[0]!='S' && response[0]!='s' && + response[0]!='R' && response[0]!='r' && + response[0]!='T' && response[0]!='t' && + response[0]!='C' && response[0]!='c'); + + e.Cancel = (response[0]=='C' || response[0]=='c'); + + if (response[0]=='S' || response[0]=='s') + entry.ZipErrorAction = ZipErrorAction.Skip; + else if (response[0]=='R' || response[0]=='r') + entry.ZipErrorAction = ZipErrorAction.Retry; + else if (response[0]=='T' || response[0]=='t') + entry.ZipErrorAction = ZipErrorAction.Throw; + } + + public void SaveTheFile() + { + string directoryToZip = "fodder"; + string directoryInArchive = "files"; + string zipFileToCreate = "Archive.zip"; + using (var zip = new ZipFile()) + { + // set the event handler before adding any entries + zip.ZipError += MyZipError; + zip.AddDirectory(directoryToZip, directoryInArchive); + zip.Save(zipFileToCreate); + } + } + + + + Private Sub MyZipError(ByVal sender As Object, ByVal e As Ionic.Zip.ZipErrorEventArgs) + ' At this point, the application could prompt the user for an action to take. + ' But in this case, this application will simply automatically skip the file, in case of error. + Console.WriteLine("Zip Error, entry {0}", e.CurrentEntry.FileName) + Console.WriteLine(" Exception: {0}", e.exception) + ' set the desired ZipErrorAction on the CurrentEntry to communicate that to DotNetZip + e.CurrentEntry.ZipErrorAction = Zip.ZipErrorAction.Skip + End Sub + + Public Sub SaveTheFile() + Dim directoryToZip As String = "fodder" + Dim directoryInArchive As String = "files" + Dim zipFileToCreate as String = "Archive.zip" + Using zipArchive As ZipFile = New ZipFile + ' set the event handler before adding any entries + AddHandler zipArchive.ZipError, AddressOf MyZipError + zipArchive.AddDirectory(directoryToZip, directoryInArchive) + zipArchive.Save(zipFileToCreate) + End Using + End Sub + + + + + + + + + Extracts all of the items in the zip archive, to the specified path in the + filesystem. The path can be relative or fully-qualified. + + + + + This method will extract all entries in the ZipFile to the + specified path. + + + + If an extraction of a file from the zip archive would overwrite an + existing file in the filesystem, the action taken is dictated by the + ExtractExistingFile property, which overrides any setting you may have + made on individual ZipEntry instances. By default, if you have not + set that property on the ZipFile instance, the entry will not + be extracted, the existing file will not be overwritten and an + exception will be thrown. To change this, set the property, or use the + overload that allows you to + specify an ExtractExistingFileAction parameter. + + + + The action to take when an extract would overwrite an existing file + applies to all entries. If you want to set this on a per-entry basis, + then you must use one of the ZipEntry.Extract methods. + + + + This method will send verbose output messages to the , if it is set on the ZipFile + instance. + + + + You may wish to take advantage of the ExtractProgress event. + + + + About timestamps: When extracting a file entry from a zip archive, the + extracted file gets the last modified time of the entry as stored in + the archive. The archive may also store extended file timestamp + information, including last accessed and created times. If these are + present in the ZipEntry, then the extracted file will also get + these times. + + + + A Directory entry is somewhat different. It will get the times as + described for a file entry, but, if there are file entries in the zip + archive that, when extracted, appear in the just-created directory, + then when those file entries are extracted, the last modified and last + accessed times of the directory will change, as a side effect. The + result is that after an extraction of a directory and a number of + files within the directory, the last modified and last accessed + timestamps on the directory will reflect the time that the last file + was extracted into the directory, rather than the time stored in the + zip archive for the directory. + + + + To compensate, when extracting an archive with ExtractAll, + DotNetZip will extract all the file and directory entries as described + above, but it will then make a second pass on the directories, and + reset the times on the directories to reflect what is stored in the + zip archive. + + + + This compensation is performed only within the context of an + ExtractAll. If you call ZipEntry.Extract on a directory + entry, the timestamps on directory in the filesystem will reflect the + times stored in the zip. If you then call ZipEntry.Extract on + a file entry, which is extracted into the directory, the timestamps on + the directory will be updated to the current time. + + + + + This example extracts all the entries in a zip archive file, to the + specified target directory. The extraction will overwrite any + existing files silently. + + + String TargetDirectory= "unpack"; + using(ZipFile zip= ZipFile.Read(ZipFileToExtract)) + { + zip.ExtractExistingFile= ExtractExistingFileAction.OverwriteSilently; + zip.ExtractAll(TargetDirectory); + } + + + + Dim TargetDirectory As String = "unpack" + Using zip As ZipFile = ZipFile.Read(ZipFileToExtract) + zip.ExtractExistingFile= ExtractExistingFileAction.OverwriteSilently + zip.ExtractAll(TargetDirectory) + End Using + + + + + + + + The path to which the contents of the zipfile will be extracted. + The path can be relative or fully-qualified. + + + + + + Extracts all of the items in the zip archive, to the specified path in the + filesystem, using the specified behavior when extraction would overwrite an + existing file. + + + + + + This method will extract all entries in the ZipFile to the specified + path. For an extraction that would overwrite an existing file, the behavior + is dictated by , which overrides any + setting you may have made on individual ZipEntry instances. + + + + The action to take when an extract would overwrite an existing file + applies to all entries. If you want to set this on a per-entry basis, + then you must use or one of the similar methods. + + + + Calling this method is equivalent to setting the property and then calling . + + + + This method will send verbose output messages to the + , if it is set on the ZipFile instance. + + + + + This example extracts all the entries in a zip archive file, to the + specified target directory. It does not overwrite any existing files. + + String TargetDirectory= "c:\\unpack"; + using(ZipFile zip= ZipFile.Read(ZipFileToExtract)) + { + zip.ExtractAll(TargetDirectory, ExtractExistingFileAction.DontOverwrite); + } + + + + Dim TargetDirectory As String = "c:\unpack" + Using zip As ZipFile = ZipFile.Read(ZipFileToExtract) + zip.ExtractAll(TargetDirectory, ExtractExistingFileAction.DontOverwrite) + End Using + + + + + The path to which the contents of the zipfile will be extracted. + The path can be relative or fully-qualified. + + + + The action to take if extraction would overwrite an existing file. + + + + + + Reads a zip file archive and returns the instance. + + + + + The stream is read using the default System.Text.Encoding, which is the + IBM437 codepage. + + + + + Thrown if the ZipFile cannot be read. The implementation of this method + relies on System.IO.File.OpenRead, which can throw a variety of exceptions, + including specific exceptions if a file is not found, an unauthorized access + exception, exceptions for poorly formatted filenames, and so on. + + + + The name of the zip archive to open. This can be a fully-qualified or relative + pathname. + + + . + + The instance read from the zip archive. + + + + + Reads a zip file archive from the named filesystem file using the + specified options. + + + + + This version of the Read() method allows the caller to pass + in a TextWriter an Encoding, via an instance of the + ReadOptions class. The ZipFile is read in using the + specified encoding for entries where UTF-8 encoding is not + explicitly specified. + + + + + + + This example shows how to read a zip file using the Big-5 Chinese + code page (950), and extract each entry in the zip file, while + sending status messages out to the Console. + + + + For this code to work as intended, the zipfile must have been + created using the big5 code page (CP950). This is typical, for + example, when using WinRar on a machine with CP950 set as the + default code page. In that case, the names of entries within the + Zip archive will be stored in that code page, and reading the zip + archive must be done using that code page. If the application did + not use the correct code page in ZipFile.Read(), then names of + entries within the zip archive would not be correctly retrieved. + + + + string zipToExtract = "MyArchive.zip"; + string extractDirectory = "extract"; + var options = new ReadOptions + { + StatusMessageWriter = System.Console.Out, + Encoding = System.Text.Encoding.GetEncoding(950) + }; + using (ZipFile zip = ZipFile.Read(zipToExtract, options)) + { + foreach (ZipEntry e in zip) + { + e.Extract(extractDirectory); + } + } + + + + + Dim zipToExtract as String = "MyArchive.zip" + Dim extractDirectory as String = "extract" + Dim options as New ReadOptions + options.Encoding = System.Text.Encoding.GetEncoding(950) + options.StatusMessageWriter = System.Console.Out + Using zip As ZipFile = ZipFile.Read(zipToExtract, options) + Dim e As ZipEntry + For Each e In zip + e.Extract(extractDirectory) + Next + End Using + + + + + + + + This example shows how to read a zip file using the default + code page, to remove entries that have a modified date before a given threshold, + sending status messages out to a StringWriter. + + + + var options = new ReadOptions + { + StatusMessageWriter = new System.IO.StringWriter() + }; + using (ZipFile zip = ZipFile.Read("PackedDocuments.zip", options)) + { + var Threshold = new DateTime(2007,7,4); + // We cannot remove the entry from the list, within the context of + // an enumeration of said list. + // So we add the doomed entry to a list to be removed later. + // pass 1: mark the entries for removal + var MarkedEntries = new System.Collections.Generic.List<ZipEntry>(); + foreach (ZipEntry e in zip) + { + if (e.LastModified < Threshold) + MarkedEntries.Add(e); + } + // pass 2: actually remove the entry. + foreach (ZipEntry zombie in MarkedEntries) + zip.RemoveEntry(zombie); + zip.Comment = "This archive has been updated."; + zip.Save(); + } + // can now use contents of sw, eg store in an audit log + + + + Dim options as New ReadOptions + options.StatusMessageWriter = New System.IO.StringWriter + Using zip As ZipFile = ZipFile.Read("PackedDocuments.zip", options) + Dim Threshold As New DateTime(2007, 7, 4) + ' We cannot remove the entry from the list, within the context of + ' an enumeration of said list. + ' So we add the doomed entry to a list to be removed later. + ' pass 1: mark the entries for removal + Dim MarkedEntries As New System.Collections.Generic.List(Of ZipEntry) + Dim e As ZipEntry + For Each e In zip + If (e.LastModified < Threshold) Then + MarkedEntries.Add(e) + End If + Next + ' pass 2: actually remove the entry. + Dim zombie As ZipEntry + For Each zombie In MarkedEntries + zip.RemoveEntry(zombie) + Next + zip.Comment = "This archive has been updated." + zip.Save + End Using + ' can now use contents of sw, eg store in an audit log + + + + + Thrown if the zipfile cannot be read. The implementation of + this method relies on System.IO.File.OpenRead, which + can throw a variety of exceptions, including specific + exceptions if a file is not found, an unauthorized access + exception, exceptions for poorly formatted filenames, and so + on. + + + + The name of the zip archive to open. + This can be a fully-qualified or relative pathname. + + + + The set of options to use when reading the zip file. + + + The ZipFile instance read from the zip archive. + + + + + + + Reads a zip file archive using the specified text encoding, the specified + TextWriter for status messages, and the specified ReadProgress event handler, + and returns the instance. + + + + The name of the zip archive to open. + This can be a fully-qualified or relative pathname. + + + + An event handler for Read operations. + + + + The System.IO.TextWriter to use for writing verbose status messages + during operations on the zip archive. A console application may wish to + pass System.Console.Out to get messages on the Console. A graphical + or headless application may wish to capture the messages in a different + TextWriter, such as a System.IO.StringWriter. + + + + The System.Text.Encoding to use when reading in the zip archive. Be + careful specifying the encoding. If the value you use here is not the same + as the Encoding used when the zip archive was created (possibly by a + different archiver) you will get unexpected results and possibly exceptions. + + + The instance read from the zip archive. + + + + + Reads a zip archive from a stream. + + + + + + When reading from a file, it's probably easier to just use + ZipFile.Read(String, ReadOptions). This + overload is useful when when the zip archive content is + available from an already-open stream. The stream must be + open and readable and seekable when calling this method. The + stream is left open when the reading is completed. + + + + Using this overload, the stream is read using the default + System.Text.Encoding, which is the IBM437 + codepage. If you want to specify the encoding to use when + reading the zipfile content, see + ZipFile.Read(Stream, ReadOptions). This + + + + Reading of zip content begins at the current position in the + stream. This means if you have a stream that concatenates + regular data and zip data, if you position the open, readable + stream at the start of the zip data, you will be able to read + the zip archive using this constructor, or any of the ZipFile + constructors that accept a as + input. Some examples of where this might be useful: the zip + content is concatenated at the end of a regular EXE file, as + some self-extracting archives do. (Note: SFX files produced + by DotNetZip do not work this way; they can be read as normal + ZIP files). Another example might be a stream being read from + a database, where the zip content is embedded within an + aggregate stream of data. + + + + + + + This example shows how to Read zip content from a stream, and + extract one entry into a different stream. In this example, + the filename "NameOfEntryInArchive.doc", refers only to the + name of the entry within the zip archive. A file by that + name is not created in the filesystem. The I/O is done + strictly with the given streams. + + + + using (ZipFile zip = ZipFile.Read(InputStream)) + { + zip.Extract("NameOfEntryInArchive.doc", OutputStream); + } + + + + Using zip as ZipFile = ZipFile.Read(InputStream) + zip.Extract("NameOfEntryInArchive.doc", OutputStream) + End Using + + + + the stream containing the zip data. + + The ZipFile instance read from the stream + + + + + Reads a zip file archive from the given stream using the + specified options. + + + + + + When reading from a file, it's probably easier to just use + ZipFile.Read(String, ReadOptions). This + overload is useful when when the zip archive content is + available from an already-open stream. The stream must be + open and readable and seekable when calling this method. The + stream is left open when the reading is completed. + + + + Reading of zip content begins at the current position in the + stream. This means if you have a stream that concatenates + regular data and zip data, if you position the open, readable + stream at the start of the zip data, you will be able to read + the zip archive using this constructor, or any of the ZipFile + constructors that accept a as + input. Some examples of where this might be useful: the zip + content is concatenated at the end of a regular EXE file, as + some self-extracting archives do. (Note: SFX files produced + by DotNetZip do not work this way; they can be read as normal + ZIP files). Another example might be a stream being read from + a database, where the zip content is embedded within an + aggregate stream of data. + + + + the stream containing the zip data. + + + The set of options to use when reading the zip file. + + + + Thrown if the zip archive cannot be read. + + + The ZipFile instance read from the stream. + + + + + + + Reads a zip archive from a stream, using the specified text Encoding, the + specified TextWriter for status messages, + and the specified ReadProgress event handler. + + + + + Reading of zip content begins at the current position in the stream. This + means if you have a stream that concatenates regular data and zip data, if + you position the open, readable stream at the start of the zip data, you + will be able to read the zip archive using this constructor, or any of the + ZipFile constructors that accept a as + input. Some examples of where this might be useful: the zip content is + concatenated at the end of a regular EXE file, as some self-extracting + archives do. (Note: SFX files produced by DotNetZip do not work this + way). Another example might be a stream being read from a database, where + the zip content is embedded within an aggregate stream of data. + + + + the stream containing the zip data. + + + The System.IO.TextWriter to which verbose status messages are written + during operations on the ZipFile. For example, in a console + application, System.Console.Out works, and will get a message for each entry + added to the ZipFile. If the TextWriter is null, no verbose messages + are written. + + + + The text encoding to use when reading entries that do not have the UTF-8 + encoding bit set. Be careful specifying the encoding. If the value you use + here is not the same as the Encoding used when the zip archive was created + (possibly by a different archiver) you will get unexpected results and + possibly exceptions. See the + property for more information. + + + + An event handler for Read operations. + + + an instance of ZipFile + + + + Checks the given file to see if it appears to be a valid zip file. + + + + + Calling this method is equivalent to calling with the testExtract parameter set to false. + + + + The file to check. + true if the file appears to be a zip file. + + + + Checks a file to see if it is a valid zip file. + + + + + This method opens the specified zip file, reads in the zip archive, + verifying the ZIP metadata as it reads. + + + + If everything succeeds, then the method returns true. If anything fails - + for example if an incorrect signature or CRC is found, indicating a + corrupt file, the the method returns false. This method also returns + false for a file that does not exist. + + + + If is true, as part of its check, this + method reads in the content for each entry, expands it, and checks CRCs. + This provides an additional check beyond verifying the zip header and + directory data. + + + + If is true, and if any of the zip entries + are protected with a password, this method will return false. If you want + to verify a ZipFile that has entries which are protected with a + password, you will need to do that manually. + + + + + The zip file to check. + true if the caller wants to extract each entry. + true if the file contains a valid zip file. + + + + Checks a stream to see if it contains a valid zip archive. + + + + + This method reads the zip archive contained in the specified stream, verifying + the ZIP metadata as it reads. If testExtract is true, this method also extracts + each entry in the archive, dumping all the bits into . + + + + If everything succeeds, then the method returns true. If anything fails - + for example if an incorrect signature or CRC is found, indicating a corrupt + file, the the method returns false. This method also returns false for a + file that does not exist. + + + + If testExtract is true, this method reads in the content for each + entry, expands it, and checks CRCs. This provides an additional check + beyond verifying the zip header data. + + + + If testExtract is true, and if any of the zip entries are protected + with a password, this method will return false. If you want to verify a + ZipFile that has entries which are protected with a password, you will need + to do that manually. + + + + + + The stream to check. + true if the caller wants to extract each entry. + true if the stream contains a valid zip archive. + + + + Delete file with retry on UnauthorizedAccessException. + + + + + When calling File.Delete() on a file that has been "recently" + created, the call sometimes fails with + UnauthorizedAccessException. This method simply retries the Delete 3 + times with a sleep between tries. + + + + the name of the file to be deleted + + + + Saves the Zip archive to a file, specified by the Name property of the + ZipFile. + + + + + The ZipFile instance is written to storage, typically a zip file + in a filesystem, only when the caller calls Save. In the typical + case, the Save operation writes the zip content to a temporary file, and + then renames the temporary file to the desired name. If necessary, this + method will delete a pre-existing file before the rename. + + + + The property is specified either explicitly, + or implicitly using one of the parameterized ZipFile constructors. For + COM Automation clients, the Name property must be set explicitly, + because COM Automation clients cannot call parameterized constructors. + + + + When using a filesystem file for the Zip output, it is possible to call + Save multiple times on the ZipFile instance. With each + call the zip content is re-written to the same output file. + + + + Data for entries that have been added to the ZipFile instance is + written to the output when the Save method is called. This means + that the input streams for those entries must be available at the time + the application calls Save. If, for example, the application + adds entries with AddEntry using a dynamically-allocated + MemoryStream, the memory stream must not have been disposed + before the call to Save. See the property for more discussion of the + availability requirements of the input stream for an entry, and an + approach for providing just-in-time stream lifecycle management. + + + + + + + + Thrown if you haven't specified a location or stream for saving the zip, + either in the constructor or by setting the Name property, or if you try + to save a regular zip archive to a filename with a .exe extension. + + + + Thrown if or is non-zero, and the number + of segments that would be generated for the spanned zip file during the + save operation exceeds 99. If this happens, you need to increase the + segment size. + + + + + + Save the file to a new zipfile, with the given name. + + + + + This method allows the application to explicitly specify the name of the zip + file when saving. Use this when creating a new zip file, or when + updating a zip archive. + + + + An application can also save a zip archive in several places by calling this + method multiple times in succession, with different filenames. + + + + The ZipFile instance is written to storage, typically a zip file in a + filesystem, only when the caller calls Save. The Save operation writes + the zip content to a temporary file, and then renames the temporary file + to the desired name. If necessary, this method will delete a pre-existing file + before the rename. + + + + + + Thrown if you specify a directory for the filename. + + + + The name of the zip archive to save to. Existing files will + be overwritten with great prejudice. + + + + This example shows how to create and Save a zip file. + + using (ZipFile zip = new ZipFile()) + { + zip.AddDirectory(@"c:\reports\January"); + zip.Save("January.zip"); + } + + + + Using zip As New ZipFile() + zip.AddDirectory("c:\reports\January") + zip.Save("January.zip") + End Using + + + + + + This example shows how to update a zip file. + + using (ZipFile zip = ZipFile.Read("ExistingArchive.zip")) + { + zip.AddFile("NewData.csv"); + zip.Save("UpdatedArchive.zip"); + } + + + + Using zip As ZipFile = ZipFile.Read("ExistingArchive.zip") + zip.AddFile("NewData.csv") + zip.Save("UpdatedArchive.zip") + End Using + + + + + + + Save the zip archive to the specified stream. + + + + + The ZipFile instance is written to storage - typically a zip file + in a filesystem, but using this overload, the storage can be anything + accessible via a writable stream - only when the caller calls Save. + + + + Use this method to save the zip content to a stream directly. A common + scenario is an ASP.NET application that dynamically generates a zip file + and allows the browser to download it. The application can call + Save(Response.OutputStream) to write a zipfile directly to the + output stream, without creating a zip file on the disk on the ASP.NET + server. + + + + Be careful when saving a file to a non-seekable stream, including + Response.OutputStream. When DotNetZip writes to a non-seekable + stream, the zip archive is formatted in such a way that may not be + compatible with all zip tools on all platforms. It's a perfectly legal + and compliant zip file, but some people have reported problems opening + files produced this way using the Mac OS archive utility. + + + + + + + This example saves the zipfile content into a MemoryStream, and + then gets the array of bytes from that MemoryStream. + + + using (var zip = new Ionic.Zip.ZipFile()) + { + zip.CompressionLevel= Ionic.Zlib.CompressionLevel.BestCompression; + zip.Password = "VerySecret."; + zip.Encryption = EncryptionAlgorithm.WinZipAes128; + zip.AddFile(sourceFileName); + MemoryStream output = new MemoryStream(); + zip.Save(output); + + byte[] zipbytes = output.ToArray(); + } + + + + + + This example shows a pitfall you should avoid. DO NOT read + from a stream, then try to save to the same stream. DO + NOT DO THIS: + + + + using (var fs = new FileStream(filename, FileMode.Open)) + { + using (var zip = Ionic.Zip.ZipFile.Read(inputStream)) + { + zip.AddEntry("Name1.txt", "this is the content"); + zip.Save(inputStream); // NO NO NO!! + } + } + + + + Better like this: + + + + using (var zip = Ionic.Zip.ZipFile.Read(filename)) + { + zip.AddEntry("Name1.txt", "this is the content"); + zip.Save(); // YES! + } + + + + + + The System.IO.Stream to write to. It must be + writable. If you created the ZipFile instance by calling + ZipFile.Read(), this stream must not be the same stream + you passed to ZipFile.Read(). + + + + + Adds to the ZipFile a set of files from the current working directory on + disk, that conform to the specified criteria. + + + + + This method selects files from the the current working directory matching + the specified criteria, and adds them to the ZipFile. + + + + Specify the criteria in statements of 3 elements: a noun, an operator, and + a value. Consider the string "name != *.doc" . The noun is "name". The + operator is "!=", implying "Not Equal". The value is "*.doc". That + criterion, in English, says "all files with a name that does not end in + the .doc extension." + + + + Supported nouns include "name" (or "filename") for the filename; "atime", + "mtime", and "ctime" for last access time, last modfied time, and created + time of the file, respectively; "attributes" (or "attrs") for the file + attributes; "size" (or "length") for the file length (uncompressed), and + "type" for the type of object, either a file or a directory. The + "attributes", "name" and "type" nouns both support = and != as operators. + The "size", "atime", "mtime", and "ctime" nouns support = and !=, and + >, >=, <, <= as well. The times are taken to be expressed in + local time. + + + + Specify values for the file attributes as a string with one or more of the + characters H,R,S,A,I,L in any order, implying file attributes of Hidden, + ReadOnly, System, Archive, NotContextIndexed, and ReparsePoint (symbolic + link) respectively. + + + + To specify a time, use YYYY-MM-DD-HH:mm:ss or YYYY/MM/DD-HH:mm:ss as the + format. If you omit the HH:mm:ss portion, it is assumed to be 00:00:00 + (midnight). + + + + The value for a size criterion is expressed in integer quantities of bytes, + kilobytes (use k or kb after the number), megabytes (m or mb), or gigabytes + (g or gb). + + + + The value for a name is a pattern to match against the filename, potentially + including wildcards. The pattern follows CMD.exe glob rules: * implies one + or more of any character, while ? implies one character. If the name + pattern contains any slashes, it is matched to the entire filename, + including the path; otherwise, it is matched against only the filename + without the path. This means a pattern of "*\*.*" matches all files one + directory level deep, while a pattern of "*.*" matches all files in all + directories. + + + + To specify a name pattern that includes spaces, use single quotes around the + pattern. A pattern of "'* *.*'" will match all files that have spaces in + the filename. The full criteria string for that would be "name = '* *.*'" . + + + + The value for a type criterion is either F (implying a file) or D (implying + a directory). + + + + Some examples: + + + + + criteria + Files retrieved + + + + name != *.xls + any file with an extension that is not .xls + + + + + name = *.mp3 + any file with a .mp3 extension. + + + + + *.mp3 + (same as above) any file with a .mp3 extension. + + + + + attributes = A + all files whose attributes include the Archive bit. + + + + + attributes != H + all files whose attributes do not include the Hidden bit. + + + + + mtime > 2009-01-01 + all files with a last modified time after January 1st, 2009. + + + + + size > 2gb + all files whose uncompressed size is greater than 2gb. + + + + + type = D + all directories in the filesystem. + + + + + + You can combine criteria with the conjunctions AND or OR. Using a string + like "name = *.txt AND size >= 100k" for the selectionCriteria retrieves + entries whose names end in .txt, and whose uncompressed size is greater than + or equal to 100 kilobytes. + + + + For more complex combinations of criteria, you can use parenthesis to group + clauses in the boolean logic. Without parenthesis, the precedence of the + criterion atoms is determined by order of appearance. Unlike the C# + language, the AND conjunction does not take precendence over the logical OR. + This is important only in strings that contain 3 or more criterion atoms. + In other words, "name = *.txt and size > 1000 or attributes = H" implies + "((name = *.txt AND size > 1000) OR attributes = H)" while "attributes = + H OR name = *.txt and size > 1000" evaluates to "((attributes = H OR name + = *.txt) AND size > 1000)". When in doubt, use parenthesis. + + + + Using time properties requires some extra care. If you want to retrieve all + entries that were last updated on 2009 February 14, specify a time range + like so:"mtime >= 2009-02-14 AND mtime < 2009-02-15". Read this to + say: all files updated after 12:00am on February 14th, until 12:00am on + February 15th. You can use the same bracketing approach to specify any time + period - a year, a month, a week, and so on. + + + + The syntax allows one special case: if you provide a string with no spaces, it is + treated as a pattern to match for the filename. Therefore a string like "*.xls" + will be equivalent to specifying "name = *.xls". + + + + There is no logic in this method that insures that the file inclusion + criteria are internally consistent. For example, it's possible to specify + criteria that says the file must have a size of less than 100 bytes, as well + as a size that is greater than 1000 bytes. Obviously no file will ever + satisfy such criteria, but this method does not detect such logical + inconsistencies. The caller is responsible for insuring the criteria are + sensible. + + + + Using this method, the file selection does not recurse into + subdirectories, and the full path of the selected files is included in the + entries added into the zip archive. If you don't like these behaviors, + see the other overloads of this method. + + + + + This example zips up all *.csv files in the current working directory. + + using (ZipFile zip = new ZipFile()) + { + // To just match on filename wildcards, + // use the shorthand form of the selectionCriteria string. + zip.AddSelectedFiles("*.csv"); + zip.Save(PathToZipArchive); + } + + + Using zip As ZipFile = New ZipFile() + zip.AddSelectedFiles("*.csv") + zip.Save(PathToZipArchive) + End Using + + + + The criteria for file selection + + + + Adds to the ZipFile a set of files from the disk that conform to the + specified criteria, optionally recursing into subdirectories. + + + + + This method selects files from the the current working directory matching + the specified criteria, and adds them to the ZipFile. If + recurseDirectories is true, files are also selected from + subdirectories, and the directory structure in the filesystem is + reproduced in the zip archive, rooted at the current working directory. + + + + Using this method, the full path of the selected files is included in the + entries added into the zip archive. If you don't want this behavior, use + one of the overloads of this method that allows the specification of a + directoryInArchive. + + + + For details on the syntax for the selectionCriteria parameter, see . + + + + + + + This example zips up all *.xml files in the current working directory, or any + subdirectory, that are larger than 1mb. + + + using (ZipFile zip = new ZipFile()) + { + // Use a compound expression in the selectionCriteria string. + zip.AddSelectedFiles("name = *.xml and size > 1024kb", true); + zip.Save(PathToZipArchive); + } + + + Using zip As ZipFile = New ZipFile() + ' Use a compound expression in the selectionCriteria string. + zip.AddSelectedFiles("name = *.xml and size > 1024kb", true) + zip.Save(PathToZipArchive) + End Using + + + + The criteria for file selection + + + If true, the file selection will recurse into subdirectories. + + + + + Adds to the ZipFile a set of files from a specified directory in the + filesystem, that conform to the specified criteria. + + + + + This method selects files that conform to the specified criteria, from the + the specified directory on disk, and adds them to the ZipFile. The search + does not recurse into subdirectores. + + + + Using this method, the full filesystem path of the files on disk is + reproduced on the entries added to the zip file. If you don't want this + behavior, use one of the other overloads of this method. + + + + For details on the syntax for the selectionCriteria parameter, see . + + + + + + + This example zips up all *.xml files larger than 1mb in the directory + given by "d:\rawdata". + + + using (ZipFile zip = new ZipFile()) + { + // Use a compound expression in the selectionCriteria string. + zip.AddSelectedFiles("name = *.xml and size > 1024kb", "d:\\rawdata"); + zip.Save(PathToZipArchive); + } + + + + Using zip As ZipFile = New ZipFile() + ' Use a compound expression in the selectionCriteria string. + zip.AddSelectedFiles("name = *.xml and size > 1024kb", "d:\rawdata) + zip.Save(PathToZipArchive) + End Using + + + + The criteria for file selection + + + The name of the directory on the disk from which to select files. + + + + + Adds to the ZipFile a set of files from the specified directory on disk, + that conform to the specified criteria. + + + + + + This method selects files from the the specified disk directory matching + the specified selection criteria, and adds them to the ZipFile. If + recurseDirectories is true, files are also selected from + subdirectories. + + + + The full directory structure in the filesystem is reproduced on the + entries added to the zip archive. If you don't want this behavior, use + one of the overloads of this method that allows the specification of a + directoryInArchive. + + + + For details on the syntax for the selectionCriteria parameter, see . + + + + + + This example zips up all *.csv files in the "files" directory, or any + subdirectory, that have been saved since 2009 February 14th. + + + using (ZipFile zip = new ZipFile()) + { + // Use a compound expression in the selectionCriteria string. + zip.AddSelectedFiles("name = *.csv and mtime > 2009-02-14", "files", true); + zip.Save(PathToZipArchive); + } + + + Using zip As ZipFile = New ZipFile() + ' Use a compound expression in the selectionCriteria string. + zip.AddSelectedFiles("name = *.csv and mtime > 2009-02-14", "files", true) + zip.Save(PathToZipArchive) + End Using + + + + + This example zips up all files in the current working + directory, and all its child directories, except those in + the excludethis subdirectory. + + Using Zip As ZipFile = New ZipFile(zipfile) + Zip.AddSelectedFfiles("name != 'excludethis\*.*'", datapath, True) + Zip.Save() + End Using + + + + The criteria for file selection + + + The filesystem path from which to select files. + + + + If true, the file selection will recurse into subdirectories. + + + + + Adds to the ZipFile a selection of files from the specified directory on + disk, that conform to the specified criteria, and using a specified root + path for entries added to the zip archive. + + + + + This method selects files from the specified disk directory matching the + specified selection criteria, and adds those files to the ZipFile, using + the specified directory path in the archive. The search does not recurse + into subdirectories. For details on the syntax for the selectionCriteria + parameter, see . + + + + + + + This example zips up all *.psd files in the "photos" directory that have + been saved since 2009 February 14th, and puts them all in a zip file, + using the directory name of "content" in the zip archive itself. When the + zip archive is unzipped, the folder containing the .psd files will be + named "content". + + + using (ZipFile zip = new ZipFile()) + { + // Use a compound expression in the selectionCriteria string. + zip.AddSelectedFiles("name = *.psd and mtime > 2009-02-14", "photos", "content"); + zip.Save(PathToZipArchive); + } + + + Using zip As ZipFile = New ZipFile + zip.AddSelectedFiles("name = *.psd and mtime > 2009-02-14", "photos", "content") + zip.Save(PathToZipArchive) + End Using + + + + + The criteria for selection of files to add to the ZipFile. + + + + The path to the directory in the filesystem from which to select files. + + + + Specifies a directory path to use to in place of the + directoryOnDisk. This path may, or may not, correspond to a real + directory in the current filesystem. If the files within the zip are + later extracted, this is the path used for the extracted file. Passing + null (nothing in VB) will use the path on the file name, if any; in other + words it would use directoryOnDisk, plus any subdirectory. Passing + the empty string ("") will insert the item at the root path within the + archive. + + + + + Adds to the ZipFile a selection of files from the specified directory on + disk, that conform to the specified criteria, optionally recursing through + subdirectories, and using a specified root path for entries added to the + zip archive. + + + + This method selects files from the specified disk directory that match the + specified selection criteria, and adds those files to the ZipFile, using + the specified directory path in the archive. If recurseDirectories + is true, files are also selected from subdirectories, and the directory + structure in the filesystem is reproduced in the zip archive, rooted at + the directory specified by directoryOnDisk. For details on the + syntax for the selectionCriteria parameter, see . + + + + + This example zips up all files that are NOT *.pst files, in the current + working directory and any subdirectories. + + + using (ZipFile zip = new ZipFile()) + { + zip.AddSelectedFiles("name != *.pst", SourceDirectory, "backup", true); + zip.Save(PathToZipArchive); + } + + + Using zip As ZipFile = New ZipFile + zip.AddSelectedFiles("name != *.pst", SourceDirectory, "backup", true) + zip.Save(PathToZipArchive) + End Using + + + + + The criteria for selection of files to add to the ZipFile. + + + + The path to the directory in the filesystem from which to select files. + + + + Specifies a directory path to use to in place of the + directoryOnDisk. This path may, or may not, correspond to a real + directory in the current filesystem. If the files within the zip are + later extracted, this is the path used for the extracted file. Passing + null (nothing in VB) will use the path on the file name, if any; in other + words it would use directoryOnDisk, plus any subdirectory. Passing + the empty string ("") will insert the item at the root path within the + archive. + + + + If true, the method also scans subdirectories for files matching the + criteria. + + + + + Updates the ZipFile with a selection of files from the disk that conform + to the specified criteria. + + + + This method selects files from the specified disk directory that match the + specified selection criteria, and Updates the ZipFile with those + files, using the specified directory path in the archive. If + recurseDirectories is true, files are also selected from + subdirectories, and the directory structure in the filesystem is + reproduced in the zip archive, rooted at the directory specified by + directoryOnDisk. For details on the syntax for the + selectionCriteria parameter, see . + + + + The criteria for selection of files to add to the ZipFile. + + + + The path to the directory in the filesystem from which to select files. + + + + Specifies a directory path to use to in place of the + directoryOnDisk. This path may, or may not, correspond to a + real directory in the current filesystem. If the files within the zip + are later extracted, this is the path used for the extracted file. + Passing null (nothing in VB) will use the path on the file name, if + any; in other words it would use directoryOnDisk, plus any + subdirectory. Passing the empty string ("") will insert the item at + the root path within the archive. + + + + If true, the method also scans subdirectories for files matching the criteria. + + + + + + + Retrieve entries from the zipfile by specified criteria. + + + + + This method allows callers to retrieve the collection of entries from the zipfile + that fit the specified criteria. The criteria are described in a string format, and + can include patterns for the filename; constraints on the size of the entry; + constraints on the last modified, created, or last accessed time for the file + described by the entry; or the attributes of the entry. + + + + For details on the syntax for the selectionCriteria parameter, see . + + + + This method is intended for use with a ZipFile that has been read from storage. + When creating a new ZipFile, this method will work only after the ZipArchive has + been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip + archive from storage.) Calling SelectEntries on a ZipFile that has not yet been + saved will deliver undefined results. + + + + + Thrown if selectionCriteria has an invalid syntax. + + + + This example selects all the PhotoShop files from within an archive, and extracts them + to the current working directory. + + using (ZipFile zip1 = ZipFile.Read(ZipFileName)) + { + var PhotoShopFiles = zip1.SelectEntries("*.psd"); + foreach (ZipEntry psd in PhotoShopFiles) + { + psd.Extract(); + } + } + + + Using zip1 As ZipFile = ZipFile.Read(ZipFileName) + Dim PhotoShopFiles as ICollection(Of ZipEntry) + PhotoShopFiles = zip1.SelectEntries("*.psd") + Dim psd As ZipEntry + For Each psd In PhotoShopFiles + psd.Extract + Next + End Using + + + the string that specifies which entries to select + a collection of ZipEntry objects that conform to the inclusion spec + + + + Retrieve entries from the zipfile by specified criteria. + + + + + This method allows callers to retrieve the collection of entries from the zipfile + that fit the specified criteria. The criteria are described in a string format, and + can include patterns for the filename; constraints on the size of the entry; + constraints on the last modified, created, or last accessed time for the file + described by the entry; or the attributes of the entry. + + + + For details on the syntax for the selectionCriteria parameter, see . + + + + This method is intended for use with a ZipFile that has been read from storage. + When creating a new ZipFile, this method will work only after the ZipArchive has + been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip + archive from storage.) Calling SelectEntries on a ZipFile that has not yet been + saved will deliver undefined results. + + + + + Thrown if selectionCriteria has an invalid syntax. + + + + + using (ZipFile zip1 = ZipFile.Read(ZipFileName)) + { + var UpdatedPhotoShopFiles = zip1.SelectEntries("*.psd", "UpdatedFiles"); + foreach (ZipEntry e in UpdatedPhotoShopFiles) + { + // prompt for extract here + if (WantExtract(e.FileName)) + e.Extract(); + } + } + + + Using zip1 As ZipFile = ZipFile.Read(ZipFileName) + Dim UpdatedPhotoShopFiles As ICollection(Of ZipEntry) = zip1.SelectEntries("*.psd", "UpdatedFiles") + Dim e As ZipEntry + For Each e In UpdatedPhotoShopFiles + ' prompt for extract here + If Me.WantExtract(e.FileName) Then + e.Extract + End If + Next + End Using + + + the string that specifies which entries to select + + + the directory in the archive from which to select entries. If null, then + all directories in the archive are used. + + + a collection of ZipEntry objects that conform to the inclusion spec + + + + Remove entries from the zipfile by specified criteria. + + + + + This method allows callers to remove the collection of entries from the zipfile + that fit the specified criteria. The criteria are described in a string format, and + can include patterns for the filename; constraints on the size of the entry; + constraints on the last modified, created, or last accessed time for the file + described by the entry; or the attributes of the entry. + + + + For details on the syntax for the selectionCriteria parameter, see . + + + + This method is intended for use with a ZipFile that has been read from storage. + When creating a new ZipFile, this method will work only after the ZipArchive has + been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip + archive from storage.) Calling SelectEntries on a ZipFile that has not yet been + saved will deliver undefined results. + + + + + Thrown if selectionCriteria has an invalid syntax. + + + + This example removes all entries in a zip file that were modified prior to January 1st, 2008. + + using (ZipFile zip1 = ZipFile.Read(ZipFileName)) + { + // remove all entries from prior to Jan 1, 2008 + zip1.RemoveEntries("mtime < 2008-01-01"); + // don't forget to save the archive! + zip1.Save(); + } + + + Using zip As ZipFile = ZipFile.Read(ZipFileName) + ' remove all entries from prior to Jan 1, 2008 + zip1.RemoveEntries("mtime < 2008-01-01") + ' do not forget to save the archive! + zip1.Save + End Using + + + the string that specifies which entries to select + the number of entries removed + + + + Remove entries from the zipfile by specified criteria, and within the specified + path in the archive. + + + + + This method allows callers to remove the collection of entries from the zipfile + that fit the specified criteria. The criteria are described in a string format, and + can include patterns for the filename; constraints on the size of the entry; + constraints on the last modified, created, or last accessed time for the file + described by the entry; or the attributes of the entry. + + + + For details on the syntax for the selectionCriteria parameter, see . + + + + This method is intended for use with a ZipFile that has been read from storage. + When creating a new ZipFile, this method will work only after the ZipArchive has + been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip + archive from storage.) Calling SelectEntries on a ZipFile that has not yet been + saved will deliver undefined results. + + + + + Thrown if selectionCriteria has an invalid syntax. + + + + + using (ZipFile zip1 = ZipFile.Read(ZipFileName)) + { + // remove all entries from prior to Jan 1, 2008 + zip1.RemoveEntries("mtime < 2008-01-01", "documents"); + // a call to ZipFile.Save will make the modifications permanent + zip1.Save(); + } + + + Using zip As ZipFile = ZipFile.Read(ZipFileName) + ' remove all entries from prior to Jan 1, 2008 + zip1.RemoveEntries("mtime < 2008-01-01", "documents") + ' a call to ZipFile.Save will make the modifications permanent + zip1.Save + End Using + + + + the string that specifies which entries to select + + the directory in the archive from which to select entries. If null, then + all directories in the archive are used. + + the number of entries removed + + + + Selects and Extracts a set of Entries from the ZipFile. + + + + + The entries are extracted into the current working directory. + + + + If any of the files to be extracted already exist, then the action taken is as + specified in the property on the + corresponding ZipEntry instance. By default, the action taken in this case is to + throw an exception. + + + + For information on the syntax of the selectionCriteria string, + see . + + + + + This example shows how extract all XML files modified after 15 January 2009. + + using (ZipFile zip = ZipFile.Read(zipArchiveName)) + { + zip.ExtractSelectedEntries("name = *.xml and mtime > 2009-01-15"); + } + + + the selection criteria for entries to extract. + + + + + + Selects and Extracts a set of Entries from the ZipFile. + + + + + The entries are extracted into the current working directory. When extraction would would + overwrite an existing filesystem file, the action taken is as specified in the + parameter. + + + + For information on the syntax of the string describing the entry selection criteria, + see . + + + + + This example shows how extract all XML files modified after 15 January 2009, + overwriting any existing files. + + using (ZipFile zip = ZipFile.Read(zipArchiveName)) + { + zip.ExtractSelectedEntries("name = *.xml and mtime > 2009-01-15", + ExtractExistingFileAction.OverwriteSilently); + } + + + + the selection criteria for entries to extract. + + + The action to take if extraction would overwrite an existing file. + + + + + Selects and Extracts a set of Entries from the ZipFile. + + + + + The entries are selected from the specified directory within the archive, and then + extracted into the current working directory. + + + + If any of the files to be extracted already exist, then the action taken is as + specified in the property on the + corresponding ZipEntry instance. By default, the action taken in this case is to + throw an exception. + + + + For information on the syntax of the string describing the entry selection criteria, + see . + + + + + This example shows how extract all XML files modified after 15 January 2009, + and writes them to the "unpack" directory. + + using (ZipFile zip = ZipFile.Read(zipArchiveName)) + { + zip.ExtractSelectedEntries("name = *.xml and mtime > 2009-01-15","unpack"); + } + + + + the selection criteria for entries to extract. + + + the directory in the archive from which to select entries. If null, then + all directories in the archive are used. + + + + + + + Selects and Extracts a set of Entries from the ZipFile. + + + + + The entries are extracted into the specified directory. If any of the files to be + extracted already exist, an exception will be thrown. + + + For information on the syntax of the string describing the entry selection criteria, + see . + + + + the selection criteria for entries to extract. + + + the directory in the archive from which to select entries. If null, then + all directories in the archive are used. + + + + the directory on the disk into which to extract. It will be created + if it does not exist. + + + + + Selects and Extracts a set of Entries from the ZipFile. + + + + + The entries are extracted into the specified directory. When extraction would would + overwrite an existing filesystem file, the action taken is as specified in the + parameter. + + + + For information on the syntax of the string describing the entry selection criteria, + see . + + + + + This example shows how extract all files with an XML extension or with a size larger than 100,000 bytes, + and puts them in the unpack directory. For any files that already exist in + that destination directory, they will not be overwritten. + + using (ZipFile zip = ZipFile.Read(zipArchiveName)) + { + zip.ExtractSelectedEntries("name = *.xml or size > 100000", + null, + "unpack", + ExtractExistingFileAction.DontOverwrite); + } + + + + the selection criteria for entries to extract. + + + The directory on the disk into which to extract. It will be created if it does not exist. + + + + The directory in the archive from which to select entries. If null, then + all directories in the archive are used. + + + + The action to take if extraction would overwrite an existing file. + + + + + + + + Static constructor for ZipFile + + + Code Pages 437 and 1252 for English are same + Code Page 1252 Windows Latin 1 (ANSI) - + Code Page 437 MS-DOS Latin US - + + + + + The default text encoding used in zip archives. It is numeric 437, also + known as IBM437. + + + + + + Generic IEnumerator support, for use of a ZipFile in an enumeration. + + + + You probably do not want to call GetEnumerator explicitly. Instead + it is implicitly called when you use a loop in C#, or a + For Each loop in VB.NET. + + + + This example reads a zipfile of a given name, then enumerates the + entries in that zip file, and displays the information about each + entry on the Console. + + using (ZipFile zip = ZipFile.Read(zipfile)) + { + bool header = true; + foreach (ZipEntry e in zip) + { + if (header) + { + System.Console.WriteLine("Zipfile: {0}", zip.Name); + System.Console.WriteLine("Version Needed: 0x{0:X2}", e.VersionNeeded); + System.Console.WriteLine("BitField: 0x{0:X2}", e.BitField); + System.Console.WriteLine("Compression Method: 0x{0:X2}", e.CompressionMethod); + System.Console.WriteLine("\n{1,-22} {2,-6} {3,4} {4,-8} {0}", + "Filename", "Modified", "Size", "Ratio", "Packed"); + System.Console.WriteLine(new System.String('-', 72)); + header = false; + } + + System.Console.WriteLine("{1,-22} {2,-6} {3,4:F0}% {4,-8} {0}", + e.FileName, + e.LastModified.ToString("yyyy-MM-dd HH:mm:ss"), + e.UncompressedSize, + e.CompressionRatio, + e.CompressedSize); + + e.Extract(); + } + } + + + + Dim ZipFileToExtract As String = "c:\foo.zip" + Using zip As ZipFile = ZipFile.Read(ZipFileToExtract) + Dim header As Boolean = True + Dim e As ZipEntry + For Each e In zip + If header Then + Console.WriteLine("Zipfile: {0}", zip.Name) + Console.WriteLine("Version Needed: 0x{0:X2}", e.VersionNeeded) + Console.WriteLine("BitField: 0x{0:X2}", e.BitField) + Console.WriteLine("Compression Method: 0x{0:X2}", e.CompressionMethod) + Console.WriteLine(ChrW(10) & "{1,-22} {2,-6} {3,4} {4,-8} {0}", _ + "Filename", "Modified", "Size", "Ratio", "Packed" ) + Console.WriteLine(New String("-"c, 72)) + header = False + End If + Console.WriteLine("{1,-22} {2,-6} {3,4:F0}% {4,-8} {0}", _ + e.FileName, _ + e.LastModified.ToString("yyyy-MM-dd HH:mm:ss"), _ + e.UncompressedSize, _ + e.CompressionRatio, _ + e.CompressedSize ) + e.Extract + Next + End Using + + + + A generic enumerator suitable for use within a foreach loop. + + + + An IEnumerator, for use of a ZipFile in a foreach construct. + + + + This method is included for COM support. An application generally does not call + this method directly. It is called implicitly by COM clients when enumerating + the entries in the ZipFile instance. In VBScript, this is done with a For Each + statement. In Javascript, this is done with new Enumerator(zipfile). + + + + The IEnumerator over the entries in the ZipFile. + + + + + Options for using ZIP64 extensions when saving zip archives. + + + + + + Designed many years ago, the original zip + specification from PKWARE allowed for 32-bit quantities for the + compressed and uncompressed sizes of zip entries, as well as a 32-bit quantity + for specifying the length of the zip archive itself, and a maximum of 65535 + entries. These limits are now regularly exceeded in many backup and archival + scenarios. Recently, PKWare added extensions to the original zip spec, called + "ZIP64 extensions", to raise those limitations. This property governs whether + DotNetZip will use those extensions when writing zip archives. The use of + these extensions is optional and explicit in DotNetZip because, despite the + status of ZIP64 as a bona fide standard, many other zip tools and libraries do + not support ZIP64, and therefore a zip file with ZIP64 extensions may be + unreadable by some of those other tools. + + + + Set this property to to always use ZIP64 + extensions when saving, regardless of whether your zip archive needs it. + Suppose you add 5 files, each under 100k, to a ZipFile. If you specify Always + for this flag, you will get a ZIP64 archive, though the archive does not need + to use ZIP64 because none of the original zip limits had been exceeded. + + + + Set this property to to tell the DotNetZip + library to never use ZIP64 extensions. This is useful for maximum + compatibility and interoperability, at the expense of the capability of + handling large files or large archives. NB: Windows Explorer in Windows XP + and Windows Vista cannot currently extract files from a zip64 archive, so if + you want to guarantee that a zip archive produced by this library will work in + Windows Explorer, use Never. If you set this property to , and your application creates a zip that would + exceed one of the Zip limits, the library will throw an exception while saving + the zip file. + + + + Set this property to to tell the + DotNetZip library to use the ZIP64 extensions when required by the + entry. After the file is compressed, the original and compressed sizes are + checked, and if they exceed the limits described above, then zip64 can be + used. That is the general idea, but there is an additional wrinkle when saving + to a non-seekable device, like the ASP.NET Response.OutputStream, or + Console.Out. When using non-seekable streams for output, the entry + header - which indicates whether zip64 is in use - is emitted before it is + known if zip64 is necessary. It is only after all entries have been saved + that it can be known if ZIP64 will be required. On seekable output streams, + after saving all entries, the library can seek backward and re-emit the zip + file header to be consistent with the actual ZIP64 requirement. But using a + non-seekable output stream, the library cannot seek backward, so the header + can never be changed. In other words, the archive's use of ZIP64 extensions is + not alterable after the header is emitted. Therefore, when saving to + non-seekable streams, using is the same + as using : it will always produce a zip + archive that uses ZIP64 extensions. + + + + + + + The default behavior, which is "Never". + (For COM clients, this is a 0 (zero).) + + + + + Do not use ZIP64 extensions when writing zip archives. + (For COM clients, this is a 0 (zero).) + + + + + Use ZIP64 extensions when writing zip archives, as necessary. + For example, when a single entry exceeds 0xFFFFFFFF in size, or when the archive as a whole + exceeds 0xFFFFFFFF in size, or when there are more than 65535 entries in an archive. + (For COM clients, this is a 1.) + + + + + Always use ZIP64 extensions when writing zip archives, even when unnecessary. + (For COM clients, this is a 2.) + + + + + An enum representing the values on a three-way toggle switch + for various options in the library. This might be used to + specify whether to employ a particular text encoding, or to use + ZIP64 extensions, or some other option. + + + + + The default behavior. This is the same as "Never". + (For COM clients, this is a 0 (zero).) + + + + + Never use the associated option. + (For COM clients, this is a 0 (zero).) + + + + + Use the associated behavior "as necessary." + (For COM clients, this is a 1.) + + + + + Use the associated behavior Always, whether necessary or not. + (For COM clients, this is a 2.) + + + + + A class for collecting the various options that can be used when + Reading zip files for extraction or update. + + + + + When reading a zip file, there are several options an + application can set, to modify how the file is read, or what + the library does while reading. This class collects those + options into one container. + + + + Pass an instance of the ReadOptions class into the + ZipFile.Read() method. + + + . + . + + + + + An event handler for Read operations. When opening large zip + archives, you may want to display a progress bar or other + indicator of status progress while reading. This parameter + allows you to specify a ReadProgress Event Handler directly. + When you call Read(), the progress event is invoked as + necessary. + + + + + The System.IO.TextWriter to use for writing verbose status messages + during operations on the zip archive. A console application may wish to + pass System.Console.Out to get messages on the Console. A graphical + or headless application may wish to capture the messages in a different + TextWriter, such as a System.IO.StringWriter. + + + + + The System.Text.Encoding to use when reading in the zip archive. Be + careful specifying the encoding. If the value you use here is not the same + as the Encoding used when the zip archive was created (possibly by a + different archiver) you will get unexpected results and possibly exceptions. + + + + + + + + Provides a stream metaphor for reading zip files. + + + + + This class provides an alternative programming model for reading zip files to + the one enabled by the class. Use this when reading zip + files, as an alternative to the class, when you would + like to use a Stream class to read the file. + + + + Some application designs require a readable stream for input. This stream can + be used to read a zip file, and extract entries. + + + + Both the ZipInputStream class and the ZipFile class can be used + to read and extract zip files. Both of them support many of the common zip + features, including Unicode, different compression levels, and ZIP64. The + programming models differ. For example, when extracting entries via calls to + the GetNextEntry() and Read() methods on the + ZipInputStream class, the caller is responsible for creating the file, + writing the bytes into the file, setting the attributes on the file, and + setting the created, last modified, and last accessed timestamps on the + file. All of these things are done automatically by a call to ZipEntry.Extract(). For this reason, the + ZipInputStream is generally recommended for when your application wants + to extract the data, without storing that data into a file. + + + + Aside from the obvious differences in programming model, there are some + differences in capability between the ZipFile class and the + ZipInputStream class. + + + + + ZipFile can be used to create or update zip files, or read and + extract zip files. ZipInputStream can be used only to read and + extract zip files. If you want to use a stream to create zip files, check + out the . + + + + ZipInputStream cannot read segmented or spanned + zip files. + + + + ZipInputStream will not read Zip file comments. + + + + When reading larger files, ZipInputStream will always underperform + ZipFile. This is because the ZipInputStream does a full scan on the + zip file, while the ZipFile class reads the central directory of the + zip file. + + + + + + + + + Create a ZipInputStream, wrapping it around an existing stream. + + + + + + While the class is generally easier + to use, this class provides an alternative to those + applications that want to read from a zipfile directly, + using a . + + + + Both the ZipInputStream class and the ZipFile class can be used + to read and extract zip files. Both of them support many of the common zip + features, including Unicode, different compression levels, and ZIP64. The + programming models differ. For example, when extracting entries via calls to + the GetNextEntry() and Read() methods on the + ZipInputStream class, the caller is responsible for creating the file, + writing the bytes into the file, setting the attributes on the file, and + setting the created, last modified, and last accessed timestamps on the + file. All of these things are done automatically by a call to ZipEntry.Extract(). For this reason, the + ZipInputStream is generally recommended for when your application wants + to extract the data, without storing that data into a file. + + + + Aside from the obvious differences in programming model, there are some + differences in capability between the ZipFile class and the + ZipInputStream class. + + + + + ZipFile can be used to create or update zip files, or read and extract + zip files. ZipInputStream can be used only to read and extract zip + files. If you want to use a stream to create zip files, check out the . + + + + ZipInputStream cannot read segmented or spanned + zip files. + + + + ZipInputStream will not read Zip file comments. + + + + When reading larger files, ZipInputStream will always underperform + ZipFile. This is because the ZipInputStream does a full scan on the + zip file, while the ZipFile class reads the central directory of the + zip file. + + + + + + + + The stream to read. It must be readable. This stream will be closed at + the time the ZipInputStream is closed. + + + + + This example shows how to read a zip file, and extract entries, using the + ZipInputStream class. + + + private void Unzip() + { + byte[] buffer= new byte[2048]; + int n; + using (var raw = File.Open(inputFileName, FileMode.Open, FileAccess.Read)) + { + using (var input= new ZipInputStream(raw)) + { + ZipEntry e; + while (( e = input.GetNextEntry()) != null) + { + if (e.IsDirectory) continue; + string outputPath = Path.Combine(extractDir, e.FileName); + using (var output = File.Open(outputPath, FileMode.Create, FileAccess.ReadWrite)) + { + while ((n= input.Read(buffer, 0, buffer.Length)) > 0) + { + output.Write(buffer,0,n); + } + } + } + } + } + } + + + + Private Sub UnZip() + Dim inputFileName As String = "MyArchive.zip" + Dim extractDir As String = "extract" + Dim buffer As Byte() = New Byte(2048) {} + Using raw As FileStream = File.Open(inputFileName, FileMode.Open, FileAccess.Read) + Using input As ZipInputStream = New ZipInputStream(raw) + Dim e As ZipEntry + Do While (Not e = input.GetNextEntry Is Nothing) + If Not e.IsDirectory Then + Using output As FileStream = File.Open(Path.Combine(extractDir, e.FileName), _ + FileMode.Create, FileAccess.ReadWrite) + Dim n As Integer + Do While (n = input.Read(buffer, 0, buffer.Length) > 0) + output.Write(buffer, 0, n) + Loop + End Using + End If + Loop + End Using + End Using + End Sub + + + + + + Create a ZipInputStream, given the name of an existing zip file. + + + + + + This constructor opens a FileStream for the given zipfile, and + wraps a ZipInputStream around that. See the documentation for the + constructor for full details. + + + + While the class is generally easier + to use, this class provides an alternative to those + applications that want to read from a zipfile directly, + using a . + + + + + + The name of the filesystem file to read. + + + + + This example shows how to read a zip file, and extract entries, using the + ZipInputStream class. + + + private void Unzip() + { + byte[] buffer= new byte[2048]; + int n; + using (var input= new ZipInputStream(inputFileName)) + { + ZipEntry e; + while (( e = input.GetNextEntry()) != null) + { + if (e.IsDirectory) continue; + string outputPath = Path.Combine(extractDir, e.FileName); + using (var output = File.Open(outputPath, FileMode.Create, FileAccess.ReadWrite)) + { + while ((n= input.Read(buffer, 0, buffer.Length)) > 0) + { + output.Write(buffer,0,n); + } + } + } + } + } + + + + Private Sub UnZip() + Dim inputFileName As String = "MyArchive.zip" + Dim extractDir As String = "extract" + Dim buffer As Byte() = New Byte(2048) {} + Using input As ZipInputStream = New ZipInputStream(inputFileName) + Dim e As ZipEntry + Do While (Not e = input.GetNextEntry Is Nothing) + If Not e.IsDirectory Then + Using output As FileStream = File.Open(Path.Combine(extractDir, e.FileName), _ + FileMode.Create, FileAccess.ReadWrite) + Dim n As Integer + Do While (n = input.Read(buffer, 0, buffer.Length) > 0) + output.Write(buffer, 0, n) + Loop + End Using + End If + Loop + End Using + End Sub + + + + + + Create a ZipInputStream, explicitly specifying whether to + keep the underlying stream open. + + + + See the documentation for the ZipInputStream(Stream) + constructor for a discussion of the class, and an example of how to use the class. + + + + The stream to read from. It must be readable. + + + + true if the application would like the stream + to remain open after the ZipInputStream has been closed. + + + + Provides a string representation of the instance. + + + This can be useful for debugging purposes. + + + a string representation of the instance. + + + + The text encoding to use when reading entries into the zip archive, for + those entries whose filenames or comments cannot be encoded with the + default (IBM437) encoding. + + + + + In its + zip specification, PKWare describes two options for encoding + filenames and comments: using IBM437 or UTF-8. But, some archiving tools + or libraries do not follow the specification, and instead encode + characters using the system default code page. For example, WinRAR when + run on a machine in Shanghai may encode filenames with the Big-5 Chinese + (950) code page. This behavior is contrary to the Zip specification, but + it occurs anyway. + + + + When using DotNetZip to read zip archives that use something other than + UTF-8 or IBM437, set this property to specify the code page to use when + reading encoded filenames and comments for each ZipEntry in the zip + file. + + + + This property is "provisional". When the entry in the zip archive is not + explicitly marked as using UTF-8, then IBM437 is used to decode filenames + and comments. If a loss of data would result from using IBM436 - + specifically when encoding and decoding is not reflexive - the codepage + specified here is used. It is possible, therefore, to have a given entry + with a Comment encoded in IBM437 and a FileName encoded with + the specified "provisional" codepage. + + + + When a zip file uses an arbitrary, non-UTF8 code page for encoding, there + is no standard way for the reader application - whether DotNetZip, WinZip, + WinRar, or something else - to know which codepage has been used for the + entries. Readers of zip files are not able to inspect the zip file and + determine the codepage that was used for the entries contained within it. + It is left to the application or user to determine the necessary codepage + when reading zip files encoded this way. If you use an incorrect codepage + when reading a zipfile, you will get entries with filenames that are + incorrect, and the incorrect filenames may even contain characters that + are not legal for use within filenames in Windows. Extracting entries with + illegal characters in the filenames will lead to exceptions. It's too bad, + but this is just the way things are with code pages in zip files. Caveat + Emptor. + + + + + + + Size of the work buffer to use for the ZLIB codec during decompression. + + + + Setting this affects the performance and memory efficiency of compression + and decompression. For larger files, setting this to a larger size may + improve performance, but the exact numbers vary depending on available + memory, and a bunch of other variables. I don't have good firm + recommendations on how to set it. You'll have to test it yourself. Or + just leave it alone and accept the default. + + + + + Sets the password to be used on the ZipInputStream instance. + + + + + + When reading a zip archive, this password is used to read and decrypt the + entries that are encrypted within the zip file. When entries within a zip + file use different passwords, set the appropriate password for the entry + before the first call to Read() for each entry. + + + + When reading an entry that is not encrypted, the value of this property is + ignored. + + + + + + + This example uses the ZipInputStream to read and extract entries from a + zip file, using a potentially different password for each entry. + + + byte[] buffer= new byte[2048]; + int n; + using (var raw = File.Open(_inputFileName, FileMode.Open, FileAccess.Read )) + { + using (var input= new ZipInputStream(raw)) + { + ZipEntry e; + while (( e = input.GetNextEntry()) != null) + { + input.Password = PasswordForEntry(e.FileName); + if (e.IsDirectory) continue; + string outputPath = Path.Combine(_extractDir, e.FileName); + using (var output = File.Open(outputPath, FileMode.Create, FileAccess.ReadWrite)) + { + while ((n= input.Read(buffer,0,buffer.Length)) > 0) + { + output.Write(buffer,0,n); + } + } + } + } + } + + + + + + + Read the data from the stream into the buffer. + + + + + The data for the zipentry will be decrypted and uncompressed, as + necessary, before being copied into the buffer. + + + + You must set the property before calling + Read() the first time for an encrypted entry. To determine if an + entry is encrypted and requires a password, check the ZipEntry.Encryption property. + + + + The buffer to hold the data read from the stream. + the offset within the buffer to copy the first byte read. + the number of bytes to read. + the number of bytes read, after decryption and decompression. + + + + Read the next entry from the zip file. + + + + + Call this method just before calling , + to position the pointer in the zip file to the next entry that can be + read. Subsequent calls to Read(), will decrypt and decompress the + data in the zip file, until Read() returns 0. + + + + Each time you call GetNextEntry(), the pointer in the wrapped + stream is moved to the next entry in the zip file. If you call , and thus re-position the pointer within + the file, you will need to call GetNextEntry() again, to insure + that the file pointer is positioned at the beginning of a zip entry. + + + + This method returns the ZipEntry. Using a stream approach, you will + read the raw bytes for an entry in a zip file via calls to Read(). + Alternatively, you can extract an entry into a file, or a stream, by + calling , or one of its siblings. + + + + + + The ZipEntry read. Returns null (or Nothing in VB) if there are no more + entries in the zip file. + + + + + + Dispose the stream. + + + + + This method disposes the ZipInputStream. It may also close the + underlying stream, depending on which constructor was used. + + + + Typically the application will call Dispose() implicitly, via + a using statement in C#, or a Using statement in VB. + + + + Application code won't call this code directly. This method may + be invoked in two distinct scenarios. If disposing == true, the + method has been called directly or indirectly by a user's code, + for example via the public Dispose() method. In this case, both + managed and unmanaged resources can be referenced and disposed. + If disposing == false, the method has been called by the runtime + from inside the object finalizer and this method should not + reference other objects; in that case only unmanaged resources + must be referenced or disposed. + + + + + true if the Dispose method was invoked by user code. + + + + + Always returns true. + + + + + Returns the value of CanSeek for the underlying (wrapped) stream. + + + + + Always returns false. + + + + + Returns the length of the underlying stream. + + + + + Gets or sets the position of the underlying stream. + + + Setting the position is equivalent to calling Seek(value, SeekOrigin.Begin). + + + + + This is a no-op. + + + + + This method always throws a NotSupportedException. + + ignored + ignored + ignored + + + + This method seeks in the underlying stream. + + + + + Call this method if you want to seek around within the zip file for random access. + + + + Applications can intermix calls to Seek() with calls to . After a call to Seek(), + GetNextEntry() will get the next ZipEntry that falls after + the current position in the input stream. You're on your own for finding + out just where to seek in the stream, to get to the various entries. + + + + + the offset point to seek to + the reference point from which to seek + The new position + + + + This method always throws a NotSupportedException. + + ignored + + + + Provides a stream metaphor for generating zip files. + + + + + This class writes zip files, as defined in the specification + for zip files described by PKWare. The compression for this + implementation is provided by a managed-code version of Zlib, included with + DotNetZip in the classes in the Ionic.Zlib namespace. + + + + This class provides an alternative programming model to the one enabled by the + class. Use this when creating zip files, as an + alternative to the class, when you would like to use a + Stream type to write the zip file. + + + + Both the ZipOutputStream class and the ZipFile class can be used + to create zip files. Both of them support many of the common zip features, + including Unicode, different compression levels, and ZIP64. They provide + very similar performance when creating zip files. + + + + The ZipFile class is generally easier to use than + ZipOutputStream and should be considered a higher-level interface. For + example, when creating a zip file via calls to the PutNextEntry() and + Write() methods on the ZipOutputStream class, the caller is + responsible for opening the file, reading the bytes from the file, writing + those bytes into the ZipOutputStream, setting the attributes on the + ZipEntry, and setting the created, last modified, and last accessed + timestamps on the zip entry. All of these things are done automatically by a + call to ZipFile.AddFile(). + For this reason, the ZipOutputStream is generally recommended for use + only when your application emits arbitrary data, not necessarily data from a + filesystem file, directly into a zip file, and does so using a Stream + metaphor. + + + + Aside from the differences in programming model, there are other + differences in capability between the two classes. + + + + + ZipFile can be used to read and extract zip files, in addition to + creating zip files. ZipOutputStream cannot read zip files. If you want + to use a stream to read zip files, check out the class. + + + + ZipOutputStream does not support the creation of segmented or spanned + zip files. + + + + ZipOutputStream cannot produce a self-extracting archive. + + + + + Be aware that the ZipOutputStream class implements the interface. In order for + ZipOutputStream to produce a valid zip file, you use use it within + a using clause (Using in VB), or call the Dispose() method + explicitly. See the examples for how to employ a using clause. + + + + Also, a note regarding compression performance: On the desktop .NET + Framework, DotNetZip can use a multi-threaded compression implementation + that provides significant speed increases on large files, over 300k or so, + at the cost of increased memory use at runtime. (The output of the + compression is almost exactly the same size). But, the multi-threaded + approach incurs a performance hit on smaller files. There's no way for the + ZipOutputStream to know whether parallel compression will be beneficial, + because the ZipOutputStream does not know how much data you will write + through the stream. You may wish to set the property to zero, if you are compressing + large files through ZipOutputStream. This will cause parallel + compression to be used, always. + + + + + + Create a ZipOutputStream, wrapping an existing stream. + + + + + The class is generally easier to use when creating + zip files. The ZipOutputStream offers a different metaphor for creating a + zip file, based on the class. + + + + + + The stream to wrap. It must be writable. This stream will be closed at + the time the ZipOutputStream is closed. + + + + + This example shows how to create a zip file, using the + ZipOutputStream class. + + + private void Zipup() + { + if (filesToZip.Count == 0) + { + System.Console.WriteLine("Nothing to do."); + return; + } + + using (var raw = File.Open(_outputFileName, FileMode.Create, FileAccess.ReadWrite )) + { + using (var output= new ZipOutputStream(raw)) + { + output.Password = "VerySecret!"; + output.Encryption = EncryptionAlgorithm.WinZipAes256; + + foreach (string inputFileName in filesToZip) + { + System.Console.WriteLine("file: {0}", inputFileName); + + output.PutNextEntry(inputFileName); + using (var input = File.Open(inputFileName, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Write )) + { + byte[] buffer= new byte[2048]; + int n; + while ((n= input.Read(buffer,0,buffer.Length)) > 0) + { + output.Write(buffer,0,n); + } + } + } + } + } + } + + + + Private Sub Zipup() + Dim outputFileName As String = "XmlData.zip" + Dim filesToZip As String() = Directory.GetFiles(".", "*.xml") + If (filesToZip.Length = 0) Then + Console.WriteLine("Nothing to do.") + Else + Using raw As FileStream = File.Open(outputFileName, FileMode.Create, FileAccess.ReadWrite) + Using output As ZipOutputStream = New ZipOutputStream(raw) + output.Password = "VerySecret!" + output.Encryption = EncryptionAlgorithm.WinZipAes256 + Dim inputFileName As String + For Each inputFileName In filesToZip + Console.WriteLine("file: {0}", inputFileName) + output.PutNextEntry(inputFileName) + Using input As FileStream = File.Open(inputFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite) + Dim n As Integer + Dim buffer As Byte() = New Byte(2048) {} + Do While (n = input.Read(buffer, 0, buffer.Length) > 0) + output.Write(buffer, 0, n) + Loop + End Using + Next + End Using + End Using + End If + End Sub + + + + + + Create a ZipOutputStream that writes to a filesystem file. + + + + The class is generally easier to use when creating + zip files. The ZipOutputStream offers a different metaphor for creating a + zip file, based on the class. + + + + The name of the zip file to create. + + + + + This example shows how to create a zip file, using the + ZipOutputStream class. + + + private void Zipup() + { + if (filesToZip.Count == 0) + { + System.Console.WriteLine("Nothing to do."); + return; + } + + using (var output= new ZipOutputStream(outputFileName)) + { + output.Password = "VerySecret!"; + output.Encryption = EncryptionAlgorithm.WinZipAes256; + + foreach (string inputFileName in filesToZip) + { + System.Console.WriteLine("file: {0}", inputFileName); + + output.PutNextEntry(inputFileName); + using (var input = File.Open(inputFileName, FileMode.Open, FileAccess.Read, + FileShare.Read | FileShare.Write )) + { + byte[] buffer= new byte[2048]; + int n; + while ((n= input.Read(buffer,0,buffer.Length)) > 0) + { + output.Write(buffer,0,n); + } + } + } + } + } + + + + Private Sub Zipup() + Dim outputFileName As String = "XmlData.zip" + Dim filesToZip As String() = Directory.GetFiles(".", "*.xml") + If (filesToZip.Length = 0) Then + Console.WriteLine("Nothing to do.") + Else + Using output As ZipOutputStream = New ZipOutputStream(outputFileName) + output.Password = "VerySecret!" + output.Encryption = EncryptionAlgorithm.WinZipAes256 + Dim inputFileName As String + For Each inputFileName In filesToZip + Console.WriteLine("file: {0}", inputFileName) + output.PutNextEntry(inputFileName) + Using input As FileStream = File.Open(inputFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite) + Dim n As Integer + Dim buffer As Byte() = New Byte(2048) {} + Do While (n = input.Read(buffer, 0, buffer.Length) > 0) + output.Write(buffer, 0, n) + Loop + End Using + Next + End Using + End If + End Sub + + + + + + Create a ZipOutputStream. + + + + See the documentation for the ZipOutputStream(Stream) + constructor for an example. + + + + The stream to wrap. It must be writable. + + + + true if the application would like the stream + to remain open after the ZipOutputStream has been closed. + + + + Provides a string representation of the instance. + + + This can be useful for debugging purposes. + + + a string representation of the instance. + + + + Sets the password to be used on the ZipOutputStream instance. + + + + + + When writing a zip archive, this password is applied to the entries, not + to the zip archive itself. It applies to any ZipEntry subsequently + written to the ZipOutputStream. + + + + Using a password does not encrypt or protect the "directory" of the + archive - the list of entries contained in the archive. If you set the + Password property, the password actually applies to individual + entries that are added to the archive, subsequent to the setting of this + property. The list of filenames in the archive that is eventually created + will appear in clear text, but the contents of the individual files are + encrypted. This is how Zip encryption works. + + + + If you set this property, and then add a set of entries to the archive via + calls to PutNextEntry, then each entry is encrypted with that + password. You may also want to change the password between adding + different entries. If you set the password, add an entry, then set the + password to null (Nothing in VB), and add another entry, the + first entry is encrypted and the second is not. + + + + When setting the Password, you may also want to explicitly set the property, to specify how to encrypt the entries added + to the ZipFile. If you set the Password to a non-null value and do not + set , then PKZip 2.0 ("Weak") encryption is used. + This encryption is relatively weak but is very interoperable. If + you set the password to a null value (Nothing in VB), + Encryption is reset to None. + + + + Special case: if you wrap a ZipOutputStream around a non-seekable stream, + and use encryption, and emit an entry of zero bytes, the Close() or + PutNextEntry() following the entry will throw an exception. + + + + + + + The Encryption to use for entries added to the ZipOutputStream. + + + + + The specified Encryption is applied to the entries subsequently + written to the ZipOutputStream instance. + + + + If you set this to something other than + EncryptionAlgorithm.None, you will also need to set the + to a non-null, non-empty value in + order to actually get encryption on the entry. + + + + + ZipOutputStream.Password + ZipEntry.Encryption + + + + Size of the work buffer to use for the ZLIB codec during compression. + + + + Setting this may affect performance. For larger files, setting this to a + larger size may improve performance, but I'm not sure. Sorry, I don't + currently have good recommendations on how to set it. You can test it if + you like. + + + + + The compression strategy to use for all entries. + + + + Set the Strategy used by the ZLIB-compatible compressor, when compressing + data for the entries in the zip archive. Different compression strategies + work better on different sorts of data. The strategy parameter can affect + the compression ratio and the speed of compression but not the correctness + of the compresssion. For more information see . + + + + + The type of timestamp attached to the ZipEntry. + + + + Set this in order to specify the kind of timestamp that should be emitted + into the zip file for each entry. + + + + + Sets the compression level to be used for entries subsequently added to + the zip archive. + + + + + Varying the compression level used on entries can affect the + size-vs-speed tradeoff when compression and decompressing data streams + or files. + + + + As with some other properties on the ZipOutputStream class, like , and , + setting this property on a ZipOutputStream + instance will cause the specified CompressionLevel to be used on all + items that are subsequently added to the + ZipOutputStream instance. + + + + If you do not set this property, the default compression level is used, + which normally gives a good balance of compression efficiency and + compression speed. In some tests, using BestCompression can + double the time it takes to compress, while delivering just a small + increase in compression efficiency. This behavior will vary with the + type of data you compress. If you are in doubt, just leave this setting + alone, and accept the default. + + + + + + The compression method used on each entry added to the ZipOutputStream. + + + + + A comment attached to the zip archive. + + + + + + The application sets this property to specify a comment to be embedded + into the generated zip archive. + + + + According to PKWARE's + zip specification, the comment is not encrypted, even if there is a + password set on the zip file. + + + + The specification does not describe how to indicate the encoding used + on a comment string. Many "compliant" zip tools and libraries use + IBM437 as the code page for comments; DotNetZip, too, follows that + practice. On the other hand, there are situations where you want a + Comment to be encoded with something else, for example using code page + 950 "Big-5 Chinese". To fill that need, DotNetZip will encode the + comment following the same procedure it follows for encoding + filenames: (a) if is + Never, it uses the default encoding (IBM437). (b) if is Always, it always uses the + alternate encoding (). (c) if is AsNecessary, it uses the + alternate encoding only if the default encoding is not sufficient for + encoding the comment - in other words if decoding the result does not + produce the original string. This decision is taken at the time of + the call to ZipFile.Save(). + + + + + + + Specify whether to use ZIP64 extensions when saving a zip archive. + + + + + The default value for the property is . is + safest, in the sense that you will not get an Exception if a + pre-ZIP64 limit is exceeded. + + + + You must set this property before calling Write(). + + + + + + + Indicates whether ZIP64 extensions were used when saving the zip archive. + + + + The value is defined only after the ZipOutputStream has been closed. + + + + + Whether the ZipOutputStream should use case-insensitive comparisons when + checking for uniqueness of zip entries. + + + + + Though the zip specification doesn't prohibit zipfiles with duplicate + entries, Sane zip files have no duplicates, and the DotNetZip library + cannot create zip files with duplicate entries. If an application attempts + to call with a name that duplicates one + already used within the archive, the library will throw an Exception. + + + This property allows the application to specify whether the + ZipOutputStream instance considers ordinal case when checking for + uniqueness of zip entries. + + + + + + Indicates whether to encode entry filenames and entry comments using + Unicode (UTF-8). + + + + + The + PKWare zip specification provides for encoding file names and file + comments in either the IBM437 code page, or in UTF-8. This flag selects + the encoding according to that specification. By default, this flag is + false, and filenames and comments are encoded into the zip file in the + IBM437 codepage. Setting this flag to true will specify that filenames + and comments that cannot be encoded with IBM437 will be encoded with + UTF-8. + + + + Zip files created with strict adherence to the PKWare specification with + respect to UTF-8 encoding can contain entries with filenames containing + any combination of Unicode characters, including the full range of + characters from Chinese, Latin, Hebrew, Greek, Cyrillic, and many other + alphabets. However, because at this time, the UTF-8 portion of the PKWare + specification is not broadly supported by other zip libraries and + utilities, such zip files may not be readable by your favorite zip tool or + archiver. In other words, interoperability will decrease if you set this + flag to true. + + + + In particular, Zip files created with strict adherence to the PKWare + specification with respect to UTF-8 encoding will not work well with + Explorer in Windows XP or Windows Vista, because Windows compressed + folders, as far as I know, do not support UTF-8 in zip files. Vista can + read the zip files, but shows the filenames incorrectly. Unpacking from + Windows Vista Explorer will result in filenames that have rubbish + characters in place of the high-order UTF-8 bytes. + + + + Also, zip files that use UTF-8 encoding will not work well with Java + applications that use the java.util.zip classes, as of v5.0 of the Java + runtime. The Java runtime does not correctly implement the PKWare + specification in this regard. + + + + As a result, we have the unfortunate situation that "correct" behavior by + the DotNetZip library with regard to Unicode encoding of filenames during + zip creation will result in zip files that are readable by strictly + compliant and current tools (for example the most recent release of the + commercial WinZip tool); but these zip files will not be readable by + various other tools or libraries, including Windows Explorer. + + + + The DotNetZip library can read and write zip files with UTF8-encoded + entries, according to the PKware spec. If you use DotNetZip for both + creating and reading the zip file, and you use UTF-8, there will be no + loss of information in the filenames. For example, using a self-extractor + created by this library will allow you to unpack files correctly with no + loss of information in the filenames. + + + + If you do not set this flag, it will remain false. If this flag is false, + the ZipOutputStream will encode all filenames and comments using + the IBM437 codepage. This can cause "loss of information" on some + filenames, but the resulting zipfile will be more interoperable with other + utilities. As an example of the loss of information, diacritics can be + lost. The o-tilde character will be down-coded to plain o. The c with a + cedilla (Unicode 0xE7) used in Portugese will be downcoded to a c. + Likewise, the O-stroke character (Unicode 248), used in Danish and + Norwegian, will be down-coded to plain o. Chinese characters cannot be + represented in codepage IBM437; when using the default encoding, Chinese + characters in filenames will be represented as ?. These are all examples + of "information loss". + + + + The loss of information associated to the use of the IBM437 encoding is + inconvenient, and can also lead to runtime errors. For example, using + IBM437, any sequence of 4 Chinese characters will be encoded as ????. If + your application creates a ZipOutputStream, does not set the + encoding, then adds two files, each with names of four Chinese characters + each, this will result in a duplicate filename exception. In the case + where you add a single file with a name containing four Chinese + characters, the zipfile will save properly, but extracting that file + later, with any zip tool, will result in an error, because the question + mark is not legal for use within filenames on Windows. These are just a + few examples of the problems associated to loss of information. + + + + This flag is independent of the encoding of the content within the entries + in the zip file. Think of the zip file as a container - it supports an + encoding. Within the container are other "containers" - the file entries + themselves. The encoding within those entries is independent of the + encoding of the zip archive container for those entries. + + + + Rather than specify the encoding in a binary fashion using this flag, an + application can specify an arbitrary encoding via the property. Setting the encoding + explicitly when creating zip archives will result in non-compliant zip + files that, curiously, are fairly interoperable. The challenge is, the + PKWare specification does not provide for a way to specify that an entry + in a zip archive uses a code page that is neither IBM437 nor UTF-8. + Therefore if you set the encoding explicitly when creating a zip archive, + you must take care upon reading the zip archive to use the same code page. + If you get it wrong, the behavior is undefined and may result in incorrect + filenames, exceptions, stomach upset, hair loss, and acne. + + + + + + + The text encoding to use when emitting entries into the zip archive, for + those entries whose filenames or comments cannot be encoded with the + default (IBM437) encoding. + + + + + In its + zip specification, PKWare describes two options for encoding + filenames and comments: using IBM437 or UTF-8. But, some archiving tools + or libraries do not follow the specification, and instead encode + characters using the system default code page. For example, WinRAR when + run on a machine in Shanghai may encode filenames with the Big-5 Chinese + (950) code page. This behavior is contrary to the Zip specification, but + it occurs anyway. + + + + When using DotNetZip to write zip archives that will be read by one of + these other archivers, set this property to specify the code page to use + when encoding the and for each ZipEntry in the zip file, for + values that cannot be encoded with the default codepage for zip files, + IBM437. This is why this property is "provisional". In all cases, IBM437 + is used where possible, in other words, where no loss of data would + result. It is possible, therefore, to have a given entry with a + Comment encoded in IBM437 and a FileName encoded with the + specified "provisional" codepage. + + + + Be aware that a zip file created after you've explicitly set the + ProvisionalAlternateEncoding property to a value other than + IBM437 may not be compliant to the PKWare specification, and may not be + readable by compliant archivers. On the other hand, many (most?) + archivers are non-compliant and can read zip files created in arbitrary + code pages. The trick is to use or specify the proper codepage when + reading the zip. + + + + When creating a zip archive using this library, it is possible to change + the value of ProvisionalAlternateEncoding between each entry you + add, and between adding entries and the call to Close(). Don't do + this. It will likely result in a zipfile that is not readable. For best + interoperability, either leave ProvisionalAlternateEncoding + alone, or specify it only once, before adding any entries to the + ZipOutputStream instance. There is one exception to this + recommendation, described later. + + + + When using an arbitrary, non-UTF8 code page for encoding, there is no + standard way for the creator application - whether DotNetZip, WinZip, + WinRar, or something else - to formally specify in the zip file which + codepage has been used for the entries. As a result, readers of zip files + are not able to inspect the zip file and determine the codepage that was + used for the entries contained within it. It is left to the application + or user to determine the necessary codepage when reading zip files encoded + this way. If you use an incorrect codepage when reading a zipfile, you + will get entries with filenames that are incorrect, and the incorrect + filenames may even contain characters that are not legal for use within + filenames in Windows. Extracting entries with illegal characters in the + filenames will lead to exceptions. It's too bad, but this is just the way + things are with code pages in zip files. Caveat Emptor. + + + + One possible approach for specifying the code page for a given zip file is + to describe the code page in a human-readable form in the Zip comment. For + example, the comment may read "Entries in this archive are encoded in the + Big5 code page". For maximum interoperability, the zip comment in this + case should be encoded in the default, IBM437 code page. In this case, + the zip comment is encoded using a different page than the filenames. To + do this, Specify ProvisionalAlternateEncoding to your desired + region-specific code page, once before adding any entries, and then set + the property and reset + ProvisionalAlternateEncoding to IBM437 before calling Close(). + + + + + + A Text Encoding to use when encoding the filenames and comments for + all the ZipEntry items, during a ZipFile.Save() operation. + + + + Whether the encoding specified here is used during the save depends + on . + + + + + + A flag that tells if and when this instance should apply + AlternateEncoding to encode the filenames and comments associated to + of ZipEntry objects contained within this instance. + + + + + The default text encoding used in zip archives. It is numeric 437, also + known as IBM437. + + + + + + The size threshold for an entry, above which a parallel deflate is used. + + + + + + DotNetZip will use multiple threads to compress any ZipEntry, when + the CompressionMethod is Deflate, and if the entry is + larger than the given size. Zero means "always use parallel + deflate", while -1 means "never use parallel deflate". + + + + If the entry size cannot be known before compression, as with any entry + added via a ZipOutputStream, then Parallel deflate will never be + performed, unless the value of this property is zero. + + + + A parallel deflate operations will speed up the compression of + large files, on computers with multiple CPUs or multiple CPU + cores. For files above 1mb, on a dual core or dual-cpu (2p) + machine, the time required to compress the file can be 70% of the + single-threaded deflate. For very large files on 4p machines the + compression can be done in 30% of the normal time. The downside + is that parallel deflate consumes extra memory during the deflate, + and the deflation is slightly less effective. + + + + Parallel deflate tends to not be as effective as single-threaded deflate + because the original data stream is split into multiple independent + buffers, each of which is compressed in parallel. But because they are + treated independently, there is no opportunity to share compression + dictionaries, and additional framing bytes must be added to the output + stream. For that reason, a deflated stream may be slightly larger when + compressed using parallel deflate, as compared to a traditional + single-threaded deflate. For files of about 512k, the increase over the + normal deflate is as much as 5% of the total compressed size. For larger + files, the difference can be as small as 0.1%. + + + + Multi-threaded compression does not give as much an advantage when using + Encryption. This is primarily because encryption tends to slow down + the entire pipeline. Also, multi-threaded compression gives less of an + advantage when using lower compression levels, for example . You may have to perform + some tests to determine the best approach for your situation. + + + + The default value for this property is -1, which means parallel + compression will not be performed unless you set it to zero. + + + + + + + The maximum number of buffer pairs to use when performing + parallel compression. + + + + + This property sets an upper limit on the number of memory + buffer pairs to create when performing parallel + compression. The implementation of the parallel + compression stream allocates multiple buffers to + facilitate parallel compression. As each buffer fills up, + the stream uses + ThreadPool.QueueUserWorkItem() to compress those + buffers in a background threadpool thread. After a buffer + is compressed, it is re-ordered and written to the output + stream. + + + + A higher number of buffer pairs enables a higher degree of + parallelism, which tends to increase the speed of compression on + multi-cpu computers. On the other hand, a higher number of buffer + pairs also implies a larger memory consumption, more active worker + threads, and a higher cpu utilization for any compression. This + property enables the application to limit its memory consumption and + CPU utilization behavior depending on requirements. + + + + For each compression "task" that occurs in parallel, there are 2 + buffers allocated: one for input and one for output. This property + sets a limit for the number of pairs. The total amount of storage + space allocated for buffering will then be (N*S*2), where N is the + number of buffer pairs, S is the size of each buffer (). By default, DotNetZip allocates 4 buffer + pairs per CPU core, so if your machine has 4 cores, and you retain + the default buffer size of 128k, then the + ParallelDeflateOutputStream will use 4 * 4 * 2 * 128kb of buffer + memory in total, or 4mb, in blocks of 128kb. If you then set this + property to 8, then the number will be 8 * 2 * 128kb of buffer + memory, or 2mb. + + + + CPU utilization will also go up with additional buffers, because a + larger number of buffer pairs allows a larger number of background + threads to compress in parallel. If you find that parallel + compression is consuming too much memory or CPU, you can adjust this + value downward. + + + + The default value is 16. Different values may deliver better or + worse results, depending on your priorities and the dynamic + performance characteristics of your storage and compute resources. + + + + This property is not the number of buffer pairs to use; it is an + upper limit. An illustration: Suppose you have an application that + uses the default value of this property (which is 16), and it runs + on a machine with 2 CPU cores. In that case, DotNetZip will allocate + 4 buffer pairs per CPU core, for a total of 8 pairs. The upper + limit specified by this property has no effect. + + + + The application can set this value at any time, but it is + effective only if set before calling + ZipOutputStream.Write() for the first time. + + + + + + + + + Returns true if an entry by the given name has already been written + to the ZipOutputStream. + + + + The name of the entry to scan for. + + + + true if an entry by the given name has already been written. + + + + + Write the data from the buffer to the stream. + + + + As the application writes data into this stream, the data may be + compressed and encrypted before being written out to the underlying + stream, depending on the settings of the + and the properties. + + + The buffer holding data to write to the stream. + the offset within that data array to find the first byte to write. + the number of bytes to write. + + + + Specify the name of the next entry that will be written to the zip file. + + + + + Call this method just before calling , to + specify the name of the entry that the next set of bytes written to + the ZipOutputStream belongs to. All subsequent calls to Write, + until the next call to PutNextEntry, + will be inserted into the named entry in the zip file. + + + + If the used in PutNextEntry() ends in + a slash, then the entry added is marked as a directory. Because directory + entries do not contain data, a call to Write(), before an + intervening additional call to PutNextEntry(), will throw an + exception. + + + + If you don't call Write() between two calls to + PutNextEntry(), the first entry is inserted into the zip file as a + file of zero size. This may be what you want. + + + + Because PutNextEntry() closes out the prior entry, if any, this + method may throw if there is a problem with the prior entry. + + + + This method returns the ZipEntry. You can modify public properties + on the ZipEntry, such as , , and so on, until the first call to + ZipOutputStream.Write(), or until the next call to + PutNextEntry(). If you modify the ZipEntry after + having called Write(), you may get a runtime exception, or you may + silently get an invalid zip archive. + + + + + + + This example shows how to create a zip file, using the + ZipOutputStream class. + + + private void Zipup() + { + using (FileStream fs raw = File.Open(_outputFileName, FileMode.Create, FileAccess.ReadWrite )) + { + using (var output= new ZipOutputStream(fs)) + { + output.Password = "VerySecret!"; + output.Encryption = EncryptionAlgorithm.WinZipAes256; + output.PutNextEntry("entry1.txt"); + byte[] buffer= System.Text.Encoding.ASCII.GetBytes("This is the content for entry #1."); + output.Write(buffer,0,buffer.Length); + output.PutNextEntry("entry2.txt"); // this will be zero length + output.PutNextEntry("entry3.txt"); + buffer= System.Text.Encoding.ASCII.GetBytes("This is the content for entry #3."); + output.Write(buffer,0,buffer.Length); + } + } + } + + + + + The name of the entry to be added, including any path to be used + within the zip file. + + + + The ZipEntry created. + + + + + + Dispose the stream + + + + + This method writes the Zip Central directory, then closes the stream. The + application must call Dispose() (or Close) in order to produce a valid zip file. + + + + Typically the application will call Dispose() implicitly, via a using + statement in C#, or a Using statement in VB. + + + + + set this to true, always. + + + + Always returns false. + + + + + Always returns false. + + + + + Always returns true. + + + + + Always returns a NotSupportedException. + + + + + Setting this property always returns a NotSupportedException. Getting it + returns the value of the Position on the underlying stream. + + + + + This is a no-op. + + + + + This method always throws a NotSupportedException. + + ignored + ignored + ignored + nothing + + + + This method always throws a NotSupportedException. + + ignored + ignored + nothing + + + + This method always throws a NotSupportedException. + + ignored + + + + Sort-of like a factory method, ForUpdate is used only when + the application needs to update the zip entry metadata for + a segmented zip file, when the starting segment is earlier + than the ending segment, for a particular entry. + + + + The update is always contiguous, never rolls over. As a + result, this method doesn't need to return a ZSS; it can + simply return a FileStream. That's why it's "sort of" + like a Factory method. + + + Caller must Close/Dispose the stream object returned by + this method. + + + + + + Name of the filesystem file corresponding to the current segment. + + + + The name is not always the name currently being used in the + filesystem. When rwMode is RwMode.Write, the filesystem file has a + temporary name until the stream is closed or until the next segment is + started. + + + + + + Read from the stream + + the buffer to read + the offset at which to start + the number of bytes to read + the number of bytes actually read + + + + Write to the stream. + + the buffer from which to write + the offset at which to start writing + the number of bytes to write + + + + Enumerates the options for a logical conjunction. This enum is intended for use + internally by the FileSelector class. + + + + + FileSelector encapsulates logic that selects files from a source - a zip file + or the filesystem - based on a set of criteria. This class is used internally + by the DotNetZip library, in particular for the AddSelectedFiles() methods. + This class can also be used independently of the zip capability in DotNetZip. + + + + + + The FileSelector class is used internally by the ZipFile class for selecting + files for inclusion into the ZipFile, when the method, or one of + its overloads, is called. It's also used for the methods. Typically, an + application that creates or manipulates Zip archives will not directly + interact with the FileSelector class. + + + + Some applications may wish to use the FileSelector class directly, to + select files from disk volumes based on a set of criteria, without creating or + querying Zip archives. The file selection criteria include: a pattern to + match the filename; the last modified, created, or last accessed time of the + file; the size of the file; and the attributes of the file. + + + + Consult the documentation for + for more information on specifying the selection criteria. + + + + + + + Constructor that allows the caller to specify file selection criteria. + + + + + This constructor allows the caller to specify a set of criteria for + selection of files. + + + + See for a description of + the syntax of the selectionCriteria string. + + + + By default the FileSelector will traverse NTFS Reparse Points. To + change this, use FileSelector(String, bool). + + + + The criteria for file selection. + + + + Constructor that allows the caller to specify file selection criteria. + + + + + This constructor allows the caller to specify a set of criteria for + selection of files. + + + + See for a description of + the syntax of the selectionCriteria string. + + + + The criteria for file selection. + + whether to traverse NTFS reparse points (junctions). + + + + + The string specifying which files to include when retrieving. + + + + + Specify the criteria in statements of 3 elements: a noun, an operator, + and a value. Consider the string "name != *.doc" . The noun is + "name". The operator is "!=", implying "Not Equal". The value is + "*.doc". That criterion, in English, says "all files with a name that + does not end in the .doc extension." + + + + Supported nouns include "name" (or "filename") for the filename; + "atime", "mtime", and "ctime" for last access time, last modfied time, + and created time of the file, respectively; "attributes" (or "attrs") + for the file attributes; "size" (or "length") for the file length + (uncompressed); and "type" for the type of object, either a file or a + directory. The "attributes", "type", and "name" nouns all support = + and != as operators. The "size", "atime", "mtime", and "ctime" nouns + support = and !=, and >, >=, <, <= as well. The times are + taken to be expressed in local time. + + + + Specify values for the file attributes as a string with one or more of + the characters H,R,S,A,I,L in any order, implying file attributes of + Hidden, ReadOnly, System, Archive, NotContextIndexed, and ReparsePoint + (symbolic link) respectively. + + + + To specify a time, use YYYY-MM-DD-HH:mm:ss or YYYY/MM/DD-HH:mm:ss as + the format. If you omit the HH:mm:ss portion, it is assumed to be + 00:00:00 (midnight). + + + + The value for a size criterion is expressed in integer quantities of + bytes, kilobytes (use k or kb after the number), megabytes (m or mb), + or gigabytes (g or gb). + + + + The value for a name is a pattern to match against the filename, + potentially including wildcards. The pattern follows CMD.exe glob + rules: * implies one or more of any character, while ? implies one + character. If the name pattern contains any slashes, it is matched to + the entire filename, including the path; otherwise, it is matched + against only the filename without the path. This means a pattern of + "*\*.*" matches all files one directory level deep, while a pattern of + "*.*" matches all files in all directories. + + + + To specify a name pattern that includes spaces, use single quotes + around the pattern. A pattern of "'* *.*'" will match all files that + have spaces in the filename. The full criteria string for that would + be "name = '* *.*'" . + + + + The value for a type criterion is either F (implying a file) or D + (implying a directory). + + + + Some examples: + + + + + criteria + Files retrieved + + + + name != *.xls + any file with an extension that is not .xls + + + + + name = *.mp3 + any file with a .mp3 extension. + + + + + *.mp3 + (same as above) any file with a .mp3 extension. + + + + + attributes = A + all files whose attributes include the Archive bit. + + + + + attributes != H + all files whose attributes do not include the Hidden bit. + + + + + mtime > 2009-01-01 + all files with a last modified time after January 1st, 2009. + + + + + ctime > 2009/01/01-03:00:00 + all files with a created time after 3am (local time), + on January 1st, 2009. + + + + + size > 2gb + all files whose uncompressed size is greater than 2gb. + + + + + type = D + all directories in the filesystem. + + + + + + You can combine criteria with the conjunctions AND, OR, and XOR. Using + a string like "name = *.txt AND size >= 100k" for the + selectionCriteria retrieves entries whose names end in .txt, and whose + uncompressed size is greater than or equal to 100 kilobytes. + + + + For more complex combinations of criteria, you can use parenthesis to + group clauses in the boolean logic. Absent parenthesis, the + precedence of the criterion atoms is determined by order of + appearance. Unlike the C# language, the AND conjunction does not take + precendence over the logical OR. This is important only in strings + that contain 3 or more criterion atoms. In other words, "name = *.txt + and size > 1000 or attributes = H" implies "((name = *.txt AND size + > 1000) OR attributes = H)" while "attributes = H OR name = *.txt + and size > 1000" evaluates to "((attributes = H OR name = *.txt) + AND size > 1000)". When in doubt, use parenthesis. + + + + Using time properties requires some extra care. If you want to + retrieve all entries that were last updated on 2009 February 14, + specify "mtime >= 2009-02-14 AND mtime < 2009-02-15". Read this + to say: all files updated after 12:00am on February 14th, until + 12:00am on February 15th. You can use the same bracketing approach to + specify any time period - a year, a month, a week, and so on. + + + + The syntax allows one special case: if you provide a string with no + spaces, it is treated as a pattern to match for the filename. + Therefore a string like "*.xls" will be equivalent to specifying "name + = *.xls". This "shorthand" notation does not work with compound + criteria. + + + + There is no logic in this class that insures that the inclusion + criteria are internally consistent. For example, it's possible to + specify criteria that says the file must have a size of less than 100 + bytes, as well as a size that is greater than 1000 bytes. Obviously + no file will ever satisfy such criteria, but this class does not check + for or detect such inconsistencies. + + + + + + Thrown in the setter if the value has an invalid syntax. + + + + + Indicates whether searches will traverse NTFS reparse points, like Junctions. + + + + + Returns a string representation of the FileSelector object. + + The string representation of the boolean logic statement of the file + selection criteria for this instance. + + + + Returns the names of the files in the specified directory + that fit the selection criteria specified in the FileSelector. + + + + This is equivalent to calling + with recurseDirectories = false. + + + + The name of the directory over which to apply the FileSelector + criteria. + + + + A collection of strings containing fully-qualified pathnames of files + that match the criteria specified in the FileSelector instance. + + + + + Returns the names of the files in the specified directory that fit the + selection criteria specified in the FileSelector, optionally recursing + through subdirectories. + + + + This method applies the file selection criteria contained in the + FileSelector to the files contained in the given directory, and + returns the names of files that conform to the criteria. + + + + The name of the directory over which to apply the FileSelector + criteria. + + + + Whether to recurse through subdirectories when applying the file + selection criteria. + + + + A collection of strings containing fully-qualified pathnames of files + that match the criteria specified in the FileSelector instance. + + + + + Retrieve the ZipEntry items in the ZipFile that conform to the specified criteria. + + + + + This method applies the criteria set in the FileSelector instance (as described in + the ) to the specified ZipFile. Using this + method, for example, you can retrieve all entries from the given ZipFile that + have filenames ending in .txt. + + + + Normally, applications would not call this method directly. This method is used + by the ZipFile class. + + + + Using the appropriate SelectionCriteria, you can retrieve entries based on size, + time, and attributes. See for a + description of the syntax of the SelectionCriteria string. + + + + + The ZipFile from which to retrieve entries. + + a collection of ZipEntry objects that conform to the criteria. + + + + Retrieve the ZipEntry items in the ZipFile that conform to the specified criteria. + + + + + This method applies the criteria set in the FileSelector instance (as described in + the ) to the specified ZipFile. Using this + method, for example, you can retrieve all entries from the given ZipFile that + have filenames ending in .txt. + + + + Normally, applications would not call this method directly. This method is used + by the ZipFile class. + + + + This overload allows the selection of ZipEntry instances from the ZipFile to be restricted + to entries contained within a particular directory in the ZipFile. + + + + Using the appropriate SelectionCriteria, you can retrieve entries based on size, + time, and attributes. See for a + description of the syntax of the SelectionCriteria string. + + + + + The ZipFile from which to retrieve entries. + + + the directory in the archive from which to select entries. If null, then + all directories in the archive are used. + + + a collection of ZipEntry objects that conform to the criteria. + + + + Summary description for EnumUtil. + + + + + Returns the value of the DescriptionAttribute if the specified Enum + value has one. If not, returns the ToString() representation of the + Enum value. + + The Enum to get the description for + + + + + Converts the string representation of the name or numeric value of one + or more enumerated constants to an equivalent enumerated object. + Note: use the DescriptionAttribute on enum values to enable this. + + The System.Type of the enumeration. + + A string containing the name or value to convert. + + + + + + Converts the string representation of the name or numeric value of one + or more enumerated constants to an equivalent enumerated object. A + parameter specified whether the operation is case-sensitive. Note: + use the DescriptionAttribute on enum values to enable this. + + The System.Type of the enumeration. + + A string containing the name or value to convert. + + + Whether the operation is case-sensitive or not. + + +
+
diff --git a/packages/FiddlerCore.Trial.5.0.0/EULA.txt b/packages/FiddlerCore.Trial.5.0.0/EULA.txt new file mode 100644 index 0000000..adc011a --- /dev/null +++ b/packages/FiddlerCore.Trial.5.0.0/EULA.txt @@ -0,0 +1,176 @@ +End User License Agreement + +READ THIS END USER LICENSE AGREEMENT ("EULA") BEFORE INSTALLING OR USING THE PRODUCT TO WHICH THIS EULA APPLIES. BY ACCEPTING THIS EULA, COMPLETING THE REGISTRATION PROCESS, AND/OR INSTALLING OR USING THE PRODUCT, YOU AGREE ON BEHALF OF YOURSELF AND YOUR COMPANY (IF APPLICABLE) TO THE TERMS BELOW. IF YOU DO NOT AGREE WITH THESE TERMS, OR DO NOT HAVE THE AUTHORITY TO BIND YOUR COMPANY, DO NOT INSTALL, REGISTER FOR OR USE THE PRODUCT, AND DESTROY OR RETURN ALL COPIES OF THE PRODUCT. ONCE YOU HAVE DONE THIS, YOU MAY REQUEST FROM THE POINT OF PURCHASE A FULL REFUND OF THE LICENSE FEES, IF ANY, PAID FOR THE PRODUCT (OR, IF THE PRODUCT IS PROVIDED TO YOU AS A HOSTED SERVICE, A REFUND OF THE PREPAID SERVICE FEES FOR THE REMAINDER OF THE SUBSCRIPTION PERIOD OF THE PRODUCT). SUCH REQUEST MUST BE COMPLETED WITHIN THIRTY (30) DAYS OF DELIVERY OF THE PRODUCT TO YOU. UNLESS OTHERWISE SPECIFIED IN THIS EULA, PROGRESS SOFTWARE CORPORATION IS THE LICENSOR OF THE PRODUCT. THE LICENSOR MAY BE REFERRED TO HEREIN AS "Licensor", "we", "us", or "our". IF YOU ARE AGREEING TO THIS EULA ON BEHALF OF YOURSELF IN YOUR INDIVIDUAL CAPACITY, THEN YOU ARE THE LICENSEE AND YOU MAY BE REFERRED TO HEREIN AS "Licensee", "you", or "your". IF YOU ARE AGREEING TO THIS EULA ON BEHALF OF YOUR COMPANY, THEN YOUR COMPANY IS THE LICENSEE AND ANY REFERENCES TO "Licensee", "you", or "your" WILL MEAN YOUR COMPANY. + +This EULA includes the following sections: + +1. GENERAL TERMS AND CONDITIONS - these terms apply to all Products; + +2.A. TERMS FOR ON-PREMISE PRODUCTS - these terms apply to Products that you or Permitted Third Parties install on computers; + +2.B. TERMS FOR HOSTED SERVICES - these terms apply to Products that we host; + +3. PRODUCT FAMILY SPECIFIC TERMS - these terms apply to all Products that are part of the family of Products referenced in this section; and + +4. PRODUCT SPECIFIC TERMS - these terms apply to specific Products referenced in this section. + + + +1. GENERAL TERMS AND CONDITIONS +1.1. Definitions. +1.1.1. "Affiliate" means any legal entity that directly or indirectly controls, is controlled by, or is under common control with you or us. For the purposes of this definition, "control" means ownership, directly or indirectly, of more than fifty percent (50%) of the voting shares or other equity interest in an entity. +1.1.2. "Applicable Laws" means national, federal, state, and local laws, rules, and regulations including, without limitation, those laws and regulations relating to data privacy and security in each applicable jurisdiction. +1.1.3. "Authorized Reseller" means a third party who is not our Affiliate and who is authorized by us or our Affiliate to resell the Product. +1.1.4. "Authorized User" means you, your employee or a third-party consultant or agent that you authorize to use the Product for your benefit in accordance with section 1.2.3 (Third Party Use). +1.1.5. "Documentation" means any technical instructions or materials describing the operation of the Product made available to you (electronically or otherwise) by us for use with the Product, expressly excluding any user blogs, reviews or forums. +1.1.6. "Hosted Services" means computer software program(s), content and related services provided by us on a software-as-a-service basis through computers we or our Affiliates or our respective contractors (including cloud infrastructure suppliers) control. +1.1.7. "Intellectual Property Rights" means any and all current and future (a) rights associated with works of authorship, including copyrights, mask work rights, and moral rights; (b) trademark or service mark rights; (c) trade secret rights; (d) patents, patent rights, and industrial property rights; (e) layout design rights, design rights, and other proprietary rights of every kind and nature other than trademarks, service marks, trade dress, and similar rights; and (f) registrations, applications, renewals, extensions, or reissues of any of (a) to (e) , in each case, in any jurisdiction throughout the world. +1.1.8. "On-Premise Product(s)" means computer software program(s) provided to you to download, install and use on computer(s) controlled directly or indirectly by you. +1.1.9. "Order" means a written or electronic order document entered into between you and us (or our Affiliate or an Authorized Reseller) for the Product. Unless an Order says something different, each Order will be governed by the terms of this EULA and include the name of the Product being licensed and any usage limitations, applicable fees, and any other details related to the transaction. +1.1.10. "Our Technology" means any software, code, tools, libraries, scripts, application programming interfaces, templates, algorithms, data science recipes (including any source code for data science recipes and any modifications to such source code), data science workflows, user interfaces, links, proprietary methods and systems, know-how, trade secrets, techniques, designs, inventions, and other tangible or intangible technical material, information and works of authorship underlying or otherwise used to make available the Product, including, without limitation, all Intellectual Property Rights therein and thereto. +1.1.11. "Permitted Third Party" has the meaning given in section 1.2.3 (Third Party Use). +1.1.12. "Product" means the On-Premise Product(s) or Hosted Services, as applicable, identified in an Order, and any Updates. +1.1.13. "Update" means any update, enhancement, error correction, modification or new release to the Product that we make available to you. +1.2. General License Terms, Restrictions and Order of Precedence. +1.2.1. General License Terms. The Product is licensed, not sold, to you by us under the terms of this EULA and the Order. The scope of license granted by us to you for the Product is set out in section 3 (Product Family Specific Terms) and section 4 (Product Specific Terms). +1.2.2. Authorized Users. Anything your Authorized Users do or fail to do will be considered your act or omission, and you accept full responsibility for any such act or omission to the extent you would be liable if it were your act or omission. +1.2.3. Third Party Use. You may allow your agents, contractors and outsourcing service providers (each a "Permitted Third Party") to use the Product(s) licensed to you hereunder solely for your benefit in accordance with the terms of this EULA and you are responsible for any such Permitted Third Party's compliance with this EULA in such use. Any breach by any Permitted Third Party of the terms of this EULA will be considered your breach. +1.2.4. Restrictions. Except as otherwise expressly permitted in this EULA, you will not (and will not allow any of your Affiliates or any third party to): +(a) copy, modify, adapt, translate, or otherwise create derivative works of the Product, Documentation, or any software, services, or other technology of third party vendor(s) or hosting provider(s) that we or our Affiliate engage; +(b) disassemble, decompile or "unlock", decode or otherwise reverse translate or engineer, or attempt in any manner to reconstruct or discover the source code or underlying structure, ideas, or algorithms of the Product except as expressly permitted by law in effect in the jurisdiction in which you are located; +(c) rent, lease, sell, distribute, pledge, assign, sublicense or otherwise transfer or encumber rights to the Product; +(d) make the Product available on a timesharing or service bureau basis or otherwise allow any third party to use or access the Product; +(e) remove or modify any proprietary notices, legends, or labels on the Product or Documentation; +(f) use or access the Product in a manner that: (i) violates any Applicable Laws; (ii) violates the rights of any third party; (iii) purports to subject us or our Affiliates to any other obligations; (iv) could be fraudulent; or (v) is not permitted under this EULA; +(g) use the Product to develop, test, support or market products that are competitive with and/or provide similar functionality to the Product; or +(h) permit your Affiliates to access or use the Product unless specifically authorized elsewhere in this EULA or the Order. +1.2.5. Limitations on Evaluation or Trial Licenses. If the Product is licensed to you on an evaluation or trial basis, then you may use the Product only for such purposes until the earlier of: (a) the end of the evaluation period, if any, specified in the Order, this EULA or otherwise communicated by us to you at the time of delivery; or (b) the start date of a paid for license to the Product; or (c) termination in accordance with the terms of this EULA. You may not extend the evaluation period by uninstalling and re-installing the Product(s) or by any other means other than our written consent. You must not use the Product in a production environment. You will be required to pay for a license for the Product at our then applicable license price if you continue to use the Product, whether in a production or non-production environment, after the evaluation license expires or terminates, and the terms and conditions of the EULA in effect at that time will apply to your continued use of the Product. A Product licensed to you on an evaluation or trial basis may be subject to one or more usage limits specified in section 3 (Product Family Specific Terms), section 4 (Product Specific Terms), the Order or otherwise communicated at the time of delivery (including posting of such limits at the location where you download the Product for evaluation). We may, at our sole discretion, decide whether to offer any maintenance and support for the Product during the evaluation period, and to include any conditions or limits on such maintenance and support. You may not circumvent any technical limitations included in the Product licensed to you on an evaluation or trial basis. +1.2.6. Redistribution. If the Order or section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms) grants you the express right to redistribute or offer access to all or a portion of the Product ("Redistributables"), then, in conjunction with any such grant, you must comply with any limitations or requirements specified in the Order, section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms), as applicable, and you must distribute or offer access to the Redistributables subject to a license agreement or terms of use between you and each third party receiving or accessing the Redistributables ("your customer") that: (a) protects our interests consistent with the terms contained in this EULA, (b) prohibits your customer from any further distribution of the Redistributables (unless expressly permitted pursuant to section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms)), (c) includes a limitation of damages clause that, to the maximum extent permitted by applicable law, disclaims on behalf of us, our Affiliates or our or their respective licensors, suppliers or Authorized Resellers, liability for any and all damages, whether direct, special, incidental or consequential damages, (e) contains terms substantially similar to those in subparts (a) through (g) of section 1.2.4 (Restrictions), section 1.5.1 (Export Compliance) and section 1.5.2 (U.S. Government Customers), and (f) includes a notice substantially similar to section 1.2.7 (Third Party Notices). +1.2.7. Third Party Notices. The Product may contain or be accompanied by certain third-party components which are subject to additional restrictions. These components, are identified in, and subject to, special license terms and conditions which, in the case of On-Premise Product(s), are set out in the "readme.txt" file, the "notices.txt" file, or the "Third Party Software" file accompanying the Product or portions thereof, and in the case of Hosted Services, are set out in the third-party license agreement or notices that comes with the third-party component or is otherwise provided on the web page on which such third-party component is made available ("Special Notices"). The Special Notices include important licensing and warranty information and disclaimers. Unless otherwise expressly stated for a given third-party component, all such third-party components may be used solely in connection with the use of the Product subject to and in accordance with the terms and conditions of this EULA and the Special Notices. In the event of conflict between the Special Notices and the other portions of this EULA, the Special Notices will take precedence (but solely with respect to the third-party component(s) to which the Special Notice relates). +1.2.8. Order of Precedence between EULA and Order. If there is any conflict between the terms and conditions in the Order and the terms and conditions of this EULA, or if the Order changes any of the terms of this EULA, the terms and conditions of the Order will apply, except if the Order is between you and an Authorized Reseller, or the Order is issued/generated by you. In the case where the Order is between you and an Authorized Reseller, the terms of the Order will apply subject to the following: (a) any terms and conditions in the Order imposing obligations on the Authorized Reseller that are in addition to or different from the obligations we have to you pursuant to this EULA will be born solely by the Authorized Reseller and our obligations to you and limits on our liability will be governed solely by the terms and conditions of this EULA and (b) any terms and conditions that conflict with or would otherwise alter any of the following under this EULA will have no effect unless expressly agreed to in a written instrument executed by us: our ownership rights, yours and our confidentiality obligations, your export compliance obligations, limitations on your rights as a U.S. Government customer (if applicable), our audit rights, restrictions on your right to assign, our publicity rights or governing law and jurisdiction. In cases where the Order is issued/generated by you, the terms and conditions of Section 1.19.2. of this EULA, governing a purchase order or other document you supply in connection with this EULA, shall apply to such Order. +1.2.9. Order of Precedence within EULA. If there is any conflict among the terms and conditions of this EULA, or if a section changes the terms of another section within this EULA, the order of precedence will be as follows: first, section 4 (Product Specific Terms) (if any); second, section 3 (Product Family Specific Terms) (if any); third, section 2.A (Terms for On-Premise Products) and/or section 2.B (Terms for Hosted Services), as applicable; and fourth and finally, section 1 (General Terms and Conditions). +1.3. License Types. +1.3.1. Overview of License Types. The license type for the Product will, unless otherwise specified in this EULA, be one of the following license types: perpetual, term or subscription. This will be confirmed in the Order or will be the default license type listed in section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms). +1.3.2. Perpetual License Type. Your license to use the Product will continue in perpetuity unless earlier terminated in accordance with the terms of this EULA. +1.3.3. Term License Type. Your license to use the Product will continue until the expiration of the term identified in the Order unless earlier terminated in accordance with the terms of this EULA. If we continue to make the Product generally available to our customers, you may purchase a new term license for the Product from us or our Authorized Reseller. +1.3.4. Subscription License Type. Your license to use the Product will continue until the expiration of the subscription period identified in the Order unless earlier terminated in accordance with the terms of this EULA. The procedure for renewing your license to the Product is set out in section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms). If you upgrade your subscription to the Product, the upgrade will take effect immediately and you will be charged and must pay the applicable fee, and the term of your then-current subscription period may be extended, as described at the time you upgrade. You may not downgrade a subscription to the Product. +1.4. Our Business Principles. We will apply the principles set out in our Code of Conduct and Business Ethics (published on our website at http://investors.progress.com/governance.cfm) in our performance under this EULA. +1.5. Export Compliance and U.S. Government Customers. +1.5.1. Export Compliance. Export laws and regulations of the United States and any other relevant local export laws and regulations apply to the Products. You agree that such export control laws, including, without limitation, the U.S. Export Administration Act and its associated regulations, govern your use of the Product (including technical data), and you agree to comply with all such export laws and regulations (including "deemed export" and "deemed re-export" regulations). You agree that no data, information and/or Product (or direct product thereof) will be exported, directly or indirectly, in violation of these laws, or will be used for any purpose prohibited by these laws including, without limitation, nuclear, chemical, or biological weapons proliferation, or development of missile technology. +1.5.2. U.S. Government Customers. If the Product is being acquired by or on behalf of the U.S. Government or by a U.S. Government prime contractor or subcontractor (at any tier), then the U.S. Government's rights in the Product will be only as set out herein. The Product and Documentation are "commercial items" as that term is defined at 48 C.F.R. 2.101, consisting of "commercial computer software" and "commercial software documentation" as such terms are used in 48 C.F.R. 12.212. Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4, all U.S. Government end users acquire the Product and such Documentation with only those rights set out herein. +1.6. IP Ownership and Feedback. +1.6.1. IP Ownership. The Product, Our Technology, Documentation, and all other current or future intellectual property developed by us or our Affiliates, and all worldwide Intellectual Property Rights in each of the foregoing and all Updates, upgrades, enhancements, new versions, releases, corrections, and other modifications thereto and derivative works thereof, are the exclusive property of us or our Affiliates or our or their licensors or suppliers. Except for the rights and licenses expressly granted herein, all such rights are reserved by us and our Affiliates and our or their licensors and suppliers. All title and Intellectual Property Rights in and to the content that may be accessed through use of the Product is the property of the respective content owner and may be protected by applicable copyright or other intellectual property laws and treaties. This EULA grants you no rights to use such content. +1.6.2. Feedback. If you provide us any ideas, thoughts, criticisms, suggested improvements or other feedback related to Our Technology (collectively "Feedback") you own the Feedback and you grant to us a worldwide, royalty-free, fully paid, perpetual, irrevocable license to use, reproduce, modify, translate, distribute, perform, display, import, sell, license, offer for sale, make, have made and otherwise exploit the Feedback in any form, media, or technology, whether now known or hereafter developed, and to allow others to do the same without restriction or obligation of any kind, on account of confidential information, intellectual property rights or otherwise, and may incorporate into our products or services any service, product, technology, enhancement, documentation or other development ("Improvement") incorporating or derived from any Feedback with no obligation to license or to make available the Improvement to you or any other person or entity. This is true whether you provide the Feedback through use of the Product or through any other method of communication with us, unless we have entered into a separate agreement with you that provides otherwise. +1.7. Maintenance. +1.7.1. Our Maintenance and Support Policies. If we offer and you purchase maintenance and support for the Product, then it will be provided in accordance with our then current maintenance and support policies for the applicable Product in effect at the time of purchase. You may access our maintenance and support policies by clicking on the applicable Product family link located at https://www.progress.com/support. +1.7.2. Maintenance and Support for Perpetual or Term License Types. For Perpetual and Term License Types, unless otherwise expressly stated by us in the Order, first year annual maintenance and support (if offered by us) is required for the Product and starts on the date the Product is delivered. Thereafter, you may choose to purchase annual maintenance and support (if offered by us). If you do not purchase renewal maintenance and support services for a Product, then you will not receive any maintenance and support services for that Product and will have no entitlement to any benefits of maintenance and support services including, bug fixes, patches, upgrades, enhancements, new releases or technical support. If you want to reinstate lapsed maintenance and support services on a Product, and we offer reinstatement to our customers, then you may re-instate maintenance and support services by paying the then-current fee, plus a reinstatement fee for the lapsed maintenance and support period in accordance with our maintenance and support reinstatement policies then in effect. +1.7.3. Maintenance and Support for Subscription License Type. If the license type for the Product licensed to you is the subscription license type, then maintenance and support (if offered by us) is included in the subscription fees for each subscription period. +1.8. Fees and Taxes. +1.8.1. Payment Terms and Taxes. All fees payable to us are payable in the currency specified in the Order, or if no currency is specified, in United States Dollars, are due within 30 days from the invoice date and, except as otherwise expressly specified herein, are non-cancellable and non-refundable. We may charge you interest at a rate of 1.5% per month (or the highest rate permitted by law, if less) on all overdue payments. You agree to pay any sales, value-added or other similar taxes imposed by applicable law that we must pay on such fees, except those based on our income. Invoices may be issued by our Affiliate. If you and we agree that you will pay by credit card, you will provide us with valid and updated credit card information and you authorize us to store such information and bill such credit card for all fees applicable: (a) at the time that you order the Product and (b) at the time of any renewal or upgrade. +1.8.2. Fees for Renewal Subscription Licenses. If the license type for the Product licensed to you is the Subscription License Type then each renewal subscription will be calculated at the then-current price offered for the Product at the time of renewal. +1.8.3. Fees for Renewal Maintenance Terms. If the license type for the Product licensed to you is a Perpetual license or Term license, then, unless otherwise specified in the Order or in section 3 (Product Family Specific Terms) or section 4 (Product-Specific Terms), the fee for an optional annual renewal maintenance and support term for the Product will be calculated based on the annual rate applicable for the initial maintenance and support term or immediately preceding renewal maintenance and support term, whichever is applicable, plus a rate increase, if applicable, calculated at the lesser of any standard price increase or CPI (or equivalent index) after applying any increases as a consequence of our Lifetime Support policy, if applicable. +1.8.4. Orders between You and Our Authorized Reseller. Notwithstanding the above terms of this section 1.8 (Fees and Taxes), if you purchased your license to the Product and/or maintenance and support from an Authorized Reseller, then the fees will be set out in the Order between you and the Authorized Reseller. The Authorized Reseller may be responsible for billing and/or collecting payment from you and if so, the billing and collection terms agreed to between you and the Authorized Reseller may differ from the terms set out in this section 1.8 (Fees and Taxes). +1.8.5. No Reliance on Future Availability of any Product or Update. You agree that you have not relied on the future availability of any Product or Updates in your purchasing decision or in entering into the payment obligations in your Order. +1.9. Warranties. +1.9.1. Authority. Each party represents and warrants that it has the legal power and authority to enter into this EULA. +1.9.2. Product Compliance with Documentation. We warrant to you that, for six (6) months from delivery (in the case of an On-Premise Product) or for the duration of the license (in the case of a Hosted Service), the Product will comply with the applicable Documentation in all material respects. Your exclusive remedy, and our sole liability, with respect to any breach of this warranty will be for us to use commercially reasonable efforts to promptly correct the non-compliance (provided that you notify us in writing within the warranty period and allow us a reasonable cure period). If we, at our discretion, reasonably determine that correction is not economically or technically feasible, we may terminate your license to the Product and provide you a full refund of the fees paid to us with respect to the Product (in the case of an On-Premise Product) or a refund of the prepaid fees for the unused portion of the license period (in the case of a Hosted Service). Delivery of additional copies of, or Updates to, the Product will not restart or otherwise affect the warranty period. +1.9.3. Warranty Exclusions. The warranty specified in section 1.9.2 (Product Compliance with Documentation) does not cover any Product provided on an unpaid evaluation or trial basis, or defects to the Product due to accident, abuse, service, alteration, modification or improper installation or configuration by you, your Affiliates, your or their personnel or any third party not engaged by us. +1.9.4. Warranty Disclaimers. EXCEPT FOR THE WARRANTIES EXPRESSLY STATED IN THIS SECTION 1.9 OR THE ADDITIONAL WARRANTIES (IF ANY) EXPRESSLY STATED IN SECTION 3 (PRODUCT FAMILY SPECIFIC TERMS) OR SECTION 4 (PRODUCT SPECIFIC TERMS), THE PRODUCT, DOCUMENTATION AND OUR TECHNOLOGY ARE PROVIDED "AS IS", WITH ALL FAULTS, AND WE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, NONINFRINGEMENT, AVAILABILITY, ERROR-FREE OR UNINTERRUPTED OPERATION, AND ANY WARRANTIES ARISING FROM COURSE OF DEALING, COURSE OF PERFORMANCE, OR USAGE OF TRADE. TO THE EXTENT THAT WE MAY NOT AS A MATTER OF APPLICABLE LAW DISCLAIM ANY IMPLIED WARRANTY, THE SCOPE AND DURATION OF SUCH WARRANTY WILL BE THE MINIMUM PERMITTED UNDER APPLICABLE LAW. +1.10. Indemnification. +1.10.1. Our Indemnification Obligation. +1.10.1.1. Intellectual Property Infringement. We will defend you, and your officers, directors, employees, and agents from and against any and all third party claims, lawsuits, and proceedings alleging that your use of the Product, in accordance with the terms and conditions of this EULA, constitutes a direct infringement or misappropriation of such third party's patent, copyright or trade secret rights (the "IP Claim"), and we will indemnify you for damages finally awarded against you by a court of competent jurisdiction with respect to the IP Claim. +1.10.1.2. Exceptions. We will not indemnify you to the extent that the alleged infringement or misappropriation results from (a) use of the Product in combination with any other software or item not supplied by us; (b) failure to promptly implement an Update provided by us pursuant to 1.10.1.3 (Our Options); (c) modification of the Product not made or provided by us; or (d) use of the Product in a manner not permitted by this EULA. We also will not indemnify you if we notify you of our decision to terminate this EULA, and the license to the Product granted hereunder, in accordance with section 1.10.1.3 (Our Options) and you have not ceased all use of the Product within thirty (30) days of such notification. +1.10.1.3. Our Options. If a final injunction is, or we reasonably believe that it could be, obtained against your use of the Product, or if in our opinion the Product is likely to become the subject of a successful claim of infringement, we may, at our option and expense, (a) replace or modify the Product so that it becomes non-infringing (provided that the functionality is substantially equivalent), (b) obtain for you a license to continue to use the Product, or (c) if neither (a) nor (b) are reasonably practicable, terminate this EULA on thirty (30) days' notice and, if the Product was licensed to you on a Perpetual License or Term License basis, refund to you the license fee paid to us for the Product less an amount for depreciation determined on a straight-line five year (or actual term if shorter) depreciation basis with a commencement date as of the date of delivery of the Product, or if the Product was licensed to you on a Subscription License basis, refund to you the unused portion of the fees paid in advance to us for the then-current subscription period for the Product. THE INDEMNIFICATION PROVISIONS SET OUT IN THIS SECTION 1.10.1 STATE OUR ENTIRE LIABILITY AND YOUR SOLE AND EXCLUSIVE REMEDY WITH RESPECT TO ANY INFRINGEMENT OR ALLEGED INFRINGEMENT BY US OF ANY INTELLECTUAL PROPERTY RIGHTS OR PROPRIETARY RIGHTS IN RESPECT OF THE PRODUCT OR ITS USE. +1.10.2. Your Indemnification Obligation. +1.10.2.1. Indemnification for Third Party-Claims. To the extent permitted by applicable law, you will defend us and our Affiliates, and our and their respective officers, directors, employees, and agents from and against any and all third party claims, lawsuits, and proceedings that arise or result from (a) your breach of this EULA, (b) your use, distribution and/or licensing of the Redistributables, if applicable, except to the extent it arises from an IP Claim covered under section 1.10.1 above, or (c) your failure or alleged failure to comply with Applicable Laws or any violation of a third party's rights in connection with your use of the Product (each a "Third-Party Claim" and collectively "Third-Party Claims") and you will indemnify for damages finally awarded by a court of competent jurisdiction with respect to any Third-Party Claim. +1.10.3. Control of the Defense or Settlement. For any indemnification obligation covered in section 1.10.1,"Indemnifying Party" means us, "Indemnified Party" means you, and "Claim" means an IP Claim. For any indemnification obligation covered in section 1.10.2, "Indemnifying Party" means you, "Indemnified Party" means us, and "Claim" means a Third-Party Claim. The Indemnified Party must provide the Indemnifying Party with prompt written notice of a Claim; however, the Indemnified Party's failure to provide or delay in providing such notice will not relieve the Indemnifying Party of its obligations under this section except to the extent the Indemnifying Party is prejudiced by the Indemnified Party's failure or delay. The Indemnified Party will give the Indemnifying Party full control of the defense and settlement of the Claim as long as such settlement does not include a financial obligation on or admission of liability by the Indemnified Party. If the Indemnified Party does not do so, then the Indemnified Party waives the Indemnifying Party's indemnification obligations under section 1.10.1 or 1.10.2, as applicable. The Indemnified Party will reasonably cooperate in the defense of the Claim and may appear, at its own expense, through counsel reasonably acceptable to the Indemnifying Party. +1.11. Confidentiality. +1.11.1. Confidentiality Obligations. Except as otherwise provided herein, each party agrees to retain in confidence all information and know-how transmitted or disclosed to the other that the disclosing party has identified as being proprietary and/or confidential or should reasonably be understood to be confidential given the nature of the information and the circumstances surrounding its disclosure, and agrees to make no use of such information and know-how except under the terms of this EULA. However, neither party will have an obligation to maintain the confidentiality of information that (a) it received rightfully from a third party without an obligation to maintain such information in confidence; (b) was known to the receiving party prior to its disclosure by the disclosing party; (c) is or becomes a matter of public knowledge through no fault of the receiving party; or (d) is independently developed by the receiving party without use of the confidential information of the disclosing party. Further, either party may disclose confidential information of the other party as required by governmental or judicial order, provided such party gives the other party prompt written notice prior to such disclosure (unless such prior notice is not permitted by applicable law) and complies with any protective order (or equivalent) imposed on such disclosure. You will treat any source code for the Product as our confidential information and will not disclose, disseminate or distribute such materials to any third party without our prior written permission. Each party's obligations under this section 1.11 will apply during the term of this EULA and for five (5) years following termination of this EULA, provided, however, that (i) obligations with respect to source code will survive forever and (ii) trade secrets will be maintained as such until they fall into the public domain. +1.11.2. Product Benchmark Results. You acknowledge that any benchmark results pertaining to the Product are our confidential information and may not be disclosed or published without our prior written consent. This provision applies regardless of whether the benchmark tests are conducted by you or us. +1.11.3. Remedies for Breach of Confidentiality Obligations. Each party acknowledges that in the event of a breach or threat of breach of this section 1.11, money damages will not be adequate. Therefore, in addition to any other legal or equitable remedies, the non-breaching party will be entitled to seek injunctive or similar equitable relief against such breach or threat of breach without proof of actual injury and without posting of a bond. +1.12. Data Collection and Personal Data. +1.12.1. Data Collection through use of the Product. THE PRODUCT MAY INCLUDE FEATURE(S) THAT (A) GATHER PRODUCT ACTIVATION, USAGE AND/OR ENVIRONMENT INFORMATION, (B) IDENTIFY TRENDS AND/OR BUGS, (C) COLLECT USAGE STATISTICS, AND/OR (D) TRACK OTHER DATA RELATED TO YOUR USE OF THE PRODUCT, AS FURTHER DESCRIBED IN THE CURRENT VERSION OF OUR PRIVACY POLICY AVAILABLE AT https://www.progress.com/legal/privacy-policy. BY YOUR ACCEPTANCE OF THE TERMS OF THIS EULA AND/OR USE OF THE PRODUCT, YOU AUTHORIZE THE COLLECTION, USE AND DISCLOSURE OF THIS DATA FOR THE PURPOSES PROVIDED FOR IN THIS EULA AND/OR THE PRIVACY POLICY. +1.12.2. Additional Data Collection Terms. Depending on the Product licensed to you, this EULA may contain additional data collection terms in section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms) and/or, if we are hosting the Product, in section 2.B (Terms for Hosted Services). +1.12.3. Your Personal Data. If you determine that you will be supplying us with your Personal Data (as defined in the Data Processing Addendum referenced below) for us to process on your behalf, in the provision of maintenance and support services or hosting services (if the Product licensed to you is a Hosted Service) or during the course of any audits we conduct pursuant to section 1.14 (Audit), you may submit a written request at privacy@progress.com for the mutual execution of a Data Processing Addendum substantially in the form we make available at https://www.progress.com/docs/default-source/progress-software/data-processing-addendum.pdf and we will enter into such Data Processing Addendum with you. To the extent there is any conflict between this EULA and such Data Processing Addendum, the Data Processing Addendum will prevail with respect to our handling and processing of your Personal Data. +1.13. Limitation of Liability and Disclaimer of Certain Types of Damages. +1.13.1. Limitation of Liability. EXCEPT FOR A PARTY'S INDEMNIFICATION OBLIGATIONS SET OUT IN THIS EULA OR A PARTY'S BREACH OF ITS CONFIDENTIALITY OBLIGATIONS PURSUANT TO SECTION 1.11 (CONFIDENTIALITY), OR YOUR MATERIAL VIOLATION OF OUR INTELLECTUAL PROPERTY RIGHTS OR OF THE LICENSE RESTRICTIONS SET OUT IN THIS EULA, TO THE EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL EITHER PARTY'S LIABILITY FOR ALL COSTS, DAMAGES, AND EXPENSES ARISING OUT OF OR RELATED TO THIS EULA WHETHER BASED UPON WARRANTY, CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE AT LAW EXCEED, IN THE AGGREGATE, THE FEES PAID TO US FOR THE PRODUCT AND/OR SERVICE THAT IS THE SUBJECT OF THE CLAIM, PROVIDED, HOWEVER, THAT IF THE FEES PAID FOR SUCH PRODUCT AND/OR SERVICE ARE PAID ON A RECURRING BASIS, THEN THE NOT TO EXCEED LIMIT WILL BE THE FEES PAID TO US FOR THE PRODUCT AND/OR SERVICE DURING THE TWELVE (12) MONTH PERIOD IMMEDIATELY PRECEDING THE DATE THE CLAIM AROSE. OUR AFFILIATES AND LICENSORS, AND THE SUPPLIERS TO US, OUR AFFILIATES OR LICENSORS, WILL, TO THE EXTENT PERMITTED BY APPLICABLE LAW, HAVE NO LIABILITY TO YOU OR TO ANY OTHER PERSON OR ENTITY FOR DAMAGES, DIRECT OR OTHERWISE, ARISING OUT OF THIS EULA, INCLUDING, WITHOUT LIMITATION, DAMAGES IN CONNECTION WITH THE PERFORMANCE OR OPERATION OF OUR PRODUCTS OR OUR PERFORMANCE OF SERVICES. +1.13.2 Disclaimer of Certain Types of Damages. EXCEPT FOR A PARTY'S INDEMNIFICATION OBLIGATIONS SET OUT IN THIS EULA OR YOUR MATERIAL VIOLATION OF OUR INTELLECTUAL PROPERTY RIGHTS OR THE LICENSE RESTRICTIONS SET OUT IN THIS EULA, TO THE EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL EITHER PARTY, ITS AFFILIATES OR ITS LICENSORS OR THEIR RESPECTIVE SUPPLIERS BE LIABLE FOR ANY SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL, PUNITIVE OR TORT DAMAGES ARISING IN CONNECTION WITH THIS EULA OR EITHER PARTY'S PERFORMANCE UNDER THIS EULA OR THE PERFORMANCE OF OUR PRODUCTS, OR FOR ANY DAMAGES RESULTING FROM LOSS OF USE, LOSS OF OPPORTUNITY, LOSS OF DATA, LOSS OF REVENUE, LOSS OF PROFITS, OR LOSS OF BUSINESS, EVEN IF THE PARTY, ITS AFFILIATES, ITS LICENSORS, OR ANY OF THEIR RESPECTIVE SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF THOSE DAMAGES. +1.14. Audit. We may install and use automated license tracking, management and/or enforcement solutions with the Product, which you may not disrupt or alter. You will maintain records in connection with this EULA and the use of the Product and any Updates and/or services provided hereunder. Such records will include at a minimum the number of licenses purchased and being used by you. At our expense and with reasonable written notice to you, we or a third party appointed by us may audit the records, and if necessary and as applicable, the systems on which the Product or any Update is installed for the sole purpose of ensuring compliance with the terms of this EULA. We will have the right to conduct audits as necessary. These audits may be conducted on site at a location where you have installed the Product, remotely from our offices, or a combination of both, if applicable to the Product. On-site audits will be conducted during regular business hours, and neither on-site nor remote audits will interfere unreasonably with your business operations. You agree to share with us copies of all records referenced herein, as well as Product log files and other information reasonably requested by us promptly following such request, but in no event more than five (5) business days following receipt of our written request (or such longer period, if applicable, that we specify in the written request). We will treat all such information obtained or accessed by us during the audit as confidential information pursuant to section 1.11 (Confidentiality) for use by us only as necessary to ensure compliance with and enforcement of the terms of this EULA. If any audit reveals that you have underpaid license, maintenance and support or subscription fees, you will be invoiced for all such underpaid fees based on our list price in effect at the time the audit is completed. If the underpaid fees exceed five percent (5%) of the fees previously paid by you, then you will also pay our reasonable costs of conducting the audit and enforcement of this EULA. +1.15. Termination. +1.15.1. Termination for Breach. We may terminate this EULA by written notice at any time if you do not comply with any of your obligations under this EULA and fail to cure such failure to our satisfaction within thirty (30) days after such notice. This remedy will not be exclusive and will be in addition to any other remedies which we may have under this EULA or otherwise. +1.15.2. Effect of Termination. Upon expiration of your license term to the Product (if applicable) or earlier termination of this EULA, your license to access and/or use the Product and/or distribute the Redistributables (if applicable) will terminate. You must immediately cease use of the Product and destroy all copies of the Product in your possession (and required any Permitted Third Parties to do the same). Any licenses you have granted to the Redistributables in accordance with the terms and conditions of this EULA will, unless otherwise specified in section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms), survive termination of this EULA. +1.15.3. Survival. Any provisions of this EULA containing licensing restrictions, warranties and warranty disclaimers, confidentiality obligations, limitations of liability and/or indemnity terms, audits rights, and any term of this EULA which, by its nature, is intended to survive termination or expiration, will remain in effect following any termination or expiration if this EULA, as will your obligation to pay any fees accrued and owing to us as of termination or expiration. +1.16. Assignment. You may not, without our prior written consent, assign or novate this EULA, any of your rights or obligations under this EULA, or the Products or any of our Confidential Information, in whole or in part, by operation of law, sale of assets, merger or otherwise, to any other party, including any parent, subsidiary or affiliated entity. Your Change of Control will constitute an assignment for purposes of the preceding sentence. A "Change of Control" will include, but not be limited to, any merger, consolidation, amalgamation, reorganization or sale, transfer or exchange of the capital stock or equity interests of you in a transaction or series of transactions which results in the holders of your capital stock or equity interests holding less than 50% of the outstanding capital stock or equity interests immediately following such transaction(s). +1.17. Choice of Law. This EULA is governed by the laws of the Commonwealth of Massachusetts, U.S.A., without regard to the conflict of laws principles thereof. If any dispute, controversy, or claim cannot be resolved by a good-faith discussion between the parties, then it will be submitted for resolution to a state or federal court in Boston, Massachusetts, USA, and the parties hereby irrevocably and unconditionally agree to submit to the exclusive jurisdiction and venue of such court. The Uniform Computer Information Transactions Act and the United Nations Convention on the International Sale of Goods will not apply to this EULA. +1.18. Publicity. You agree that we may, in our sole discretion, publicize your use of the Product, and you license to us (and our Affiliates and necessary sublicensees) any intellectual property rights required to allow us (and our Affiliates and necessary sublicensees) to use your name, trade name(s), trademark(s), service mark(s), logo(s) and domain name(s) in connection with such publicity. +1.19. Miscellaneous. +1.19.1. Notices. Notices of termination, material breach, your insolvency or an indemnifiable claim ("Legal Notices") must be clearly identified as Legal Notices and sent via overnight courier or certified mail with proof of delivery to the following addresses: For us: 14 Oak Park Drive, Bedford, MA 01730, Attention: General Counsel. For you: your address set out in the Order. Legal Notices sent in accordance with the above will be effective upon the second business day after mailing. Either party may change its address for receipt of notices upon written notice to the other party. +1.19.2. Entire Agreement. This EULA, and any terms expressly incorporated herein by reference, will constitute the entire agreement between you and us with respect to the subject matter of this EULA and supersedes all prior and contemporaneous communications, oral or written, signed or unsigned, regarding such subject matter. Use of any purchase order or other document you supply in connection with this EULA will be for administrative convenience only and all terms and conditions stated therein will be void and of no effect. Except as otherwise expressly contemplated in this EULA, this EULA may not be modified or amended other than in writing signed by you and us. +1.19.3. Severability. If any provision of this EULA is terminated or held by a court of competent jurisdiction to be invalid, illegal, or unenforceable, the remainder of this EULA will remain in full force and effect. +1.19.4. Waiver. Failure or delay in exercising any right, power, privilege or remedy hereunder will not constitute a waiver thereof. A waiver of default will not operate as a waiver of any other default or of the same type of default on future occasions. +1.19.5. English Language. This EULA has been drawn up in English at the express wish of the parties. Le present contrat a ete redige en anglais a la demande expresse des parties. +1.19.6. Force Majeure. Neither you nor we will be liable for any delay or failure to take any action required under this EULA (except for payment) due to any cause beyond the reasonable control of you or us, as the case may be, including, but not limited to unavailability or shortages of labour, materials, or equipment, failure or delay in the delivery of vendors and suppliers and delays in transportation. +1.19.7. Our Use of Our Affiliates. We may, at our discretion, engage one or more of our Affiliates in the fulfilment of our obligations, including, our obligations for delivery of the Product to you and/or the provision of any maintenance and support services. + +2.A. TERMS FOR ON-PREMISE PRODUCTS +2.A.1. Delivery. Unless otherwise specified by us, On-Premise Product(s) will be provided to you via electronic delivery, and delivery is deemed complete when the On-Premise Product(s) is/are made available at the electronic software download site specified by us and you are e-mailed or otherwise provided with any necessary instructions, password and/or license keys required for you to be able to access, download and install the On-Premise Product(s). If we provide the On-Premise Product(s) on physical media, shipping terms will be FOB shipping point. +2.A.2. Updates. Each Update to an On-Premise Product replaces part or all of the On-Premise Product (or earlier Update) previously licensed to you ("Replaced Product") and will terminate such previously licensed Replaced Product to the extent replaced by the Update; provided, however, that you may continue to operate the Replaced Product for up to ninety (90) days from delivery of the Update to allow you to complete your implementation of the Update. You must cease all use of the Replaced Product at the end of the ninety (90) day period. Each Update will be subject to the terms and conditions of the license agreement accompanying the Update which must be accepted by you at the time you download or install the Update. If you do not agree to the license agreement accompanying the Update, do not download or install the Update. +2.A.3. Cloud Environment. You may upload the On-Premise Product(s) licensed to you pursuant to this EULA onto a cloud instance supplied by a third party, provided that the operation of the On-Premise Product(s) in the cloud instance complies with all license model restrictions and usage limitations applicable to the On-Premise Product(s). You may also allow the third party to upload, install, operate and/or use the On-Premise Products on the cloud instance, provided that the third party's access to and use of the On-Premise Products is solely for your benefit in accordance with the terms of this EULA. The third party will be considered a Permitted Third Party, and you will be responsible for the Permitted Third Party's compliance with this EULA in accordance with section 1.2.3 (Third Party Use). + +2.B. TERMS FOR HOSTED SERVICES THIS SECTION IS NOT APPLICABLE + +3. PRODUCT FAMILY SPECIFIC TERMS +This section specifies terms and conditions that are applicable to the following On-Premise Products: FiddlerCore Embedded Engine. The terms and conditions set forth in this Section 3 and in Section 4 apply to the Product. The specific Product(s) to which you are granted a license hereunder shall be only those Product(s) identified in the Order. + +Default License Type for each of the above-referenced On-Premise Products: Perpetual, with the exception of any Product obtained under a Trial License. +3.1. Product Family Definitions. +Any defined term used in this section 3 (Product Family Specific Terms) but not defined herein will have the meaning ascribed to it in section 1 (General Terms and Conditions) or section 2.A (Terms for On-Premise Products). +3.1.3. "Licensed Developer" means one of your employees or third-party consultants authorized to develop Your Integrated Product specifically for you using the Product Package in accordance with this EULA. Each Licensed Developer is an Authorized User as defined in section 1.1.3 and all terms and conditions in section 1 (General Terms and Conditions) and section 2.A (Terms for On-Premise Software) pertaining to Authorized Users will apply to a Licensed Developer. +3.1.2. "Permitted End User" means your own employees or subcontractors, each of whom is authorized to use the Software as part of Your Integrated Product solely for Your benefit and in accordance with the requirements of this EULA. +3.1.4. "Product Package" means the Product and the Documentation, collectively. +3.1.5. "Your Integrated Product" means a single internal-facing Licensee software product into which the Product is integrated. "Your Integrated Product" as defined herein, is further limited to Licensee's software product which: (i) is developed by Your Licensed Developers; (ii) adds substantial functionality beyond the functionality provided by the incorporated components of the Product; (iii) has functionalities which would be considered improvements within the natural progression of the software product; and (iv) is not a commercial alternative for, or competitive in the marketplace with, the Product or any components of the Product. +3.2. Restrictions on Eligibility to Purchase a License. Content Management System, .NET, PHP, Java and/or JavaScript component vendors are not allowed to use the Product Package without our express permission. If you or the company you represent is a Content Management System, .NET, PHP, Java or JavaScript component vendor, you may not purchase a license for or use the Product Package unless you contact us directly and obtain permission. +3.3. Required Quantity of Licensed Developers. Licensed Developers must correspond to the maximum number of seats you have purchased for the Product Package from us hereunder. This means that, at any given time, the number of Licensed Developers cannot exceed the number of seats that you have purchased from us and for which you have paid us all the applicable license fees pursuant to this EULA. The Product Package is in "use" on a computer when it is loaded into temporary memory (i.e. RAM) or installed into permanent memory (e.g. hard disk or other storage device). Your Licensed Developers may install the Product Package on multiple machines, so long as the Product Package is not being used simultaneously for development purposes at any given time by more Licensed Developers than you have seats. +3.4. Trial License. +3.4.1. License Grant. If you downloaded the free trial license for the Product Package ("Trial License"), then your use of the Product Package is subject to the limitations and conditions specified in section 1.2.5 (Limitations on Evaluation or Trial Licenses). Without limiting the foregoing, you are not allowed to integrate the Product Package into end products or use it for any commercial, productive or training purpose. You may not redistribute the Product Package. The term of the Trial License will be 30 days. If you wish to continue using the Product Package beyond the expiration of the Trial License, you must purchase the applicable Internal Business Systems License, as defined in section 4 (Product-Specific Terms) or a FiddlerCore Embedded Engine Commercial License, as referenced at the end of section 4.A.1.3. +3.4.2. Support - Trial License. As described in greater detail here: http://www.telerik.com/purchase/support-plans, and subject to the limitations and restrictions described in the Fair Usage Policy, you are entitled to enter support requests via our ticketing system with a 72 hour response time (excluding Saturdays, Sundays and holidays) for thirty (30) days after download of your initial Trial License. For avoidance of doubt, you are not entitled to additional support requests for any Trial Licenses of the same or successor Products downloaded after your initial download (e.g. to evaluate a new release), for a period of one (1) year from the date of your initial download. +3.4.3. Updates - Trial License. At our sole discretion, you may receive certain Updates for the Product Package version you are evaluating. If Licensor makes Updates to the Product Package available to you, such Updates replace and/or supplement (and may disable) the version of the Product Package that formed the basis for your eligibility for the Update. You may use the resulting updated Product Package only in accordance with the terms of this Trial License. For the avoidance of doubt, Updates do not restart the term of the Trial License. +3.5. Support and Updates - Internal Business Systems License +3.5.1. Support. For any applicable period for which you have purchased maintenance and support (the "Maintenance Period"), you will receive minor and major Updates for the Product Package, and will be entitled to receive support, each as described in further detail below. Except as otherwise set forth in Section 4, during the Maintenance Period, you are entitled to either the "Lite", "Priority", or "Ultimate" support package as determined at time of purchase and set forth on the Order and described in greater detail here: http://www.telerik.com/purchase/support-plans subject to the limitations and restrictions described in the following Fair Usage Policy. You will lose the right to receive support and Updates at the end of your Maintenance Period, unless you renew your access to updates and support for additional Maintenance Period(s) with us at additional cost. Your level of support (Lite, Priority or Ultimate) is determined at the time of initial license purchase. You may upgrade your level of support for individually purchased Products at any time during an active Maintenance Period provided we continue to make such levels of support generally available. Any support level upgrades (if purchased) and all access to support and Updates thereunder will be bound to the term of the then active Maintenance Period (i.e. the renewal/expiration date of your Maintenance Period will not change as a result of the support level upgrade). You generally may not downgrade your level of support and there is no automated mechanism available to you by which to downgrade. The following additional terms apply to support hereunder: + (a) We may apply a Fair Usage Policy that allows us to limit or terminate your access to any or all of the support services if your use of the support services is determined by us, in our sole and reasonable discretion, to be excessive. + (b) In no event will we provide support of any kind to your Permitted End Users. +3.5.2. Updates. During the Maintenance Period, you will be eligible to receive all major Updates and minor Updates for the version of the Product Package that you license hereunder. Notwithstanding anything to the contrary in Section 2.A.2., you may use the resulting updated Product Package in accordance with the terms of this EULA, except that: (i) to the extent the Update contains new or updated Special Notices, your use of any third party components shall be subject to Section 1.2.7 of this EULA and the Special Notices accompanying the Update; and, (ii) to the extent the Update contains new Products, components, features and/or functionality which are subject to additional or conflicting terms and conditions than those set forth in this EULA, your use of such new Products, components, features and/or functionality will be subject to the terms and conditions of the license agreement accompanying the Update which must be accepted by you at the time you download or install the Update. If you do not agree to such additional or conflicting terms and conditions, do not download or install the Update. +3.7. No Publicity. Licensee may not publicize or disclose its use of the Product Package (or any portion thereof) in any way nor use Licensor's name, trademarks, service marks or logos without Licensor's prior written consent. For avoidance of doubt, use of the Product within Your Integrated Product (if permitted in accordance with Section 4) shall be "white label". +3.8. Destruction Requirement upon Termination. Upon termination of this EULA, all licenses granted to you hereunder will terminate automatically and the terms of section 1.15.2 (Effect of Termination) will apply. Additionally, you must destroy: (i) all copies of the Product Package not integrated into a live, functioning instance(s) of Your Integrated Product(s) already installed, implemented and deployed for your Permitted End Users, and (ii) any product and company logos provided by us in connection with this EULA. +3.9. Product Discontinuance. We reserve the right to discontinue any Product Package or any component of any Product Package, whether offered as a standalone product or solely as a component, at any time. However, we are obligated to provide support in accordance with the terms of this EULA for the discontinued Product Package or any discontinued component of the Product Package for a period of one year after the date of discontinuance (provided you are under an active Maintenance Period). + +4. PRODUCT-SPECIFIC TERMS +Any defined term used in this section 4 (Product-Specific Terms) but not defined herein will have the meaning ascribed to it in section 1 (General Terms and Conditions), section 2.A (Terms for On-Premise Products), or 3 (Product Family Specific Terms). +4.A FiddlerCore Embedded Engine. +This section specifies terms and conditions that are applicable to the FiddlerCore Embedded Engine. +4.A.1. License. +Subject to the terms of this EULA, we grant to you the following limited, non-exclusive, non-transferable license (the "License") to use the Product Package as set out herein. You are granted either a Trial License pursuant to section 3.4 (Trial License) or an internal business systems license ("Internal Business Systems License") pursuant to section 4.A.1.1 (Internal Business Systems License). Which version of the License applies (i.e., Trial License or Internal Business Systems License) is determined at the time of the License purchase. +4.A.1.1 Internal Business Systems License +If You purchase an Internal Business Systems License with Updates and Support, your Licensed Developers may use the Product Package in object code form only in the development of one (1) Your Integrated Product. In addition, for the applicable period of one (1), two (2), or three (3) years from the date on which you purchased a license to use the Product Package, for which you have purchased updates and support (the "Subscription Period"), you will receive minor and major updates for the Product Package, as well as the "Priority" support package, each as described in 4.A.1.2. +4.A.1.2 Maintenance and Support- Internal Business Systems License +During the Subscription Period, you are entitled to the "Priority" support package as described in greater detail here: http://www.telerik.com/purchase/support-plans/, subject to the limitations and restrictions described herein. +Licensor may limit or terminate your access to any or all of the support services available under the "Priority" support package if your use of the support services is determined by Licensor, in its sole and reasonable discretion, to be excessive. + +4.A.1.3 Third-Party Libraries + +In addition to and without limiting the applicability of any Special Notices, the Product Package installation includes optional third-party libraries which are licensed by third-parties under their own separate terms. If you choose to utilize these libraries, you must comply with the terms outlined by their owners, each as described in section 4.A.1.3.1 and 4.A.1.3.2. + +4.A.1.3.1 Library BCMakeCert.dll + +The included library BCMakeCert.dll is the C# version of "The Legion of the Bouncy Castle" http://www.bouncycastle.org/ and its use and redistribution are governed by the terms specified by its owners. See http://www.bouncycastle.org/csharp/licence.html for details. + +4.A.1.3.2 Library MakeCert.exe + +The included library MakeCert.exe is Microsoft's certificate generation library. This library is redistributed under the license terms included with Visual Studio 2008. + +4.A.1.3 Redistribution + +If you have purchased an Internal Business Systems License, subject to the terms of this EULA, Licensee is granted a limited, non-transferable right to internally distribute the Product in object code form only as embedded in Your Integrated Product to your Permitted End Users for use solely within your organization. You are not permitted to distribute the Product pursuant to this section: (i) in any format other than in object form, (ii) as a standalone product, or (iii) as a part of any product other than Your Integrated Product, or (iv) in any manner which causes the Product to be stored on a server not owned or controlled by you. You must ensure that the Product is not distributed in any form that allows it to be reused by any application other than Your Integrated Product. Licensee is not allowed to and is expressly prohibited from granting its Permitted End Users any right to further sublicense the Product. For avoidance of doubt, your Permitted End Users are not permitted to use the Product, or any portions thereof, for software development or application development purposes unless they also purchase a separate commercial license from Licensor for each of the users. This EULA does not grant you a license or any rights to use or distribute the FiddlerCore Embedded Engine in a public facing, redistributable Your Integrated Product. For the FiddlerCore Embedded Engine Commercial License, please contact sales at sales@telerik.com. + + + diff --git a/packages/FiddlerCore.Trial.5.0.0/FiddlerCore.Trial.5.0.0.nupkg b/packages/FiddlerCore.Trial.5.0.0/FiddlerCore.Trial.5.0.0.nupkg new file mode 100644 index 0000000..67ed2ca Binary files /dev/null and b/packages/FiddlerCore.Trial.5.0.0/FiddlerCore.Trial.5.0.0.nupkg differ diff --git a/packages/FiddlerCore.Trial.5.0.0/THIRD-PARTY-NOTICES.txt b/packages/FiddlerCore.Trial.5.0.0/THIRD-PARTY-NOTICES.txt new file mode 100644 index 0000000..b441e13 --- /dev/null +++ b/packages/FiddlerCore.Trial.5.0.0/THIRD-PARTY-NOTICES.txt @@ -0,0 +1,86 @@ +Progress Telerik FiddlerCore v5 + +Copyright © 2010-2019 Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved. + +Portions of the Product include certain open source and commercial third-party components listed below (“Third-Party Components”). The authors of the Third-Party Components require Progress Software Corporation (“PSC”) to include the following notices and additional licensing terms as a condition of PSC’s use of such Third-Party Components. You acknowledge that the authors of the Third-Party Components have no obligation to provide support to you for the Third-Party Components or the Product. You hereby undertake to comply with all licenses related to the applicable Third-Party Components. Notwithstanding anything to the contrary, to the extent that any of the terms and conditions of the Progress Agreement conflict, vary, or are in addition to the terms and conditions of the aforementioned third-party licenses for these technologies, such terms and conditions are offered by PSC alone and not by any other party. + +1. Special Notices Regarding Open Source Third Party Components incorporated in the Product: + +(1) MIT-Style Licenses: + +(a) Progress Telerik FiddlerCore v5 incorporates Bouncy Castle C# API v1.8.1. Such technology is subject to the following terms and conditions: +LICENSE +Copyright (c) 2000 - 2019 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org) +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +(b) Progress Telerik FiddlerCore v5 incorporates Windows SDK for Google Analytics v1.5.0.0.Feb.2017. Such technology is subject to the following terms and conditions: +MIT License +Copyright (c) 2017 .NET Foundation +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +(2) Microsoft Public License (Ms-PL): + +Progress Telerik FiddlerCore v5 incorporates DotNetZip Library v1.13.4. Such technology is subject to the following terms and conditions: +Software Licenses that apply to the DotNetZip library and tools +As DotNetZip includes work derived from other projects, you are required to comply with the terms and conditions for each of them. These licenses include BSD, Apache, and zlib. +To use the software, you must accept the licenses. If you do not accept the licenses, do not use the software. +Original intellectual property in DotNetZip is provided under the Ms-PL: +Copyright (c) 2006 - 2011 Dino Chiesa +Copyright (c) 2006, 2007, 2008, 2009 Dino Chiesa and Microsoft Corporation. +Microsoft Public License (Ms-PL) +This license governs use of the accompanying software, the DotNetZip library ("the software"). If you use the software, you accept this license. If you do not accept the license, do not use the software. +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. +A "contribution" is the original software, or any additions or changes to the software. +A "contributor" is any person that distributes its contribution under this license. +"Licensed patents" are a contributor's patent claims that read directly on its contribution. +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. +(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. +-------------------------------------------------------------- +The managed ZLIB code included in Ionic.Zlib.dll and Ionic.Zip.dll is derived from jzlib. +jzlib ( https://github.com/ymnk/jzlib ) is provided under a BSD-style (3 clause) +Copyright (c) 2000,2001,2002,2003 ymnk, JCraft, Inc. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------- +The jzlib library, itself, is a re-implementation of ZLIB v1.1.3 in pure Java. +zlib is provided under the zlib license: +Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler + The ZLIB software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + Jean-loup Gailly jloup@gzip.org? Mark Adler madler@alumni.caltech.edu +-------------------------------------------------------------- +The managed BZIP2 code included in Ionic.BZip2.dll and Ionic.Zip.dll is modified code, based on Java code in the Apache commons compress library. +Apache Commons Compress ( http://commons.apache.org/proper/commons-compress/ ) is provided under the Apache 2 license: +Apache Commons Compress +Copyright 2002-2014 The Apache Software Foundation + Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. +Many thanks to Julian Seward for the original C implementation of BZip2 ( http://www.bzip.org/ ). + + +2. Special Notices Regarding Commercially Licensed Third-Party Components incorporated in the Product: None + + +NOTICE FROM PROGRESS SOFTWARE CORPORATION: Additional notices may be included in the release notes or other documentation that accompanies updates received in connection with support of the Product. + + +Updated 11/6/2019 diff --git a/packages/FiddlerCore.Trial.5.0.0/content/BasicFormatsForCore.dll b/packages/FiddlerCore.Trial.5.0.0/content/BasicFormatsForCore.dll new file mode 100644 index 0000000..37c960e Binary files /dev/null and b/packages/FiddlerCore.Trial.5.0.0/content/BasicFormatsForCore.dll differ diff --git a/packages/FiddlerCore.Trial.5.0.0/contentFiles/any/net40/BasicFormatsForCore.dll b/packages/FiddlerCore.Trial.5.0.0/contentFiles/any/net40/BasicFormatsForCore.dll new file mode 100644 index 0000000..37c960e Binary files /dev/null and b/packages/FiddlerCore.Trial.5.0.0/contentFiles/any/net40/BasicFormatsForCore.dll differ diff --git a/packages/FiddlerCore.Trial.5.0.0/contentFiles/any/net45/BasicFormatsForCore.dll b/packages/FiddlerCore.Trial.5.0.0/contentFiles/any/net45/BasicFormatsForCore.dll new file mode 100644 index 0000000..6bc24ae Binary files /dev/null and b/packages/FiddlerCore.Trial.5.0.0/contentFiles/any/net45/BasicFormatsForCore.dll differ diff --git a/packages/FiddlerCore.Trial.5.0.0/contentFiles/any/netstandard2.0/BasicFormatsForCore.dll b/packages/FiddlerCore.Trial.5.0.0/contentFiles/any/netstandard2.0/BasicFormatsForCore.dll new file mode 100644 index 0000000..8bad278 Binary files /dev/null and b/packages/FiddlerCore.Trial.5.0.0/contentFiles/any/netstandard2.0/BasicFormatsForCore.dll differ diff --git a/packages/FiddlerCore.Trial.5.0.0/icon.png b/packages/FiddlerCore.Trial.5.0.0/icon.png new file mode 100644 index 0000000..0f81c91 Binary files /dev/null and b/packages/FiddlerCore.Trial.5.0.0/icon.png differ diff --git a/packages/FiddlerCore.Trial.5.0.0/lib/net40/FiddlerCore.dll b/packages/FiddlerCore.Trial.5.0.0/lib/net40/FiddlerCore.dll new file mode 100644 index 0000000..4c9088a Binary files /dev/null and b/packages/FiddlerCore.Trial.5.0.0/lib/net40/FiddlerCore.dll differ diff --git a/packages/FiddlerCore.Trial.5.0.0/lib/net40/FiddlerCore.pdb b/packages/FiddlerCore.Trial.5.0.0/lib/net40/FiddlerCore.pdb new file mode 100644 index 0000000..21397e6 Binary files /dev/null and b/packages/FiddlerCore.Trial.5.0.0/lib/net40/FiddlerCore.pdb differ diff --git a/packages/FiddlerCore.Trial.5.0.0/lib/net40/FiddlerCore.xml b/packages/FiddlerCore.Trial.5.0.0/lib/net40/FiddlerCore.xml new file mode 100644 index 0000000..ac58939 --- /dev/null +++ b/packages/FiddlerCore.Trial.5.0.0/lib/net40/FiddlerCore.xml @@ -0,0 +1,8014 @@ + + + + FiddlerCore + + + + + A generic builder class for . + + + + + + + The FiddlerCoreStartupSettings instance being built. + + + + + Reference to this. Return this field instead of (T)this in your methods in order to avoid multiple casting. + + + + + Initializes a new instance of + + The instance of FiddlerCoreStartupSettings which is going to be built. + + + + The port on which the FiddlerCore app will listen on. If 0, a random port will be used. + + The port on which the FiddlerCore app should listen on. + + + + + Registers as the system proxy. + + + + + + Decrypts HTTPS Traffic. + + + + + + Accepts requests from remote computers or devices. WARNING: Security Impact + + + Use caution when allowing Remote Clients to connect. If a hostile computer is able to proxy its traffic through your + FiddlerCore instance, he could circumvent IPSec traffic rules, circumvent intranet firewalls, consume memory on your PC, etc. + + + + + + Forwards requests to any upstream gateway. + + + + + + Sets all connections to use FiddlerCore, otherwise only the Local LAN is pointed to FiddlerCore. + + + + + + Sets connections to use a self-generated PAC File. + + + + + + Passes the <-loopback> token to the proxy exception list. + + + + + + Registers FiddlerCore as the FTP proxy. + + + + + + Calls ThreadPool.SetMinThreads for improved performance. + + + + + + Sets manual upstream gateway. + + The upstream gateway which FiddlerCore will use in the format "address:port | protocol=address:port(;protocol=address:port)*" + + + + + Sets manual upstream gateway with a bypass list. + + The upstream gateway which FiddlerCore will use in the format "address:port | protocol=address:port(;protocol=address:port)*" + List of hosts which should bypass the manually configured upstream gateway. Format: "example.com;*.another-example.com". + + + + + Sets the proxy settings which FiddlerCore uses to find the upstream proxy. + + + + + + + Builds the FiddlerCoreStartupSettings instance. + + The instance of FiddlerCoreStartupSettings. + + + + A generic builder interface for . + + + + + + + The port on which the FiddlerCore app will listen on. If 0, a random port will be used. + + The port on which the FiddlerCore app should listen on. + + + + + Registers as the system proxy. + + + + + + Decrypts HTTPS Traffic. + + + + + + Accepts requests from remote computers or devices. WARNING: Security Impact + + + Use caution when allowing Remote Clients to connect. If a hostile computer is able to proxy its traffic through your + FiddlerCore instance, he could circumvent IPSec traffic rules, circumvent intranet firewalls, consume memory on your PC, etc. + + + + + + Forwards requests to any upstream gateway. + + + + + + Sets all connections to use FiddlerCore, otherwise only the Local LAN is pointed to FiddlerCore. + + + + + + Sets connections to use a self-generated PAC File. + + + + + + Passes the <-loopback> token to the proxy exception list. + + + + + + Registers FiddlerCore as the FTP proxy. + + + + + + Calls ThreadPool.SetMinThreads for improved performance. + + + + + + Sets manual upstream gateway. + + The upstream gateway which FiddlerCore will use in the format "address:port | protocol=address:port(;protocol=address:port)*" + + + + + Sets the proxy settings which FiddlerCore uses to find the upstream proxy. + + + + + + + Sets manual upstream gateway with a bypass list. + + The upstream gateway which FiddlerCore will use in the format "address:port | protocol=address:port(;protocol=address:port)*" + List of hosts which should bypass the manually configured upstream gateway. Format: "example.com;*.another-example.com". + + + + + Builds the FiddlerCoreStartupSettings instance. + + The instance of FiddlerCoreStartupSettings. + + + + Holds startup settings for FiddlerCore. + Use the to build an instance of this class. + Then pass the instance to the method to start FiddlerCore. + + + + + Initializes a new instance of . + + + + + The port on which the FiddlerCore app will listen on. If 0, a random port will be used. + + + + + If set to true, FiddlerCore registers as the system proxy. + + + + + If set to true, FiddlerCore decrypts HTTPS Traffic. + + + + + If set to true, FiddlerCore accepts requests from remote computers or devices. WARNING: Security Impact. + + + Use caution when allowing Remote Clients to connect. If a hostile computer is able to proxy its traffic through your + FiddlerCore instance, he could circumvent IPSec traffic rules, circumvent intranet firewalls, consume memory on your PC, etc. + + + + + If set to true, FiddlerCore forwards requests to any upstream gateway. + + + + + If set to true, FiddlerCore sets all connections to use it, otherwise only the Local LAN is pointed to FiddlerCore. + + + + + If set to true, FiddlerCore sets connections to use a self-generated PAC File. + + + + + If set to true, FiddlerCore passes the <-loopback> token to the proxy exception list. + + + + + If set to true, FiddlerCore registers as the FTP proxy. + + + + + If set to true, FiddlerCore calls ThreadPool.SetMinThreads to improve performance. + + + + + The upstream gateway which FiddlerCore will use in the format "address:port | protocol=address:port(;protocol=address:port)*". + + + + + The proxy settings which FiddlerCore uses to find the upstream proxy. + + + + + List of hosts which should bypass the manually configured upstream gateway. Format: "example.com;*.another-example.com". + + + + + A builder class for . + + + + + Initializes a new instance of + + + + + The frmPrompt class is used to get information from the client. It's primarily used by calling one of the static functions. + + + + + Required designer variable. + + + + + Get a string value from the user. + + The title of the dialog + The prompt text + The default string value + The value entered by the user (or default, if unmodified) + + + + GetUserString prompts the user for a string. + + Title of the dialog + The prompt text in the dialog + The default response + If true, will return null if user hits cancel. Else returns sDefault. + The user's result, or null if user cancelled and bReturnNullIfCancelled set. + + + + Clean up any resources being used. + + + + + Required method for Designer support - do not modify + the contents of this method with the code editor. + + + + + ISessionImport allows loading of password-protected Session data + + + + + Import Sessions from a password-protected data source + + Shortname of the format + Dictionary of options that the Importer class may use + Callback event on which progress is reported or the host may cancel + Callback that is used to request passwords from the host + Array of Session objects imported from source + + + + The class that is used to store MIME-type-to-file-extension mapping. + + + + + Gets or sets the MIME type for this mapping. The provided MIME type should be in the format "top-level type name / subtype name" + and should not include the parameters section of the MIME type. E.g. application/json, text/html, image/gif etc. This property + should not be null, empty string or string containing only white spaces, in order Telerik FiddlerCore to load it. + + + + + Gets or sets the file extension for this mapping. The provided file extension should start with . (dot). E.g. .txt, .html, .png etc. + This property should not be null, empty string or string containing only white spaces, in order Telerik FiddlerCore to load it. + + + + + This class is used to deserialize and store MIME-type-to-file-extension mappings from given XML file. + + + The XML file should be in the following format: + + + mime/type + .ext + + + + ]]> + + + + + Initializes new instance of with the specified file path. + + A relative or absolute path to the XML file. + + + + Type of Upstream Gateway + + + + + Traffic should be sent directly to the server + + + + + Traffic should be sent to a manually-specified proxy + + + + + Traffic should be sent to the System-configured proxy + + + + + Proxy should be automatically detected + + + + + A simple Process Type enumeration used by various filtering features + + + + + Include all Processes + + + + + Processes which appear to be Web Browsers + + + + + Processes which appear to NOT be Web Browsers + + + + + Include only traffic where Process ID isn't known (e.g. remote clients) + + + + + When may requests be resent on a new connection? + + + + + The request may always be retried. + + + + + The request may never be retried + + + + + The request may only be resent if the HTTP Method is idempotent. + This SHOULD be the default per HTTP spec, but this appears to break tons of servers. + + + + + Dictionary of all Connectoids, indexed by the Connectoid's Name + + + + + Return the configured default connectoid's proxy information. + + Either proxy information from "DefaultLAN" or the user-specified connectoid + + + + Enumerates all of the connectoids and determines if the bIsHooked field is incorrect. If so, correct the value + and return TRUE to indicate that work was done. + + The Proxy:Port string to look for (e.g. Config.FiddlerListenHostPort) + TRUE if any of the connectoids' Hook state was inaccurate. + + + + Updates all (or CONFIG.sHookConnectionNamed-specified) connectoids to point at the argument-provided proxy information. + + The proxy info to set into the Connectoid + TRUE if updating at least one connectoid was successful + + + + Restore original proxy settings for any connectoid we changed. + + FALSE if any connectoids failed to unhook + + + + Map a local port number to the originating process ID + + The local port number + The originating process ID + + + + Returns a string containing the process listening on a given port + + + + + This class is used to find and create certificates for use in HTTPS interception. + The default implementation (DefaultCertProvider object) uses the Windows Certificate store, + but if a plugin ICertificateProvider is provided, it is used instead. + + + + + Enables specification of a delegate certificate provider that generates certificates for HTTPS interception. + + + + + Lock on this object when TestExistenceOf/Create oCertProvider + + + + + Ensures that the Certificate Generator is ready; thread-safe + + + + + Load a delegate Certificate Provider + + The provider, or null + + + + Removes Fiddler-generated certificates from the Windows certificate store + + + + + Removes Fiddler-generated certificates from the Windows certificate store + + Indicates whether Root certificates should also be cleaned up + + + + Returns the Root certificate that Fiddler uses to generate per-site certificates used for HTTPS interception. + + Returns the root certificate, if present, or null if the root certificate does not exist. + + + + Return the raw byte[]s of the root certificate, or null + + + + + + Request a certificate with the specified SubjectCN + + A string of the form: "www.hostname.com" + A certificate or /null/ if the certificate could not be found or created + + + + Pre-cache a Certificate in the Certificate Maker that should be returned in subsequent calls to FindCert + + The hostname for which this certificate should be returned. + The X509Certificate2 with attached Private Key + TRUE if the Certificate Provider succeeded in pre-caching the certificate. FALSE if Provider doesn't support pre-caching. THROWS if supplied Certificate lacks Private Key. + + + + Pre-cache a Certificate in the Certificate Maker that should be returned in subsequent calls to FindCert + + The hostname for which this certificate should be returned. + The filename of the PFX file containing the certificate and private key + The password for the PFX file + Throws if the Certificate Provider failed to pre-cache the certificate + + + + Determine if the self-signed root certificate exists + + True if the Root certificate returned from GetRootCertificate is non-null, False otherwise. + + + + Is Fiddler's root certificate in the Root store? + + TRUE if so + + + + Is Fiddler's root certificate in the Machine Root store? + + TRUE if so + + + + Create a self-signed root certificate to use as the trust anchor for HTTPS interception certificate chains + + TRUE if successful + + + + Finds the Fiddler root certificate and prompts the user to add it to the TRUSTED store. + Note: The system certificate store is used by most applications (IE, Chrome, etc) but not + all; for instance, Firefox uses its own certificate store. + + True if successful + + + + Dispose of the Certificate Provider, if any. + + + + + The ClientChatter object, exposed as the oRequest object on the Session object, represents a single web request. + + + + + Size of buffer passed to pipe.Receive when reading from the client. + + + + + Discardable State of Read Operation + + While it is reading a request from the client, the ClientChatter class uses a RequestReaderState object to track + the state of the read. This state is discarded when the request has been completely read. + + + + + The Host pulled from the URI + + + + + Buffer holds this request's data as it is read from the pipe. + + + + + Offset to first byte of body in m_requestData + + + + + Optimization: Offset of most recent transfer-encoded chunk + + + + + Optimization: tracks how far we've previously looked when determining iEntityBodyOffset + + + + + Did the request specify Transfer-Encoding: chunked + + + + + The integer value of the Content-Length header, if any + + + + + Count of body bytes read from the client. If no body bytes have yet been read, returns count of header bytes. + + + + + + Scans requestData stream for the \r\n\r\n (or variants) sequence + which indicates that the header block is complete. + + SIDE EFFECTS: + iBodySeekProgress is updated and maintained across calls to this function + iEntityBodyOffset is updated if the end of headers is found + + True, if requestData contains a full set of headers + + + + Tracks the progress of reading the request from the client. Because of the multi-threaded nature + of some users of this field, most will make a local copy before accessing its members. + + + + + The ClientPipe object which is connected to the client, or null. + + + + + Parsed Headers + + + + + The Session object which owns this ClientChatter + + + + + Returns the port on which Fiddler read the request (typically 8888) + + + + + Count of body bytes read from the client. If no body bytes have yet been read, returns count of header bytes. + + + + + HTTP Headers sent in the client request, or null. + + + + + Was this request received from a reused client connection? Looks at SessionFlags.ClientPipeReused flag on owning Session. + + + + + Note: This returns the request's HOST header, which may include a trailing port #. + If the Host is an IPv6 literal, it will be enclosed in brackets '[' and ']' + + + + + Controls whether the request body is streamed to the server as it is read from the client. + + + + + Create a ClientChatter object initialized with a set of HTTP headers + Called primarily when loading session data from a file. + + The Session object which will own this request + The string containing the request data + + + + Loads a HTTP request body from a file rather than a memory stream. + + The file to load + TRUE if the file existed. THROWS on most errors other than File-Not-Found + + + + Based on this session's data, determine the expected Transfer-Size of the request body. See RFC2616 Section 4.4 Message Length. + Note, there's currently no support for "multipart/byteranges" requests anywhere in Fiddler. + + Expected Transfer-Size of the body, in bytes. + + + + Free Request data. Called by TakeEntity or by ReadRequest method on request failure + + + + + Extract byte array representing the entity, put any excess bytes back in the pipe, free the RequestReadState, and + return the entity. + + Byte array containing the entity body + + + + Simple indexer into the Request Headers object + + + + + Send a HTTP/XXX Error Message to the Client, calling FiddlerApplication.BeforeReturningError and DoReturningError in FiddlerScript. + Note: This method does not poison the Server pipe, so if poisoning is desired, it's the caller's responsibility to do that. + Note: Because this method uses Connection: close on the returned response, it has the effect of poisoning the client pipe + + Response code + Response status text + Body of the HTTP Response + + + + Return a HTTP response and signal that the client should close the connection + + A Delegate that fires to give one final chance to modify the Session before + calling the DoBeforeReturningError and returning the response + + + + Parse the headers from the requestData buffer. + Precondition: Call AFTER having set the correct iEntityBodyOffset. + + Note: This code used to be a lot simpler before, when it used strings instead of byte[]s. Sadly, + we've gotta use byte[]s to ensure nothing in the URI gets lost. + + TRUE if successful. + + + + This function decides if the request string represents a complete HTTP request + + + + + + Read a (usually complete) request from pipeClient. If RequestStreamed flag is set, only the headers have been read. + + TRUE, if a request could be read. FALSE, otherwise. + + + + Verifies that the Hostname specified in the request line is compatible with the HOST header + + + + + The CONFIG object is Fiddler's legacy settings object, introduced before the advent of the Preferences system. + + + + + Underlying Preferences container whose IFiddlerPreferences interface is + exposed by the FiddlerApplication.Prefs property. + + + + + Generally, callers should use FiddlerApplication.Prefs, but RawPrefs allows use of the PreferenceBag members that + are not a part of IFiddlerPreferences + + + + + Response files larger than this (2^28 = ~262mb) will NOT be loaded into memory when using LoadResponseFromFile + + + + + Backing field for the QuietMode property. Controls whether notifications are displayed in a MessageBox. + NB: KEEP THIS FIELD DECLARED AT THE TOP OF THE CLASS. We initialize some fields using methods that can check this field. + + + + + Cached layout info for columns. + + + + + Control which processes have HTTPS traffic decryption enabled + + + + + True if this is a "Viewer" instance of Fiddler that will not persist its settings. Exposed as FiddlerApplication.IsViewerMode + + + TODO: ARCH: This setting shouldn't exist in FiddlerCore, but it's used in a dozen places + + + + TODO: Why is this defaulted to FALSE? Has been since 2009, probably due to some bug. Should keep better records. (Sigh). + + + + + Boolean controls whether Fiddler should map inbound connections to their original process using IPHLPAPI + + + + + Controls whether Fiddler should attempt to decrypt HTTPS Traffic + + + + + Boolean controls whether Fiddler will attempt to use the Server Name Indicator TLS extension to generate the SubjectCN for certificates + + + + + Should Audio/Video types automatically stream by default? + + + + + Returns 127.0.0.1:{ListenPort} or fiddler.network.proxy.RegistrationHostName:{ListenPort} + + + + + Use 128bit AES Encryption when password-protecting .SAZ files. Note that, while this + encryption is much stronger than the default encryption algorithm, it is significantly + slower to save and load these files, and the Windows Explorer ZIP utility cannot open them. + + + + + SSL/TLS Protocols we allow the client to choose from (when we call AuthenticateAsServer) + We allow all protocols by default (Ssl2,Ssl3,Tls1) and also 'Bitwise OR' in the constants for TLS1.1 and TLS1.2 in case we happen to be running on .NET4.5. + + + + + SSL/TLS Protocols we request the server use (when we call AuthenticateAsClient). By default, SSL3 and TLS1 are accepted; we exclude SSL2 so that TLS Extensions may be sent. + We do NOT enable TLS1.1 or TLS1.2 by default because many servers will fail if you offer them and unlike browsers, .NET has no fallback code. + + + + + When True, Fiddler will offer the latest TLS protocol version offered by the client in its request + + + + + Version information for the Fiddler/FiddlerCore assembly + + + + + Will send traffic to an upstream proxy? + OBSOLETE -- DO NOT USE. see instead. + + + + + Gets a value indicating what mechanism, if any, will be used to find the upstream proxy/gateway. + + + + + The encoding with which HTTP Headers should be parsed. Defaults to UTF8, but may be overridden by specifying a REG_SZ containing the encoding name in the registry key \Fiddler2\HeaderEncoding + + + + + Controls whether Fiddler will reuse server connections for multiple sessions + + + + + Controls whether Fiddler will reuse client connections for multiple sessions + + + + + Controls whether Fiddler should register as the HTTPS proxy + + + + + Controls whether Fiddler should register as the FTP proxy + + + + + Controls whether Fiddler will try to write exceptions to the System Event log. Note: Usually fails due to ACLs on the Event Log. + + + + + Controls whether Fiddler will attempt to log on to the upstream proxy server to download the proxy configuration script + + + + + Controls whether Fiddler will attempt to connect to IPv6 addresses + + + + + Name of connection to which Fiddler should autoattach if MonitorAllConnections is not set + + + + + The username to send to the upstream gateway if the Version Checking webservice request requires authentication + + + + + The password to send to the upstream gateway if the Version Checking webservice request requires authentication + + + + + Set this flag if m_ListenPort is a "temporary" port (E.g. specified on command-line) and it shouldn't be overridden in the registry + + + + + Controls whether Certificate-Generation output will be spewed to the Fiddler Log + + + + + Port to which Fiddler should forward inbound requests when configured to run as a Reverse Proxy + + + + + Alternative hostname which Fiddler should recognize as an alias for the local machine. The + default value of ? will never be usable, as it's the QueryString delimiter + + + + + (Lowercase) Machine Name + + + + + (Lowercase) Machine Domain Name + + + + + On attach, will configure WinINET to bypass Fiddler for these hosts. + + + + + List of hostnames for which HTTPS decryption (if enabled) should be skipped + + + + + True if Fiddler should be maximized on restart + + + + + Boolean indicating whether Fiddler will open the listening port exclusively + + + + + Controls whether server certificate errors are ignored when decrypting HTTPS traffic. + + + + + Controls whether notification dialogs and prompts should be shown. + + + + + The port upon which Fiddler is configured to listen. + + + + + Return a Special URL. + + String constant describing the URL to return. CASE-SENSITIVE! + Returns target URL + + + + Get a registry path for a named constant + + The path to retrieve [Root, UI, Dynamic, Prefs] + The registry path + + + + Return an app path (ending in Path.DirectorySeparatorChar) or a filename + + CASE-SENSITIVE + The specified filesystem path + + + + Returns the path and filename of the editor used to edit the Rules script file. + + + + + Returns true if Fiddler should permit remote connections. Requires restart. + + + + + Ensure that the per-user folders used by Fiddler are present. + + + + + Loads Preferences from the Registry and fills appropriate fields + + + + + Interface for the WebSocket and CONNECT Tunnel classes + + + + + The CONNECTTunnel class represents a "blind tunnel" through which a CONNECT request is serviced to shuffle bytes between a client and the server. + + + See pg 206 in HTTP: The Complete Reference for details on how Tunnels work. + When HTTPS Decryption is disabled, Fiddler accepts a CONNECT request from the client. Then, we open a connection to the remote server. + We shuttle bytes back and forth between the client and the server in this tunnel, keeping Fiddler itself out of the loop + (no tampering, etc). + + + + + Number of bytes received from the client + + + + + Number of bytes received from the server + + + + + TRUE if this is a Blind tunnel, FALSE if decrypting + + + + + Returns number of bytes sent from the Server to the Client + + + + + Returns number of bytes sent from the Client to the Server + + + + + This "Factory" method creates a new HTTPS Tunnel and executes it on a background (non-pooled) thread. + + The Session containing the HTTP CONNECT request + + + + Creates a HTTPS tunnel. External callers instead use the CreateTunnel static method. + + The session for which this tunnel was initially created. + Client Pipe + Server Pipe + + + + This function keeps the thread alive until it is signaled that the traffic is complete + + + + + Executes the HTTPS tunnel inside an All-it-can-eat exception handler. + Call from a background thread. + + + + + Close the HTTPS tunnel and signal the event to let the service thread die. + WARNING: This MUST not be allowed to throw any exceptions, because it will do so on threads that don't catch them, and this will kill the application. + + + + + Called when we have received data from the local client. + Incoming data will immediately be forwarded to the remote host. + + The result of the asynchronous operation. + + + Called when we have sent data to the local client.
When all the data has been sent, we will start receiving again from the remote host.
+ The result of the asynchronous operation. +
+ + Called when we have sent data to the remote host.
When all the data has been sent, we will start receiving again from the local client.
+ The result of the asynchronous operation. +
+ + Called when we have received data from the remote host.
Incoming data will immediately be forwarded to the local client.
+ The result of the asynchronous operation. +
+ + + [DEPRECATED] Use the BCCertMaker instead. + This is the default Fiddler certificate provider. + + + + + CertEnroll is an ActiveX Control available on Windows Vista and later that allows programmatic generation of X509 certificates. + We can use it as an alternative to MakeCert.exe; it offers better behavior (e.g. setting AKID) and doesn't require redistributing makecert.exe + + + + + Factory method. Returns null if this engine cannot be created + + + + + Invoke CertEnroll + + Target CN + TRUE if the certificate is a root cert + TRUE if we should validate that we're running in a MTA thread and switch if not + A Cert + + + + Factory method. Returns null if this engine cannot be created + + + + + File path pointing to the location of MakeCert.exe + + + + + Hash to use when signing certificates. + Note: sha1 is required on XP (even w/SP3, using sha256 throws 0x80090008). + + + + + Constructor: Simply cache the path to MakeCert + + + + + The underlying Certificate Generator (MakeCert or CertEnroll) + + + + + Cache of previously-generated EE certificates. Thread safety managed by _oRWLock + + + + + Cache of previously-generated Root certificate + + + + + Should Fiddler automatically generate wildcard certificates? + + + + + Reader/Writer lock gates access to the certificate cache and generation functions. + + We must set the SupportsRecursion flag because there are cases where the thread holds the lock in Write mode and then enters Read mode in a nested call. + + + + Find certificates that have the specified full subject. + + The store to search + FindBySubject{Distinguished}Name requires a complete match of the SUBJECT, including CN, O, and OU + Matching certificates + + + + Find all certificates (in the CurrentUser Personal store) that have the specified issuer. + + The store to search + FindByIssuer{Distinguished}Name requires a complete match of the SUBJECT, including CN, O, and OU + Matching certificates + + + + Interface method: Clear the in-memory caches and Windows certificate stores + + TRUE to clear the Root Certificate from the cache and Windows stores + TRUE if successful + + + + Interface method: Clear the in-memory caches and Windows certificate stores + + + + + + Use MakeCert to generate a unique self-signed certificate + + TRUE if the Root certificate was generated successfully + + + + Get the root certificate from cache or storage, only IF IT ALREADY EXISTS. + + + + + + Returns an Interception certificate for the specified hostname + + Hostname for the target certificate + This method uses a Reader lock when checking the cache and a Writer lock when updating the cache. + An Interception Certificate, or NULL + + + + Find a certificate from the certificate store, creating a new certificate if it was not found. + + A SubjectCN hostname, of the form www.example.com + TRUE if the cert wasn't found in the Windows Certificate store and this function attempted to create it. + No locks are acquired by this method itself. + A certificate or /null/ + + + + Find (but do not create!) a certificate from the CurrentUser certificate store, if present. + + No locks are acquired by this method itself. + A certificate or /null/ + + + + Updates the Server Certificate cache under the Writer lock + + The target hostname + The certificate to cache + + + + + Creates a certificate for ServerAuth. If isRoot is set, designates that this is a self-signed root. + + Uses a reader lock when checking for the Root certificate. Uses a Writer lock when creating a certificate. + A string of the form: "www.hostname.com" + A boolean indicating if this is a request to create the root certificate + Newly-created certificate, or Null + + + + Cache of Hostname->Address mappings + + + + + Number of milliseconds that a DNS cache entry may be reused without validation. + + + + + Maximum number of A/AAAA records to cache for DNS entries. + Beware: Changing this number changes how many IP-failovers Fiddler will perform if fiddler.network.dns.fallback is set, + and increasing the number will consume more memory in the cache. + + + + + Clear the DNS Cache. Called by the NetworkChange event handler in the oProxy object + + + + + Remove all expired DNSCache entries; called by the Janitor + + + + + Show the contents of the DNS Resolver cache + + + + + + Gets first available IP Address from DNS. Throws if address not found! + + String containing the host + True to use Fiddler's DNS cache. + IPAddress of target, if found. + + + + Gets IP Addresses for host from DNS. Throws if address not found! + + String containing the host + True to use Fiddler's DNS cache. + The Timers object to which the DNS lookup time should be stored, or null + List of IPAddresses of target, if any found. + + + + Trim an address list, removing the duplicate entries, any IPv6-entries if IPv6 is disabled, + and entries beyond the COUNT_MAX_A_RECORDS limit. + + The list to filter + A filtered address list + + + + A DNSCacheEntry holds a cached resolution from the DNS + + + + + TickCount of this record's creation + + + + + IPAddresses for this hostname + + + + + Construct a new cache entry + + The address information to add to the cache + + + + Attribute used to specify the minimum version of Fiddler compatible with this extension assembly. + + + + + Attribute used to specify the minimum version of Fiddler compatible with this extension assembly. + + The minimal version string (e.g. "2.2.8.8") + + + + Getter for the required version string + + + + + Attribute allowing developer to specify that a class supports the specified Import/Export Format. + + + + + Attribute allowing developer to specify that a class supports the specified Import/Export Format + + Shortname of the Format (e.g. WebText XML) + Description of the format + + + + Attribute allowing developer to specify that a class supports the specified Import/Export Format + + Shortname of the Format (e.g. WebText XML) + Description of the format + Semi-colon delimited file extensions (e.g. ".har;.harx") + + + + Returns the Shortname for this format + + + + + Returns the Description of this format + + + + + This tuple maps a display descriptive string to a Import/Export type. + (The parent dictionary contains the shortname string) + + + + + Textual description of the Format + + + + + Class implementing the format + + + + + All metadata about the provider + + + + + Create a new Transcoder Tuple + + Proffer format description + Type implementing this format + + + + ISessionImport allows loading of Session data + + + + + Import Sessions from a data source + + Shortname of the format + Dictionary of options that the Importer class may use + Callback event on which progress is reported or the host may cancel + Array of Session objects imported from source + + + + ISessionExport allows saving of Session data + + + + + Export Sessions to a data store + + Shortname of the format + Array of Sessions being exported + Dictionary of options that the Exporter class may use + Callback event on which progress is reported or the host may cancel + TRUE if the export was successful + + + + EventArgs class for the ISessionImporter and ISessionExporter interface callbacks + + + + + Set to TRUE to request that Import/Export process be aborted as soon as convenient + + + + + Progress Callback + + Float indicating completion ratio, 0.0 to 1.0. Set to 0 if unknown. + Short string describing current operation, progress, etc + + + + The string message of the notification + + + + + The percentage completed + + + + + Implement ICertificateProvider2 instead + + + + + Return a certificate to secure this traffic. Generally, it's expected that this method WILL create a new certificate if needed. + + Hostname (e.g. "www.example.com") + An X509Certificate, or null on error + + + + Return the root certificate to which Host Certificates are chained. Generally, it's expected that this method will NOT create a root certificate. + + An X509Certificate, or null on error + + + + When this method is called, your extension should create a Root certificate. + + TRUE if the operation was successful + + + + When this method is called, your extension should copy the your Root certificate into + the user's (or machines's) Root certificate store. + + TRUE if the operation was successful + + + + When this method is called, your extension should discard all certificates and + clear any certificates that have been added to the user's certificate store. + + TRUE, if all certificates were removed; FALSE if any certificates were preserved + + + + When this method is called, your extension should check to see if the User or Machine Root + certificate store contains your Root certificate. + + Set to TRUE if StoreLocation.CurrentUser StoreName.Root has the certificate + Set to TRUE if StoreLocation.LocalMachine StoreName.Root has the certificate + TRUE if either bUserTrusted or bMachineTrusted + + + + To override default certificate handling, your class should implement this interface in an assembly + referenced by the fiddler.certmaker.assembly preference; by default, "certmaker.dll" in the application + folder is loaded + + + + + When this method is called, your extension should discard all certificates and + clear any certificates that have been added to the user's certificate store + + TRUE if the root certificate should also be cleared + TRUE, if all certificates were removed; FALSE if any certificates were preserved + + + + Call this function to cache a certificate in the Certificate Provider + + The hostname to match + The certificate that the Provider should later provide when GetCertificateForHost is called + True if the request was successful + + + + Copy of the cache of the EndEntity certificates that have been generated in this session. + + + + + When this method is called, your extension should read the root certificate and its private key from a stream. + + The stream. + The password which is used to protect the private key. Could be null or empty if the private key is not protected. + The alias for the certificate and the private key. Could be null. + + + + When this method is called, your extension should write the root certificate and its private key to a stream. + + The stream. + The password protecting the private key. If null or empty, the private key is written unprotected. + The alias for the certificate and the private key. If null, a random alias could be created. + + + + When this method is called, your extension should write the root certificate without the private key to a stream. + + The stream. + + + + When this method is called, your extension should read the root certificate and its private key from the PKCS#12 file(.pfx | .p12). + + The filename of the PKCS#12 file (.pfx | .p12). + The password which is used to protect the private key. Could be null or empty if the private key is not protected. + The alias for the certificate and the private key. Could be null. + + + + When this method is called, your extension should write the root certificate and its private key to a PKCS#12 file(.pfx | .p12). + + The filename of the PKCS#12 file (.pfx | .p12). + The password which is used to protect the private key. If null or empty, the private key is written unprotected. + The alias for the certificate and the private key. If null, a random alias could be created. + + + + When this method is called, your extension should write the root certificate without the private key to a DER encoded file(.cer | .crt | .der). + + The filename of the DER encoded file (.cer | .crt | .der) + + + + Return a string describing the current configuration of the Certificate Provider. For instance, list + the configured key size, hash algorithms, etc. + + + + + Show a configuration dialog that allows user to control options related to your Certificate Provider, + for instance, the configured key size, hash algorithm, etc. + + Owning Window Handle + + + + Fiddler Transcoders allow import and export of Sessions from Fiddler + + + + + Create the FiddlerTranscoders object + + + + + True if one or more classes implementing ISessionImporter are available. + + + + + List all of the Transcoder objects that are loaded + + + + + + True if one or more classes implementing ISessionImporter are available. + + + + + Add Import/Export encoders to FiddlerApplication.oTranscoders + + Assembly to import exporters and importers + FALSE on obvious errors + + + + Add Import/Export encoders to FiddlerApplication.oTranscoders + + Assembly to scan for transcoders + FALSE on obvious errors + + + + Loads any assembly in the specified path that ends with .dll and does not start with "_", checks that a compatible version requirement was specified, + and adds the importer and exporters within to the collection. + + The path to scan for extensions + + + + Ensures that Import/Export Transcoders have been loaded + + + + + Returns a TranscoderTuple willing to handle the specified format + + The Format + TranscoderTuple, or null + + + + Returns a TranscoderTuple willing to handle the specified format + + The Format + TranscoderTuple, or null + + + + Gets the format list of the specified type and adds that type to the collection. + + + + TRUE if any formats were found; FALSE otherwise + + + + Clear Importer and Exporter collections + + + + + The IFiddlerPreferences Interface is exposed by the FiddlerApplication.Prefs object, and enables + callers to Add, Update, and Remove preferences, as well as observe changes to the preferences. + + + + + Store a boolean value for a preference + + The named preference + The boolean value to store + + + + Store an Int32 value for a preference + + The named preference + The int32 value to store + + + + Store a string value for a preference + + The named preference + The string value to store + + + + Store multiple preferences. + + An enumeration of the preferences' names and values to store. + + + + Get a preference's value as a boolean + + The Preference Name + The default value for missing or invalid preferences + A Boolean + + + + Gets a preference's value as a string + + The Preference Name + The default value for missing preferences + A string + + + + Gets a preference's value as a 32-bit integer + + The Preference Name + The default value for missing or invalid preferences + An integer + + + + Removes a named preference from storage + + The name of the preference to remove + + + + Add a Watcher that will be notified when a value has changed within the specified prefix. + + The prefix of preferences for which changes are interesting + The Event handler to notify + Returns the Watcher object added to the notification list + + + + Removes a previously-created preference Watcher from the notification queue + + The Watcher to remove + + + + Indexer. Returns the value of the preference as a string + + The Preference Name + The Preference value as a string, or null + + + + EventArgs for preference-change events. See http://msdn.microsoft.com/en-us/library/ms229011.aspx. + + + + + The name of the preference being added, changed, or removed + + + + + The string value of the preference, or null if the preference is being removed + + + + + Returns TRUE if ValueString=="true", case-insensitively + + + + + The PreferenceBag is used to maintain a threadsafe Key/Value list of preferences, persisted in the registry, and with appropriate eventing when a value changes. + + + + + Returns a string naming the current profile + + + + + Indexer into the Preference collection. + + The name of the Preference to update/create or return. + The string value of the preference, or null. + + + + Get a string array of the preference names + + string[] of preference names + + + + Gets a preference's value as a string + + The Preference Name + The default value if the preference is missing + A string + + + + Return a bool preference. + + The Preference name + The default value to return if the specified preference does not exist + The boolean value of the Preference, or the default value + + + + Return an Int32 Preference. + + The Preference name + The default value to return if the specified preference does not exist + The Int32 value of the Preference, or the default value + + + + Update or create a string preference. + + The name of the Preference + The value to assign to the Preference + + + + Update or create a Int32 Preference + + The name of the Preference + The value to assign to the Preference + + + + Update or create a Boolean preference. + + The name of the Preference + The value to assign to the Preference + + + + Update or create multiple preferences. + + An enumeration of the preferences' names and values to store. + + + + Delete a Preference from the collection. + + The name of the Preference to be removed. + + + + Remove all Watchers + + + + + Remove all watchers and write the registry. + + + + + Return a description of the contents of the preference bag + + Multi-line string + + + + Return a string-based serialization of the Preferences settings. + + TRUE for a multi-line format with all preferences + String + + + + Returns a CRLF-delimited string containing all Preferences whose Name case-insensitively contains the specified filter string. + + Partial string to match + A string + + + + A simple struct which contains a Branch identifier and EventHandler + + + + + Add a watcher for changes to the specified preference or preference branch. + + Preference branch to monitor, or String.Empty to watch all + The EventHandler accepting PrefChangeEventArgs to notify + Returns the PrefWatcher object which has been added, store to pass to RemoveWatcher later. + + + + Remove a previously attached Watcher + + The previously-specified Watcher + + + + This function executes on a single background thread and notifies any registered + Watchers of changes in preferences they care about. + + A string containing the name of the Branch that changed + + + + Spawn a background thread to notify any interested Watchers of changes to the Target preference branch. + + The arguments to pass to the interested Watchers + + + + Use this method to ensure that the passed protocols are consecutive. It is done by adding missing + protocols from the sequence, thus filling the gaps, if any. Works only with Tls, Tls11 and Tls12. + + + Passed protocols: Tls, Tls12 + Return value: Tls, Tls11, Tls12 + + The input SSL protocols + Consecutive version of the input SSL protocols + + + + CodeDescription attributes are used to enable the FiddlerScript Editor to describe available methods, properties, fields, and events. + + + + + CodeDescription attributes should be constructed by annotating a property, method, or field. + + The descriptive string which should be displayed for this this property, method, or field + + + + The descriptive string which should be displayed for this this property, method, or field + + + + + A simple delegate for functions which accept no parameters. (MethodInvoker is the identical Framework version of this delegate) + + + + + An event handling delegate which is called during report calculation with the set of sessions being evaluated. + + The sessions in this report. + + + + An event handling delegate which is called as a part of the HTTP pipeline at various stages. + + The Web Session in the pipeline. + + + + This class acts as the central point for script/extensions to interact with Fiddler components. + + + + + TRUE if Fiddler is currently shutting down. Suspend all work that won't have side-effects. + + + + + The default certificate used for client authentication + + + + + Fiddler's logging system + + + + + Fiddler's "Janitor" clears up unneeded resources (e.g. server sockets, DNS entries) + + + + + Fiddler's Preferences collection. Learn more at http://fiddler.wikidot.com/prefs + + + + + Gets Fiddler* version info + + A string indicating the build/flavor of the Fiddler* assembly + + + + Set the DisplayName for the application + + 1 to 64 character name to be displayed in error messages, etc + + + + Fiddler's core proxy object. + + + + + By setting this property you can provide Telerik Fiddler Core with custom MIME-type-to-file-extension mappings. + + + + + Fiddler Import/Export Transcoders + + + + + This event fires when the user instructs Fiddler to clear the cache or cookies + + + + + This event fires each time FiddlerCore reads data from network for the server's response. Note that this data + is not formatted in any way, and must be parsed by the recipient. + + + + + This event fires each time FiddlerCore reads data from network for the client's request. Note that this data + is not formatted in any way, and must be parsed by the recipient. + + + + + This event fires when a client request is received by Fiddler + + + + + This event fires when a server response is received by Fiddler + + + + + This event fires when Request Headers are available + + + + + This event fires when Response Headers are available + + + + + This event fires when an error response is generated by Fiddler + + + + + This event fires when Fiddler captures a WebSocket message + + + + + This event fires when a session has been completed + + + + + This event fires when a user notification would be shown. See CONFIG.QuietMode property. + + + + + This event fires when Fiddler evaluates the validity of a server-provided certificate. Adjust the value of the ValidityState property if desired. + + + + + Sync this event to be notified when FiddlerCore has attached as the system proxy.")] + + + + + Sync this event to be notified when FiddlerCore has detached as the system proxy. + + + + + List of "leaked" temporary files to be deleted as Fiddler exits. + + + + + Checks if FiddlerCore is running. + + TRUE if FiddlerCore is started/listening; FALSE otherwise. + + + + Checks if FiddlerCore is running and registered as the System Proxy. + + TRUE if FiddlerCore IsStarted AND registered as the system proxy; FALSE otherwise. + + + + Recommended way to Start FiddlerCore. + + + + + + Start a new proxy endpoint instance, listening on the specified port + + The port to listen on + TRUE if remote clients should be permitted to connect to this endpoint + A Hostname (e.g. EXAMPLE.com) if this endpoint should be treated as a HTTPS Server + A Proxy object, or null if unsuccessful + + + + Start a new proxy endpoint instance, listening on the specified port + + The port to listen on + TRUE if remote clients should be permitted to connect to this endpoint + A certificate to return when clients connect, or null + A Proxy object, or null if unsuccessful + + + + Shuts down the FiddlerCore proxy and disposes it. Note: If there's any traffic in progress while you're calling this method, + your background threads are likely to blow up with ObjectDisposedExceptions or NullReferenceExceptions. In many cases, you're + better off simply calling oProxy.Detach() and letting the garbage collector clean up when your program exits. + + + + + Notify a listener that a block of a response was read. + + The session for which the response is being read + byte buffer (not completely full) + bytes set. + FALSE if AbortReading was set + + + + Notify a listener that a block of a request was read. Note that this event may fire with overlapping blocks of data but + different sessions if the client uses HTTP Pipelining. + + The session for which the response is being read + byte buffer (not completely full) + bytes set. + FALSE if AbortReading was set + + + + Export Sessions in the specified format + + Shortname of desired format + Sessions to export + Options to pass to the ISessionExport interface + Your callback event handler, or NULL to allow Fiddler to handle + TRUE if successful, FALSE if desired format doesn't exist or other error occurs + + + + Calls a Fiddler Session Importer and returns the list of loaded Sessions. + + String naming the Import format, e.g. HTTPArchive + Should sessions be added to WebSessions list? (Not meaningful for FiddlerCore) + Dictionary of Options to pass to the Transcoder + Your callback event handler, or NULL to allow Fiddler to handle + Callback that is used to request passwords from the host if needed + Loaded Session[], or null on Failure + + + + Reset the SessionID counter to 0. This method can lead to confusing UI, so call sparingly. + + + + + Log a notification to the OnNotification handler and, if not in quiet mode, show a MessageBox + + Window to which this notification should be parented, or null + Text in the Window + Title of the Window + Icon for the window + + + + Report an exception to the user. + + The Exception + The Title of the dialog + + + + Report an exception to the user. + + The Exception + The Title of the dialog + The intro text to show. If null or empty, the default "Fiddler has encountered an unexpected... " message is shown. + + + + Show the user a message when an HTTP Error was encountered + + Session with error + Set to true to prevent pooling/reuse of client connection + The SessionFlag which should be set to log this violation + Set to true to prevent pooling/reuse of server connection + Information about the problem + + + + Process ID of this Fiddler instance + + + + + processname:PID of Fiddler + + + + + We really don't want this method to get inlined, because that would cause the Xceed DLLs to get loaded in the Main() function instead + of when _SetXceedLicenseKeys is called; that, in turn, would delay the SplashScreen. + + + + + Used to track errors with addons. + + + + + + + Record that a temporary file was created and handed to an external tool. We'll do our best to delete this file on exit. + + The filename of the file to be deleted + + + + Clean up any Temporary files that were created + + + + + Fired each time Fiddler successfully establishes a TCP/IP connection + + + + + Fired each time Fiddler successfully accepts a TCP/IP connection + + + + + Does this Fiddler instance support the specified feature? + + Feature name (e.g. "bzip2") + TRUE if the specified feature is supported; false otherwise + + + + The Socket which was just Connected or Accepted + + + + + The Session which owns the this new connection + + + + + EventArgs class for the OnNotification handler + + + + + The string message of the notification + + + + + Enumeration of possible responses specified by the ValidateServerCertificateEventArgs as modified by FiddlerApplication's OnValidateServerCertificate event + + + + + The certificate will be considered valid if CertificatePolicyErrors == SslPolicyErrors.None, otherwise the certificate will be invalid unless the user manually allows the certificate. + + + + + The certificate will be confirmed with the user even if CertificatePolicyErrors == SslPolicyErrors.None. + Note: FiddlerCore does not support user-prompting and will always treat this status as ForceInvalid. + + + + + Force the certificate to be considered Invalid, regardless of the value of CertificatePolicyErrors. + + + + + Force the certificate to be considered Valid, regardless of the value of CertificatePolicyErrors. + + + + + These EventArgs are passed to the FiddlerApplication.OnValidateServerCertificate event handler when a server-provided HTTPS certificate is evaluated + + + + + EventArgs for the ValidateServerCertificateEvent that allows host to override default certificate handling policy + + The session + The CN expected for this session + The certificate provided by the server + The certificate chain of that certificate + Errors from default validation + + + + The port to which this request was targeted + + + + + The SubjectCN (e.g. Hostname) that should be expected on this HTTPS connection, based on the request's Host property. + + + + + The Session for which a HTTPS certificate was received. + + + + + The server's certificate chain. + + + + + The SslPolicyErrors found during default certificate evaluation. + + + + + Set this property to override the certificate validity + + + + + The X509Certificate provided by the server to vouch for its authenticity + + + + + These EventArgs are constructed when FiddlerApplication.OnClearCache is called. + + + + + True if the user wants cache files to be cleared + + + + + True if the user wants cookies to be cleared + + + + + Constructs the Event Args + + Should Cache Files be cleared? + Should Cookies be cleared? + + + + When the FiddlerApplication.OnReadResponseBuffer event fires, the raw bytes are available via this object. + + + + + Set to TRUE to request that upload or download process be aborted as soon as convenient + + + + + Session for which this responseRead is occurring + + + + + Byte buffer returned from read. Note: Always of fixed size, check iCountOfBytes to see which bytes were set + + + + + Count of latest read from Socket. If less than 1, response was ended. + + + + + This FTP Gateway class is used if Fiddler is configured as the FTP proxy and there's no upstream gateway configured. + Fiddler must act as a HTTP->FTP protocol converter, which it does by using the .NET FTP classes. + + + + + Make a FTP request using the .NET FTPWebRequest class. + WARNING: This method will throw. + + Session bearing an FTP request + Returns Response body stream + Returns generated Response headers + + + + The GenericTunnel class represents a "blind tunnel" to shuffle bytes between a client and the server. + + + + + Is streaming started in the downstream direction? + + + + + Number of bytes received from the client + + + + + Number of bytes received from the server + + + + + Returns number of bytes sent from the Server to the Client + + + + + Returns number of bytes sent from the Client to the Server + + + + + This "Factory" method creates a new HTTPS Tunnel and executes it on a background (non-pooled) thread. + + The Session containing the HTTP CONNECT request + + + + Creates a tunnel. External callers instead use the CreateTunnel static method. + + The session for which this tunnel was initially created. + Client Pipe + Server Pipe + + + + This function keeps the thread alive until it is signaled that the traffic is complete + + + + + Executes the HTTPS tunnel inside an All-it-can-eat exception handler. + Call from a background thread. + + + + + Executes the WebSocket tunnel on a background thread + + + + + Instructs the tunnel to take over the server pipe and begin streaming responses to the client + + + + + Close the HTTPS tunnel and signal the event to let the service thread die. + WARNING: This MUST not be allowed to throw any exceptions, because it will do so on threads that don't catch them, and this will kill the application. + + + + + Called when we have received data from the local client. + Incoming data will immediately be forwarded to the remote host. + + The result of the asynchronous operation. + + + Called when we have sent data to the local client.
When all the data has been sent, we will start receiving again from the remote host.
+ The result of the asynchronous operation. +
+ + Called when we have sent data to the remote host.
When all the data has been sent, we will start receiving again from the local client.
+ The result of the asynchronous operation. +
+ + Called when we have received data from the remote host.
Incoming data will immediately be forwarded to the local client.
+ The result of the asynchronous operation. +
+ + + The HostList allows fast determination of whether a given host is in the list. It supports leading wildcards (e.g. *.foo.com), and the special tokens <local> <nonlocal> and <loopback>. + Note: List is *not* threadsafe; instead of updating it, construct a new one. + + + + + This private tuple allows us to associate a Hostname and a Port + + + + + Port specified in the rule + + + + + Hostname specified in the rule + + + + + Create a new HostPortTuple + + + + + Generate an empty HostList + + + + + Create a hostlist and assign it an initial set of sites + + List of hostnames, including leading wildcards, and optional port specifier. Special tokens are *, <local>, <nonlocal>, and <loopback>. + + + + Clear the HostList + + + + + Clear the List and assign the new string as the contents of the list. + + List of hostnames, including leading wildcards, and optional port specifier. Special tokens are *, <local>, <nonlocal>, and <loopback>. + TRUE if the list was constructed without errors + + + + Clear the list and assign the new string as the contents of the list. + + List of hostnames, including leading wildcards, and optional port specifier. Special tokens are *, <local>, <nonlocal>, and <loopback>. + Outparam string containing list of parsing errors + TRUE if the list was constructed without errors + + + + Return the current list of rules as a string + + String containing current rules, using "; " as a delimiter between entries + + + + Determine if a given Host is in the list + + A Host string, potentially including a port + TRUE if the Host's hostname matches a rule in the list + + + + Determine if a given Hostname is in the list + + A hostname, NOT including a port + TRUE if the hostname matches a rule in the list + + + + Determine if a given Host:Port pair matches an entry in the list + + A hostname, NOT including the port + The port + TRUE if the hostname matches a rule in the list + + + + HTTP Response headers object + + + + + Protect your enumeration using GetReaderLock + + + + + Protect your enumeration using GetReaderLock + + + + + Clone this HTTPResponseHeaders object and return the result cast to an Object + + The new response headers object, cast to an object + + + + Status code from HTTP Response. If setting, also set HTTPResponseStatus too! + + + + + Code AND Description of Response Status (e.g. '200 OK'). + + + + + Gets or sets the text associated with the response code (e.g. "OK", "Not Found", etc) + + + + + Update the response status code and text + + HTTP Status code (e.g. 401) + HTTP Status text (e.g. "Access Denied") + + + + Constructor for HTTP Response headers object + + + + + Constructor for HTTP Response headers object + + Text encoding to be used for this set of Headers when converting to a byte array + + + + Returns a byte array representing the HTTP headers. + + TRUE if the response status line should be included + TRUE if there should be a trailing \r\n byte sequence included + Byte[] containing the headers + + + + Returns a string containing http headers + + TRUE if the response status line should be included + TRUE if there should be a trailing CRLF included + String containing http headers + + + + Returns a string containing the http headers + + + Returns a string containing http headers with a status line but no trailing CRLF + + + + + Parses a string and assigns the headers parsed to this object + + The header string + TRUE if the operation succeeded, false otherwise + + + + HTTP Request headers object + + + + + Warning: You should protect your enumeration using the GetReaderLock + + + + + Warning: You should protect your enumeration using the GetReaderLock + + + + + Clones the HTTP request headers + + The new HTTPRequestHeaders object, cast to an object + + + + The HTTP Method (e.g. GET, POST, etc) + + + + + Constructor for HTTP Request headers object + + + + + Constructor for HTTP Request headers object + + Text encoding to be used for this set of Headers when converting to a byte array + + + + The (lowercased) URI scheme for this request (https, http, or ftp) + + + + + Username:Password info for FTP URLs. (either null or "user:pass@") + (Note: It's silly that this contains a trailing @, but whatever...) + + + + + Get or set the request path as a string + + + + + Get or set the request path as a byte array + + + + + Parses a string and assigns the headers parsed to this object + + The header string + TRUE if the operation succeeded, false otherwise + + + + Returns a byte array representing the HTTP headers. + + TRUE if the HTTP REQUEST line (method+path+httpversion) should be included + TRUE if there should be a trailing \r\n byte sequence included + TRUE if the SCHEME and HOST should be included in the HTTP REQUEST LINE + The HTTP headers as a byte[] + + + + Returns a byte array representing the HTTP headers. + + TRUE if the HTTP REQUEST line (method+path+httpversion) should be included + TRUE if there should be a trailing \r\n byte sequence included + TRUE if the SCHEME and HOST should be included in the HTTP REQUEST LINE + Only meaningful if prependVerbLine is TRUE, the host to use in the HTTP REQUEST LINE + The HTTP headers as a byte[] + + + + Returns a string representing the HTTP headers. + + TRUE if the HTTP REQUEST line (method+path+httpversion) should be included + TRUE if there should be a trailing CRLF sequence included + TRUE if the SCHEME and HOST should be included in the HTTP REQUEST LINE (Automatically set to FALSE for CONNECT requests) + The HTTP headers as a string. + + + + Returns a string representing the HTTP headers, without the SCHEME+HOST in the HTTP REQUEST line + + TRUE if the HTTP REQUEST line (method+path+httpversion) should be included + TRUE if there should be a trailing CRLF sequence included + The header string + + + + Returns a string representing the HTTP headers, without the SCHEME+HOST in the HTTP request line, and no trailing CRLF + + The header string + + + + Base class for RequestHeaders and ResponseHeaders + + + + + Get the Reader Lock if you plan to enumerate the Storage collection. + + + + + Get the Writer Lock if you plan to change the Storage collection. + NB: You only need this lock if you plan to change the collection itself; you can party on the items in the collection if you like without locking. + + + + + If you get the Writer lock, Free it ASAP or you're going to hang or deadlock the Session + + + + + Text encoding to be used when converting this header object to/from a byte array + + + + + HTTP version (e.g. HTTP/1.1) + + + + + Storage for individual HTTPHeaderItems in this header collection + NB: Using a list is important, as order can matter + + + + + Get byte count of this HTTP header instance. + NOTE: This method should've been abstract. + + Byte Count + + + + Number of HTTP headers + + Number of HTTP headers + + + + Returns all instances of the named header + + Header name + List of instances of the named header + + + + Copies the Headers to a new array. + Prefer this method over the enumerator to avoid cross-thread problems. + + An array containing HTTPHeaderItems + + + + Returns all values of the named header in a single string, delimited by commas + + Header + Each, Header's, Value + + + + Returns the count of instances of the named header + + Header name + Count of instances of the named header + + + + Enumerator for HTTPHeader storage collection + + Enumerator + + + + Gets or sets the value of a header. In the case of Gets, the value of the first header of that name is returned. + If the header does not exist, returns null. + In the case of Sets, the value of the first header of that name is updated. + If the header does not exist, it is added. + + + + + Indexer property. Returns HTTPHeaderItem by index. Throws Exception if index out of bounds + + + + + Adds a new header containing the specified name and value. + + Name of the header to add. + Value of the header. + Returns the newly-created HTTPHeaderItem. + + + + Adds one or more headers + + + + + Returns the Value from a token in the header. Correctly handles double-quoted strings. Requires semicolon for delimiting tokens + Limitation: FAILS if semicolon is in token's value, even if quoted. + FAILS in the case of crazy headers, e.g. Header: Blah="SoughtToken=Blah" SoughtToken=MissedMe + + We really need a "proper" header parser + + Name of the header + Name of the token + Value of the token if present; otherwise, null + + + + Determines if the Headers collection contains a header of the specified name, with any value. + + The name of the header to check. (case insensitive) + True, if the header exists. + + + + Determines if the Headers collection contains any header from the specified list, with any value. + + list of headers + True, if any named header exists. + + + + Determines if the Headers collection contains one or more headers of the specified name, and + sHeaderValue is part of one of those Headers' value. + + The name of the header to check. (case insensitive) + The partial header value. (case insensitive) + True if the header is found and the value case-insensitively contains the parameter + + + + Determines if the Headers collection contains a header of the specified name, and sHeaderValue=Header's value. Similar + to a case-insensitive version of: headers[sHeaderName]==sHeaderValue, although it checks all instances of the named header. + + The name of the header to check. (case insensitive) + The full header value. (case insensitive) + True if the header is found and the value case-insensitively matches the parameter + + + + Removes all headers from the header collection which have the specified name. + + The name of the header to remove. (case insensitive) + + + + Removes all headers from the header collection which have the specified names. + + Array of names of headers to remove. (case insensitive) + + + + Removes a HTTPHeader item from the collection + + The HTTPHeader item to be removed + + + + Removes all HTTPHeader items from the collection + + + + + Renames all headers in the header collection which have the specified name. + + The name of the header to rename. (case insensitive) + The new name for the header. + True if one or more replacements were made. + + + + Represents a single HTTP header + + + + + Clones a single HTTP header and returns the clone cast to an object + + HTTPHeader Name: Value pair, cast to an object + + + + The name of the HTTP header + + + + + The value of the HTTP header + + + + + Creates a new HTTP Header item. WARNING: Doesn't do any trimming or validation on the name. + + Header name + Header value + + + + Return a string of the form "NAME: VALUE" + + "NAME: VALUE" Header string + + + + Utility functions common to parsing both ClientHello and ServerHello messages + + + + + Gets a textual string from a TLS extension + + + + + Builds a string from an ALPN List of strings + + + + + List Sig/Hash pairs from RFC5246 and TLS/1.3 spec + + + + + + + Describes a block of padding, with a friendly summary if all bytes are 0s + https://www.ietf.org/archive/id/draft-agl-tls-padding-03.txt + + + + + List defined Supported Groups & ECC Curves from RFC4492 + + + + + + List defined ECC Point Formats from RFC4492 + + + + + + + Converts a HTTPS version to a "Major.Minor (Friendly)" string + + + + + The HTTPSClientHello class is used to parse the bytes of a HTTPS ClientHello message. + + + + + Map cipher id numbers to names. See http://www.iana.org/assignments/tls-parameters/ + Format is PROTOCOL_KEYAGREEMENT_AUTHENTICATIONMECHANISM_CIPHER_MACPRIMITIVE + + + + + Parse ClientHello from stream. See Page 77 of SSL & TLS Essentials + + + + + Parse a single extension using the list from http://tools.ietf.org/html/rfc6066 + https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xml + https://src.chromium.org/viewvc/chrome/trunk/src/net/third_party/nss/ssl/sslt.h + + + + + + + Did client use ALPN to go to SPDY? + http://tools.ietf.org/html/draft-ietf-tls-applayerprotoneg-01#section-3.1 + + + + + Did this ServerHello Handshake specify an upgrade to SPDY? + + + + + Did this ServerHello Handshake specify an upgrade to SPDY? + + + + + Parse a single extension using the list from http://tools.ietf.org/html/rfc6066 + + + + + + + The Logger object is a simple event log message dispatcher + + + + + The Event to raise when a string is logged + + + + + Queue of Messages that are be logged (usually during application startup) until another object has loaded and registered for notification of such Messages + + + + + Creates a Logger object + + True if a queue should be created to store messages during Fiddler's startup + + + + Flushes previously-queued messages to the newly attached listener. + + + + + Log a string with specified string formatting + + The format string + The arguments to replace in the string + + + + Log a string + + The string to log + + + + EventArgs class for the LogEvent handler + + + + + The String which has been logged + + + + + The MockTunnel represents a CONNECT tunnel which was reloaded from a SAZ file. + + + + + Flags that indicate what problems, if any, were encountered in parsing HTTP headers + + + + + There were no problems parsing the HTTP headers + + + + + The HTTP headers ended incorrectly with \n\n + + + + + The HTTP headers ended incorrectly with \n\r\n + + + + + The HTTP headers were malformed. + + + + + The Parser class exposes static methods used to parse strings or byte arrays into HTTP messages. + + + + + Given a byte[] representing a request, determines the offsets of the components of the line. WARNING: Input MUST contain a LF or an exception will be thrown + + Byte array of the request + Returns the index of the byte of the URI in the Request line + Returns the length of the URI in the Request line + Returns the index of the first byte of the name/value header pairs + + + + + + + Index of final byte of headers, if found, or location that search should resume next time + + + + + + + Parse out HTTP Header lines. + + Header collection to *append* headers to + Array of Strings + Index into array at which parsing should start + String containing any errors encountered + TRUE if there were no errors, false otherwise + + + + Given a byte array, determines the Headers length + + Input array of data + Returns the calculated length of the headers. + Returns the calculated start of the response body. + Any HTTPHeaderParseWarnings discovered during parsing. + True, if the parsing was successful. + + + + Given a MemoryStream, attempts to parse a HTTP Request starting at the current position. + + TRUE if a request could be parsed, FALSE otherwise + + + + Given a MemoryStream, attempts to parse a HTTP Response starting at the current position + + TRUE if a response could be parsed, FALSE otherwise + + + + Parse the HTTP Request into a headers object. + + The HTTP Request string, including *at least the headers* with a trailing CRLFCRLF + HTTPRequestHeaders parsed from the string. + + + + Break headers off, then convert CRLFs into LFs + + + + + + + Parse the HTTP Response into a headers object. + + The HTTP response as a string, including at least the headers. + HTTPResponseHeaders parsed from the string. + + + + Class allows finding the end of a body sent using Transfer-Encoding: Chunked + + + + + Number of bytes in the body (sans chunk headers, CRLFs, and trailers) + + + + + + Read the first character of the hexadecimal size + + + + + Read the first character of the next Trailer header (if any) + + + + + We're in a trailer. Read up to the next \r + + + + + We've just read a trailer CR, now read its LF + + + + + We read a CR on an "empty" Trailer line, so now we just need the final LF + + + + + The chunked body was successfully read with no excess + + + + + Completed, but we read too many bytes. Call getOverage to return how many bytes to put back + + + + + The body was malformed + + + + + Somewhat similar to the Framework's "BackgroundWorker" class, the periodic worker performs a similar function on a periodic schedule. + NOTE: the callback occurs on a background thread. + + The PeriodicWorker class is used by Fiddler to perform "cleanup" style tasks on a timer. Put work in the queue, + and it will see that it's done at least as often as the schedule specified until Fiddler begins to close at which + point all work stops. + + + The underlying timer's interval is 1 second. + + + + I think a significant part of the reason that this class exists is that I thought the System.Threading.Timer consumed one thread for each + timer. In reality, per "CLR via C# 4e" all of the instances share one underlying thread and thus my concern was misplaced. Ah well. + + + + + Assigns a "job" to the Periodic worker, on the schedule specified by iMS. + + The function to run on the timer specified. + Warning: the function is NOT called on the UI thread, so use .Invoke() if needed. + The # of milliseconds to wait between runs + A taskItem which can be used to revokeWork later + + + + Revokes a previously-assigned task from this worker. + + + + + + The ScheduledTasks class allows addition of jobs by name. It ensures that ONE instance of the named + job will occur at *some* point in the future, between 0 and a specified max delay. If you queue multiple + instances of the same-named Task, it's only done once. + + + + + Under the lock, we enumerate the schedule to find work to do and remove that work from the schedule. + After we release the lock, we then do the queued work. + + + + + + A jobItem represents a Function+Time tuple. The function will run after the given time. + + + + + TickCount at which this job must run. + + + + + Method to invoke to complete the job + + + + + Abstract base class for the ClientPipe and ServerPipe classes. A Pipe represents a connection to either the client or the server, optionally encrypted using SSL/TLS. + + + + + The base socket wrapped in this pipe + + + + + The number of times that this Pipe has been used + + + + + The HTTPS stream wrapped around the base socket + + + + + The display name of this Pipe + + + + + Number of milliseconds to delay each 1024 bytes transmitted + + + + + Create a new pipe, an enhanced wrapper around a socket + + Socket which this pipe wraps + Identification string used for debugging purposes + + + + Return the Connected status of the base socket. + WARNING: This doesn't work as you might expect; you can see Connected == false when a READ timed out but a WRITE will succeed. + + + + + Poll the underlying socket for readable data (or closure/errors) + + TRUE if this Pipe requires attention + + + + Returns a bool indicating if the socket in this Pipe is CURRENTLY connected and wrapped in a SecureStream + + + + + Returns the SSL/TLS protocol securing this connection + + + + + Return the Remote Port to which this socket is attached. + + + + + Return the Local Port to which the base socket is attached. Note: May return a misleading port if the ISA Firewall Client is in use. + + + + + Returns the remote address to which this Pipe is connected, or 0.0.0.0 on error. + + + + + Gets or sets the transmission delay on this Pipe, used for performance simulation purposes. + + + + + Call this method when about to reuse a socket. Currently, increments the socket's UseCount and resets its transmit delay to 0. + + The session identifier of the new session, or zero + + + + Sends a byte array through this pipe + + The bytes + + + + Sends the data specified in oBytes (between iOffset and iOffset+iCount-1 inclusive) down the pipe. + + + + + + + + Receive bytes from the pipe into the DATA buffer. + + Throws IO exceptions from the socket/stream + Array of data read + Bytes read + + + + Return the raw socket this pipe wraps. Avoid calling this method if at all possible. + + The Socket object this Pipe wraps. + + + + Shutdown and close the socket inside this pipe. Eats exceptions. + + + + + Abruptly closes the socket by sending a RST packet + + + + + A ClientPipe wraps a socket connection to a client application. + + + + + By default, we now test for loopbackness before lookup of PID + https://github.com/telerik/fiddler/issues/83 + + + + + Timeout to wait for the *first* data from the client + + + + + Timeout to wait for the ongoing reads from the client (as headers and body are read) + + + + + Timeout before which an idle connection is closed (e.g. for HTTP Keep-Alive) + + + + + Client process name (e.g. "iexplore") + + + + + Client process ProcessID + + + + + Data which was previously "over-read" from the client. Populated when HTTP-pipelining is attempted + + + + + ID of the process that opened this socket, assuming that Port Mapping is enabled, and the connection is from the local machine + + + + + Does this Pipe have data (or closure/errors) to read? + + TRUE if this Pipe requires attention + + + + If you previously read more bytes than you needed from this client socket, you can put some back. + + Array of bytes to put back; now owned by this object + + + + Name of the Process referred to by LocalProcessID, or String.Empty if unknown + + + + + Sets the socket's timeout based on whether we're waiting for our first read or for an ongoing read-loop + + + + + Returns a semicolon-delimited string describing this ClientPipe + + A semicolon-delimited string + + + + Perform a HTTPS Server handshake to the client. Swallows exception and returns false on failure. + + + + + + + This function sends the client socket a CONNECT ESTABLISHED, and then performs a HTTPS authentication + handshake, with Fiddler acting as the server. + + Hostname Fiddler is pretending to be (NO PORT!) + The set of headers to be returned to the client in response to the client's CONNECT tunneling request + true if the handshake succeeds + + + + Timestamp of either 1> The underlying socket's creation from a .Accept() call, or 2> when this ClientPipe was created. + + + + + The PipePool maintains a collection of connected ServerPipes for reuse + + + + + Minimum idle time of pipes to be expired from the pool. + Note, we don't check the pipe's ulLastPooled value when extracting a pipe, + so its age could exceed the allowed lifetime by up to MSEC_POOL_CLEANUP_INTERVAL + WARNING: Don't change the timeout >2 minutes casually. Server bugs apparently exist: https://bugzilla.mozilla.org/show_bug.cgi?id=491541 + + + + + The Pool itself. + + + + + Time at which a "Clear before" operation was conducted. We store this + so that we don't accidentally put any pipes that were in use back into + the pool after a clear operation + + + + + Remove any pipes from Stacks if they exceed the age threshold + Remove any Stacks from pool if they are empty + + + + + Clear all pooled Pipes, calling .End() on each. + + + + + Return a string representing the Pipes in the Pool + + A string representing the pipes in the pool + + + + Get a Server connection for reuse, or null if a suitable connection is not in the pool. + + The key which identifies the connection to search for. + The ProcessID of the client requesting the Pipe + HACK to be removed; the SessionID# of the request for logging + A Pipe to reuse, or NULL + + + + Store a pipe for later use, if reuse is allowed by settings and state of the pipe. + + The Pipe to place in the pool + + + + This class holds a specialized memory stream with growth characteristics more suitable for reading from a HTTP Stream. + The default MemoryStream's Capacity will always grow to 256 bytes, then at least ~2x current capacity up to 1gb (2gb on .NET 4.6), then to the exact length after that. + That has three problems: + + The capacity may unnecessarily grow to >85kb, putting the object on the LargeObjectHeap even if we didn't really need 85kb. + On 32bit, we may hit a Address Space exhaustion ("Out of memory" exception) prematurely and unnecessarily due to size-doubling + After the capacity reaches 1gb in length, the capacity growth never exceeds the length, leading to huge reallocations and copies on every write (fixed in .NET 4.6) + + This class addresses those issues. http://textslashplain.com/2015/08/06/tuning-memorystream/ + + + + + A client may submit a "hint" of the expected size. We use that if present. + + + + + Used by the caller to supply a hint on the expected total size of reads from the pipe. + We cannot blindly trust this value because sometimes the client or server will lie and provide a + huge value that it will never use. This is common for RPC-over-HTTPS tunnels like that used by + Outlook, for instance. + + The Content-Length can also lie by underreporting the size. + + Suggested total buffer size in bytes + + + + The policy which describes how this pipe may be reused by a later request. Ordered by least restrictive to most. + + + + + The ServerPipe may be freely reused by any subsequent request + + + + + The ServerPipe may be reused only by a subsequent request from the same client process + + + + + The ServerPipe may be reused only by a subsequent request from the same client pipe + + + + + The ServerPipe may not be reused for a subsequent request + + + + + A ServerPipe wraps a socket connection to a server. + + + + + Policy for reuse of this pipe + + + + + DateTime of the completion of the TCP/IP Connection + + + + + TickCount when this Pipe was last placed in a PipePool + + + + + Returns TRUE if this ServerPipe is connected to a Gateway + + + + + Returns TRUE if this ServerPipe is connected to a SOCKS gateway + + + + + The Pooling key used for reusing a previously pooled ServerPipe. See sPoolKey property. + + + + + This field, if set, tracks the process ID to which this Pipe is permanently bound; set by MarkAsAuthenticated. + NOTE: This isn't actually checked by anyone; instead the PID is added to the POOL Key + + + + + Backing field for the isAuthenticated property + + + + + String containing representation of the server's certificate chain + + + + + Server's certificate + + + + + Wraps a socket in a Pipe + + The Socket + Pipe's human-readable name + True if the Pipe is attached to a gateway + The Pooling key used for socket reuse + + + + Returns TRUE if there is an underlying, mutually-authenticated HTTPS stream. + + WARNING: Results are a bit of a lie. System.NET IsMutuallyAuthenticated == true if a client certificate is AVAILABLE even + if that certificate was never SENT to the server. + + + + + Returns TRUE if this PIPE is marked as having been authenticated using a Connection-Oriented Auth protocol: + NTLM, Kerberos, or HTTPS Client Certificate. + + + + + Marks this Pipe as having been authenticated. Depending on the preference "fiddler.network.auth.reusemode" this may impact the reuse policy for this pipe + + The client's process ID, if known. + + + + Indicates if this pipe is connected to an upstream (non-SOCKS) Proxy. + + + + + Indicates if this pipe is connected to a SOCKS gateway + + + + + Sets the receiveTimeout based on whether this is a freshly opened server socket or a reused one. + + + + + Returns a semicolon-delimited string describing this ServerPipe + + A semicolon-delimited string + + + + Gets and sets the pooling key for this server pipe. + + + direct->{http|https}/{serverhostname}:{serverport} + gw:{gatewayaddr:port}->* + gw:{gatewayaddr:port}->{http|https}/{serverhostname}:{serverport} + socks:{gatewayaddr:port}->{http|https}/{serverhostname}:{serverport} + + + + + Returns the Server's certificate Subject CN (used by "x-UseCertCNFromServer") + + The *FIRST* CN field from the Subject of the certificate used to secure this HTTPS connection, or null if the connection is unsecure + + + + Return a string describing the HTTPS connection security, if this socket is secured + + A string describing the HTTPS connection's security. + + + + Returns a string describing how this connection is secured. + + + + + + Get the Transport Context for the underlying HTTPS connection so that Channel-Binding Tokens work correctly + + + + + + Returns the IPEndPoint to which this socket is connected, or null + + + + + Get the user's default client cert for authentication; caching if if possible and permitted. + + + + + + This method is called by the HTTPS Connection establishment to optionally attach a client certificate to the request. + Test Page: https://tower.dartmouth.edu/doip/OracleDatabases.jspx or ClientCertificate.ms in Test folder should request on initial connection + In contrast, this one: https://roaming.officeapps.live.com/rs/roamingsoapservice.svc appears to try twice (renego) + + + + + + + + + + + This function secures an existing connection and authenticates as client. This is primarily useful when + the socket is connected to a Gateway/Proxy and we had to send a CONNECT and get a HTTP/200 Connected back before + we actually secure the socket. + http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx + + The Session (a CONNECT) this tunnel wraps + The CN to use in the certificate + Path to client certificate file + The HTTPS protocol version of the Client Pipe; can influence which SslProtocols we offer the server + Reference-passed integer which returns the time spent securing the connection + TRUE if the connection can be secued + + + + Return a Certificate Collection containing certificate from the specified file. + + Path to the certificate. Relative Paths will be absolutified automatically + The Certificate collection, or null + + + + This class allows fast-lookup of a ProcessName from a ProcessID. + + + + + Static constructor which registers for cleanup + + + + + Prune the cache of expiring PIDs + + + + + Map a Process ID (PID) to a Process Name + + The PID + A Process Name (e.g. IEXPLORE.EXE) or String.Empty + + + + Structure mapping a Process ID (PID) to a ProcessName + + + + + The TickCount when this entry was created + + + + + The ProcessName (e.g. IEXPLORE.EXE) + + + + + Create a PID->ProcessName mapping + + The ProcessName (e.g. IEXPLORE.EXE) + + + + The core proxy object which accepts connections from clients and creates session objects from those connections. + + + + + Hostname if this Proxy Endpoint is terminating HTTPS connections + + + + + Certificate if this Proxy Endpoint is terminating HTTPS connections + + + + + Per-connectoid information about each WinINET connectoid + + + + + The upstream proxy settings. + + + + + The AutoProxy object, created if we're using WPAD or a PAC Script as a gateway + + + + + Allow binding to a specific egress adapter: "fiddler.network.egress.ip" + + + + + Watcher for Notification of Preference changes + + + + + Server connections may be pooled for performance reasons. + + + + + The Socket Endpoint on which this proxy receives requests + + + + + Flag indicating that Fiddler is in the process of detaching... + + + + + List of hosts which should bypass the upstream gateway + + + + + Returns a string of information about this instance and the ServerPipe reuse pool + + A multiline string + + + + Returns true if the proxy is listening on a port. + + + + + The port on which this instance is listening + + + + + Returns true if Fiddler believes it is currently registered as the Local System proxy + + + + + This event handler fires when Fiddler detects that it is (unexpectedly) no longer the system's registered proxy + + + + + Change the outbound IP address used to send traffic + + + + + + Watch for relevent changes on the Preferences object + + + + + + + Called whenever Windows reports that the system's NetworkAddress has changed + + + + + + + Called by Windows whenever network availability goes up or down. + + + + + + + Directly inject a session into the Fiddler pipeline, returning a reference to it. + NOTE: This method will THROW any exceptions to its caller. + + HTTP Request Headers + HTTP Request body (or null) + StringDictionary of Session Flags (or null) + The new Session + + + + Directly inject a session into the Fiddler pipeline, returning a reference to it. + NOTE: This method will THROW any exceptions to its caller. + + HTTP Request Headers + HTTP Request body (or null) + StringDictionary of Session Flags (or null) + Event Handler to notify when the session changes state + The new Session + + + + Directly inject a session into the Fiddler pipeline, returning a reference to it. + NOTE: This method will THROW any exceptions to its caller. + + String representing the HTTP request. If headers only, be sure to end with CRLFCRLF + StringDictionary of Session Flags (or null) + The new session + + + + [DEPRECATED] Directly inject a session into the Fiddler pipeline. + NOTE: This method will THROW any exceptions to its caller. + + + HTTP Request Headers + HTTP Request body (or null) + StringDictionary of Session Flags (or null) + + + + [DEPRECATED] Directly inject a session into the Fiddler pipeline. + NOTE: This method will THROW any exceptions to its caller. + + + String representing the HTTP request. If headers only, be sure to end with CRLFCRLF + StringDictionary of Session Flags (or null) + + + + [DEPRECATED]: This version does no validation of the request data, and doesn't set SessionFlags.RequestGeneratedByFiddler + Send a custom HTTP request to Fiddler's listening endpoint (127.0.0.1:8888 by default). + NOTE: This method will THROW any exceptions to its caller and blocks the current thread. + + + String representing the HTTP request. If headers only, be sure to end with CRLFCRLF + + + + This function, when given a scheme host[:port], returns the gateway information of the proxy to forward requests to. + + URIScheme: use http, https, or ftp + Host for which to return gateway information + IPEndPoint of gateway to use, or NULL + + + + Accept the connection and pass it off to a handler thread + + + + + + Register as the system proxy for WinINET and set the Dynamic registry key for other FiddlerHook + + True if the proxy registration was successful + + + + If we get a notice that the proxy registry key has changed, wait 50ms and then check to see + if the key is pointed at us. If not, raise the alarm. + + + + + + + If we are supposed to be "attached", we re-verify the registry keys, and if they are corrupt, notify + our host of the discrepency. + + + + + This method sets up the connectoid list and updates gateway information. Called by the Attach() method, or + called on startup if Fiddler isn't configured to attach automatically. + + + + + Given an address list, walks the list until it's able to successfully make a connection. + Used for finding an available Gateway when we have a list to choose from + + A string, e.g. PROXY1:80 + The IP:Port of the first alive endpoint for the specified host/port + + + + Set internal fields pointing at upstream proxies. + + + + + Detach the proxy by setting the registry keys and sending a Windows Message + + True if the proxy settings were successfully detached + + + + Detach the proxy by setting the registry keys and sending a Windows Message + + True if the proxy settings were successfully detached + + + + Stop the proxy by closing the socket. + + + + + Start the proxy by binding to the local port and accepting connections + + Port to listen on + TRUE to allow remote connections + + + + + Dispose Fiddler's listening socket + + + + + Clear the pool of Server Pipes. May be called by extensions. + + + + + Assign HTTPS Certificate for this endpoint + + Certificate to return to clients who connect + + + + Sets the upstream gateway to match the specified ProxySettings + + + + + + Generate or find a certificate for this endpoint + + Subject FQDN + TRUE if the certificate could be found/generated, false otherwise + + + + Return a simple string indicating what upstream proxy/gateway is in use. + + + + + + This class maintains the Proxy Bypass List for the upstream gateway. + In the constructor, pass the desired proxy bypass string, as retrieved from WinINET for the Options screen. + Then, call the IsBypass(sTarget) method to determine if the Gateway should be bypassed + + + + + List of regular expressions for matching against request Scheme://HostPort. + NB: This list is either null or contains at least one item. + + + + + Boolean flag indicating whether the bypass list contained a <local> token. + + + + + Pass the desired proxy bypass string retrieved from WinINET. + + + + + + Does the bypassList contain any rules at all? + + + + + Given the rules for this bypasslist, should this target bypass the proxy? + + The URI Scheme + The Host and PORT + True if this request should not be sent to the gateway proxy + + + + Convert the string representing the bypass list into an array of rules escaped and ready to be turned into regular expressions + + + + + + The ServerChatter object is responsible for transmitting the Request to the destination server and retrieving its Response. + + + This class maintains its own PipeReadBuffer that it fills from the created or reused ServerPipe. After it determines that + a complete response is present, it allows the caller to grab that array using the TakeEntity method. If + unsatisfied with the result (e.g. a network error), the caller can call Initialize() and SendRequest() again. + + + + + Size of buffer passed to pipe.Receive when reading from the server + + + PERF: Currently, I use [32768]; but I'd assume bigger buffers are faster. Does ReceiveBufferSize/SO_RCVBUF figure in here? + Anecdotal data suggests that current reads rarely fill the full 32k buffer. + + + + + Interval, in milliseconds, after which Fiddler will check to see whether a response should continue to be read. Otherwise, + a never-ending network stream can accumulate ever larger amounts of data that will never be seen by the garbage collector. + + + + + The pipeServer represents Fiddler's connection to the server. + + + + + The session to which this ServerChatter belongs + + + + + The inbound headers on this response + + + + + Indicates whether this request was sent to a (non-SOCKS) Gateway, which influences whether the protocol and host are + mentioned in the Request line + When True, the session should have SessionFlags.SentToGateway set. + + + + + Buffer holds this response's data as it is read from the pipe. + + + + + The total count of bytes read for this response. Typically equals m_responseData.Length unless + Streaming & Log-Drop-Response-Body - in which case it will be larger since the m_responseData is cleared after every read. + + BUG BUG: This value is reset to 0 when clearing streamed data. It probably shouldn't be; the problem is that this field is getting used for two purposes + + + + + Pointer to first byte of Entity body (or to the start of the next set of headers in the case where there's a HTTP/1xx intermediate header) + Note: This gets reset to 0 if we're streaming and dropping the response body. + + + + + Optimization: tracks how far we've looked into the Request when determining iEntityBodyOffset + + + + + True if final (non-1xx) HTTP Response headers have been returned to the client. + + + + + Indicates how much of _responseData buffer has already been streamed to the client + + + + + Position in responseData of the start of the latest parsed chunk size information + + + + + Locals used by the Connect-to-Host state machine + + + + + The ExecutionState object holds information that is used by the Connect-to-Host state machine + + + + + Peek at number of bytes downloaded thus far. + + + + + Get the MIME type (sans Character set or other attributes) from the HTTP Content-Type response header, or String.Empty if missing. + + + + + DEPRECATED: You should use the Timers object on the Session object instead. + The number of milliseconds between the start of sending the request to the server to the first byte of the server's response + + + + + DEPRECATED: You should use the Timers object on the Session object instead. + The number of milliseconds between the start of sending the request to the server to the last byte of the server's response. + + + + + Was this request forwarded to a gateway? + + + + + Was this request serviced from a reused server connection? + + + + + The HTTP headers of the server's response + + + + + Simple indexer into the Response Headers object + + + + + Create a ServerChatter object and initialize its headers from the specified string + + + + + + + Reset the response-reading fields on the object. Also used on a retry. + + If TRUE, allocates a buffer (m_responseData) to read from a pipe. If FALSE, nulls m_responseData. + + + + Peek at the current response body and return it as an array + + The response body as an array, or byte[0] + + + + Get the response body byte array from the PipeReadBuffer, then dispose of it. + + WARNING: This eats all of the bytes in the Pipe, even if that includes bytes of a + future, as-yet-unrequested response. Fiddler does not pipeline requests, so that works okay for now. + For now, the caller should validate that the returned entity is of the expected size (e.g. based on Content-Length) + + + + + Scans responseData stream for the \r\n\r\n (or variants) sequence + which indicates that the header block is complete. + + SIDE EFFECTS: + iBodySeekProgress is updated and maintained across calls to this function + iEntityBodyOffset is updated if the end of headers is found + + True, if responseData contains a full set of headers + + + + Parse the HTTP Response into Headers and Body. + + + + + + Attempt to pull the final (non-1xx) Headers from the stream. If HTTP/100 messages are found, the method + will recurse into itself to find the next set of headers. + + + + + Deletes a single HTTP/1xx header block from the Response stream + and adjusts all header-reading state to start over from the top of the stream. + Note: If 'fiddler.network.leakhttp1xx' is TRUE, then the 1xx message will have been leaked before calling this method. + + + + + Adjusts PipeServer's ReusePolicy if response headers require closure. Then calls _detachServerPipe() + + + + + Queues or End()s the ServerPipe, depending on its ReusePolicy + + + + + Determines whether a given PIPE is suitable for a given Session, based on that Session's SID + + The Client Process ID, if any + The base (no PID) PoolKey expected by the session + The pipe's pool key + TRUE if the connection should be used, FALSE otherwise + + + + If a Connection cannot be established, we need to report the failure to our caller + + + + + + Given an address list and port, attempts to create a socket to the first responding host in the list (retrying via DNS Failover if needed). + + IPEndpoints to attempt to reach + Session object to annotate with timings and errors + Connected Socket. Throws Exceptions on errors. + + + + If the Session was configured to stream the request body, we need to read from the client + and send it to the server here. + + + FALSE on transfer error, TRUE otherwise. + + + + + Sends (or resends) the Request to the server or upstream proxy. If the request is a CONNECT and there's no + gateway, this method ~only~ establishes the connection to the target, but does NOT send a request. + + Note: THROWS on failures + + + + + May request be resent on a different connection because the .Send() of the request did not complete? + + TRUE if the request may be resent + + + + Performs a SOCKSv4A handshake on the socket + + + + + Build the SOCKS4 outbound connection handshake as a byte array. + http://en.wikipedia.org/wiki/SOCKS#SOCKS4a + + + + + Replaces body with an error message + + Error to send if client was remote + Error to send if cilent was local + + + + The Session object will call this method if it wishes to stream a file from disk instead + of loading it into memory. This method sets default headers. + + + + + + Loads a HTTP response from a file + + The name of the file from which a response should be loaded + False if the file wasn't found. Throws on other errors. + + + + Reads the response from the ServerPipe. + + TRUE if a response was read + + + + When the headers first arrive, update bBufferResponse based on their contents. + + + + + Detects whether this is an direct FTP request and if so executes it and returns true. + + FALSE if the request wasn't FTP or wasn't direct. + + + + Remove from memory the response data that we have already returned to the client. + + + + + Remove from memory the response data that we have already returned to the client, up to the last chunk + size indicator, which we need to keep around for chunk-integrity purposes. + + + + + Leak the current bytes of the response to client. We wait for the full header + set before starting to stream for a variety of impossible-to-change reasons. + + Returns TRUE if response bytes were leaked, false otherwise (e.g. write error). THROWS if "fiddler.network.streaming.abortifclientaborts" is TRUE + + + + Mark this connection as non-reusable + + + + + The Session object manages the complete HTTP session including the UI listitem, the ServerChatter, and the ClientChatter. + + + + + Should we try to use the SPNToken type? + Cached for performance reasons. + ISSUE: It's technically possible to use FiddlerCorev2/v3 on .NET/4.5 but we won't set this field if you do that. + + + + + Sorta hacky, we may use a .NET WebRequest object to generate a valid NTLM/Kerberos response if the server + demands authentication and the Session is configured to automatically respond. + + + + + Used if the Session is bound to a WebSocket or CONNECTTunnel + + + + + File to stream if responseBodyBytes is null + + + + + Bitflags of commonly-queried session attributes + + + + + DO NOT USE. TEMPORARY WHILE REFACTORING VISIBILITY OF MEMBERS + + + + + + + Sets or unsets the specified SessionFlag(s) + + SessionFlags + Desired set value + + + + Test the session's BitFlags + + One or more (OR'd) SessionFlags + TRUE if ALL specified flag(s) are set + + + + Test the session's BitFlags + + One or more (OR'd) SessionFlags + TRUE if ANY of specified flag(s) are set + + + + When a client socket is reused, this field holds the next Session until its execution begins + + + + + Should response be buffered for tampering. + + ARCH: This should have been a property instead of a field, so we could throw an InvalidStateException if code tries to manipulate this value after the response has begun + + + + Timers stored as this Session progresses + + + + + Field is set to False if socket is poisoned due to HTTP errors. + + + + + Returns True if this is a HTTP CONNECT tunnel. + + + + + Object representing the HTTP Response. + + + + + Object representing the HTTP Request. + + + + + Fiddler-internal flags set on the Session. + + TODO: ARCH: This shouldn't be exposed directly; it should be wrapped by a ReaderWriterLockSlim to prevent + exceptions while enumerating the flags for storage, etc + + + + A common use for the Tag property is to store data that is closely associated with the Session. + It is NOT marshalled during drag/drop and is NOT serialized to a SAZ file. + + + + + Contains the bytes of the request body. + + + + + Contains the bytes of the response body. + + + + + IP Address of the client for this session. + + + + + Client port attached to Fiddler. + + + + + IP Address of the server for this session. + + + + + Event object used for pausing and resuming the thread servicing this session + + + + + This event fires at any time the session's State changes. Use with caution due to the potential for performance impact. + + + + + This event fires if this Session automatically yields a new one, for instance, if Fiddler is configured to automatically + follow redirects or perform multi-leg authentication (X-AutoAuth). + + + + + If this session is a Tunnel, and the tunnel's IsOpen property is TRUE, returns TRUE. Otherwise returns FALSE. + + + + + If this session is a Tunnel, returns number of bytes sent from the Server to the Client + + + + + If this session is a Tunnel, returns number of bytes sent from the Client to the Server + + + + + Gets or Sets the HTTP Request body bytes. + Setter adjusts Content-Length header, and removes Transfer-Encoding and Content-Encoding headers. + Setter DOES NOT CLONE the passed array. + Setter will throw if the Request object does not exist for some reason. + Use utilSetRequestBody(sStr) to ensure proper character encoding if you need to use a string. + + + + + Gets or Sets the HTTP Response body bytes. + Setter adjusts Content-Length header, and removes Transfer-Encoding and Content-Encoding headers. + Setter DOES NOT CLONE the passed array. + Setter will throw if the Response object has not yet been created. (See utilCreateResponseAndBypassServer) + Use utilSetResponseBody(sStr) to ensure proper character encoding if you need to use a string. + + + + + When true, this session was conducted using the HTTPS protocol. + + + + + When true, this session was conducted using the FTP protocol. + + + + + Returns TRUE if the Session's HTTP Method is available and matches the target method. + + The target HTTP Method being compared. + true, if the method is specified and matches sTestFor (case-insensitive); otherwise false. + + + + Returns TRUE if the Session's target hostname (no port) matches sTestHost (case-insensitively). + + The host to which this session's host should be compared. + True if this session is targeted to the specified host. + + + + Get the process ID of the application which made this request, or 0 if it cannot be determined. + + + + + Get the Process Info of the application which made this request, or String.Empty if it is not known + + + + + Replaces any characters in a filename that are unsafe with safe equivalents, and trim to 160 characters. + + + + + + + Gets a path-less filename suitable for saving the Response entity. Uses Content-Disposition if available. + + + + + Examines the MIME type, and if ambiguous, returns sniffs the body. + + + + + + Set to true in OnBeforeRequest if this request should bypass the gateway + + + + + Returns the port used by the client to communicate to Fiddler. + + + + + State of session. Note Side-Effects: If setting to .Aborted, calls FinishUISession. If setting to/from a Tamper state, calls RefreshMyInspectors + + + + + Notify extensions if this Session naturally led to another (e.g. due to redirect chasing or Automatic Authentication) + + The original session + The new session created + + + + Returns the path and query part of the URL. (For a CONNECT request, returns the host:port to be connected.) + + + + + Retrieves the complete URI, including protocol/scheme, in the form http://www.host.com/filepath?query. + Or sets the complete URI, adjusting the UriScheme and/or Host. + + + + + Gets or sets the URL (without protocol) being requested from the server, in the form www.host.com/filepath?query. + + + + + DNS Name of the host server targeted by this request. May include IPv6 literal brackets. NB: a port# may be included. + + + + + DNS Name of the host server (no port) targeted by this request. Will include IPv6-literal brackets for IPv6-literal addresses + + + + + Returns the server port to which this request is targeted. + + + + + Returns the sequential number of this session. Note, by default numbering is restarted at zero when the session list is cleared. + + + + + Returns the Address used by the client to communicate to Fiddler. + + + + + Gets or Sets the HTTP Status code of the server's response + + + + + Returns HTML representing the Session. Call Utilities.StringToCF_HTML on the result of this function before placing it on the clipboard. + + TRUE if only the headers should be copied. + A HTML-formatted fragment representing the current session. + + + + Store this session's request and response to a string. + + If true, return only the request and response headers + String representing this session + + + + Store this session's request and response to a string. + + A string containing the content of the request and response. + + + + This method resumes the Session's thread in response to "Continue" commands from the UI + + + + + Set the SessionFlags.Ignore bit for this Session, also configuring it to stream, drop read data, and bypass event handlers. + For a CONNECT Tunnel, traffic will be blindly shuffled back and forth. Session will be hidden. + + + + + Called by an AcceptConnection-spawned background thread, create a new session object from a client socket + and execute the session + + Parameter object defining client socket and endpoint's HTTPS certificate, if present + + + + Call this method to AuthenticateAsServer on the client pipe (e.g. Fiddler itself is acting as a HTTPS server). + If configured, the pipe will first sniff the request's TLS ClientHello ServerNameIndicator extension. + + The default certificate to use + TRUE if a HTTPS handshake was achieved; FALSE for any exceptions or other errors. + + + + Call this function while in the "reading response" state to update the responseBodyBytes array with + the partially read response. + + TRUE if the peek succeeded; FALSE if not in the ReadingResponse state + + + + Prevents the server pipe from this session from being pooled for reuse + + + + + Ensures that, after the response is complete, the client socket is closed and not reused. + Does NOT (and must not) close the pipe. + + + + + Immediately close client and server sockets. Call in the event of errors-- doesn't queue server pipes for future reuse. + + + + + + Closes both client and server pipes and moves state to Aborted; unpauses thread if paused. + + + + + Checks whether this is a WebSocket, and if so, whether it has logged any parsed messages. + + + + + Returns TRUE if this session's State > ReadingResponse, and oResponse, oResponse.headers, and responseBodyBytes are all non-null. Note that + bHasResponse returns FALSE if the session is currently reading, even if a body was copied using the COMETPeek feature + + + + + Save HTTP response body to Fiddler Captures folder. You likely want to call utilDecodeResponse first. + + True if the response body was successfully saved + + + + Save HTTP response body to specified location. You likely want to call utilDecodeResponse first. + + The name of the file to which the response body should be saved. + True if the file was successfully written. + + + + Save the request body to a file. You likely want to call utilDecodeRequest first. + + The name of the file to which the request body should be saved. + True if the file was successfully written. + + + + Save the request and response to a single file. + + The filename to which the session should be saved. + TRUE if only the headers should be written. + + + + Save the request to a file. + The headers' Request Line will not contain the scheme or host, which is probably not what you want. + + The name of the file to which the request should be saved. + TRUE to save only the headers + + + + Save the request to a file. Throws if file cannot be written. + + The name of the file to which the request should be saved. + TRUE to save only the headers. + TRUE to include the Scheme and Host in the Request Line. + + + + Read metadata about this session from a stream. NB: Closes the Stream when done. + + The stream of XML text from which session metadata will be loaded. + True if the Metadata was successfully loaded; False if any exceptions were trapped. + + + + Writes this session's metadata to a file. + + The name of the file to which the metadata should be saved in XML format. + True if the file was successfully written. + + + + Saves the response (headers and body) to a file + + The File to write + TRUE if only heaers should be written + + + + Write the metadata about this Session to a stream. The Stream is left open! + + The Stream to write to + + + + Write the session's Request to the specified stream + + TRUE if only the headers should be be written + TRUE if the Scheme and Host should be written in the Request Line + The Stream to which the request should be written + True if the request was written to the stream. False if the request headers do not exist. Throws on other stream errors. + + + + Write the session's Request to the specified stream + + TRUE if only the headers should be be written + TRUE if the Scheme and Host should be written in the Request Line + TRUE if binary bodies should be encoded in base64 for text-safe transport (e.g. used by Composer drag/drop) + The Stream to which the request should be written + True if the request was written to the stream. False if the request headers do not exist. Throws on other stream errors. + + + + Write the session's Response to the specified stream + + The stream to which the response should be written + TRUE if only the headers should be written + TRUE if the response was written to the stream. False if the response headers do not exist. Throws on other stream errors. + + + + Write the session to the specified stream + + The stream to which the session should be written + TRUE if only the request and response headers should be written + False on any exceptions; True otherwise + + + + Replace HTTP request body using the specified file. + + The file containing the request + True if the file was successfully loaded as the request body + + + + Replace HTTP response headers and body using the specified stream. + + The stream containing the response. + True if the Stream was successfully loaded. + + + + Replace HTTP response headers and body using the specified file. + + The file containing the response. + True if the file was successfully loaded. + + + + Return a string generated from the request body, decoding it and converting from a codepage if needed. Throws on errors. + + A string containing the request body. + + + + Return a string generated from the response body, decoding it and converting from a codepage if needed. Throws on errors. + + A string containing the response body. + + + + Find the text encoding of the request + WARNING: Will not decompress body to scan for indications of the character set + + Returns the Encoding of the requestBodyBytes + + + + Find the text encoding of the response + WARNING: Will not decompress body to scan for indications of the character set + + The Encoding of the responseBodyBytes + + + + Returns true if the absolute request URI contains the specified string. Case-insensitive. + + Case-insensitive string to find + TRUE if the URI contains the string + + + + Removes chunking and HTTP Compression from the Response. Adds or updates Content-Length header. + + Returns TRUE if the response was decoded; returns FALSE on failure, or if response didn't have headers that showed encoding. + + + + Removes chunking and HTTP Compression from the Response. Adds or updates Content-Length header. + + TRUE if error messages should be suppressed. False otherwise. + TRUE if the decoding was successsful. + + + + Removes chunking and HTTP Compression from the Request. Adds or updates Content-Length header. + + Returns TRUE if the request was decoded; returns FALSE on failure, or if request didn't have headers that showed encoding. + + + + Use GZIP to compress the request body. Throws exceptions to caller. + + TRUE if compression succeeded + + + + Use GZIP to compress the response body. Throws exceptions to caller. + + TRUE if compression succeeded + + + + Use DEFLATE to compress the response body. Throws exceptions to caller. + + TRUE if compression succeeded + + + + Use BZIP2 to compress the response body. Throws exceptions to caller. + + TRUE if compression succeeded + + + + Introduces HTTP Chunked encoding on the response body + + The number of chunks to try to create + TRUE if the chunking could be performed. + + + + Perform a string replacement on the request body. Adjusts the Content-Length header if needed. + + The case-sensitive string to search for. + The text to replace. + TRUE if one or more replacements occurred. + + + + Call inside OnBeforeRequest to create a response object and bypass the server. + + + + + Perform a regex-based string replacement on the response body. Adjusts the Content-Length header if needed. + + The regular expression used to search the body. Specify RegEx Options via leading Inline Flags, e.g. (?im) for case-Insensitive Multi-line. + The text or expression used to replace + TRUE if replacements occured + + + + Perform a string replacement on the response body (potentially multiple times). Adjust the Content-Length header if needed. + + String to find (case-sensitive) + String to use to replace + TRUE if replacements occurred + + + + Perform a one-time string replacement on the response body. Adjust the Content-Length header if needed. + + String to find (case-sensitive) + String to use to replace + TRUE for Case-Sensitive + TRUE if a replacement occurred + + + + Replaces the request body with sString. Sets Content-Length header and removes Transfer-Encoding/Content-Encoding. + + The desired request Body as a string + + + + Replaces the response body with sString. Sets Content-Length header and removes Transfer-Encoding/Content-Encoding + + The desired response Body as a string + + + + Add a string to the top of the response body, updating Content-Length. (Call utilDecodeResponse first!) + + The string to prepend + + + + Find a string in the request body. Return its index, or -1. + + Term to search for + Require case-sensitive match? + Location of sSearchFor,or -1 + + + + Find a string in the response body. Return its index, or -1. + + Term to search for + Require case-sensitive match? + Location of sSearchFor,or -1 + + + + Reset the SessionID counter to 0. This method can lead to confusing UI, so use sparingly. + + + + + Create a Session object from two byte[] representing request and response. + + The client data bytes + The server data bytes + + + + Create a Session object from a (serializable) SessionData object + + + + + + Create a Session object from two byte[] representing request and response. This is used when loading a Session Archive Zip. + + The client data bytes + The server data bytes + SessionFlags for this session + + + + Creates a new session and attaches it to the pipes passed as arguments + + The client pipe from which the request is read and to which the response is written. + The server pipe to which the request is sent and from which the response is read. May be null. + + + + Initialize a new session from a given request headers and body request builder data. Note: No Session ID is assigned here. + + NB: If you're copying an existing request, use oRequestHeaders.Clone() + The bytes of the request's body + + + + Copy Constructor. . + + Session to clone into a new Session instance + + + + Factory constructor + + + + + + + + + + + + Indexer property into SESSION flags, REQUEST headers, and RESPONSE headers. e.g. oSession["Request", "Host"] returns string value for the Request host header. If null, returns String.Empty + + SESSION, REQUEST or RESPONSE + The name of the flag or header + String value or String.Empty + + + + Simple indexer into the Session's oFlags object; returns null if flag is not present. + + + Returns the string value if the specified flag is present, or null if it is not. + + + + + Called when the Session is ready to begin processing. Eats exceptions to prevent unhandled exceptions on background threads from killing the application. + + Unused parameter (required by ThreadPool) + + + + Current step in the SessionProcessing State Machine + + + + + InnerExecute() implements Fiddler's HTTP Pipeline + + + + + Initiate bi-directional streaming on the RPC connection + + + + + Ensure that the Session's state is >= ss, updating state if necessary + + TargetState + + + + May this Session be resent on a different connection because reading of the response did not succeed? + + TRUE if the entire session may be resent on a new connection + + + + If the response demands credentials and the Session is configured to have Fiddler provide those + credentials, try to do so now. + + TRUE if Fiddler has generated a response to an Auth challenge; FALSE otherwise. + + + + This method will perform obtain authentication credentials from System.NET using a reflection trick to grab the internal value. + It's needed to cope with Channel-Binding-Tokens (CBT). + + This MUST live within its own non-inlined method such that when it's run on an outdated version of the .NET Framework, the outdated + version of the target object triggers a TypeLoadException in such a way that the caller can catch it and warn the user without + killing Fiddler.exe. + + TRUE if we didn't hit any exceptions + + + + Copies process-owner information from a source session to a destination session. Used during handling of AutoRedirects + and auto-Authentications + + + + + + Returns a Kerberos-usable SPN for the target + http://dev.chromium.org/developers/design-documents/http-authentication + "HttpAuthHandlerNegotiate::CreateSPN" + http://blog.michelbarneveld.nl/michel/archive/2009/11/14/the-reason-why-kb911149-and-kb908209-are-not-the-soluton.aspx + + + + + + + Returns the fully-qualified URL to which this Session's response points, or null. + This method is needed because many servers (illegally) return a relative url in HTTP/3xx Location response headers. + + null, or Target URL. Note, you may want to call Utilities.TrimAfter(sTarget, '#'); on the response + + + + Gets a redirect-target from a base URI and a Location header + + + + null, or Target URL. Note, you may want to call Utilities.TrimAfter(sTarget, '#'); + + + + Fiddler can only auto-follow redirects to HTTP/HTTPS/FTP. + + The BASE URL to which a relative redirection should be applied + Response "Location" header + TRUE if the auto-redirect target is allowed + + + + Handles a Response's Redirect if the Session is configured to do so. + + TRUE if a redirect was handled, FALSE otherwise + + + + Check for common mistakes in HTTP Responses and notify the user if they are found. Called only if Linting is enabled. + + + + + Assign a Session ID. Called by ClientChatter when headers are available + + + + + Called only by InnerExecute, this method reads a request from the client and performs tampering/manipulation on it. + + TRUE if there's a Request object and we should continue processing. FALSE if reading the request failed + *OR* if script or an extension changed the session's State to DONE or ABORTED. + + + + + If the executeObtainRequest called failed, we perform cleanup + + + + + Returns TRUE if response is a NTLM or NEGO challenge + + True for HTTP/401,407 with NEGO or NTLM demand + + + + Returns TRUE if response is a Digest, NTLM, or Nego challenge + + True for HTTP/401,407 with Digest, NEGO, NTLM demand + + + + Replace the "ipv*.fiddler "fake" hostnames with the IP-literal equvalents. + + + + + Determines if request host is pointing directly at Fiddler. + + + + + + Echo the client's request back as a HTTP Response, encoding to prevent XSS. + + + + + Send a Proxy Configuration script back to the client. + + + + + Send a Proxy Configuration script back to WinHTTP, so that Fiddler can use an upstream proxy specified + by a script on a fileshare. (WinHTTP only allows HTTP/HTTPS-hosted script files) + + + + + Send the Fiddler Root certificate back to the client + + + + + This method indicates to the client that a secure tunnel was created, + without actually talking to an upstream server. + + If Fiddler's AutoResponder is enabled, and that autoresponder denies passthrough, + then Fiddler itself will always indicate "200 Connection Established" and wait for + another request from the client. That subsequent request can then potentially be + handled by the AutoResponder engine. + + BUG BUG: This occurs even if Fiddler isn't configured for HTTPS Decryption + + + The hostname to use in the Certificate returned to the client + + + + This method adds a Proxy-Support: Session-Based-Authentication header and indicates whether the response is Nego:Type2. + + Returns TRUE if server returned a credible Type2 NTLM Message + + + + This helper evaluates the conditions for client socket reuse. + + + + + + Sends the Response that Fiddler received from the server back to the client socket. + + Should the client and server pipes be tightly-bound together? + True, if the response was successfully sent to the client + + + + Sets up the next Session on these pipes, binding this Session's pipes to that new Session, as appropriate. When this method is called, + the nextSession variable is populated with the new Session, and that object is executed at the appropriate time. + + TRUE if both the client and server pipes should be bound regardless of the serverPipe's ReusePolicy + + + + This object holds Session information as a set of four easily-marshalled byte arrays. + It is serializable, which enables cross-process transfer of this data (as in a drag/drop operation). + (Internally, data is serialized as if it were being stored in a SAZ file) + + + + + Create a SessionData object. + Note: Method must run as cheaply as possible, since it runs on all Drag/Dropped sessions within Fiddler itself. + + + + + + Parameters passed into the AcceptConnection method. + + + + + The Socket which represents the newly-accepted Connection + + + + + The Certificate to pass to SecureClientPipeDirect immediately after accepting the connection. + Normally null, this will be set if the proxy endpoint is configured as a "Secure" endpoint + by AssignEndpointCertificate / ActAsHTTPSEndpointForHostname. + + + + + The DateTime of Creation of this connection + + + + + Unknown + + + + + The new Session is needed to respond to an Authentication Challenge + + + + + The new Session is needed to follow a Redirection + + + + + The new Session is needed to generate a CONNECT tunnel + + + + + Event arguments constructed for the OnStateChanged event raised when a Session's state property changed + + + + + The prior state of this session + + + + + The new state of this session + + + + + Constructor for the change in state + + The old state + The new state + + + + States for the (future) Session-processing State Machine. + + Fun Idea: We can omit irrelevant states from FiddlerCore and thus not have to litter + our state machine itself with a bunch of #if FIDDLERCORE checks... + ... except no, that doesn't work because compiler still cares. Rats. + + + + + + State of the current session + + + + + Object created but nothing's happening yet + + + + + Thread is reading the HTTP Request + + + + + AutoTamperRequest pass 1 (IAutoTamper, OnBeforeRequest script method) + + + + + User can tamper using Fiddler Inspectors + + + + + AutoTamperRequest pass 2 (Only used by IAutoTamper) + + + + + Thread is sending the Request to the server + + + + + Thread is reading the HTTP Response + + + + + AutoTamperResponse pass 1 (Only used by IAutoTamper) + + + + + User can tamper using Fiddler Inspectors + + + + + AutoTamperResponse pass 2 (Only used by IAutoTamper) + + + + + Sending response to client application + + + + + Session complete + + + + + Session was aborted (client didn't want response, fatal error, etc) + + + + + This enumeration provides the values for the Session object's BitFlags field + + + + + No flags are set + + + + + The request originally arrived with a URL specifying the HTTPS protocol. + + + + + The request originally arrived with a URL specifying the FTP protocol. + + + + + Ignore this traffic; do not buffer, store, or call event handlers + + + + + The client pipe was reused + + + + + The server pipe was reused + + + + + The request was transmitted to the server when its headers were complete + + + + + The response was streamed + + + + + The request was generated by Fiddler itself (e.g. the Composer tab) + + + + + The response was generated by Fiddler itself (e.g. AutoResponder or utilCreateResponseAndBypassServer) + + + + + This session was loaded from a .SAZ File + + + + + This session was loaded from some other tool + + + + + This request was sent to an upstream (CERN) gateway proxy + + + + + This is a "blind" CONNECT tunnel for HTTPS traffic + + + + + This is a CONNECT tunnel which decrypts HTTPS traffic as it flows through + + + + + This response was served from a client cache, bypassing Fiddler. Fiddler only "sees" this session because other software reported it to Fiddler + + + + + There was a HTTP Protocol violation in the client's request + + + + + There was a HTTP Protocol violation in the server's response + + + + + Response body was dropped, e.g due to fiddler.network.streaming.ForgetStreamedData or log-drop-response-body flag + + + + + This is a CONNECT tunnel for WebSocket traffic + + + + + This request was sent using the SOCKS protocol + + + + + Request body was dropped, e.g due to log-drop-request-body flag + + + + + The request was to create a RPC tunnel (e.g. on an RPC_OUT_DATA request) + + + + + A SessionTimers object holds timing information about a single Session. + + + + + Log a Read's size and timestamp + + Number of milliseconds since first calling .Read() + Number of bytes returned in this read + + + + Return the ReadTimings as an array. Only one read is counted per millisecond + + + + + + Create a new List and append to it + + + + + + + The time at which the client's HTTP connection to Fiddler was established + + + + + The time at which the request's first Send() to Fiddler completes + + + + + The time at which the request headers were received + + + + + The time at which the request to Fiddler completes (aka RequestLastWrite) + + + + + The time at which the server connection has been established + + + + + The time at which Fiddler begins sending the HTTP request to the server (FiddlerRequestFirstSend) + + + + + The time at which Fiddler has completed sending the HTTP request to the server (FiddlerRequestLastSend). + BUG: Should be named "FiddlerEndRequest". + NOTE: Value here is often misleading due to buffering inside WinSock's send() call. + + + + + The time at which Fiddler receives the first byte of the server's response (ServerResponseFirstRead) + + + + + The time at which Fiddler received the server's headers + + + + + The time at which Fiddler has completed receipt of the server's response (ServerResponseLastRead) + + + + + The time at which Fiddler has begun sending the Response to the client (ClientResponseFirstSend) + + + + + The time at which Fiddler has completed sending the Response to the client (ClientResponseLastSend) + + + + + The number of milliseconds spent determining which gateway should be used to handle this request + (Should be mutually exclusive to DNSTime!=0) + + + + + The number of milliseconds spent waiting for DNS + + + + + The number of milliseconds spent waiting for the server TCP/IP connection establishment + + + + + The number of milliseconds elapsed while performing the HTTPS handshake with the server + + + + + Override of ToString shows timer info in a fancy format + + Timing information as a string + + + + Override of ToString shows timer info in a fancy format + + TRUE if the result can contain linebreaks; false if comma-delimited format preferred + Timing information as a string + + + + Enables High-Resolution timers, which are bad for battery-life but good for the accuracy of timestamps. + See http://technet.microsoft.com/en-us/sysinternals/bb897568 for the ClockRes utility that shows current clock resolution. + NB: Exiting Fiddler reverts this to the default value. + + + + + URLMon Interop Class + + + + + Set the user-agent string for the current process + + New UA string + + + + Query WinINET for the current process' proxy settings. Oddly, there's no way to UrlMkGetSessionOption for the current proxy. + + String of hex suitable for display + + + + Configures the current process to use the system proxy for URLMon/WinINET traffic. + + + + + Configures the current process to use no Proxy for URLMon/WinINET traffic. + + + + + Sets the proxy for the current process to the specified list. See http://msdn.microsoft.com/en-us/library/aa383996(VS.85).aspx + + e.g. "127.0.0.1:8888" or "http=insecProxy:80;https=secProxy:444" + Semi-colon delimted list of hosts to bypass proxy; use <local> to bypass for Intranet + + + + Holds a variety of useful functions used in Fiddler and its addons. + + + + + Create a Session Archive Zip file containing the specified sessions + + The filename of the SAZ file to store + Array of sessions to store + Password to encrypt the file with, or null + TRUE if verbose error dialogs should be shown. + + + + + This is a refactored helper function which writes a single session to an open SAZ file. + + The session to write to the file + The ZIP File + The number of this file + The format string (e.g. "D3") to use when formatting the file number + The HTML String builder to write index information + TRUE to show verbose error dialog information + + + + Reads a Session Archive Zip file into an array of Session objects + + Filename to load + + Loaded array of sessions or null, in case of failure + + + + Reads a Session Archive Zip file into an array of Session objects + + Filename to load + + Loaded array of sessions or null, in case of failure + + + + Ensures a value is within a specified range. + + Type of the value + Current value + Min value + Max value + Returns the provided value, unless it is outside of the specified range, in which case the nearest "fencepost" is returned. + + + + A static byte array containing 0 elements. Use to avoid having many copies of an empty byte[] floating around. + + + + + Queries the user for a filename + + Dialog title + String representing file dialog filter + Filename or null + + + + Queries the user for a filename + + Dialog title + String representing file dialog filter + Initial directory or null + Filename or null + + + + Adds a place to a FileDialog's "Places" collection. + Includes error handling for internal .NET Framework bug. + + Note: CustomPlaces requires SP2 of .NET Framework v2. Attempting to call this method will throw System.MissingMethodException + if the required service pack is not installed. + + + + + + + Queries the user for an OPEN filename + + Dialog title + String representing file dialog filter (e.g. "All files (*.*)|*.*") + Filename or null + + + + Queries the user for an OPEN filename + + Dialog title + String representing file dialog filter + Initial directory or null + Filename or null + + + + Check to see that the target assembly defines a RequiredVersionAttribute and that the current Fiddler instance meets that requirement + + The assembly to test + The "type" of extension for display in error message + TRUE if the assembly includes a requirement and Fiddler meets it. + + + + Typically, a version number is displayed as "major number.minor number.build number.private part number". + + Version required + Version of the binary being tested + Returns 0 if exact match, else greater than 0 if Required version greater than verTest + + + + Address the problem where the target "PATH" calls for a directoryname is already a filename + + + + + + + Ensure that the target file does not yet exist. If it does, generates a new filename with an embedded identifier, e.g. out[1].txt instead. + Attempts to ensure filename is creatable; e.g. if a path component needs to be a directory but is a file already, injects [#] into that + path component. + + Candidate filename + New filename which does not yet exist + + + + Ensure that the target path exists and if a file exists there, it is not readonly or hidden. + WARNING: Can throw if target "Filename" calls for a parent directoryname that is already used as a filename by a non-directory. + E.g. EnsureOverwriteable(C:\io.sys\filename.txt); would throw. + + The candidate filename + + + + Writes arrBytes to a file, creating the target directory and overwriting if the file exists. + + Path to File to write. + Bytes to write. + + + + Fills an array completely using the provided stream. Unlike a normal .Read(), this one will always fully fill the array unless the Stream throws. + + The stream from which to read. + The byte array into which the data should be stored. + The count of bytes read. + + + + Create a new byte[] containing the contents of two other byte arrays. + + + + + + + + Returns the Value from a (case-insensitive) token in the header string. Correctly handles double-quoted strings. + Allows comma and semicolon as delimiter. Trailing whitespace may be present. + + Name of the header + Name of the token + Value of the token if present; otherwise, null + + + + Ensures that the target string is iMaxLength or fewer characters + + The string to trim from + The maximum number of characters to return + Up to iMaxLength characters from the "Head" of the string. + + + + Ensures that the target string is iMaxLength or fewer characters, appending ... if truncation occurred + + The string to trim from + The maximum number of characters to return + The string, or up to iMaxLength-1 characters from the "Head" of the string, with \u2026 appeneded. + + + + Returns the "Head" of a string, before and not including a specified search string. + + The string to trim from + The delimiting string at which the trim should end. + Part of a string up to (but not including) sDelim, or the full string if sDelim was not found. + + + + Returns the "Head" of a string, before and not including the first instance of specified delimiter. + + The string to trim from. + The delimiting character at which the trim should end. + Part of a string up to (but not including) chDelim, or the full string if chDelim was not found. + + + + [Deprecated] Ensures that the target string is iMaxLength or fewer characters + + The string to trim from + The maximum number of characters to return + Identical to the method. + Up to iMaxLength characters from the "Head" of the string. + + + + Returns the "Tail" of a string, after (but NOT including) the First instance of specified delimiter. + See also + + The string to trim from. + The delimiting character after which the text should be returned. + Part of a string after (but not including) chDelim, or the full string if chDelim was not found. + + + + Returns the "Tail" of a string, after (but NOT including) the First instance of specified search string. + + + The string to trim from. + The delimiting string after which the text should be returned. + Part of a string after (but not including) sDelim, or the full string if sDelim was not found. + + + + Returns the "Tail" of a string, after (and including) the first instance of specified search string. + + The string to trim from. + The delimiting string at which the text should be returned. + Part of the string starting with sDelim, or the entire string if sDelim not found. + + + + Returns the "Tail" of a string, after (but not including) the Last instance of specified delimiter. + + + The string to trim from. + The delimiting character after which text should be returned. + Part of a string after (but not including) the final chDelim, or the full string if chDelim was not found. + + + + Returns the "Tail" of a string, after (but not including) the Last instance of specified substring. + + + The string to trim from. + The delimiting string after which text should be returned. + Part of a string after (but not including) the final sDelim, or the full string if sDelim was not found. + + + + Strip any IPv6-Literal brackets, needed when creating a Certificate + + + + + + + Determines true if a request with the specified HTTP Method/Verb MUST contain a entity body + + The Method/Verb + TRUE if the HTTP Method MUST contain a request body. + + + + http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-4.2.2 + + HTTPMethod + TRUE if the method is deemed idempotent + + + + Returns true if a request with the specified HTTP Method/Verb may contain a entity body + + The Method/Verb + TRUE if the HTTP Method MAY contain a request body. + + + + Detects whether string ends in a file extension generally recognized as an image file extension. + Pass lowercase into this function. + + *Lowercase* string + TRUE if string ends with common image file extension + + + + Determines if the specified MIME type is "binary" in nature. + + The MIME type + TRUE if the MIME type is likely binary in nature + + + + Gets a string from a byte-array, stripping a Byte Order Marker preamble if present. + + + This function really shouldn't need to exist. Why doesn't calling .GetString on a string with a preamble remove the preamble??? + + The byte array + The encoding to convert from *if* there's no Byte-order-marker + The string + + + + WARNING: May throw. + Gets an encoding, with proper respect for "utf8" as an alias for "utf-8"; Microsoft products don't support + this prior to 2015-era, but it turns out to be common. We do have a linter elsewhere that reports a warning + if it sees the dashless form. + https://github.com/telerik/fiddler/issues/38 + + Textual name of the encoding + + + + WARNING: Potentially slow. + WARNING: Does not decode the HTTP Response body; if compressed, embedded META or _charset_ will not be checked + Gets (via Headers or Sniff) the provided body's text Encoding. If not found, returns CONFIG.oHeaderEncoding (usually UTF-8). + + HTTP Headers, ideally containing a Content-Type header with a charset attribute. + byte[] containing the entity body. + A character encoding, if one could be determined + + + + Gets (via Headers or Sniff) the Response Text Encoding. Returns CONFIG.oHeaderEncoding (usually UTF-8) if unknown. + Perf: May be quite slow; cache the response + + The session + The encoding of the response body + + + + Set of encodings for which we'll attempt to sniff. (List order matters, I think) + + + + + HtmlEncode a string. + In Fiddler itself, this is a simple wrapper for the System.Web.HtmlEncode function. + The .NET3.5/4.0 Client Profile doesn't include System.Web, so we must provide our + own implementation of HtmlEncode for FiddlerCore's use. + + String to encode + String encoded according to the rules of HTML Encoding, or null. + + + + This function accepts a string and an offset into the string. It reads one or more %XX sequences from the + string converting them into a UTF-8 string based on the input text + + + + + + + + Convert the %-encoded string into a string, interpreting %-escape sequences as UTF-8 characters + + %-encoded string + Unencoded string + + + + Replaces System.Web.HttpUtility.UrlPathEncode(str). + + String to encode as a URL Path + Encoded string + + + + Tokenize a string into tokens. Delimits on unquoted whitespace ; quote marks are dropped unless preceded by \ characters. + Some special hackery to allow trailing slash not escape the final character of the entire input, so that: + prefs set fiddler.config.path.vsplugins "F:\users\ericlaw\VSWebTest\" + ...doesn't end up with a trailing quote. + + The string to tokenize + Are single-quotes allowed to as escapes? + An array of strings + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + String containing a pretty-printed array + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + The maximum number of bytes to pretty-print + String containing a pretty-printed array + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + The maximum number of bytes to pretty-print + Show ASCII text at the end of each line + String containing a pretty-printed array + + + + Print an byte array to a hex string. + Slow. + + Byte array + String of hex bytes, or "null"/"empty" if no bytes provided + + + + Create a string in CF_HTML format + + The HTML string + The HTML string wrapped with a CF_HTML prelude + + + + Returns an integer from the registry, or a default. + + The Registry key in which to find the value. + The registry value name. + Default to return if the registry key is missing or cannot be used as an integer + The retrieved integer, or the default. + + + + Save a string to the registry. Correctly handles null Value, saving as String.Empty + + The registry key into which the value will be written. + The name of the value. + The value to write. + + + + Returns an Float from the registry, or a default. + + Registry key in which to find the value. + The value name. + The default float value if the registry key is missing or cannot be used as a float. + Float representing the value, or the default. + + + + Get a bool from the registry + + The RegistryKey + The Value name + The default value + Returns an bool from the registry, or bDefault if the registry key is missing or cannot be used as an bool. + + + + Maps a MIMEType to a file extension. + Pass only the TYPE (e.g. use oResponse.MIMEType), to ensure no charset info in the string. + + The MIME Type + A file extension for the type, or .TXT + + + + Return the content type of a target file, or application/octet-stream if unknown. + + A filename, including the extension + + + + + Determines if we have a complete chunked response body (RFC2616 Section 3.6.1) + + The session object, used for error reporting + The response data stream. Note: We do not touch the POSITION property. + The start of the HTTP body to scan for chunk size info + Returns the start of the final received/partial chunk + End of byte data in stream representing this chunked content, or -1 if error + True, if we've found the complete last chunk, false otherwise. + + + + Takes a byte array and applies HTTP Chunked Transfer Encoding to it + + The byte array to convert + The number of chunks to try to create + The byte array with Chunked Transfer Encoding applied + + + + Removes HTTP chunked encoding from the data in writeData and returns the resulting array. + + Some chunked data + Unchunked data. Throws InvalidDataException on data format errors. + + + + Removes HTTP chunked encoding from the data in writeData and returns the resulting array. + + Array to unchunk + Optional Session (for UI error messages) + TRUE to suppress error messages, FALSE to show alert boxes + Unchunked data. Throws InvalidDataException on data format errors. + + + + Returns TRUE if the Array contains nulls. TODO: Extend to check for other chars which are clearly non-Unicode + + + + + + + Implements a BlockList for "unknown" encodings that the utilDecode* functions cannot handle + + Transfer-Encoding + Content-Encoding + TRUE if any encoding is known to be unsupported + + + + Removes one or more encodings in the proper order to reconstruct the unencoded body. + If removing Transfer-Encoding and Content-Encoding, ALWAYS remove Transfer-Encoding first. + + The list of encodings in the order that they were applied + RFC2616: If multiple encodings have been applied to an entity, the content codings MUST be listed in the order in which they were applied. + Should unchunking be permitted (TRUE for Transfer-Encoding, FALSE for Content-Encoding) + The bytes of the body + + + + Content-Encodings + + + + + + + + + + Remove all encodings from arrBody, based on those specified in the supplied HTTP headers; DOES NOT MODIFY HEADERS. + Throws on errors. + + *Readonly* headers specifying what encodings are applied + In/Out array to be modified + + + + Remove all encodings from arrBody, based on those specified in the supplied HTTP headers; + DOES NOT MODIFY HEADERS. DOES NOT HANDLE UNSUPPORTED ENCODINGS WELL. + Throws on errors. + + *Readonly* headers specifying what encodings are applied + In/Out array to be modified + FALSE to show dialog boxes on errors, TRUE to remain silent + + + + Attempts to remove all Content-Encodings from a HTTP body. May throw if content is malformed. + MODIFIES HEADERS. + + Headers for the body; Content-Encoding and Content-Length will be modified + Reference to the body array + FALSE if error dialog boxes should be shown + TRUE if the body was decoded completely. + + + + Decompress an array compressed using an Zlib DEFLATE stream. Not a HTTP Encoding; it's used internally in the PNG format. + + The array to expand + byte[] of decompressed data + + + + GZIPs a byte-array + + Input byte array + byte[] containing a gzip-compressed copy of writeData[] + + + + GZIP-Expand function which shows no UI and will throw on error + + TRUE if you want to use Xceed to decompress; false if you want to use System.IO + byte[] to decompress + A decompressed byte array, or byte[0]. Throws on errors. + + + + Expands a GZIP-compressed byte array + + The array to decompress + byte[] containing an un-gzipped copy of compressedData[] + + + + Compress a byte array using RFC1951 DEFLATE + + Array to compress + byte[] containing a DEFLATE'd copy of writeData[] + + + + UnDeflate function which shows no UI and will throw on error + + TRUE if you want to use Xceed to decompress; false if you want to use System.IO + byte[] to decompress + A decompressed byte array, or byte[0]. Throws on errors. + + + + Decompress a byte array that was compressed using Microsoft's Xpress Raw format. + Available only on Windows 8+ + + Array to decompress + byte[] of decompressed data + + + + Decompress a byte array that was compressed using RFC1951 DEFLATE + + Array to decompress + byte[] of decompressed data + + + + Compress a byte[] using the bzip2 algorithm + + Array to compress + byte[] of data compressed using bzip2 + + + + Decompress an array compressed using bzip2 + + The array to expand + byte[] of decompressed data + + + + Decompress an array compressed using bzip2 + + The array to expand + byte[] of decompressed data + + + + Try parsing the string for a Hex-formatted int. If it fails, return false and 0 in iOutput. + + The hex number + The int value + TRUE if the parsing succeeded + + + + Returns TRUE if two ORIGIN (scheme+host+port) values are functionally equivalent. + + The first ORIGIN + The second ORIGIN + The default port, if a port is not specified + TRUE if the two origins are equivalent + + + + This function cracks a sHostPort string to determine if the address + refers to a "local" site + + The string to evaluate, potentially containing a port + True if the address is local + + + + This function cracks a sHostPort string to determine if the address + refers to the local computer + + The string to evaluate, potentially containing a port + True if the address is 127.0.0.1, 'localhost', or ::1 + + + + Determines if the specified Hostname is a either 'localhost' or an IPv4 or IPv6 loopback literal + + Hostname (no port) + TRUE if the hostname is equivalent to localhost + + + + This function cracks the Hostname/Port combo, removing IPV6 brackets if needed + + Hostname/port combo, like www.foo.com or www.example.com:8888 or [::1]:80 + The hostname, minus any IPv6 literal brackets, if present + Port #, 80 if not specified, -1 if corrupt + + + + Given a string/list in the form HOSTNAME:PORT#;HOSTNAME2:PORT2#, this function returns the FIRST IPEndPoint. Defaults to port 80 if not specified. + Warning: DNS resolution is slow, so use this function wisely. + + HOSTNAME:PORT#;OPTHOST2:PORT2# + An IPEndPoint or null + + + + Given a string/list in the form HOSTNAME:PORT#;HOSTNAME2:PORT2#, this function returns all IPEndPoints for ALL listed hosts. Defaults to port 80 if not specified. + Warning: DNS resolution is slow, so use this function wisely. + + HOSTNAME:PORT#;OPTHOST2:PORT2# + An array of IPEndPoints or null if no results were obtained + + + + This function attempts to be a ~fast~ way to return an IP from a hoststring that contains an IPv4/6-Literal. + + Hostname + IPAddress, or null, if the sHost wasn't an IP-Literal + + + + Launch the user's browser to a hyperlink. This function traps exceptions and notifies the user via UI dialog. + + The URL to ShellExecute. + TRUE if the ShellExecute call succeeded. + + + + Wrapper for Process.Start that shows error messages in the event of failure. + + Fully-qualified filename to execute. + Command line parameters to pass. + TRUE if the execution succeeded. FALSE if the execution failed. An error message will be shown for any error except the user declining UAC. + + + + Run an executable and wait for it to exit, notifying the user of any exceptions. + + Fully-qualified filename of file to execute. + Command-line parameters to pass. + TRUE if the execution succeeded. FALSE if the error message was shown. + + + + Run an executable, wait for it to exit, and return its output as a string. + NOTE: Uses CreateProcess, so you cannot launch applications which require Elevation. + + Fully-qualified filename of file to Execute + Command-line parameters to pass + Exit code returned by the executable + String containing the standard-output of the executable + + + + Copy a string to the clipboard, notifying the user of any exceptions + + The text to copy + TRUE if the copy succeeded + + + + Copy an object to the clipboard, notifying the user of any exceptions + + The object to copy + True if successful + + + + This method prepares a string to be converted into a regular expression by escaping special characters and CONVERTING WILDCARDS. + This method was originally meant for parsing WPAD proxy script strings. + + You typically should use the Static RegEx.Escape method for most purposes, as it doesn't convert "*" into ".*" + + + + + + + + + Determines whether the arrData array STARTS WITH with the supplied arrMagics bytes. Used for Content-Type sniffing. + + The data, or null + The MagicBytes to look for + TRUE if arrData begins with arrMagics + + + + Determines whether the arrData array begins with the supplied sMagics ASCII text. Used for Content-Type sniffing. + + The data, or null + The ASCII text to look for + TRUE if arrData begins with sMagics (encoded as ASCII octets) + + + + Is this HTTPMethod used for RPC-over-HTTPS? + + + + + Determine if a given byte array has the start of a HTTP/1.* 200 response. + Useful primarily to determine if a CONNECT request to a proxy returned success. + + + + + + + Determine if a given byte array has the start of a HTTP/1.* 407 response. + Useful primarily to determine if a CONNECT request to a proxy returned an auth challenge + + + + + + + For a given process name, returns a bool indicating whether this is a known browser process name. + + The Process name (e.g. "abrowser.exe") + Returns true if the process name starts with a common browser process name (e.g. ie, firefox, etc) + + + + Ensure that a given path is absolute, if not, applying the root path. + WARNING: This function only works as well as Path.IsPathRooted, which returns "True" for things like "/NoDriveSpecified/fuzzle.txt" + A better approach would be to look at the internal Path.IsRelative method + + + + + + + + If sFilename is absolute, returns it, otherwise, combines the leaf filename with local response folders hunting for a match. + Trims at the first ? character, if any + + Either a fully-qualified path, or a leaf filename + File path + + + + Get a TickCount (milliseconds since system start) as an unsigned 64bit value. On Windows Vista+, uses the GetTickCount64 API that + won't rollover, but on any other platform, this unsigned wrapper moves the rollover point to 49 days of uptime. + + Number of ms since the system started + + + + Returns a succinct version of Environment.OSVersion.VersionString + + + + + + Returns TRUE on *Windows* (not Mono) when OS Version is Win8+ (NT6.2+) + + + + + + Turns a string into a SslProtocol Flags enum. Ignores our magic <client> token. + + e.g. tls1.0;ssl3.0 + + + + + Duplicate a byte array, replacing null with byte[0]. + Doing this instead of .Clone() because it better handles nulls and it may be faster. + + The array to copy + The new array. + + + + Warning: This will throw if FIPS mode is enabled + + + + + + + Returns TRUE if the array is null or contains 0 bytes + + byte[] to test + + + + + Returns TRUE if the string is non-empty and not of the pattern "[#123]" + Necessary because SAZ-saving logic autogenerates comments of that form + + + + + + + + + + True if ClientChatter is non-null and its headers are non-null + + + + True if ClientChatter is non-null and its headers are non-null + + + True if ClientChatter is non-null and its headers are non-null + + + + Return a multi-line string describing the NetworkInterfaces[] + + + + + + Checks a DLL's filename for signals that it doesn't contain extensions. + This hack is only needed because I wasn't smart enough to require that the assembly be named something like Fiddler.* in the original design. + + DLL filename + TRUE if we should skip this assembly during enumeration + + + + Garbage collect and, if possible, compact the Large Object heap + + + + + Common functions we'll want to use on Strings. Fiddler makes extensive use of strings which + should be interpreted in a case-insensitive manner. + + WARNING: Methods assume that the calling object is not null, which is lame for reliability but arguably good for performance. + + + + + The WebSocket class represents a "tunnel" through which WebSocket messages flow. + The class' messages may be deserialized from a SAZ file. + + + + + Should this WebSocket Tunnel parse the WS traffic within into individual messages? + + + + + Is this WebSocket open/connected? + + + + + Writes all of the messages stored in this WebSocket to a stream. + + + + + + + Approximate size of the data of the stored messages, used for memory tracking + + + + + + Read headers from the stream. + + The Stream from which WebSocketSerializationHeaders should be read + The Array of headers, or String[0] + + + + Boolean that determines whether the WebSocket tunnel tracks messages. + + + + + Number of bytes received from the client + + + + + Number of bytes received from the server + + + + + Returns number of bytes sent from the Server to the Client on this WebSocket + + + + + Returns number of bytes sent from the Client to the Server on this WebSocket + + + + + Creates a "detached" WebSocket which contains messages loaded from the specified stream + + Session to which the WebSocket messages belong + The Stream containing messages, which will be closed upon completion + + + + This factory method creates a new WebSocket Tunnel and executes it on a background (non-pooled) thread. + + The Session containing the HTTP CONNECT request + + + + Creates a WebSocket tunnel. External callers instead use the CreateTunnel static method. + + The session for which this tunnel was initially created. + The client pipe + The server pipe + + + + This function keeps the Tunnel/Thread alive until it is signaled that the traffic is complete + + + + + Performs cleanup of the WebSocket instance. Call this after the WebSocket closes normally or after abort/exceptions. + + + + + Executes the WebSocket tunnel on a background thread + + + + + Interface Method + Close the WebSocket and signal the event to let its service thread die. Also called by oSession.Abort() + WARNING: This should not be allowed to throw any exceptions, because it will do so on threads that don't + catch them, and this will kill the application. + + + + + When we get a buffer from the client, we push it into the memory stream + + + + + When we get a buffer from the server, we push it into the memory stream + + + + + This method parses the data in strmClientBytes to extact one or more WebSocket messages. It then sends each message + through the pipeline. + + + + This method parses the data in strmServerBytes to extact one or more WebSocket messages. It then sends each message + through the pipeline to the client. + + + + Called when we have received data from the local client. + + The result of the asynchronous operation. + + + Called when we have received data from the remote host. Incoming data will immediately be forwarded to the local client. + The result of the asynchronous operation. + + + + This enumeration provides the values for the WebSocketMessage object's BitFlags field + + + + + No flags are set + + + + + Message was eaten ("dropped") by Fiddler + + + + + Message was generated ("injected") by Fiddler itself + + + + + Fragmented Message was reassembled by Fiddler + + + + + Breakpointed + + + + + A WebSocketMessage stores a single frame of a single WebSocket message + http://tools.ietf.org/html/rfc6455 + + + + + 3 bits frame-rsv1,frame-rsv2,frame-rsv3 + + + + + Unmasks the first array into the third, using the second as a masking key. + + + + + + + + Masks the first array's data using the key in the second + + The data to be masked + A 4-byte obfuscation key, or null. + + + + Replaces the WebSocketMessage's payload with the specified string, masking if needed. + + + + + + Copies the provided byte array over the WebSocketMessage's payload, masking if needed. + + + + + + Masks the provided array (if necessary) and assigns it to the WebSocketMessage's payload. + + New array of data + + + + Return the WebSocketMessage's payload as a string. + + + + + + Copy the WebSocketMessage's payload into a new Byte Array. + + A new byte array containing the (unmasked) payload. + + + + Is this a Request message? + + + + + The WebSocketTimers collection tracks the timestamps for this message + + + + + The raw payload data, which may be masked. + + + + + The four-byte payload masking key, if any + + + + + The type of the WebSocket Message's frame + + + + + Serialize this message to a stream + + + + + + Add the content of the subequent continuation to me. + + + + + + Timers + + + + + When was this message read from the sender + + + + + When did transmission of this message to the recipient begin + + + + + When did transmission of this message to the recipient end + + + + + Return the timers formatted to be placed in pseudo-headers used in saving the WebSocketMessage to a stream (SAZ). + NOTE: TRAILING \r\n is critical. + + + + + + The AutoProxy class is used to handle upstream gateways when the client was configured to use WPAD or a Proxy AutoConfig (PAC) script. + + + + + Indication as to whether AutoProxy information is valid. 0=Unknown/Enabled; 1=Valid/Enabled; -1=Invalid/Disabled + + + + + Get the text of the file located at a specified file URI, or null if the URI is non-file or the file is not found. + + + + + Returns a string containing the currently selected autoproxy options + + + + + + Get WPAD-discovered URL for display purposes (e.g. Help> About); note that we don't actually use this when determining the gateway, + instead relying on the this.autoProxy.TryGetProxyForUrl method to do this work for us. + + A WPAD url, if found, or String.Empty + + + + Return gateway endpoint for requested Url. TODO: Add caching layer on our side? TODO: Support multiple results? + + The URL for which the gateway should be determined + The Endpoint of the Gateway, or null + TRUE if WinHttpGetProxyForUrl succeeded + + + + Dispose AutoProxy. + + + + + Wrapper for WinINET cache APIs. + + + + + Clear all HTTP Cookies from the WinINET Cache + + + + + Clear all files from the WinINET Cache + + + + + Delete all permanent WinINET cookies for sHost; won't clear memory-only session cookies. Supports hostnames with an optional leading wildcard, e.g. *example.com. NOTE: Will not work on VistaIE Protected Mode cookies. + + The hostname whose cookies should be cleared + + + + Clear the Cache items. Note: May be synchronous, may be asynchronous. + + TRUE if cache files should be cleared + TRUE if cookies should be cleared + + + + Writes the ContentTypes XML to the ZIP so Packaging APIs can read it. + See http://en.wikipedia.org/wiki/Open_Packaging_Conventions + + + + + + Implement this interface to handle upstream gateways when the client is configured to use WPAD or a Proxy AutoConfig (PAC) script. + + + + + Outs the for the requested . + + The URL for which the should be determined. + One or more of the following strings separated by semicolons. + ([<scheme>=][<scheme>"://"]<server>[":"<port>]) + If the method fails this parameter should contain the error message, null otherwise. + True if the method succeeds, false otherwise. + + + + Outs WPAD-discovered URL of the Proxy Auto-Config file. + + The Proxy Auto-Config URL. + True if the method succeeds, false otherwise. + + + + Implement this interface in order to provide FiddlerCore with platform specific functionality. + + + + + Map a local port number to the originating process ID. + + The port number. + true to include processes using IPv6 addresses in the mapping. + Contains the originating process ID if the operation is successful. + Contains an error message if the operation fails. + true if the operation is successful, false otherwise. + + + + Gets any process' name and ID which listens on a port. + + The port number. + Contains the process name of a process if there is one listening on the port, otherwise contains an empty string. + Contains the process ID of a process if there is one listening on the port, otherwise contains 0. + Contains an error message if the operation fails. + true if the operation is successful, false otherwise. + + + + Changes system-wide timer's resolution. + + true to increase the resolution for better accuracy of timestamps, false to decrease it to the default value for the system. + true if the operation is successful, false otherwise. + + + + Returns true if the system-wide timer's resolution is increased, false otherwise. + + + + + Gets a proxy helper, which can be used to manipulate proxy settings. + + + + + This event is raised when a debug message is being spewed. + + + + + This event is raised when an error has occured. + + + + + This event is raised when a message is being logged. + + + + + Decompresses a byte[] that is compressed with XPRESS. + + The compressed byte[]. + The decompressed byte[]. + + + + This method is used to post-process the name of a process, in order to resolve it more accurately. + + The ID of the process, whose name should be post-processed. + The process name that should be post-processed. + The post-processed process name. + + + + This method is used to set the user-agent string for the current process. + + The user-agent string. + + + + This method is used to get the number of milliseconds since the system start. + + Contains the system uptime in milliseconds if the operation is successful. + true if the operation is successful, false otherwise. + + + + Creates . + + True if the must use the WPAD protocol, false otherwise. + URL of the Proxy Auto-Config file. Can be null. + True if the WPAD processing should be done in the current process, false otherwise. + Specifies whether the client's domain credentials should be automatically sent + in response to an NTLM or Negotiate Authentication challenge when the requests the PAC file. + + + + + Implement this interface in order to implement a factory, which is used to create objects. + + + + + Creates new object. + + The platform extensions object. + + + + Implement this interface, in order to provide FiddlerCore with platform-specific proxy helper. + This interface contains members used to manipulate proxy settings. + + + + + Configures the current process to use no proxy. + + + + + Returns the current process' proxy settings. + + String containing a HEX view of the current process' proxy settings. + + + + Configures current process' proxy settings to default. + + + + + Configures current process' proxy settings. + + The proxy information (IP and port). It can be per connection type + (e.g. http=127.0.0.1:8080;https=127.0.0.1:444) or global (e.g. 127.0.0.1:8888). + Semi-colon delimted list of hosts to bypass proxy + (e.g. www.google.com;www.microsoft.com) + + + + Implement this interface in order to provide FiddlerCore with Windows-specific functionality. + + + + + Gets a WinINet helper, which can be used to access WinINet native API. + + + + + Implement this interface in order to provide FiddlerCore with access to native WinINet API. + + + + + Clears WinINet's cache. + + true if cache files should be cleared, false otherwise. + true if cookies should be cleared, false otherwise. + + + + Delete all permanent WinINet cookies for a . + + The hostname whose cookies should be cleared. + + + + Use this method in order to get cache information for a . + + The URL for which the cache info is requested. + String, containing cache information for the given . + + + + This class is used to pass a simple string message to a event handler. + + + + + Creates and initializes new instance of the . + + The message. + + + + Gets the message. + + + + + Given a local port number, uses GetExtendedTcpTable to find the originating process ID. + First checks the IPv4 connections, then looks at IPv6 connections. + + Client applications' port + ProcessID, or 0 if not found + + + + Calls the GetExtendedTcpTable function to map a port to a process ID. + This function is (over) optimized for performance. + + Client port + AF_INET or AF_INET6 + PID, if found, or 0 + + + + Enumeration of possible queries that can be issued using GetExtendedTcpTable + http://msdn2.microsoft.com/en-us/library/aa366386.aspx + + + + + Processes listening on Ports + + + + + Processes with active TCP/IP connections + + + + + Outs WPAD-discovered URL for display purposes (e.g. Help> About); note that we don't actually use this when determining the gateway, + instead relying on the WinHTTPGetProxyForUrl function to do this work for us. + + A WPAD url, if found, or String.Empty + + + + Note: Be sure to use the same hSession to prevent redownload of the proxy script + + + + + Set to true to send Negotiate creds when challenged to download the script + + + + + For PInvoke: Contains information about an entry in the Internet cache + + + + + Requires Win8+ + Decompress Xpress|Raw blocks used by WSUS, etc. + Introduction to the API is at http://msdn.microsoft.com/en-us/library/windows/desktop/hh920921(v=vs.85).aspx + + + + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + String containing a pretty-printed array + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + The maximum number of bytes to pretty-print + String containing a pretty-printed array + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + The maximum number of bytes to pretty-print + Show ASCII text at the end of each line + String containing a pretty-printed array + + + + Returns the "Tail" of a string, after (but not including) the Last instance of specified delimiter. + + + The string to trim from. + The delimiting character after which text should be returned. + Part of a string after (but not including) the final chDelim, or the full string if chDelim was not found. + + + + Format an Exception message, including InnerException message if present. + + + + + + + How long should we wait for parallel creations + + + + + "SHA256WITHRSA", "SHA384WITHRSA", "SHA512WITHRSA", "MD5WITHRSA", etc + + + + + Cache of EndEntity certificates that have been generated in this session. + + + + + The ReaderWriter lock gates access to the certCache + + + + + Queue of creations in progress, indexed by certificate CN. + ManualResetEvent info: http://msdn.microsoft.com/en-us/library/ksb7zs2x(v=vs.95).aspx + + + + + The ReaderWriter lock gates access to the Queue which ensures we only have one Certificate-Generating-per-Host + + + + + The BouncyCastle Root certificate + + + + + The BouncyCastle Root Private key + + + + + The EE Certificate Public/Private key that we'll reuse for all EE certificates if the + preference fiddler.certmaker.bc.ReusePrivateKeys is set. + + + + + Object we use to lock on when updating oEEKeyPair + + + + + Object we use to lock on when updating oCACert / OCAKey + + + + + Should Fiddler automatically generate wildcard certificates? + + + + + TLDs for which should Fiddler generate wildcarded 3rd-level-domain certs + + + + + Length for the Public/Private Key used in the EE certificate + + + + + Length for the Public/Private Key used in the Root certificate + + + + + Should verbose logging information be emitted? + + + + + Controls whether we use the same Public/Private keypair for all Server Certificates (improves perf) + + + + + Controls whether we use the same Public/Private keypair for the root AND all Server Certificates (improves perf) + + + + + Get the base name for the KeyContainer into which the private key goes. If EE Keys are being reused, then we use only + this ID. + + + + + + Returns the Subject O field. Note that Fiddler's normal root uses "DO_NOT_TRUST" rather than "DO_NOT_TRUST_BC". + + + + + + Flush EE certificates to force regeneration + + + + + Free the KeyContainer that contains this private key. + Avoids pollution of %USERPROFILE%\appdata\roaming\microsoft\crypto\ with orphaned keys + + + + + + + + + FindByIssuer{Distinguished}Name requires a complete match of the SUBJECT, including CN, O, and OU + + + + + Converts from a BouncyCastle Certificate object into a .NET X509Certificate2 object + + A BouncyCastle X509Certificate + The .NET X509Certificate2 + + + + Converts a BouncyCastle PrivateKey object into a .NET-compatible object + + + + + + + Copy BC cert to Windows Certificate Storage, without key. THROWS on Errors + + + + + + + + + Generates a new EE Certificate using the given CA Certificate to sign it. Throws on Crypto Exceptions. + + + + + + + + + Generates (or retrieves from cache) a Public/Private keypair to attach to an EE Certificate + + The CN for the certificate being generated (used for Logging only) + A KeyPair + + + + Called to make a new cert. + + + + + + + Waits on the provided event until it is signaled, then returns the contents of the Cert Cache for the specified sHostname + + The hostname of a Certificate which is pending creation + The event which will be signaled when the cert is ready (max wait is 15 seconds) + The Certificate (or possibly null) + + + + Signals anyone waiting that the certificate desired is now available. + + Hostname of the target certificate + + + + Ensure that the Root Certificate exists, loading or generating it if necessary. + Throws if the root could not be ensured. + + + + + Finds cert, uses Reader lock. + + + + + + + Store a generated Root Certificate and PrivateKey in Preferences. + + + + + Load a previously-generated Root Certificate and PrivateKey from Preferences. + + + + + + Copies the Root certificate into the Current User's Root store. This will show a prompt even if run at Admin. + + + + + + Clears the in-memory caches including the Root Certificate. + + + + This method does not delete the private keys of the certificates. + + + In order to delete them, please cast this instance to + and get a copy of the cache by using the property. + + + TRUE if successful + + + + Clears the in-memory caches. + + + + This method does not delete the private keys of the certificates. + + + In order to delete them, please cast this instance to + and get a copy of the cache by using the property. + + + TRUE to clear the Root Certificate from the cache. + TRUE if successful + + + + Reads the root certificate and its private key from a PKCS#12 formated stream. + + The PKCS#12 formated stream. + The password which is used to protect the private key. Could be null or empty if the private key is not protected. + The alias for the certificate and the private key. If null, the first alias found (if any) will be used. + + + + Writes the root certificate and its private key to a PKCS#12 stream. + + The PKCS#12 stream. + The password which is used to protect the private key. If null or empty, the private key is written unprotected. + The alias for the certificate and the private key. If null, a random alias will be created. + + + + Writes the root certificate without the private key to a stream using DER encoding. + + The stream. + + + + Reads the root certificate and its private key from the PKCS#12 file (.pfx | .p12). + + The filename of the PKCS#12 file (.pfx | .p12) + The password which is used to protect the private key. + The alias for the certificate and the private key. If null, the first alias in the pkcs12 will be used. + + + + Writes the root certificate and its private key to a PKCS#12 file (.pfx | .p12). + + The filename of the PKCS#12 file (.pfx | .p12). + The password which is used to protect the private key. + The alias for the certificate and the private key. If null, a random alias will be created. + + + + Writes the root certificate without the private key to a DER encoded file(.cer | .crt | .der). + + The filename of the DER encoded file (.cer | .crt | .der) + + + + Dispose by clearing all of the EE Certificates' private keys, preventing pollution of the user's \Microsoft\Crypto\RSA\ folder. + + +
+
diff --git a/packages/FiddlerCore.Trial.5.0.0/lib/net45/FiddlerCore.dll b/packages/FiddlerCore.Trial.5.0.0/lib/net45/FiddlerCore.dll new file mode 100644 index 0000000..fae5fde Binary files /dev/null and b/packages/FiddlerCore.Trial.5.0.0/lib/net45/FiddlerCore.dll differ diff --git a/packages/FiddlerCore.Trial.5.0.0/lib/net45/FiddlerCore.pdb b/packages/FiddlerCore.Trial.5.0.0/lib/net45/FiddlerCore.pdb new file mode 100644 index 0000000..9388791 Binary files /dev/null and b/packages/FiddlerCore.Trial.5.0.0/lib/net45/FiddlerCore.pdb differ diff --git a/packages/FiddlerCore.Trial.5.0.0/lib/net45/FiddlerCore.xml b/packages/FiddlerCore.Trial.5.0.0/lib/net45/FiddlerCore.xml new file mode 100644 index 0000000..4cb567c --- /dev/null +++ b/packages/FiddlerCore.Trial.5.0.0/lib/net45/FiddlerCore.xml @@ -0,0 +1,8854 @@ + + + + FiddlerCore + + + + + A generic builder class for . + + + + + + + The FiddlerCoreStartupSettings instance being built. + + + + + Reference to this. Return this field instead of (T)this in your methods in order to avoid multiple casting. + + + + + Initializes a new instance of + + The instance of FiddlerCoreStartupSettings which is going to be built. + + + + The port on which the FiddlerCore app will listen on. If 0, a random port will be used. + + The port on which the FiddlerCore app should listen on. + + + + + Registers as the system proxy. + + + + + + Decrypts HTTPS Traffic. + + + + + + Accepts requests from remote computers or devices. WARNING: Security Impact + + + Use caution when allowing Remote Clients to connect. If a hostile computer is able to proxy its traffic through your + FiddlerCore instance, he could circumvent IPSec traffic rules, circumvent intranet firewalls, consume memory on your PC, etc. + + + + + + Forwards requests to any upstream gateway. + + + + + + Sets all connections to use FiddlerCore, otherwise only the Local LAN is pointed to FiddlerCore. + + + + + + Sets connections to use a self-generated PAC File. + + + + + + Passes the <-loopback> token to the proxy exception list. + + + + + + Registers FiddlerCore as the FTP proxy. + + + + + + Calls ThreadPool.SetMinThreads for improved performance. + + + + + + Sets manual upstream gateway. + + The upstream gateway which FiddlerCore will use in the format "address:port | protocol=address:port(;protocol=address:port)*" + + + + + Sets manual upstream gateway with a bypass list. + + The upstream gateway which FiddlerCore will use in the format "address:port | protocol=address:port(;protocol=address:port)*" + List of hosts which should bypass the manually configured upstream gateway. Format: "example.com;*.another-example.com". + + + + + Sets the proxy settings which FiddlerCore uses to find the upstream proxy. + + + + + + + Builds the FiddlerCoreStartupSettings instance. + + The instance of FiddlerCoreStartupSettings. + + + + A generic builder interface for . + + + + + + + The port on which the FiddlerCore app will listen on. If 0, a random port will be used. + + The port on which the FiddlerCore app should listen on. + + + + + Registers as the system proxy. + + + + + + Decrypts HTTPS Traffic. + + + + + + Accepts requests from remote computers or devices. WARNING: Security Impact + + + Use caution when allowing Remote Clients to connect. If a hostile computer is able to proxy its traffic through your + FiddlerCore instance, he could circumvent IPSec traffic rules, circumvent intranet firewalls, consume memory on your PC, etc. + + + + + + Forwards requests to any upstream gateway. + + + + + + Sets all connections to use FiddlerCore, otherwise only the Local LAN is pointed to FiddlerCore. + + + + + + Sets connections to use a self-generated PAC File. + + + + + + Passes the <-loopback> token to the proxy exception list. + + + + + + Registers FiddlerCore as the FTP proxy. + + + + + + Calls ThreadPool.SetMinThreads for improved performance. + + + + + + Sets manual upstream gateway. + + The upstream gateway which FiddlerCore will use in the format "address:port | protocol=address:port(;protocol=address:port)*" + + + + + Sets the proxy settings which FiddlerCore uses to find the upstream proxy. + + + + + + + Sets manual upstream gateway with a bypass list. + + The upstream gateway which FiddlerCore will use in the format "address:port | protocol=address:port(;protocol=address:port)*" + List of hosts which should bypass the manually configured upstream gateway. Format: "example.com;*.another-example.com". + + + + + Builds the FiddlerCoreStartupSettings instance. + + The instance of FiddlerCoreStartupSettings. + + + + Holds startup settings for FiddlerCore. + Use the to build an instance of this class. + Then pass the instance to the method to start FiddlerCore. + + + + + Initializes a new instance of . + + + + + The port on which the FiddlerCore app will listen on. If 0, a random port will be used. + + + + + If set to true, FiddlerCore registers as the system proxy. + + + + + If set to true, FiddlerCore decrypts HTTPS Traffic. + + + + + If set to true, FiddlerCore accepts requests from remote computers or devices. WARNING: Security Impact. + + + Use caution when allowing Remote Clients to connect. If a hostile computer is able to proxy its traffic through your + FiddlerCore instance, he could circumvent IPSec traffic rules, circumvent intranet firewalls, consume memory on your PC, etc. + + + + + If set to true, FiddlerCore forwards requests to any upstream gateway. + + + + + If set to true, FiddlerCore sets all connections to use it, otherwise only the Local LAN is pointed to FiddlerCore. + + + + + If set to true, FiddlerCore sets connections to use a self-generated PAC File. + + + + + If set to true, FiddlerCore passes the <-loopback> token to the proxy exception list. + + + + + If set to true, FiddlerCore registers as the FTP proxy. + + + + + If set to true, FiddlerCore calls ThreadPool.SetMinThreads to improve performance. + + + + + The upstream gateway which FiddlerCore will use in the format "address:port | protocol=address:port(;protocol=address:port)*". + + + + + The proxy settings which FiddlerCore uses to find the upstream proxy. + + + + + List of hosts which should bypass the manually configured upstream gateway. Format: "example.com;*.another-example.com". + + + + + A builder class for . + + + + + Initializes a new instance of + + + + + The frmPrompt class is used to get information from the client. It's primarily used by calling one of the static functions. + + + + + Required designer variable. + + + + + Get a string value from the user. + + The title of the dialog + The prompt text + The default string value + The value entered by the user (or default, if unmodified) + + + + GetUserString prompts the user for a string. + + Title of the dialog + The prompt text in the dialog + The default response + If true, will return null if user hits cancel. Else returns sDefault. + The user's result, or null if user cancelled and bReturnNullIfCancelled set. + + + + Clean up any resources being used. + + + + + Required method for Designer support - do not modify + the contents of this method with the code editor. + + + + + ISessionImport allows loading of password-protected Session data + + + + + Import Sessions from a password-protected data source + + Shortname of the format + Dictionary of options that the Importer class may use + Callback event on which progress is reported or the host may cancel + Callback that is used to request passwords from the host + Array of Session objects imported from source + + + + The class that is used to store MIME-type-to-file-extension mapping. + + + + + Gets or sets the MIME type for this mapping. The provided MIME type should be in the format "top-level type name / subtype name" + and should not include the parameters section of the MIME type. E.g. application/json, text/html, image/gif etc. This property + should not be null, empty string or string containing only white spaces, in order Telerik FiddlerCore to load it. + + + + + Gets or sets the file extension for this mapping. The provided file extension should start with . (dot). E.g. .txt, .html, .png etc. + This property should not be null, empty string or string containing only white spaces, in order Telerik FiddlerCore to load it. + + + + + This class is used to deserialize and store MIME-type-to-file-extension mappings from given XML file. + + + The XML file should be in the following format: + + + mime/type + .ext + + + + ]]> + + + + + Initializes new instance of with the specified file path. + + A relative or absolute path to the XML file. + + + + Type of Upstream Gateway + + + + + Traffic should be sent directly to the server + + + + + Traffic should be sent to a manually-specified proxy + + + + + Traffic should be sent to the System-configured proxy + + + + + Proxy should be automatically detected + + + + + A simple Process Type enumeration used by various filtering features + + + + + Include all Processes + + + + + Processes which appear to be Web Browsers + + + + + Processes which appear to NOT be Web Browsers + + + + + Include only traffic where Process ID isn't known (e.g. remote clients) + + + + + When may requests be resent on a new connection? + + + + + The request may always be retried. + + + + + The request may never be retried + + + + + The request may only be resent if the HTTP Method is idempotent. + This SHOULD be the default per HTTP spec, but this appears to break tons of servers. + + + + + Dictionary of all Connectoids, indexed by the Connectoid's Name + + + + + Return the configured default connectoid's proxy information. + + Either proxy information from "DefaultLAN" or the user-specified connectoid + + + + Enumerates all of the connectoids and determines if the bIsHooked field is incorrect. If so, correct the value + and return TRUE to indicate that work was done. + + The Proxy:Port string to look for (e.g. Config.FiddlerListenHostPort) + TRUE if any of the connectoids' Hook state was inaccurate. + + + + Updates all (or CONFIG.sHookConnectionNamed-specified) connectoids to point at the argument-provided proxy information. + + The proxy info to set into the Connectoid + TRUE if updating at least one connectoid was successful + + + + Restore original proxy settings for any connectoid we changed. + + FALSE if any connectoids failed to unhook + + + + Map a local port number to the originating process ID + + The local port number + The originating process ID + + + + Returns a string containing the process listening on a given port + + + + + This class is used to find and create certificates for use in HTTPS interception. + The default implementation (DefaultCertProvider object) uses the Windows Certificate store, + but if a plugin ICertificateProvider is provided, it is used instead. + + + + + Enables specification of a delegate certificate provider that generates certificates for HTTPS interception. + + + + + Lock on this object when TestExistenceOf/Create oCertProvider + + + + + Ensures that the Certificate Generator is ready; thread-safe + + + + + Load a delegate Certificate Provider + + The provider, or null + + + + Removes Fiddler-generated certificates from the Windows certificate store + + + + + Removes Fiddler-generated certificates from the Windows certificate store + + Indicates whether Root certificates should also be cleaned up + + + + Returns the Root certificate that Fiddler uses to generate per-site certificates used for HTTPS interception. + + Returns the root certificate, if present, or null if the root certificate does not exist. + + + + Return the raw byte[]s of the root certificate, or null + + + + + + Request a certificate with the specified SubjectCN + + A string of the form: "www.hostname.com" + A certificate or /null/ if the certificate could not be found or created + + + + Pre-cache a Certificate in the Certificate Maker that should be returned in subsequent calls to FindCert + + The hostname for which this certificate should be returned. + The X509Certificate2 with attached Private Key + TRUE if the Certificate Provider succeeded in pre-caching the certificate. FALSE if Provider doesn't support pre-caching. THROWS if supplied Certificate lacks Private Key. + + + + Pre-cache a Certificate in the Certificate Maker that should be returned in subsequent calls to FindCert + + The hostname for which this certificate should be returned. + The filename of the PFX file containing the certificate and private key + The password for the PFX file + Throws if the Certificate Provider failed to pre-cache the certificate + + + + Determine if the self-signed root certificate exists + + True if the Root certificate returned from GetRootCertificate is non-null, False otherwise. + + + + Is Fiddler's root certificate in the Root store? + + TRUE if so + + + + Is Fiddler's root certificate in the Machine Root store? + + TRUE if so + + + + Create a self-signed root certificate to use as the trust anchor for HTTPS interception certificate chains + + TRUE if successful + + + + Finds the Fiddler root certificate and prompts the user to add it to the TRUSTED store. + Note: The system certificate store is used by most applications (IE, Chrome, etc) but not + all; for instance, Firefox uses its own certificate store. + + True if successful + + + + Dispose of the Certificate Provider, if any. + + + + + The ClientChatter object, exposed as the oRequest object on the Session object, represents a single web request. + + + + + Size of buffer passed to pipe.Receive when reading from the client. + + + + + Discardable State of Read Operation + + While it is reading a request from the client, the ClientChatter class uses a RequestReaderState object to track + the state of the read. This state is discarded when the request has been completely read. + + + + + The Host pulled from the URI + + + + + Buffer holds this request's data as it is read from the pipe. + + + + + Offset to first byte of body in m_requestData + + + + + Optimization: Offset of most recent transfer-encoded chunk + + + + + Optimization: tracks how far we've previously looked when determining iEntityBodyOffset + + + + + Did the request specify Transfer-Encoding: chunked + + + + + The integer value of the Content-Length header, if any + + + + + Count of body bytes read from the client. If no body bytes have yet been read, returns count of header bytes. + + + + + + Scans requestData stream for the \r\n\r\n (or variants) sequence + which indicates that the header block is complete. + + SIDE EFFECTS: + iBodySeekProgress is updated and maintained across calls to this function + iEntityBodyOffset is updated if the end of headers is found + + True, if requestData contains a full set of headers + + + + Tracks the progress of reading the request from the client. Because of the multi-threaded nature + of some users of this field, most will make a local copy before accessing its members. + + + + + The ClientPipe object which is connected to the client, or null. + + + + + Parsed Headers + + + + + The Session object which owns this ClientChatter + + + + + Returns the port on which Fiddler read the request (typically 8888) + + + + + Count of body bytes read from the client. If no body bytes have yet been read, returns count of header bytes. + + + + + HTTP Headers sent in the client request, or null. + + + + + Was this request received from a reused client connection? Looks at SessionFlags.ClientPipeReused flag on owning Session. + + + + + Note: This returns the request's HOST header, which may include a trailing port #. + If the Host is an IPv6 literal, it will be enclosed in brackets '[' and ']' + + + + + Controls whether the request body is streamed to the server as it is read from the client. + + + + + Create a ClientChatter object initialized with a set of HTTP headers + Called primarily when loading session data from a file. + + The Session object which will own this request + The string containing the request data + + + + Loads a HTTP request body from a file rather than a memory stream. + + The file to load + TRUE if the file existed. THROWS on most errors other than File-Not-Found + + + + Based on this session's data, determine the expected Transfer-Size of the request body. See RFC2616 Section 4.4 Message Length. + Note, there's currently no support for "multipart/byteranges" requests anywhere in Fiddler. + + Expected Transfer-Size of the body, in bytes. + + + + Free Request data. Called by TakeEntity or by ReadRequest method on request failure + + + + + Extract byte array representing the entity, put any excess bytes back in the pipe, free the RequestReadState, and + return the entity. + + Byte array containing the entity body + + + + Simple indexer into the Request Headers object + + + + + Send a HTTP/XXX Error Message to the Client, calling FiddlerApplication.BeforeReturningError and DoReturningError in FiddlerScript. + Note: This method does not poison the Server pipe, so if poisoning is desired, it's the caller's responsibility to do that. + Note: Because this method uses Connection: close on the returned response, it has the effect of poisoning the client pipe + + Response code + Response status text + Body of the HTTP Response + + + + Return a HTTP response and signal that the client should close the connection + + A Delegate that fires to give one final chance to modify the Session before + calling the DoBeforeReturningError and returning the response + + + + Parse the headers from the requestData buffer. + Precondition: Call AFTER having set the correct iEntityBodyOffset. + + Note: This code used to be a lot simpler before, when it used strings instead of byte[]s. Sadly, + we've gotta use byte[]s to ensure nothing in the URI gets lost. + + TRUE if successful. + + + + This function decides if the request string represents a complete HTTP request + + + + + + Read a (usually complete) request from pipeClient. If RequestStreamed flag is set, only the headers have been read. + + TRUE, if a request could be read. FALSE, otherwise. + + + + Verifies that the Hostname specified in the request line is compatible with the HOST header + + + + + The CONFIG object is Fiddler's legacy settings object, introduced before the advent of the Preferences system. + + + + + Underlying Preferences container whose IFiddlerPreferences interface is + exposed by the FiddlerApplication.Prefs property. + + + + + Generally, callers should use FiddlerApplication.Prefs, but RawPrefs allows use of the PreferenceBag members that + are not a part of IFiddlerPreferences + + + + + Response files larger than this (2^28 = ~262mb) will NOT be loaded into memory when using LoadResponseFromFile + + + + + Backing field for the QuietMode property. Controls whether notifications are displayed in a MessageBox. + NB: KEEP THIS FIELD DECLARED AT THE TOP OF THE CLASS. We initialize some fields using methods that can check this field. + + + + + Cached layout info for columns. + + + + + Control which processes have HTTPS traffic decryption enabled + + + + + True if this is a "Viewer" instance of Fiddler that will not persist its settings. Exposed as FiddlerApplication.IsViewerMode + + + TODO: ARCH: This setting shouldn't exist in FiddlerCore, but it's used in a dozen places + + + + TODO: Why is this defaulted to FALSE? Has been since 2009, probably due to some bug. Should keep better records. (Sigh). + + + + + Boolean controls whether Fiddler should map inbound connections to their original process using IPHLPAPI + + + + + Controls whether Fiddler should attempt to decrypt HTTPS Traffic + + + + + Boolean controls whether Fiddler will attempt to use the Server Name Indicator TLS extension to generate the SubjectCN for certificates + + + + + Should Audio/Video types automatically stream by default? + + + + + Returns 127.0.0.1:{ListenPort} or fiddler.network.proxy.RegistrationHostName:{ListenPort} + + + + + Use 128bit AES Encryption when password-protecting .SAZ files. Note that, while this + encryption is much stronger than the default encryption algorithm, it is significantly + slower to save and load these files, and the Windows Explorer ZIP utility cannot open them. + + + + + SSL/TLS Protocols we allow the client to choose from (when we call AuthenticateAsServer) + We allow all protocols by default (Ssl2,Ssl3,Tls1) and also 'Bitwise OR' in the constants for TLS1.1 and TLS1.2 in case we happen to be running on .NET4.5. + + + + + SSL/TLS Protocols we request the server use (when we call AuthenticateAsClient). By default, SSL3 and TLS1 are accepted; we exclude SSL2 so that TLS Extensions may be sent. + We do NOT enable TLS1.1 or TLS1.2 by default because many servers will fail if you offer them and unlike browsers, .NET has no fallback code. + + + + + When True, Fiddler will offer the latest TLS protocol version offered by the client in its request + + + + + Version information for the Fiddler/FiddlerCore assembly + + + + + Will send traffic to an upstream proxy? + OBSOLETE -- DO NOT USE. see instead. + + + + + Gets a value indicating what mechanism, if any, will be used to find the upstream proxy/gateway. + + + + + The encoding with which HTTP Headers should be parsed. Defaults to UTF8, but may be overridden by specifying a REG_SZ containing the encoding name in the registry key \Fiddler2\HeaderEncoding + + + + + Controls whether Fiddler will reuse server connections for multiple sessions + + + + + Controls whether Fiddler will reuse client connections for multiple sessions + + + + + Controls whether Fiddler should register as the HTTPS proxy + + + + + Controls whether Fiddler should register as the FTP proxy + + + + + Controls whether Fiddler will try to write exceptions to the System Event log. Note: Usually fails due to ACLs on the Event Log. + + + + + Controls whether Fiddler will attempt to log on to the upstream proxy server to download the proxy configuration script + + + + + Controls whether Fiddler will attempt to connect to IPv6 addresses + + + + + Name of connection to which Fiddler should autoattach if MonitorAllConnections is not set + + + + + The username to send to the upstream gateway if the Version Checking webservice request requires authentication + + + + + The password to send to the upstream gateway if the Version Checking webservice request requires authentication + + + + + Set this flag if m_ListenPort is a "temporary" port (E.g. specified on command-line) and it shouldn't be overridden in the registry + + + + + Controls whether Certificate-Generation output will be spewed to the Fiddler Log + + + + + Port to which Fiddler should forward inbound requests when configured to run as a Reverse Proxy + + + + + Alternative hostname which Fiddler should recognize as an alias for the local machine. The + default value of ? will never be usable, as it's the QueryString delimiter + + + + + (Lowercase) Machine Name + + + + + (Lowercase) Machine Domain Name + + + + + On attach, will configure WinINET to bypass Fiddler for these hosts. + + + + + List of hostnames for which HTTPS decryption (if enabled) should be skipped + + + + + True if Fiddler should be maximized on restart + + + + + Boolean indicating whether Fiddler will open the listening port exclusively + + + + + Controls whether server certificate errors are ignored when decrypting HTTPS traffic. + + + + + Controls whether notification dialogs and prompts should be shown. + + + + + The port upon which Fiddler is configured to listen. + + + + + Return a Special URL. + + String constant describing the URL to return. CASE-SENSITIVE! + Returns target URL + + + + Get a registry path for a named constant + + The path to retrieve [Root, UI, Dynamic, Prefs] + The registry path + + + + Return an app path (ending in Path.DirectorySeparatorChar) or a filename + + CASE-SENSITIVE + The specified filesystem path + + + + Returns the path and filename of the editor used to edit the Rules script file. + + + + + Returns true if Fiddler should permit remote connections. Requires restart. + + + + + Ensure that the per-user folders used by Fiddler are present. + + + + + Loads Preferences from the Registry and fills appropriate fields + + + + + Interface for the WebSocket and CONNECT Tunnel classes + + + + + The CONNECTTunnel class represents a "blind tunnel" through which a CONNECT request is serviced to shuffle bytes between a client and the server. + + + See pg 206 in HTTP: The Complete Reference for details on how Tunnels work. + When HTTPS Decryption is disabled, Fiddler accepts a CONNECT request from the client. Then, we open a connection to the remote server. + We shuttle bytes back and forth between the client and the server in this tunnel, keeping Fiddler itself out of the loop + (no tampering, etc). + + + + + Number of bytes received from the client + + + + + Number of bytes received from the server + + + + + TRUE if this is a Blind tunnel, FALSE if decrypting + + + + + Returns number of bytes sent from the Server to the Client + + + + + Returns number of bytes sent from the Client to the Server + + + + + This "Factory" method creates a new HTTPS Tunnel and executes it on a background (non-pooled) thread. + + The Session containing the HTTP CONNECT request + + + + Creates a HTTPS tunnel. External callers instead use the CreateTunnel static method. + + The session for which this tunnel was initially created. + Client Pipe + Server Pipe + + + + This function keeps the thread alive until it is signaled that the traffic is complete + + + + + Executes the HTTPS tunnel inside an All-it-can-eat exception handler. + Call from a background thread. + + + + + Close the HTTPS tunnel and signal the event to let the service thread die. + WARNING: This MUST not be allowed to throw any exceptions, because it will do so on threads that don't catch them, and this will kill the application. + + + + + Called when we have received data from the local client. + Incoming data will immediately be forwarded to the remote host. + + The result of the asynchronous operation. + + + Called when we have sent data to the local client.
When all the data has been sent, we will start receiving again from the remote host.
+ The result of the asynchronous operation. +
+ + Called when we have sent data to the remote host.
When all the data has been sent, we will start receiving again from the local client.
+ The result of the asynchronous operation. +
+ + Called when we have received data from the remote host.
Incoming data will immediately be forwarded to the local client.
+ The result of the asynchronous operation. +
+ + + [DEPRECATED] Use the BCCertMaker instead. + This is the default Fiddler certificate provider. + + + + + CertEnroll is an ActiveX Control available on Windows Vista and later that allows programmatic generation of X509 certificates. + We can use it as an alternative to MakeCert.exe; it offers better behavior (e.g. setting AKID) and doesn't require redistributing makecert.exe + + + + + Factory method. Returns null if this engine cannot be created + + + + + Invoke CertEnroll + + Target CN + TRUE if the certificate is a root cert + TRUE if we should validate that we're running in a MTA thread and switch if not + A Cert + + + + Factory method. Returns null if this engine cannot be created + + + + + File path pointing to the location of MakeCert.exe + + + + + Hash to use when signing certificates. + Note: sha1 is required on XP (even w/SP3, using sha256 throws 0x80090008). + + + + + Constructor: Simply cache the path to MakeCert + + + + + The underlying Certificate Generator (MakeCert or CertEnroll) + + + + + Cache of previously-generated EE certificates. Thread safety managed by _oRWLock + + + + + Cache of previously-generated Root certificate + + + + + Should Fiddler automatically generate wildcard certificates? + + + + + Reader/Writer lock gates access to the certificate cache and generation functions. + + We must set the SupportsRecursion flag because there are cases where the thread holds the lock in Write mode and then enters Read mode in a nested call. + + + + Find certificates that have the specified full subject. + + The store to search + FindBySubject{Distinguished}Name requires a complete match of the SUBJECT, including CN, O, and OU + Matching certificates + + + + Find all certificates (in the CurrentUser Personal store) that have the specified issuer. + + The store to search + FindByIssuer{Distinguished}Name requires a complete match of the SUBJECT, including CN, O, and OU + Matching certificates + + + + Interface method: Clear the in-memory caches and Windows certificate stores + + TRUE to clear the Root Certificate from the cache and Windows stores + TRUE if successful + + + + Interface method: Clear the in-memory caches and Windows certificate stores + + + + + + Use MakeCert to generate a unique self-signed certificate + + TRUE if the Root certificate was generated successfully + + + + Get the root certificate from cache or storage, only IF IT ALREADY EXISTS. + + + + + + Returns an Interception certificate for the specified hostname + + Hostname for the target certificate + This method uses a Reader lock when checking the cache and a Writer lock when updating the cache. + An Interception Certificate, or NULL + + + + Find a certificate from the certificate store, creating a new certificate if it was not found. + + A SubjectCN hostname, of the form www.example.com + TRUE if the cert wasn't found in the Windows Certificate store and this function attempted to create it. + No locks are acquired by this method itself. + A certificate or /null/ + + + + Find (but do not create!) a certificate from the CurrentUser certificate store, if present. + + No locks are acquired by this method itself. + A certificate or /null/ + + + + Updates the Server Certificate cache under the Writer lock + + The target hostname + The certificate to cache + + + + + Creates a certificate for ServerAuth. If isRoot is set, designates that this is a self-signed root. + + Uses a reader lock when checking for the Root certificate. Uses a Writer lock when creating a certificate. + A string of the form: "www.hostname.com" + A boolean indicating if this is a request to create the root certificate + Newly-created certificate, or Null + + + + Cache of Hostname->Address mappings + + + + + Number of milliseconds that a DNS cache entry may be reused without validation. + + + + + Maximum number of A/AAAA records to cache for DNS entries. + Beware: Changing this number changes how many IP-failovers Fiddler will perform if fiddler.network.dns.fallback is set, + and increasing the number will consume more memory in the cache. + + + + + Clear the DNS Cache. Called by the NetworkChange event handler in the oProxy object + + + + + Remove all expired DNSCache entries; called by the Janitor + + + + + Show the contents of the DNS Resolver cache + + + + + + Gets first available IP Address from DNS. Throws if address not found! + + String containing the host + True to use Fiddler's DNS cache. + IPAddress of target, if found. + + + + Gets IP Addresses for host from DNS. Throws if address not found! + + String containing the host + True to use Fiddler's DNS cache. + The Timers object to which the DNS lookup time should be stored, or null + List of IPAddresses of target, if any found. + + + + Trim an address list, removing the duplicate entries, any IPv6-entries if IPv6 is disabled, + and entries beyond the COUNT_MAX_A_RECORDS limit. + + The list to filter + A filtered address list + + + + A DNSCacheEntry holds a cached resolution from the DNS + + + + + TickCount of this record's creation + + + + + IPAddresses for this hostname + + + + + Construct a new cache entry + + The address information to add to the cache + + + + Attribute used to specify the minimum version of Fiddler compatible with this extension assembly. + + + + + Attribute used to specify the minimum version of Fiddler compatible with this extension assembly. + + The minimal version string (e.g. "2.2.8.8") + + + + Getter for the required version string + + + + + Attribute allowing developer to specify that a class supports the specified Import/Export Format. + + + + + Attribute allowing developer to specify that a class supports the specified Import/Export Format + + Shortname of the Format (e.g. WebText XML) + Description of the format + + + + Attribute allowing developer to specify that a class supports the specified Import/Export Format + + Shortname of the Format (e.g. WebText XML) + Description of the format + Semi-colon delimited file extensions (e.g. ".har;.harx") + + + + Returns the Shortname for this format + + + + + Returns the Description of this format + + + + + This tuple maps a display descriptive string to a Import/Export type. + (The parent dictionary contains the shortname string) + + + + + Textual description of the Format + + + + + Class implementing the format + + + + + All metadata about the provider + + + + + Create a new Transcoder Tuple + + Proffer format description + Type implementing this format + + + + ISessionImport allows loading of Session data + + + + + Import Sessions from a data source + + Shortname of the format + Dictionary of options that the Importer class may use + Callback event on which progress is reported or the host may cancel + Array of Session objects imported from source + + + + ISessionExport allows saving of Session data + + + + + Export Sessions to a data store + + Shortname of the format + Array of Sessions being exported + Dictionary of options that the Exporter class may use + Callback event on which progress is reported or the host may cancel + TRUE if the export was successful + + + + EventArgs class for the ISessionImporter and ISessionExporter interface callbacks + + + + + Set to TRUE to request that Import/Export process be aborted as soon as convenient + + + + + Progress Callback + + Float indicating completion ratio, 0.0 to 1.0. Set to 0 if unknown. + Short string describing current operation, progress, etc + + + + The string message of the notification + + + + + The percentage completed + + + + + Implement ICertificateProvider2 instead + + + + + Return a certificate to secure this traffic. Generally, it's expected that this method WILL create a new certificate if needed. + + Hostname (e.g. "www.example.com") + An X509Certificate, or null on error + + + + Return the root certificate to which Host Certificates are chained. Generally, it's expected that this method will NOT create a root certificate. + + An X509Certificate, or null on error + + + + When this method is called, your extension should create a Root certificate. + + TRUE if the operation was successful + + + + When this method is called, your extension should copy the your Root certificate into + the user's (or machines's) Root certificate store. + + TRUE if the operation was successful + + + + When this method is called, your extension should discard all certificates and + clear any certificates that have been added to the user's certificate store. + + TRUE, if all certificates were removed; FALSE if any certificates were preserved + + + + When this method is called, your extension should check to see if the User or Machine Root + certificate store contains your Root certificate. + + Set to TRUE if StoreLocation.CurrentUser StoreName.Root has the certificate + Set to TRUE if StoreLocation.LocalMachine StoreName.Root has the certificate + TRUE if either bUserTrusted or bMachineTrusted + + + + To override default certificate handling, your class should implement this interface in an assembly + referenced by the fiddler.certmaker.assembly preference; by default, "certmaker.dll" in the application + folder is loaded + + + + + When this method is called, your extension should discard all certificates and + clear any certificates that have been added to the user's certificate store + + TRUE if the root certificate should also be cleared + TRUE, if all certificates were removed; FALSE if any certificates were preserved + + + + Call this function to cache a certificate in the Certificate Provider + + The hostname to match + The certificate that the Provider should later provide when GetCertificateForHost is called + True if the request was successful + + + + Copy of the cache of the EndEntity certificates that have been generated in this session. + + + + + When this method is called, your extension should read the root certificate and its private key from a stream. + + The stream. + The password which is used to protect the private key. Could be null or empty if the private key is not protected. + The alias for the certificate and the private key. Could be null. + + + + When this method is called, your extension should write the root certificate and its private key to a stream. + + The stream. + The password protecting the private key. If null or empty, the private key is written unprotected. + The alias for the certificate and the private key. If null, a random alias could be created. + + + + When this method is called, your extension should write the root certificate without the private key to a stream. + + The stream. + + + + When this method is called, your extension should read the root certificate and its private key from the PKCS#12 file(.pfx | .p12). + + The filename of the PKCS#12 file (.pfx | .p12). + The password which is used to protect the private key. Could be null or empty if the private key is not protected. + The alias for the certificate and the private key. Could be null. + + + + When this method is called, your extension should write the root certificate and its private key to a PKCS#12 file(.pfx | .p12). + + The filename of the PKCS#12 file (.pfx | .p12). + The password which is used to protect the private key. If null or empty, the private key is written unprotected. + The alias for the certificate and the private key. If null, a random alias could be created. + + + + When this method is called, your extension should write the root certificate without the private key to a DER encoded file(.cer | .crt | .der). + + The filename of the DER encoded file (.cer | .crt | .der) + + + + Return a string describing the current configuration of the Certificate Provider. For instance, list + the configured key size, hash algorithms, etc. + + + + + Show a configuration dialog that allows user to control options related to your Certificate Provider, + for instance, the configured key size, hash algorithm, etc. + + Owning Window Handle + + + + Fiddler Transcoders allow import and export of Sessions from Fiddler + + + + + Create the FiddlerTranscoders object + + + + + True if one or more classes implementing ISessionImporter are available. + + + + + List all of the Transcoder objects that are loaded + + + + + + True if one or more classes implementing ISessionImporter are available. + + + + + Add Import/Export encoders to FiddlerApplication.oTranscoders + + Assembly to import exporters and importers + FALSE on obvious errors + + + + Add Import/Export encoders to FiddlerApplication.oTranscoders + + Assembly to scan for transcoders + FALSE on obvious errors + + + + Loads any assembly in the specified path that ends with .dll and does not start with "_", checks that a compatible version requirement was specified, + and adds the importer and exporters within to the collection. + + The path to scan for extensions + + + + Ensures that Import/Export Transcoders have been loaded + + + + + Returns a TranscoderTuple willing to handle the specified format + + The Format + TranscoderTuple, or null + + + + Returns a TranscoderTuple willing to handle the specified format + + The Format + TranscoderTuple, or null + + + + Gets the format list of the specified type and adds that type to the collection. + + + + TRUE if any formats were found; FALSE otherwise + + + + Clear Importer and Exporter collections + + + + + The IFiddlerPreferences Interface is exposed by the FiddlerApplication.Prefs object, and enables + callers to Add, Update, and Remove preferences, as well as observe changes to the preferences. + + + + + Store a boolean value for a preference + + The named preference + The boolean value to store + + + + Store an Int32 value for a preference + + The named preference + The int32 value to store + + + + Store a string value for a preference + + The named preference + The string value to store + + + + Store multiple preferences. + + An enumeration of the preferences' names and values to store. + + + + Get a preference's value as a boolean + + The Preference Name + The default value for missing or invalid preferences + A Boolean + + + + Gets a preference's value as a string + + The Preference Name + The default value for missing preferences + A string + + + + Gets a preference's value as a 32-bit integer + + The Preference Name + The default value for missing or invalid preferences + An integer + + + + Removes a named preference from storage + + The name of the preference to remove + + + + Add a Watcher that will be notified when a value has changed within the specified prefix. + + The prefix of preferences for which changes are interesting + The Event handler to notify + Returns the Watcher object added to the notification list + + + + Removes a previously-created preference Watcher from the notification queue + + The Watcher to remove + + + + Indexer. Returns the value of the preference as a string + + The Preference Name + The Preference value as a string, or null + + + + EventArgs for preference-change events. See http://msdn.microsoft.com/en-us/library/ms229011.aspx. + + + + + The name of the preference being added, changed, or removed + + + + + The string value of the preference, or null if the preference is being removed + + + + + Returns TRUE if ValueString=="true", case-insensitively + + + + + The PreferenceBag is used to maintain a threadsafe Key/Value list of preferences, persisted in the registry, and with appropriate eventing when a value changes. + + + + + Returns a string naming the current profile + + + + + Indexer into the Preference collection. + + The name of the Preference to update/create or return. + The string value of the preference, or null. + + + + Get a string array of the preference names + + string[] of preference names + + + + Gets a preference's value as a string + + The Preference Name + The default value if the preference is missing + A string + + + + Return a bool preference. + + The Preference name + The default value to return if the specified preference does not exist + The boolean value of the Preference, or the default value + + + + Return an Int32 Preference. + + The Preference name + The default value to return if the specified preference does not exist + The Int32 value of the Preference, or the default value + + + + Update or create a string preference. + + The name of the Preference + The value to assign to the Preference + + + + Update or create a Int32 Preference + + The name of the Preference + The value to assign to the Preference + + + + Update or create a Boolean preference. + + The name of the Preference + The value to assign to the Preference + + + + Update or create multiple preferences. + + An enumeration of the preferences' names and values to store. + + + + Delete a Preference from the collection. + + The name of the Preference to be removed. + + + + Remove all Watchers + + + + + Remove all watchers and write the registry. + + + + + Return a description of the contents of the preference bag + + Multi-line string + + + + Return a string-based serialization of the Preferences settings. + + TRUE for a multi-line format with all preferences + String + + + + Returns a CRLF-delimited string containing all Preferences whose Name case-insensitively contains the specified filter string. + + Partial string to match + A string + + + + A simple struct which contains a Branch identifier and EventHandler + + + + + Add a watcher for changes to the specified preference or preference branch. + + Preference branch to monitor, or String.Empty to watch all + The EventHandler accepting PrefChangeEventArgs to notify + Returns the PrefWatcher object which has been added, store to pass to RemoveWatcher later. + + + + Remove a previously attached Watcher + + The previously-specified Watcher + + + + This function executes on a single background thread and notifies any registered + Watchers of changes in preferences they care about. + + A string containing the name of the Branch that changed + + + + Spawn a background thread to notify any interested Watchers of changes to the Target preference branch. + + The arguments to pass to the interested Watchers + + + + Use this method to ensure that the passed protocols are consecutive. It is done by adding missing + protocols from the sequence, thus filling the gaps, if any. Works only with Tls, Tls11 and Tls12. + + + Passed protocols: Tls, Tls12 + Return value: Tls, Tls11, Tls12 + + The input SSL protocols + Consecutive version of the input SSL protocols + + + + CodeDescription attributes are used to enable the FiddlerScript Editor to describe available methods, properties, fields, and events. + + + + + CodeDescription attributes should be constructed by annotating a property, method, or field. + + The descriptive string which should be displayed for this this property, method, or field + + + + The descriptive string which should be displayed for this this property, method, or field + + + + + A simple delegate for functions which accept no parameters. (MethodInvoker is the identical Framework version of this delegate) + + + + + An event handling delegate which is called during report calculation with the set of sessions being evaluated. + + The sessions in this report. + + + + An event handling delegate which is called as a part of the HTTP pipeline at various stages. + + The Web Session in the pipeline. + + + + This class acts as the central point for script/extensions to interact with Fiddler components. + + + + + TRUE if Fiddler is currently shutting down. Suspend all work that won't have side-effects. + + + + + The default certificate used for client authentication + + + + + Fiddler's logging system + + + + + Fiddler's "Janitor" clears up unneeded resources (e.g. server sockets, DNS entries) + + + + + Fiddler's Preferences collection. Learn more at http://fiddler.wikidot.com/prefs + + + + + Gets Fiddler* version info + + A string indicating the build/flavor of the Fiddler* assembly + + + + Set the DisplayName for the application + + 1 to 64 character name to be displayed in error messages, etc + + + + Fiddler's core proxy object. + + + + + By setting this property you can provide Telerik Fiddler Core with custom MIME-type-to-file-extension mappings. + + + + + Fiddler Import/Export Transcoders + + + + + This event fires when the user instructs Fiddler to clear the cache or cookies + + + + + This event fires each time FiddlerCore reads data from network for the server's response. Note that this data + is not formatted in any way, and must be parsed by the recipient. + + + + + This event fires each time FiddlerCore reads data from network for the client's request. Note that this data + is not formatted in any way, and must be parsed by the recipient. + + + + + This event fires when a client request is received by Fiddler + + + + + This event fires when a server response is received by Fiddler + + + + + This event fires when Request Headers are available + + + + + This event fires when Response Headers are available + + + + + This event fires when an error response is generated by Fiddler + + + + + This event fires when Fiddler captures a WebSocket message + + + + + This event fires when a session has been completed + + + + + This event fires when a user notification would be shown. See CONFIG.QuietMode property. + + + + + This event fires when Fiddler evaluates the validity of a server-provided certificate. Adjust the value of the ValidityState property if desired. + + + + + Sync this event to be notified when FiddlerCore has attached as the system proxy.")] + + + + + Sync this event to be notified when FiddlerCore has detached as the system proxy. + + + + + List of "leaked" temporary files to be deleted as Fiddler exits. + + + + + Checks if FiddlerCore is running. + + TRUE if FiddlerCore is started/listening; FALSE otherwise. + + + + Checks if FiddlerCore is running and registered as the System Proxy. + + TRUE if FiddlerCore IsStarted AND registered as the system proxy; FALSE otherwise. + + + + Recommended way to Start FiddlerCore. + + + + + + Start a new proxy endpoint instance, listening on the specified port + + The port to listen on + TRUE if remote clients should be permitted to connect to this endpoint + A Hostname (e.g. EXAMPLE.com) if this endpoint should be treated as a HTTPS Server + A Proxy object, or null if unsuccessful + + + + Start a new proxy endpoint instance, listening on the specified port + + The port to listen on + TRUE if remote clients should be permitted to connect to this endpoint + A certificate to return when clients connect, or null + A Proxy object, or null if unsuccessful + + + + Shuts down the FiddlerCore proxy and disposes it. Note: If there's any traffic in progress while you're calling this method, + your background threads are likely to blow up with ObjectDisposedExceptions or NullReferenceExceptions. In many cases, you're + better off simply calling oProxy.Detach() and letting the garbage collector clean up when your program exits. + + + + + Notify a listener that a block of a response was read. + + The session for which the response is being read + byte buffer (not completely full) + bytes set. + FALSE if AbortReading was set + + + + Notify a listener that a block of a request was read. Note that this event may fire with overlapping blocks of data but + different sessions if the client uses HTTP Pipelining. + + The session for which the response is being read + byte buffer (not completely full) + bytes set. + FALSE if AbortReading was set + + + + Export Sessions in the specified format + + Shortname of desired format + Sessions to export + Options to pass to the ISessionExport interface + Your callback event handler, or NULL to allow Fiddler to handle + TRUE if successful, FALSE if desired format doesn't exist or other error occurs + + + + Calls a Fiddler Session Importer and returns the list of loaded Sessions. + + String naming the Import format, e.g. HTTPArchive + Should sessions be added to WebSessions list? (Not meaningful for FiddlerCore) + Dictionary of Options to pass to the Transcoder + Your callback event handler, or NULL to allow Fiddler to handle + Callback that is used to request passwords from the host if needed + Loaded Session[], or null on Failure + + + + Reset the SessionID counter to 0. This method can lead to confusing UI, so call sparingly. + + + + + Log a notification to the OnNotification handler and, if not in quiet mode, show a MessageBox + + Window to which this notification should be parented, or null + Text in the Window + Title of the Window + Icon for the window + + + + Report an exception to the user. + + The Exception + The Title of the dialog + + + + Report an exception to the user. + + The Exception + The Title of the dialog + The intro text to show. If null or empty, the default "Fiddler has encountered an unexpected... " message is shown. + + + + Show the user a message when an HTTP Error was encountered + + Session with error + Set to true to prevent pooling/reuse of client connection + The SessionFlag which should be set to log this violation + Set to true to prevent pooling/reuse of server connection + Information about the problem + + + + Process ID of this Fiddler instance + + + + + processname:PID of Fiddler + + + + + We really don't want this method to get inlined, because that would cause the Xceed DLLs to get loaded in the Main() function instead + of when _SetXceedLicenseKeys is called; that, in turn, would delay the SplashScreen. + + + + + Used to track errors with addons. + + + + + + + Record that a temporary file was created and handed to an external tool. We'll do our best to delete this file on exit. + + The filename of the file to be deleted + + + + Clean up any Temporary files that were created + + + + + Fired each time Fiddler successfully establishes a TCP/IP connection + + + + + Fired each time Fiddler successfully accepts a TCP/IP connection + + + + + Does this Fiddler instance support the specified feature? + + Feature name (e.g. "bzip2") + TRUE if the specified feature is supported; false otherwise + + + + The Socket which was just Connected or Accepted + + + + + The Session which owns the this new connection + + + + + EventArgs class for the OnNotification handler + + + + + The string message of the notification + + + + + Enumeration of possible responses specified by the ValidateServerCertificateEventArgs as modified by FiddlerApplication's OnValidateServerCertificate event + + + + + The certificate will be considered valid if CertificatePolicyErrors == SslPolicyErrors.None, otherwise the certificate will be invalid unless the user manually allows the certificate. + + + + + The certificate will be confirmed with the user even if CertificatePolicyErrors == SslPolicyErrors.None. + Note: FiddlerCore does not support user-prompting and will always treat this status as ForceInvalid. + + + + + Force the certificate to be considered Invalid, regardless of the value of CertificatePolicyErrors. + + + + + Force the certificate to be considered Valid, regardless of the value of CertificatePolicyErrors. + + + + + These EventArgs are passed to the FiddlerApplication.OnValidateServerCertificate event handler when a server-provided HTTPS certificate is evaluated + + + + + EventArgs for the ValidateServerCertificateEvent that allows host to override default certificate handling policy + + The session + The CN expected for this session + The certificate provided by the server + The certificate chain of that certificate + Errors from default validation + + + + The port to which this request was targeted + + + + + The SubjectCN (e.g. Hostname) that should be expected on this HTTPS connection, based on the request's Host property. + + + + + The Session for which a HTTPS certificate was received. + + + + + The server's certificate chain. + + + + + The SslPolicyErrors found during default certificate evaluation. + + + + + Set this property to override the certificate validity + + + + + The X509Certificate provided by the server to vouch for its authenticity + + + + + These EventArgs are constructed when FiddlerApplication.OnClearCache is called. + + + + + True if the user wants cache files to be cleared + + + + + True if the user wants cookies to be cleared + + + + + Constructs the Event Args + + Should Cache Files be cleared? + Should Cookies be cleared? + + + + When the FiddlerApplication.OnReadResponseBuffer event fires, the raw bytes are available via this object. + + + + + Set to TRUE to request that upload or download process be aborted as soon as convenient + + + + + Session for which this responseRead is occurring + + + + + Byte buffer returned from read. Note: Always of fixed size, check iCountOfBytes to see which bytes were set + + + + + Count of latest read from Socket. If less than 1, response was ended. + + + + + This FTP Gateway class is used if Fiddler is configured as the FTP proxy and there's no upstream gateway configured. + Fiddler must act as a HTTP->FTP protocol converter, which it does by using the .NET FTP classes. + + + + + Make a FTP request using the .NET FTPWebRequest class. + WARNING: This method will throw. + + Session bearing an FTP request + Returns Response body stream + Returns generated Response headers + + + + The GenericTunnel class represents a "blind tunnel" to shuffle bytes between a client and the server. + + + + + Is streaming started in the downstream direction? + + + + + Number of bytes received from the client + + + + + Number of bytes received from the server + + + + + Returns number of bytes sent from the Server to the Client + + + + + Returns number of bytes sent from the Client to the Server + + + + + This "Factory" method creates a new HTTPS Tunnel and executes it on a background (non-pooled) thread. + + The Session containing the HTTP CONNECT request + + + + Creates a tunnel. External callers instead use the CreateTunnel static method. + + The session for which this tunnel was initially created. + Client Pipe + Server Pipe + + + + This function keeps the thread alive until it is signaled that the traffic is complete + + + + + Executes the HTTPS tunnel inside an All-it-can-eat exception handler. + Call from a background thread. + + + + + Executes the WebSocket tunnel on a background thread + + + + + Instructs the tunnel to take over the server pipe and begin streaming responses to the client + + + + + Close the HTTPS tunnel and signal the event to let the service thread die. + WARNING: This MUST not be allowed to throw any exceptions, because it will do so on threads that don't catch them, and this will kill the application. + + + + + Called when we have received data from the local client. + Incoming data will immediately be forwarded to the remote host. + + The result of the asynchronous operation. + + + Called when we have sent data to the local client.
When all the data has been sent, we will start receiving again from the remote host.
+ The result of the asynchronous operation. +
+ + Called when we have sent data to the remote host.
When all the data has been sent, we will start receiving again from the local client.
+ The result of the asynchronous operation. +
+ + Called when we have received data from the remote host.
Incoming data will immediately be forwarded to the local client.
+ The result of the asynchronous operation. +
+ + + The HostList allows fast determination of whether a given host is in the list. It supports leading wildcards (e.g. *.foo.com), and the special tokens <local> <nonlocal> and <loopback>. + Note: List is *not* threadsafe; instead of updating it, construct a new one. + + + + + This private tuple allows us to associate a Hostname and a Port + + + + + Port specified in the rule + + + + + Hostname specified in the rule + + + + + Create a new HostPortTuple + + + + + Generate an empty HostList + + + + + Create a hostlist and assign it an initial set of sites + + List of hostnames, including leading wildcards, and optional port specifier. Special tokens are *, <local>, <nonlocal>, and <loopback>. + + + + Clear the HostList + + + + + Clear the List and assign the new string as the contents of the list. + + List of hostnames, including leading wildcards, and optional port specifier. Special tokens are *, <local>, <nonlocal>, and <loopback>. + TRUE if the list was constructed without errors + + + + Clear the list and assign the new string as the contents of the list. + + List of hostnames, including leading wildcards, and optional port specifier. Special tokens are *, <local>, <nonlocal>, and <loopback>. + Outparam string containing list of parsing errors + TRUE if the list was constructed without errors + + + + Return the current list of rules as a string + + String containing current rules, using "; " as a delimiter between entries + + + + Determine if a given Host is in the list + + A Host string, potentially including a port + TRUE if the Host's hostname matches a rule in the list + + + + Determine if a given Hostname is in the list + + A hostname, NOT including a port + TRUE if the hostname matches a rule in the list + + + + Determine if a given Host:Port pair matches an entry in the list + + A hostname, NOT including the port + The port + TRUE if the hostname matches a rule in the list + + + + HTTP Response headers object + + + + + Protect your enumeration using GetReaderLock + + + + + Protect your enumeration using GetReaderLock + + + + + Clone this HTTPResponseHeaders object and return the result cast to an Object + + The new response headers object, cast to an object + + + + Status code from HTTP Response. If setting, also set HTTPResponseStatus too! + + + + + Code AND Description of Response Status (e.g. '200 OK'). + + + + + Gets or sets the text associated with the response code (e.g. "OK", "Not Found", etc) + + + + + Update the response status code and text + + HTTP Status code (e.g. 401) + HTTP Status text (e.g. "Access Denied") + + + + Constructor for HTTP Response headers object + + + + + Constructor for HTTP Response headers object + + Text encoding to be used for this set of Headers when converting to a byte array + + + + Returns a byte array representing the HTTP headers. + + TRUE if the response status line should be included + TRUE if there should be a trailing \r\n byte sequence included + Byte[] containing the headers + + + + Returns a string containing http headers + + TRUE if the response status line should be included + TRUE if there should be a trailing CRLF included + String containing http headers + + + + Returns a string containing the http headers + + + Returns a string containing http headers with a status line but no trailing CRLF + + + + + Parses a string and assigns the headers parsed to this object + + The header string + TRUE if the operation succeeded, false otherwise + + + + HTTP Request headers object + + + + + Warning: You should protect your enumeration using the GetReaderLock + + + + + Warning: You should protect your enumeration using the GetReaderLock + + + + + Clones the HTTP request headers + + The new HTTPRequestHeaders object, cast to an object + + + + The HTTP Method (e.g. GET, POST, etc) + + + + + Constructor for HTTP Request headers object + + + + + Constructor for HTTP Request headers object + + Text encoding to be used for this set of Headers when converting to a byte array + + + + The (lowercased) URI scheme for this request (https, http, or ftp) + + + + + Username:Password info for FTP URLs. (either null or "user:pass@") + (Note: It's silly that this contains a trailing @, but whatever...) + + + + + Get or set the request path as a string + + + + + Get or set the request path as a byte array + + + + + Parses a string and assigns the headers parsed to this object + + The header string + TRUE if the operation succeeded, false otherwise + + + + Returns a byte array representing the HTTP headers. + + TRUE if the HTTP REQUEST line (method+path+httpversion) should be included + TRUE if there should be a trailing \r\n byte sequence included + TRUE if the SCHEME and HOST should be included in the HTTP REQUEST LINE + The HTTP headers as a byte[] + + + + Returns a byte array representing the HTTP headers. + + TRUE if the HTTP REQUEST line (method+path+httpversion) should be included + TRUE if there should be a trailing \r\n byte sequence included + TRUE if the SCHEME and HOST should be included in the HTTP REQUEST LINE + Only meaningful if prependVerbLine is TRUE, the host to use in the HTTP REQUEST LINE + The HTTP headers as a byte[] + + + + Returns a string representing the HTTP headers. + + TRUE if the HTTP REQUEST line (method+path+httpversion) should be included + TRUE if there should be a trailing CRLF sequence included + TRUE if the SCHEME and HOST should be included in the HTTP REQUEST LINE (Automatically set to FALSE for CONNECT requests) + The HTTP headers as a string. + + + + Returns a string representing the HTTP headers, without the SCHEME+HOST in the HTTP REQUEST line + + TRUE if the HTTP REQUEST line (method+path+httpversion) should be included + TRUE if there should be a trailing CRLF sequence included + The header string + + + + Returns a string representing the HTTP headers, without the SCHEME+HOST in the HTTP request line, and no trailing CRLF + + The header string + + + + Base class for RequestHeaders and ResponseHeaders + + + + + Get the Reader Lock if you plan to enumerate the Storage collection. + + + + + Get the Writer Lock if you plan to change the Storage collection. + NB: You only need this lock if you plan to change the collection itself; you can party on the items in the collection if you like without locking. + + + + + If you get the Writer lock, Free it ASAP or you're going to hang or deadlock the Session + + + + + Text encoding to be used when converting this header object to/from a byte array + + + + + HTTP version (e.g. HTTP/1.1) + + + + + Storage for individual HTTPHeaderItems in this header collection + NB: Using a list is important, as order can matter + + + + + Get byte count of this HTTP header instance. + NOTE: This method should've been abstract. + + Byte Count + + + + Number of HTTP headers + + Number of HTTP headers + + + + Returns all instances of the named header + + Header name + List of instances of the named header + + + + Copies the Headers to a new array. + Prefer this method over the enumerator to avoid cross-thread problems. + + An array containing HTTPHeaderItems + + + + Returns all values of the named header in a single string, delimited by commas + + Header + Each, Header's, Value + + + + Returns the count of instances of the named header + + Header name + Count of instances of the named header + + + + Enumerator for HTTPHeader storage collection + + Enumerator + + + + Gets or sets the value of a header. In the case of Gets, the value of the first header of that name is returned. + If the header does not exist, returns null. + In the case of Sets, the value of the first header of that name is updated. + If the header does not exist, it is added. + + + + + Indexer property. Returns HTTPHeaderItem by index. Throws Exception if index out of bounds + + + + + Adds a new header containing the specified name and value. + + Name of the header to add. + Value of the header. + Returns the newly-created HTTPHeaderItem. + + + + Adds one or more headers + + + + + Returns the Value from a token in the header. Correctly handles double-quoted strings. Requires semicolon for delimiting tokens + Limitation: FAILS if semicolon is in token's value, even if quoted. + FAILS in the case of crazy headers, e.g. Header: Blah="SoughtToken=Blah" SoughtToken=MissedMe + + We really need a "proper" header parser + + Name of the header + Name of the token + Value of the token if present; otherwise, null + + + + Determines if the Headers collection contains a header of the specified name, with any value. + + The name of the header to check. (case insensitive) + True, if the header exists. + + + + Determines if the Headers collection contains any header from the specified list, with any value. + + list of headers + True, if any named header exists. + + + + Determines if the Headers collection contains one or more headers of the specified name, and + sHeaderValue is part of one of those Headers' value. + + The name of the header to check. (case insensitive) + The partial header value. (case insensitive) + True if the header is found and the value case-insensitively contains the parameter + + + + Determines if the Headers collection contains a header of the specified name, and sHeaderValue=Header's value. Similar + to a case-insensitive version of: headers[sHeaderName]==sHeaderValue, although it checks all instances of the named header. + + The name of the header to check. (case insensitive) + The full header value. (case insensitive) + True if the header is found and the value case-insensitively matches the parameter + + + + Removes all headers from the header collection which have the specified name. + + The name of the header to remove. (case insensitive) + + + + Removes all headers from the header collection which have the specified names. + + Array of names of headers to remove. (case insensitive) + + + + Removes a HTTPHeader item from the collection + + The HTTPHeader item to be removed + + + + Removes all HTTPHeader items from the collection + + + + + Renames all headers in the header collection which have the specified name. + + The name of the header to rename. (case insensitive) + The new name for the header. + True if one or more replacements were made. + + + + Represents a single HTTP header + + + + + Clones a single HTTP header and returns the clone cast to an object + + HTTPHeader Name: Value pair, cast to an object + + + + The name of the HTTP header + + + + + The value of the HTTP header + + + + + Creates a new HTTP Header item. WARNING: Doesn't do any trimming or validation on the name. + + Header name + Header value + + + + Return a string of the form "NAME: VALUE" + + "NAME: VALUE" Header string + + + + Utility functions common to parsing both ClientHello and ServerHello messages + + + + + Gets a textual string from a TLS extension + + + + + Builds a string from an ALPN List of strings + + + + + List Sig/Hash pairs from RFC5246 and TLS/1.3 spec + + + + + + + Describes a block of padding, with a friendly summary if all bytes are 0s + https://www.ietf.org/archive/id/draft-agl-tls-padding-03.txt + + + + + List defined Supported Groups & ECC Curves from RFC4492 + + + + + + List defined ECC Point Formats from RFC4492 + + + + + + + Converts a HTTPS version to a "Major.Minor (Friendly)" string + + + + + The HTTPSClientHello class is used to parse the bytes of a HTTPS ClientHello message. + + + + + Map cipher id numbers to names. See http://www.iana.org/assignments/tls-parameters/ + Format is PROTOCOL_KEYAGREEMENT_AUTHENTICATIONMECHANISM_CIPHER_MACPRIMITIVE + + + + + Parse ClientHello from stream. See Page 77 of SSL & TLS Essentials + + + + + Parse a single extension using the list from http://tools.ietf.org/html/rfc6066 + https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xml + https://src.chromium.org/viewvc/chrome/trunk/src/net/third_party/nss/ssl/sslt.h + + + + + + + Did client use ALPN to go to SPDY? + http://tools.ietf.org/html/draft-ietf-tls-applayerprotoneg-01#section-3.1 + + + + + Did this ServerHello Handshake specify an upgrade to SPDY? + + + + + Did this ServerHello Handshake specify an upgrade to SPDY? + + + + + Parse a single extension using the list from http://tools.ietf.org/html/rfc6066 + + + + + + + The Logger object is a simple event log message dispatcher + + + + + The Event to raise when a string is logged + + + + + Queue of Messages that are be logged (usually during application startup) until another object has loaded and registered for notification of such Messages + + + + + Creates a Logger object + + True if a queue should be created to store messages during Fiddler's startup + + + + Flushes previously-queued messages to the newly attached listener. + + + + + Log a string with specified string formatting + + The format string + The arguments to replace in the string + + + + Log a string + + The string to log + + + + EventArgs class for the LogEvent handler + + + + + The String which has been logged + + + + + The MockTunnel represents a CONNECT tunnel which was reloaded from a SAZ file. + + + + + Flags that indicate what problems, if any, were encountered in parsing HTTP headers + + + + + There were no problems parsing the HTTP headers + + + + + The HTTP headers ended incorrectly with \n\n + + + + + The HTTP headers ended incorrectly with \n\r\n + + + + + The HTTP headers were malformed. + + + + + The Parser class exposes static methods used to parse strings or byte arrays into HTTP messages. + + + + + Given a byte[] representing a request, determines the offsets of the components of the line. WARNING: Input MUST contain a LF or an exception will be thrown + + Byte array of the request + Returns the index of the byte of the URI in the Request line + Returns the length of the URI in the Request line + Returns the index of the first byte of the name/value header pairs + + + + + + + Index of final byte of headers, if found, or location that search should resume next time + + + + + + + Parse out HTTP Header lines. + + Header collection to *append* headers to + Array of Strings + Index into array at which parsing should start + String containing any errors encountered + TRUE if there were no errors, false otherwise + + + + Given a byte array, determines the Headers length + + Input array of data + Returns the calculated length of the headers. + Returns the calculated start of the response body. + Any HTTPHeaderParseWarnings discovered during parsing. + True, if the parsing was successful. + + + + Given a MemoryStream, attempts to parse a HTTP Request starting at the current position. + + TRUE if a request could be parsed, FALSE otherwise + + + + Given a MemoryStream, attempts to parse a HTTP Response starting at the current position + + TRUE if a response could be parsed, FALSE otherwise + + + + Parse the HTTP Request into a headers object. + + The HTTP Request string, including *at least the headers* with a trailing CRLFCRLF + HTTPRequestHeaders parsed from the string. + + + + Break headers off, then convert CRLFs into LFs + + + + + + + Parse the HTTP Response into a headers object. + + The HTTP response as a string, including at least the headers. + HTTPResponseHeaders parsed from the string. + + + + Class allows finding the end of a body sent using Transfer-Encoding: Chunked + + + + + Number of bytes in the body (sans chunk headers, CRLFs, and trailers) + + + + + + Read the first character of the hexadecimal size + + + + + Read the first character of the next Trailer header (if any) + + + + + We're in a trailer. Read up to the next \r + + + + + We've just read a trailer CR, now read its LF + + + + + We read a CR on an "empty" Trailer line, so now we just need the final LF + + + + + The chunked body was successfully read with no excess + + + + + Completed, but we read too many bytes. Call getOverage to return how many bytes to put back + + + + + The body was malformed + + + + + Somewhat similar to the Framework's "BackgroundWorker" class, the periodic worker performs a similar function on a periodic schedule. + NOTE: the callback occurs on a background thread. + + The PeriodicWorker class is used by Fiddler to perform "cleanup" style tasks on a timer. Put work in the queue, + and it will see that it's done at least as often as the schedule specified until Fiddler begins to close at which + point all work stops. + + + The underlying timer's interval is 1 second. + + + + I think a significant part of the reason that this class exists is that I thought the System.Threading.Timer consumed one thread for each + timer. In reality, per "CLR via C# 4e" all of the instances share one underlying thread and thus my concern was misplaced. Ah well. + + + + + Assigns a "job" to the Periodic worker, on the schedule specified by iMS. + + The function to run on the timer specified. + Warning: the function is NOT called on the UI thread, so use .Invoke() if needed. + The # of milliseconds to wait between runs + A taskItem which can be used to revokeWork later + + + + Revokes a previously-assigned task from this worker. + + + + + + The ScheduledTasks class allows addition of jobs by name. It ensures that ONE instance of the named + job will occur at *some* point in the future, between 0 and a specified max delay. If you queue multiple + instances of the same-named Task, it's only done once. + + + + + Under the lock, we enumerate the schedule to find work to do and remove that work from the schedule. + After we release the lock, we then do the queued work. + + + + + + A jobItem represents a Function+Time tuple. The function will run after the given time. + + + + + TickCount at which this job must run. + + + + + Method to invoke to complete the job + + + + + Abstract base class for the ClientPipe and ServerPipe classes. A Pipe represents a connection to either the client or the server, optionally encrypted using SSL/TLS. + + + + + The base socket wrapped in this pipe + + + + + The number of times that this Pipe has been used + + + + + The HTTPS stream wrapped around the base socket + + + + + The display name of this Pipe + + + + + Number of milliseconds to delay each 1024 bytes transmitted + + + + + Create a new pipe, an enhanced wrapper around a socket + + Socket which this pipe wraps + Identification string used for debugging purposes + + + + Return the Connected status of the base socket. + WARNING: This doesn't work as you might expect; you can see Connected == false when a READ timed out but a WRITE will succeed. + + + + + Poll the underlying socket for readable data (or closure/errors) + + TRUE if this Pipe requires attention + + + + Returns a bool indicating if the socket in this Pipe is CURRENTLY connected and wrapped in a SecureStream + + + + + Returns the SSL/TLS protocol securing this connection + + + + + Return the Remote Port to which this socket is attached. + + + + + Return the Local Port to which the base socket is attached. Note: May return a misleading port if the ISA Firewall Client is in use. + + + + + Returns the remote address to which this Pipe is connected, or 0.0.0.0 on error. + + + + + Gets or sets the transmission delay on this Pipe, used for performance simulation purposes. + + + + + Call this method when about to reuse a socket. Currently, increments the socket's UseCount and resets its transmit delay to 0. + + The session identifier of the new session, or zero + + + + Sends a byte array through this pipe + + The bytes + + + + Sends the data specified in oBytes (between iOffset and iOffset+iCount-1 inclusive) down the pipe. + + + + + + + + Receive bytes from the pipe into the DATA buffer. + + Throws IO exceptions from the socket/stream + Array of data read + Bytes read + + + + Return the raw socket this pipe wraps. Avoid calling this method if at all possible. + + The Socket object this Pipe wraps. + + + + Shutdown and close the socket inside this pipe. Eats exceptions. + + + + + Abruptly closes the socket by sending a RST packet + + + + + A ClientPipe wraps a socket connection to a client application. + + + + + By default, we now test for loopbackness before lookup of PID + https://github.com/telerik/fiddler/issues/83 + + + + + Timeout to wait for the *first* data from the client + + + + + Timeout to wait for the ongoing reads from the client (as headers and body are read) + + + + + Timeout before which an idle connection is closed (e.g. for HTTP Keep-Alive) + + + + + Client process name (e.g. "iexplore") + + + + + Client process ProcessID + + + + + Data which was previously "over-read" from the client. Populated when HTTP-pipelining is attempted + + + + + ID of the process that opened this socket, assuming that Port Mapping is enabled, and the connection is from the local machine + + + + + Does this Pipe have data (or closure/errors) to read? + + TRUE if this Pipe requires attention + + + + If you previously read more bytes than you needed from this client socket, you can put some back. + + Array of bytes to put back; now owned by this object + + + + Name of the Process referred to by LocalProcessID, or String.Empty if unknown + + + + + Sets the socket's timeout based on whether we're waiting for our first read or for an ongoing read-loop + + + + + Returns a semicolon-delimited string describing this ClientPipe + + A semicolon-delimited string + + + + Perform a HTTPS Server handshake to the client. Swallows exception and returns false on failure. + + + + + + + This function sends the client socket a CONNECT ESTABLISHED, and then performs a HTTPS authentication + handshake, with Fiddler acting as the server. + + Hostname Fiddler is pretending to be (NO PORT!) + The set of headers to be returned to the client in response to the client's CONNECT tunneling request + true if the handshake succeeds + + + + Timestamp of either 1> The underlying socket's creation from a .Accept() call, or 2> when this ClientPipe was created. + + + + + The PipePool maintains a collection of connected ServerPipes for reuse + + + + + Minimum idle time of pipes to be expired from the pool. + Note, we don't check the pipe's ulLastPooled value when extracting a pipe, + so its age could exceed the allowed lifetime by up to MSEC_POOL_CLEANUP_INTERVAL + WARNING: Don't change the timeout >2 minutes casually. Server bugs apparently exist: https://bugzilla.mozilla.org/show_bug.cgi?id=491541 + + + + + The Pool itself. + + + + + Time at which a "Clear before" operation was conducted. We store this + so that we don't accidentally put any pipes that were in use back into + the pool after a clear operation + + + + + Remove any pipes from Stacks if they exceed the age threshold + Remove any Stacks from pool if they are empty + + + + + Clear all pooled Pipes, calling .End() on each. + + + + + Return a string representing the Pipes in the Pool + + A string representing the pipes in the pool + + + + Get a Server connection for reuse, or null if a suitable connection is not in the pool. + + The key which identifies the connection to search for. + The ProcessID of the client requesting the Pipe + HACK to be removed; the SessionID# of the request for logging + A Pipe to reuse, or NULL + + + + Store a pipe for later use, if reuse is allowed by settings and state of the pipe. + + The Pipe to place in the pool + + + + This class holds a specialized memory stream with growth characteristics more suitable for reading from a HTTP Stream. + The default MemoryStream's Capacity will always grow to 256 bytes, then at least ~2x current capacity up to 1gb (2gb on .NET 4.6), then to the exact length after that. + That has three problems: + + The capacity may unnecessarily grow to >85kb, putting the object on the LargeObjectHeap even if we didn't really need 85kb. + On 32bit, we may hit a Address Space exhaustion ("Out of memory" exception) prematurely and unnecessarily due to size-doubling + After the capacity reaches 1gb in length, the capacity growth never exceeds the length, leading to huge reallocations and copies on every write (fixed in .NET 4.6) + + This class addresses those issues. http://textslashplain.com/2015/08/06/tuning-memorystream/ + + + + + A client may submit a "hint" of the expected size. We use that if present. + + + + + Used by the caller to supply a hint on the expected total size of reads from the pipe. + We cannot blindly trust this value because sometimes the client or server will lie and provide a + huge value that it will never use. This is common for RPC-over-HTTPS tunnels like that used by + Outlook, for instance. + + The Content-Length can also lie by underreporting the size. + + Suggested total buffer size in bytes + + + + The policy which describes how this pipe may be reused by a later request. Ordered by least restrictive to most. + + + + + The ServerPipe may be freely reused by any subsequent request + + + + + The ServerPipe may be reused only by a subsequent request from the same client process + + + + + The ServerPipe may be reused only by a subsequent request from the same client pipe + + + + + The ServerPipe may not be reused for a subsequent request + + + + + A ServerPipe wraps a socket connection to a server. + + + + + Policy for reuse of this pipe + + + + + DateTime of the completion of the TCP/IP Connection + + + + + TickCount when this Pipe was last placed in a PipePool + + + + + Returns TRUE if this ServerPipe is connected to a Gateway + + + + + Returns TRUE if this ServerPipe is connected to a SOCKS gateway + + + + + The Pooling key used for reusing a previously pooled ServerPipe. See sPoolKey property. + + + + + This field, if set, tracks the process ID to which this Pipe is permanently bound; set by MarkAsAuthenticated. + NOTE: This isn't actually checked by anyone; instead the PID is added to the POOL Key + + + + + Backing field for the isAuthenticated property + + + + + String containing representation of the server's certificate chain + + + + + Server's certificate + + + + + Wraps a socket in a Pipe + + The Socket + Pipe's human-readable name + True if the Pipe is attached to a gateway + The Pooling key used for socket reuse + + + + Returns TRUE if there is an underlying, mutually-authenticated HTTPS stream. + + WARNING: Results are a bit of a lie. System.NET IsMutuallyAuthenticated == true if a client certificate is AVAILABLE even + if that certificate was never SENT to the server. + + + + + Returns TRUE if this PIPE is marked as having been authenticated using a Connection-Oriented Auth protocol: + NTLM, Kerberos, or HTTPS Client Certificate. + + + + + Marks this Pipe as having been authenticated. Depending on the preference "fiddler.network.auth.reusemode" this may impact the reuse policy for this pipe + + The client's process ID, if known. + + + + Indicates if this pipe is connected to an upstream (non-SOCKS) Proxy. + + + + + Indicates if this pipe is connected to a SOCKS gateway + + + + + Sets the receiveTimeout based on whether this is a freshly opened server socket or a reused one. + + + + + Returns a semicolon-delimited string describing this ServerPipe + + A semicolon-delimited string + + + + Gets and sets the pooling key for this server pipe. + + + direct->{http|https}/{serverhostname}:{serverport} + gw:{gatewayaddr:port}->* + gw:{gatewayaddr:port}->{http|https}/{serverhostname}:{serverport} + socks:{gatewayaddr:port}->{http|https}/{serverhostname}:{serverport} + + + + + Returns the Server's certificate Subject CN (used by "x-UseCertCNFromServer") + + The *FIRST* CN field from the Subject of the certificate used to secure this HTTPS connection, or null if the connection is unsecure + + + + Return a string describing the HTTPS connection security, if this socket is secured + + A string describing the HTTPS connection's security. + + + + Returns a string describing how this connection is secured. + + + + + + Get the Transport Context for the underlying HTTPS connection so that Channel-Binding Tokens work correctly + + + + + + Returns the IPEndPoint to which this socket is connected, or null + + + + + Get the user's default client cert for authentication; caching if if possible and permitted. + + + + + + This method is called by the HTTPS Connection establishment to optionally attach a client certificate to the request. + Test Page: https://tower.dartmouth.edu/doip/OracleDatabases.jspx or ClientCertificate.ms in Test folder should request on initial connection + In contrast, this one: https://roaming.officeapps.live.com/rs/roamingsoapservice.svc appears to try twice (renego) + + + + + + + + + + + This function secures an existing connection and authenticates as client. This is primarily useful when + the socket is connected to a Gateway/Proxy and we had to send a CONNECT and get a HTTP/200 Connected back before + we actually secure the socket. + http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx + + The Session (a CONNECT) this tunnel wraps + The CN to use in the certificate + Path to client certificate file + The HTTPS protocol version of the Client Pipe; can influence which SslProtocols we offer the server + Reference-passed integer which returns the time spent securing the connection + TRUE if the connection can be secued + + + + Return a Certificate Collection containing certificate from the specified file. + + Path to the certificate. Relative Paths will be absolutified automatically + The Certificate collection, or null + + + + This class allows fast-lookup of a ProcessName from a ProcessID. + + + + + Static constructor which registers for cleanup + + + + + Prune the cache of expiring PIDs + + + + + Map a Process ID (PID) to a Process Name + + The PID + A Process Name (e.g. IEXPLORE.EXE) or String.Empty + + + + Structure mapping a Process ID (PID) to a ProcessName + + + + + The TickCount when this entry was created + + + + + The ProcessName (e.g. IEXPLORE.EXE) + + + + + Create a PID->ProcessName mapping + + The ProcessName (e.g. IEXPLORE.EXE) + + + + The core proxy object which accepts connections from clients and creates session objects from those connections. + + + + + Hostname if this Proxy Endpoint is terminating HTTPS connections + + + + + Certificate if this Proxy Endpoint is terminating HTTPS connections + + + + + Per-connectoid information about each WinINET connectoid + + + + + The upstream proxy settings. + + + + + The AutoProxy object, created if we're using WPAD or a PAC Script as a gateway + + + + + Allow binding to a specific egress adapter: "fiddler.network.egress.ip" + + + + + Watcher for Notification of Preference changes + + + + + Server connections may be pooled for performance reasons. + + + + + The Socket Endpoint on which this proxy receives requests + + + + + Flag indicating that Fiddler is in the process of detaching... + + + + + List of hosts which should bypass the upstream gateway + + + + + Returns a string of information about this instance and the ServerPipe reuse pool + + A multiline string + + + + Returns true if the proxy is listening on a port. + + + + + The port on which this instance is listening + + + + + Returns true if Fiddler believes it is currently registered as the Local System proxy + + + + + This event handler fires when Fiddler detects that it is (unexpectedly) no longer the system's registered proxy + + + + + Change the outbound IP address used to send traffic + + + + + + Watch for relevent changes on the Preferences object + + + + + + + Called whenever Windows reports that the system's NetworkAddress has changed + + + + + + + Called by Windows whenever network availability goes up or down. + + + + + + + Directly inject a session into the Fiddler pipeline, returning a reference to it. + NOTE: This method will THROW any exceptions to its caller. + + HTTP Request Headers + HTTP Request body (or null) + StringDictionary of Session Flags (or null) + The new Session + + + + Directly inject a session into the Fiddler pipeline, returning a reference to it. + NOTE: This method will THROW any exceptions to its caller. + + HTTP Request Headers + HTTP Request body (or null) + StringDictionary of Session Flags (or null) + Event Handler to notify when the session changes state + The new Session + + + + Directly inject a session into the Fiddler pipeline, returning a reference to it. + NOTE: This method will THROW any exceptions to its caller. + + String representing the HTTP request. If headers only, be sure to end with CRLFCRLF + StringDictionary of Session Flags (or null) + The new session + + + + [DEPRECATED] Directly inject a session into the Fiddler pipeline. + NOTE: This method will THROW any exceptions to its caller. + + + HTTP Request Headers + HTTP Request body (or null) + StringDictionary of Session Flags (or null) + + + + [DEPRECATED] Directly inject a session into the Fiddler pipeline. + NOTE: This method will THROW any exceptions to its caller. + + + String representing the HTTP request. If headers only, be sure to end with CRLFCRLF + StringDictionary of Session Flags (or null) + + + + [DEPRECATED]: This version does no validation of the request data, and doesn't set SessionFlags.RequestGeneratedByFiddler + Send a custom HTTP request to Fiddler's listening endpoint (127.0.0.1:8888 by default). + NOTE: This method will THROW any exceptions to its caller and blocks the current thread. + + + String representing the HTTP request. If headers only, be sure to end with CRLFCRLF + + + + This function, when given a scheme host[:port], returns the gateway information of the proxy to forward requests to. + + URIScheme: use http, https, or ftp + Host for which to return gateway information + IPEndPoint of gateway to use, or NULL + + + + Accept the connection and pass it off to a handler thread + + + + + + Register as the system proxy for WinINET and set the Dynamic registry key for other FiddlerHook + + True if the proxy registration was successful + + + + If we get a notice that the proxy registry key has changed, wait 50ms and then check to see + if the key is pointed at us. If not, raise the alarm. + + + + + + + If we are supposed to be "attached", we re-verify the registry keys, and if they are corrupt, notify + our host of the discrepency. + + + + + This method sets up the connectoid list and updates gateway information. Called by the Attach() method, or + called on startup if Fiddler isn't configured to attach automatically. + + + + + Given an address list, walks the list until it's able to successfully make a connection. + Used for finding an available Gateway when we have a list to choose from + + A string, e.g. PROXY1:80 + The IP:Port of the first alive endpoint for the specified host/port + + + + Set internal fields pointing at upstream proxies. + + + + + Detach the proxy by setting the registry keys and sending a Windows Message + + True if the proxy settings were successfully detached + + + + Detach the proxy by setting the registry keys and sending a Windows Message + + True if the proxy settings were successfully detached + + + + Stop the proxy by closing the socket. + + + + + Start the proxy by binding to the local port and accepting connections + + Port to listen on + TRUE to allow remote connections + + + + + Dispose Fiddler's listening socket + + + + + Clear the pool of Server Pipes. May be called by extensions. + + + + + Assign HTTPS Certificate for this endpoint + + Certificate to return to clients who connect + + + + Sets the upstream gateway to match the specified ProxySettings + + + + + + Generate or find a certificate for this endpoint + + Subject FQDN + TRUE if the certificate could be found/generated, false otherwise + + + + Return a simple string indicating what upstream proxy/gateway is in use. + + + + + + This class maintains the Proxy Bypass List for the upstream gateway. + In the constructor, pass the desired proxy bypass string, as retrieved from WinINET for the Options screen. + Then, call the IsBypass(sTarget) method to determine if the Gateway should be bypassed + + + + + List of regular expressions for matching against request Scheme://HostPort. + NB: This list is either null or contains at least one item. + + + + + Boolean flag indicating whether the bypass list contained a <local> token. + + + + + Pass the desired proxy bypass string retrieved from WinINET. + + + + + + Does the bypassList contain any rules at all? + + + + + Given the rules for this bypasslist, should this target bypass the proxy? + + The URI Scheme + The Host and PORT + True if this request should not be sent to the gateway proxy + + + + Convert the string representing the bypass list into an array of rules escaped and ready to be turned into regular expressions + + + + + + The ServerChatter object is responsible for transmitting the Request to the destination server and retrieving its Response. + + + This class maintains its own PipeReadBuffer that it fills from the created or reused ServerPipe. After it determines that + a complete response is present, it allows the caller to grab that array using the TakeEntity method. If + unsatisfied with the result (e.g. a network error), the caller can call Initialize() and SendRequest() again. + + + + + Size of buffer passed to pipe.Receive when reading from the server + + + PERF: Currently, I use [32768]; but I'd assume bigger buffers are faster. Does ReceiveBufferSize/SO_RCVBUF figure in here? + Anecdotal data suggests that current reads rarely fill the full 32k buffer. + + + + + Interval, in milliseconds, after which Fiddler will check to see whether a response should continue to be read. Otherwise, + a never-ending network stream can accumulate ever larger amounts of data that will never be seen by the garbage collector. + + + + + The pipeServer represents Fiddler's connection to the server. + + + + + The session to which this ServerChatter belongs + + + + + The inbound headers on this response + + + + + Indicates whether this request was sent to a (non-SOCKS) Gateway, which influences whether the protocol and host are + mentioned in the Request line + When True, the session should have SessionFlags.SentToGateway set. + + + + + Buffer holds this response's data as it is read from the pipe. + + + + + The total count of bytes read for this response. Typically equals m_responseData.Length unless + Streaming & Log-Drop-Response-Body - in which case it will be larger since the m_responseData is cleared after every read. + + BUG BUG: This value is reset to 0 when clearing streamed data. It probably shouldn't be; the problem is that this field is getting used for two purposes + + + + + Pointer to first byte of Entity body (or to the start of the next set of headers in the case where there's a HTTP/1xx intermediate header) + Note: This gets reset to 0 if we're streaming and dropping the response body. + + + + + Optimization: tracks how far we've looked into the Request when determining iEntityBodyOffset + + + + + True if final (non-1xx) HTTP Response headers have been returned to the client. + + + + + Indicates how much of _responseData buffer has already been streamed to the client + + + + + Position in responseData of the start of the latest parsed chunk size information + + + + + Locals used by the Connect-to-Host state machine + + + + + The ExecutionState object holds information that is used by the Connect-to-Host state machine + + + + + Peek at number of bytes downloaded thus far. + + + + + Get the MIME type (sans Character set or other attributes) from the HTTP Content-Type response header, or String.Empty if missing. + + + + + DEPRECATED: You should use the Timers object on the Session object instead. + The number of milliseconds between the start of sending the request to the server to the first byte of the server's response + + + + + DEPRECATED: You should use the Timers object on the Session object instead. + The number of milliseconds between the start of sending the request to the server to the last byte of the server's response. + + + + + Was this request forwarded to a gateway? + + + + + Was this request serviced from a reused server connection? + + + + + The HTTP headers of the server's response + + + + + Simple indexer into the Response Headers object + + + + + Create a ServerChatter object and initialize its headers from the specified string + + + + + + + Reset the response-reading fields on the object. Also used on a retry. + + If TRUE, allocates a buffer (m_responseData) to read from a pipe. If FALSE, nulls m_responseData. + + + + Peek at the current response body and return it as an array + + The response body as an array, or byte[0] + + + + Get the response body byte array from the PipeReadBuffer, then dispose of it. + + WARNING: This eats all of the bytes in the Pipe, even if that includes bytes of a + future, as-yet-unrequested response. Fiddler does not pipeline requests, so that works okay for now. + For now, the caller should validate that the returned entity is of the expected size (e.g. based on Content-Length) + + + + + Scans responseData stream for the \r\n\r\n (or variants) sequence + which indicates that the header block is complete. + + SIDE EFFECTS: + iBodySeekProgress is updated and maintained across calls to this function + iEntityBodyOffset is updated if the end of headers is found + + True, if responseData contains a full set of headers + + + + Parse the HTTP Response into Headers and Body. + + + + + + Attempt to pull the final (non-1xx) Headers from the stream. If HTTP/100 messages are found, the method + will recurse into itself to find the next set of headers. + + + + + Deletes a single HTTP/1xx header block from the Response stream + and adjusts all header-reading state to start over from the top of the stream. + Note: If 'fiddler.network.leakhttp1xx' is TRUE, then the 1xx message will have been leaked before calling this method. + + + + + Adjusts PipeServer's ReusePolicy if response headers require closure. Then calls _detachServerPipe() + + + + + Queues or End()s the ServerPipe, depending on its ReusePolicy + + + + + Determines whether a given PIPE is suitable for a given Session, based on that Session's SID + + The Client Process ID, if any + The base (no PID) PoolKey expected by the session + The pipe's pool key + TRUE if the connection should be used, FALSE otherwise + + + + If a Connection cannot be established, we need to report the failure to our caller + + + + + + Given an address list and port, attempts to create a socket to the first responding host in the list (retrying via DNS Failover if needed). + + IPEndpoints to attempt to reach + Session object to annotate with timings and errors + Connected Socket. Throws Exceptions on errors. + + + + If the Session was configured to stream the request body, we need to read from the client + and send it to the server here. + + + FALSE on transfer error, TRUE otherwise. + + + + + Sends (or resends) the Request to the server or upstream proxy. If the request is a CONNECT and there's no + gateway, this method ~only~ establishes the connection to the target, but does NOT send a request. + + Note: THROWS on failures + + + + + May request be resent on a different connection because the .Send() of the request did not complete? + + TRUE if the request may be resent + + + + Performs a SOCKSv4A handshake on the socket + + + + + Build the SOCKS4 outbound connection handshake as a byte array. + http://en.wikipedia.org/wiki/SOCKS#SOCKS4a + + + + + Replaces body with an error message + + Error to send if client was remote + Error to send if cilent was local + + + + The Session object will call this method if it wishes to stream a file from disk instead + of loading it into memory. This method sets default headers. + + + + + + Loads a HTTP response from a file + + The name of the file from which a response should be loaded + False if the file wasn't found. Throws on other errors. + + + + Reads the response from the ServerPipe. + + TRUE if a response was read + + + + When the headers first arrive, update bBufferResponse based on their contents. + + + + + Detects whether this is an direct FTP request and if so executes it and returns true. + + FALSE if the request wasn't FTP or wasn't direct. + + + + Remove from memory the response data that we have already returned to the client. + + + + + Remove from memory the response data that we have already returned to the client, up to the last chunk + size indicator, which we need to keep around for chunk-integrity purposes. + + + + + Leak the current bytes of the response to client. We wait for the full header + set before starting to stream for a variety of impossible-to-change reasons. + + Returns TRUE if response bytes were leaked, false otherwise (e.g. write error). THROWS if "fiddler.network.streaming.abortifclientaborts" is TRUE + + + + Mark this connection as non-reusable + + + + + The Session object manages the complete HTTP session including the UI listitem, the ServerChatter, and the ClientChatter. + + + + + Should we try to use the SPNToken type? + Cached for performance reasons. + ISSUE: It's technically possible to use FiddlerCorev2/v3 on .NET/4.5 but we won't set this field if you do that. + + + + + Sorta hacky, we may use a .NET WebRequest object to generate a valid NTLM/Kerberos response if the server + demands authentication and the Session is configured to automatically respond. + + + + + Used if the Session is bound to a WebSocket or CONNECTTunnel + + + + + File to stream if responseBodyBytes is null + + + + + Bitflags of commonly-queried session attributes + + + + + DO NOT USE. TEMPORARY WHILE REFACTORING VISIBILITY OF MEMBERS + + + + + + + Sets or unsets the specified SessionFlag(s) + + SessionFlags + Desired set value + + + + Test the session's BitFlags + + One or more (OR'd) SessionFlags + TRUE if ALL specified flag(s) are set + + + + Test the session's BitFlags + + One or more (OR'd) SessionFlags + TRUE if ANY of specified flag(s) are set + + + + When a client socket is reused, this field holds the next Session until its execution begins + + + + + Should response be buffered for tampering. + + ARCH: This should have been a property instead of a field, so we could throw an InvalidStateException if code tries to manipulate this value after the response has begun + + + + Timers stored as this Session progresses + + + + + Field is set to False if socket is poisoned due to HTTP errors. + + + + + Returns True if this is a HTTP CONNECT tunnel. + + + + + Object representing the HTTP Response. + + + + + Object representing the HTTP Request. + + + + + Fiddler-internal flags set on the Session. + + TODO: ARCH: This shouldn't be exposed directly; it should be wrapped by a ReaderWriterLockSlim to prevent + exceptions while enumerating the flags for storage, etc + + + + A common use for the Tag property is to store data that is closely associated with the Session. + It is NOT marshalled during drag/drop and is NOT serialized to a SAZ file. + + + + + Contains the bytes of the request body. + + + + + Contains the bytes of the response body. + + + + + IP Address of the client for this session. + + + + + Client port attached to Fiddler. + + + + + IP Address of the server for this session. + + + + + Event object used for pausing and resuming the thread servicing this session + + + + + This event fires at any time the session's State changes. Use with caution due to the potential for performance impact. + + + + + This event fires if this Session automatically yields a new one, for instance, if Fiddler is configured to automatically + follow redirects or perform multi-leg authentication (X-AutoAuth). + + + + + If this session is a Tunnel, and the tunnel's IsOpen property is TRUE, returns TRUE. Otherwise returns FALSE. + + + + + If this session is a Tunnel, returns number of bytes sent from the Server to the Client + + + + + If this session is a Tunnel, returns number of bytes sent from the Client to the Server + + + + + Gets or Sets the HTTP Request body bytes. + Setter adjusts Content-Length header, and removes Transfer-Encoding and Content-Encoding headers. + Setter DOES NOT CLONE the passed array. + Setter will throw if the Request object does not exist for some reason. + Use utilSetRequestBody(sStr) to ensure proper character encoding if you need to use a string. + + + + + Gets or Sets the HTTP Response body bytes. + Setter adjusts Content-Length header, and removes Transfer-Encoding and Content-Encoding headers. + Setter DOES NOT CLONE the passed array. + Setter will throw if the Response object has not yet been created. (See utilCreateResponseAndBypassServer) + Use utilSetResponseBody(sStr) to ensure proper character encoding if you need to use a string. + + + + + When true, this session was conducted using the HTTPS protocol. + + + + + When true, this session was conducted using the FTP protocol. + + + + + Returns TRUE if the Session's HTTP Method is available and matches the target method. + + The target HTTP Method being compared. + true, if the method is specified and matches sTestFor (case-insensitive); otherwise false. + + + + Returns TRUE if the Session's target hostname (no port) matches sTestHost (case-insensitively). + + The host to which this session's host should be compared. + True if this session is targeted to the specified host. + + + + Get the process ID of the application which made this request, or 0 if it cannot be determined. + + + + + Get the Process Info of the application which made this request, or String.Empty if it is not known + + + + + Replaces any characters in a filename that are unsafe with safe equivalents, and trim to 160 characters. + + + + + + + Gets a path-less filename suitable for saving the Response entity. Uses Content-Disposition if available. + + + + + Examines the MIME type, and if ambiguous, returns sniffs the body. + + + + + + Set to true in OnBeforeRequest if this request should bypass the gateway + + + + + Returns the port used by the client to communicate to Fiddler. + + + + + State of session. Note Side-Effects: If setting to .Aborted, calls FinishUISession. If setting to/from a Tamper state, calls RefreshMyInspectors + + + + + Notify extensions if this Session naturally led to another (e.g. due to redirect chasing or Automatic Authentication) + + The original session + The new session created + + + + Returns the path and query part of the URL. (For a CONNECT request, returns the host:port to be connected.) + + + + + Retrieves the complete URI, including protocol/scheme, in the form http://www.host.com/filepath?query. + Or sets the complete URI, adjusting the UriScheme and/or Host. + + + + + Gets or sets the URL (without protocol) being requested from the server, in the form www.host.com/filepath?query. + + + + + DNS Name of the host server targeted by this request. May include IPv6 literal brackets. NB: a port# may be included. + + + + + DNS Name of the host server (no port) targeted by this request. Will include IPv6-literal brackets for IPv6-literal addresses + + + + + Returns the server port to which this request is targeted. + + + + + Returns the sequential number of this session. Note, by default numbering is restarted at zero when the session list is cleared. + + + + + Returns the Address used by the client to communicate to Fiddler. + + + + + Gets or Sets the HTTP Status code of the server's response + + + + + Returns HTML representing the Session. Call Utilities.StringToCF_HTML on the result of this function before placing it on the clipboard. + + TRUE if only the headers should be copied. + A HTML-formatted fragment representing the current session. + + + + Store this session's request and response to a string. + + If true, return only the request and response headers + String representing this session + + + + Store this session's request and response to a string. + + A string containing the content of the request and response. + + + + This method resumes the Session's thread in response to "Continue" commands from the UI + + + + + Set the SessionFlags.Ignore bit for this Session, also configuring it to stream, drop read data, and bypass event handlers. + For a CONNECT Tunnel, traffic will be blindly shuffled back and forth. Session will be hidden. + + + + + Called by an AcceptConnection-spawned background thread, create a new session object from a client socket + and execute the session + + Parameter object defining client socket and endpoint's HTTPS certificate, if present + + + + Call this method to AuthenticateAsServer on the client pipe (e.g. Fiddler itself is acting as a HTTPS server). + If configured, the pipe will first sniff the request's TLS ClientHello ServerNameIndicator extension. + + The default certificate to use + TRUE if a HTTPS handshake was achieved; FALSE for any exceptions or other errors. + + + + Call this function while in the "reading response" state to update the responseBodyBytes array with + the partially read response. + + TRUE if the peek succeeded; FALSE if not in the ReadingResponse state + + + + Prevents the server pipe from this session from being pooled for reuse + + + + + Ensures that, after the response is complete, the client socket is closed and not reused. + Does NOT (and must not) close the pipe. + + + + + Immediately close client and server sockets. Call in the event of errors-- doesn't queue server pipes for future reuse. + + + + + + Closes both client and server pipes and moves state to Aborted; unpauses thread if paused. + + + + + Checks whether this is a WebSocket, and if so, whether it has logged any parsed messages. + + + + + Returns TRUE if this session's State > ReadingResponse, and oResponse, oResponse.headers, and responseBodyBytes are all non-null. Note that + bHasResponse returns FALSE if the session is currently reading, even if a body was copied using the COMETPeek feature + + + + + Save HTTP response body to Fiddler Captures folder. You likely want to call utilDecodeResponse first. + + True if the response body was successfully saved + + + + Save HTTP response body to specified location. You likely want to call utilDecodeResponse first. + + The name of the file to which the response body should be saved. + True if the file was successfully written. + + + + Save the request body to a file. You likely want to call utilDecodeRequest first. + + The name of the file to which the request body should be saved. + True if the file was successfully written. + + + + Save the request and response to a single file. + + The filename to which the session should be saved. + TRUE if only the headers should be written. + + + + Save the request to a file. + The headers' Request Line will not contain the scheme or host, which is probably not what you want. + + The name of the file to which the request should be saved. + TRUE to save only the headers + + + + Save the request to a file. Throws if file cannot be written. + + The name of the file to which the request should be saved. + TRUE to save only the headers. + TRUE to include the Scheme and Host in the Request Line. + + + + Read metadata about this session from a stream. NB: Closes the Stream when done. + + The stream of XML text from which session metadata will be loaded. + True if the Metadata was successfully loaded; False if any exceptions were trapped. + + + + Writes this session's metadata to a file. + + The name of the file to which the metadata should be saved in XML format. + True if the file was successfully written. + + + + Saves the response (headers and body) to a file + + The File to write + TRUE if only heaers should be written + + + + Write the metadata about this Session to a stream. The Stream is left open! + + The Stream to write to + + + + Write the session's Request to the specified stream + + TRUE if only the headers should be be written + TRUE if the Scheme and Host should be written in the Request Line + The Stream to which the request should be written + True if the request was written to the stream. False if the request headers do not exist. Throws on other stream errors. + + + + Write the session's Request to the specified stream + + TRUE if only the headers should be be written + TRUE if the Scheme and Host should be written in the Request Line + TRUE if binary bodies should be encoded in base64 for text-safe transport (e.g. used by Composer drag/drop) + The Stream to which the request should be written + True if the request was written to the stream. False if the request headers do not exist. Throws on other stream errors. + + + + Write the session's Response to the specified stream + + The stream to which the response should be written + TRUE if only the headers should be written + TRUE if the response was written to the stream. False if the response headers do not exist. Throws on other stream errors. + + + + Write the session to the specified stream + + The stream to which the session should be written + TRUE if only the request and response headers should be written + False on any exceptions; True otherwise + + + + Replace HTTP request body using the specified file. + + The file containing the request + True if the file was successfully loaded as the request body + + + + Replace HTTP response headers and body using the specified stream. + + The stream containing the response. + True if the Stream was successfully loaded. + + + + Replace HTTP response headers and body using the specified file. + + The file containing the response. + True if the file was successfully loaded. + + + + Return a string generated from the request body, decoding it and converting from a codepage if needed. Throws on errors. + + A string containing the request body. + + + + Return a string generated from the response body, decoding it and converting from a codepage if needed. Throws on errors. + + A string containing the response body. + + + + Find the text encoding of the request + WARNING: Will not decompress body to scan for indications of the character set + + Returns the Encoding of the requestBodyBytes + + + + Find the text encoding of the response + WARNING: Will not decompress body to scan for indications of the character set + + The Encoding of the responseBodyBytes + + + + Returns true if the absolute request URI contains the specified string. Case-insensitive. + + Case-insensitive string to find + TRUE if the URI contains the string + + + + Removes chunking and HTTP Compression from the Response. Adds or updates Content-Length header. + + Returns TRUE if the response was decoded; returns FALSE on failure, or if response didn't have headers that showed encoding. + + + + Removes chunking and HTTP Compression from the Response. Adds or updates Content-Length header. + + TRUE if error messages should be suppressed. False otherwise. + TRUE if the decoding was successsful. + + + + Removes chunking and HTTP Compression from the Request. Adds or updates Content-Length header. + + Returns TRUE if the request was decoded; returns FALSE on failure, or if request didn't have headers that showed encoding. + + + + Use GZIP to compress the request body. Throws exceptions to caller. + + TRUE if compression succeeded + + + + Use GZIP to compress the response body. Throws exceptions to caller. + + TRUE if compression succeeded + + + + Use DEFLATE to compress the response body. Throws exceptions to caller. + + TRUE if compression succeeded + + + + Use BZIP2 to compress the response body. Throws exceptions to caller. + + TRUE if compression succeeded + + + + Introduces HTTP Chunked encoding on the response body + + The number of chunks to try to create + TRUE if the chunking could be performed. + + + + Perform a string replacement on the request body. Adjusts the Content-Length header if needed. + + The case-sensitive string to search for. + The text to replace. + TRUE if one or more replacements occurred. + + + + Call inside OnBeforeRequest to create a response object and bypass the server. + + + + + Perform a regex-based string replacement on the response body. Adjusts the Content-Length header if needed. + + The regular expression used to search the body. Specify RegEx Options via leading Inline Flags, e.g. (?im) for case-Insensitive Multi-line. + The text or expression used to replace + TRUE if replacements occured + + + + Perform a string replacement on the response body (potentially multiple times). Adjust the Content-Length header if needed. + + String to find (case-sensitive) + String to use to replace + TRUE if replacements occurred + + + + Perform a one-time string replacement on the response body. Adjust the Content-Length header if needed. + + String to find (case-sensitive) + String to use to replace + TRUE for Case-Sensitive + TRUE if a replacement occurred + + + + Replaces the request body with sString. Sets Content-Length header and removes Transfer-Encoding/Content-Encoding. + + The desired request Body as a string + + + + Replaces the response body with sString. Sets Content-Length header and removes Transfer-Encoding/Content-Encoding + + The desired response Body as a string + + + + Add a string to the top of the response body, updating Content-Length. (Call utilDecodeResponse first!) + + The string to prepend + + + + Find a string in the request body. Return its index, or -1. + + Term to search for + Require case-sensitive match? + Location of sSearchFor,or -1 + + + + Find a string in the response body. Return its index, or -1. + + Term to search for + Require case-sensitive match? + Location of sSearchFor,or -1 + + + + Reset the SessionID counter to 0. This method can lead to confusing UI, so use sparingly. + + + + + Create a Session object from two byte[] representing request and response. + + The client data bytes + The server data bytes + + + + Create a Session object from a (serializable) SessionData object + + + + + + Create a Session object from two byte[] representing request and response. This is used when loading a Session Archive Zip. + + The client data bytes + The server data bytes + SessionFlags for this session + + + + Creates a new session and attaches it to the pipes passed as arguments + + The client pipe from which the request is read and to which the response is written. + The server pipe to which the request is sent and from which the response is read. May be null. + + + + Initialize a new session from a given request headers and body request builder data. Note: No Session ID is assigned here. + + NB: If you're copying an existing request, use oRequestHeaders.Clone() + The bytes of the request's body + + + + Copy Constructor. . + + Session to clone into a new Session instance + + + + Factory constructor + + + + + + + + + + + + Indexer property into SESSION flags, REQUEST headers, and RESPONSE headers. e.g. oSession["Request", "Host"] returns string value for the Request host header. If null, returns String.Empty + + SESSION, REQUEST or RESPONSE + The name of the flag or header + String value or String.Empty + + + + Simple indexer into the Session's oFlags object; returns null if flag is not present. + + + Returns the string value if the specified flag is present, or null if it is not. + + + + + Called when the Session is ready to begin processing. Eats exceptions to prevent unhandled exceptions on background threads from killing the application. + + Unused parameter (required by ThreadPool) + + + + Current step in the SessionProcessing State Machine + + + + + InnerExecute() implements Fiddler's HTTP Pipeline + + + + + Initiate bi-directional streaming on the RPC connection + + + + + Ensure that the Session's state is >= ss, updating state if necessary + + TargetState + + + + May this Session be resent on a different connection because reading of the response did not succeed? + + TRUE if the entire session may be resent on a new connection + + + + If the response demands credentials and the Session is configured to have Fiddler provide those + credentials, try to do so now. + + TRUE if Fiddler has generated a response to an Auth challenge; FALSE otherwise. + + + + This method will perform obtain authentication credentials from System.NET using a reflection trick to grab the internal value. + It's needed to cope with Channel-Binding-Tokens (CBT). + + This MUST live within its own non-inlined method such that when it's run on an outdated version of the .NET Framework, the outdated + version of the target object triggers a TypeLoadException in such a way that the caller can catch it and warn the user without + killing Fiddler.exe. + + TRUE if we didn't hit any exceptions + + + + Copies process-owner information from a source session to a destination session. Used during handling of AutoRedirects + and auto-Authentications + + + + + + Returns a Kerberos-usable SPN for the target + http://dev.chromium.org/developers/design-documents/http-authentication + "HttpAuthHandlerNegotiate::CreateSPN" + http://blog.michelbarneveld.nl/michel/archive/2009/11/14/the-reason-why-kb911149-and-kb908209-are-not-the-soluton.aspx + + + + + + + Returns the fully-qualified URL to which this Session's response points, or null. + This method is needed because many servers (illegally) return a relative url in HTTP/3xx Location response headers. + + null, or Target URL. Note, you may want to call Utilities.TrimAfter(sTarget, '#'); on the response + + + + Gets a redirect-target from a base URI and a Location header + + + + null, or Target URL. Note, you may want to call Utilities.TrimAfter(sTarget, '#'); + + + + Fiddler can only auto-follow redirects to HTTP/HTTPS/FTP. + + The BASE URL to which a relative redirection should be applied + Response "Location" header + TRUE if the auto-redirect target is allowed + + + + Handles a Response's Redirect if the Session is configured to do so. + + TRUE if a redirect was handled, FALSE otherwise + + + + Check for common mistakes in HTTP Responses and notify the user if they are found. Called only if Linting is enabled. + + + + + Assign a Session ID. Called by ClientChatter when headers are available + + + + + Called only by InnerExecute, this method reads a request from the client and performs tampering/manipulation on it. + + TRUE if there's a Request object and we should continue processing. FALSE if reading the request failed + *OR* if script or an extension changed the session's State to DONE or ABORTED. + + + + + If the executeObtainRequest called failed, we perform cleanup + + + + + Returns TRUE if response is a NTLM or NEGO challenge + + True for HTTP/401,407 with NEGO or NTLM demand + + + + Returns TRUE if response is a Digest, NTLM, or Nego challenge + + True for HTTP/401,407 with Digest, NEGO, NTLM demand + + + + Replace the "ipv*.fiddler "fake" hostnames with the IP-literal equvalents. + + + + + Determines if request host is pointing directly at Fiddler. + + + + + + Echo the client's request back as a HTTP Response, encoding to prevent XSS. + + + + + Send a Proxy Configuration script back to the client. + + + + + Send a Proxy Configuration script back to WinHTTP, so that Fiddler can use an upstream proxy specified + by a script on a fileshare. (WinHTTP only allows HTTP/HTTPS-hosted script files) + + + + + Send the Fiddler Root certificate back to the client + + + + + This method indicates to the client that a secure tunnel was created, + without actually talking to an upstream server. + + If Fiddler's AutoResponder is enabled, and that autoresponder denies passthrough, + then Fiddler itself will always indicate "200 Connection Established" and wait for + another request from the client. That subsequent request can then potentially be + handled by the AutoResponder engine. + + BUG BUG: This occurs even if Fiddler isn't configured for HTTPS Decryption + + + The hostname to use in the Certificate returned to the client + + + + This method adds a Proxy-Support: Session-Based-Authentication header and indicates whether the response is Nego:Type2. + + Returns TRUE if server returned a credible Type2 NTLM Message + + + + This helper evaluates the conditions for client socket reuse. + + + + + + Sends the Response that Fiddler received from the server back to the client socket. + + Should the client and server pipes be tightly-bound together? + True, if the response was successfully sent to the client + + + + Sets up the next Session on these pipes, binding this Session's pipes to that new Session, as appropriate. When this method is called, + the nextSession variable is populated with the new Session, and that object is executed at the appropriate time. + + TRUE if both the client and server pipes should be bound regardless of the serverPipe's ReusePolicy + + + + This object holds Session information as a set of four easily-marshalled byte arrays. + It is serializable, which enables cross-process transfer of this data (as in a drag/drop operation). + (Internally, data is serialized as if it were being stored in a SAZ file) + + + + + Create a SessionData object. + Note: Method must run as cheaply as possible, since it runs on all Drag/Dropped sessions within Fiddler itself. + + + + + + Parameters passed into the AcceptConnection method. + + + + + The Socket which represents the newly-accepted Connection + + + + + The Certificate to pass to SecureClientPipeDirect immediately after accepting the connection. + Normally null, this will be set if the proxy endpoint is configured as a "Secure" endpoint + by AssignEndpointCertificate / ActAsHTTPSEndpointForHostname. + + + + + The DateTime of Creation of this connection + + + + + Unknown + + + + + The new Session is needed to respond to an Authentication Challenge + + + + + The new Session is needed to follow a Redirection + + + + + The new Session is needed to generate a CONNECT tunnel + + + + + Event arguments constructed for the OnStateChanged event raised when a Session's state property changed + + + + + The prior state of this session + + + + + The new state of this session + + + + + Constructor for the change in state + + The old state + The new state + + + + States for the (future) Session-processing State Machine. + + Fun Idea: We can omit irrelevant states from FiddlerCore and thus not have to litter + our state machine itself with a bunch of #if FIDDLERCORE checks... + ... except no, that doesn't work because compiler still cares. Rats. + + + + + + State of the current session + + + + + Object created but nothing's happening yet + + + + + Thread is reading the HTTP Request + + + + + AutoTamperRequest pass 1 (IAutoTamper, OnBeforeRequest script method) + + + + + User can tamper using Fiddler Inspectors + + + + + AutoTamperRequest pass 2 (Only used by IAutoTamper) + + + + + Thread is sending the Request to the server + + + + + Thread is reading the HTTP Response + + + + + AutoTamperResponse pass 1 (Only used by IAutoTamper) + + + + + User can tamper using Fiddler Inspectors + + + + + AutoTamperResponse pass 2 (Only used by IAutoTamper) + + + + + Sending response to client application + + + + + Session complete + + + + + Session was aborted (client didn't want response, fatal error, etc) + + + + + This enumeration provides the values for the Session object's BitFlags field + + + + + No flags are set + + + + + The request originally arrived with a URL specifying the HTTPS protocol. + + + + + The request originally arrived with a URL specifying the FTP protocol. + + + + + Ignore this traffic; do not buffer, store, or call event handlers + + + + + The client pipe was reused + + + + + The server pipe was reused + + + + + The request was transmitted to the server when its headers were complete + + + + + The response was streamed + + + + + The request was generated by Fiddler itself (e.g. the Composer tab) + + + + + The response was generated by Fiddler itself (e.g. AutoResponder or utilCreateResponseAndBypassServer) + + + + + This session was loaded from a .SAZ File + + + + + This session was loaded from some other tool + + + + + This request was sent to an upstream (CERN) gateway proxy + + + + + This is a "blind" CONNECT tunnel for HTTPS traffic + + + + + This is a CONNECT tunnel which decrypts HTTPS traffic as it flows through + + + + + This response was served from a client cache, bypassing Fiddler. Fiddler only "sees" this session because other software reported it to Fiddler + + + + + There was a HTTP Protocol violation in the client's request + + + + + There was a HTTP Protocol violation in the server's response + + + + + Response body was dropped, e.g due to fiddler.network.streaming.ForgetStreamedData or log-drop-response-body flag + + + + + This is a CONNECT tunnel for WebSocket traffic + + + + + This request was sent using the SOCKS protocol + + + + + Request body was dropped, e.g due to log-drop-request-body flag + + + + + The request was to create a RPC tunnel (e.g. on an RPC_OUT_DATA request) + + + + + A SessionTimers object holds timing information about a single Session. + + + + + Log a Read's size and timestamp + + Number of milliseconds since first calling .Read() + Number of bytes returned in this read + + + + Return the ReadTimings as an array. Only one read is counted per millisecond + + + + + + Create a new List and append to it + + + + + + + The time at which the client's HTTP connection to Fiddler was established + + + + + The time at which the request's first Send() to Fiddler completes + + + + + The time at which the request headers were received + + + + + The time at which the request to Fiddler completes (aka RequestLastWrite) + + + + + The time at which the server connection has been established + + + + + The time at which Fiddler begins sending the HTTP request to the server (FiddlerRequestFirstSend) + + + + + The time at which Fiddler has completed sending the HTTP request to the server (FiddlerRequestLastSend). + BUG: Should be named "FiddlerEndRequest". + NOTE: Value here is often misleading due to buffering inside WinSock's send() call. + + + + + The time at which Fiddler receives the first byte of the server's response (ServerResponseFirstRead) + + + + + The time at which Fiddler received the server's headers + + + + + The time at which Fiddler has completed receipt of the server's response (ServerResponseLastRead) + + + + + The time at which Fiddler has begun sending the Response to the client (ClientResponseFirstSend) + + + + + The time at which Fiddler has completed sending the Response to the client (ClientResponseLastSend) + + + + + The number of milliseconds spent determining which gateway should be used to handle this request + (Should be mutually exclusive to DNSTime!=0) + + + + + The number of milliseconds spent waiting for DNS + + + + + The number of milliseconds spent waiting for the server TCP/IP connection establishment + + + + + The number of milliseconds elapsed while performing the HTTPS handshake with the server + + + + + Override of ToString shows timer info in a fancy format + + Timing information as a string + + + + Override of ToString shows timer info in a fancy format + + TRUE if the result can contain linebreaks; false if comma-delimited format preferred + Timing information as a string + + + + Enables High-Resolution timers, which are bad for battery-life but good for the accuracy of timestamps. + See http://technet.microsoft.com/en-us/sysinternals/bb897568 for the ClockRes utility that shows current clock resolution. + NB: Exiting Fiddler reverts this to the default value. + + + + + URLMon Interop Class + + + + + Set the user-agent string for the current process + + New UA string + + + + Query WinINET for the current process' proxy settings. Oddly, there's no way to UrlMkGetSessionOption for the current proxy. + + String of hex suitable for display + + + + Configures the current process to use the system proxy for URLMon/WinINET traffic. + + + + + Configures the current process to use no Proxy for URLMon/WinINET traffic. + + + + + Sets the proxy for the current process to the specified list. See http://msdn.microsoft.com/en-us/library/aa383996(VS.85).aspx + + e.g. "127.0.0.1:8888" or "http=insecProxy:80;https=secProxy:444" + Semi-colon delimted list of hosts to bypass proxy; use <local> to bypass for Intranet + + + + Holds a variety of useful functions used in Fiddler and its addons. + + + + + Create a Session Archive Zip file containing the specified sessions + + The filename of the SAZ file to store + Array of sessions to store + Password to encrypt the file with, or null + TRUE if verbose error dialogs should be shown. + + + + + This is a refactored helper function which writes a single session to an open SAZ file. + + The session to write to the file + The ZIP File + The number of this file + The format string (e.g. "D3") to use when formatting the file number + The HTML String builder to write index information + TRUE to show verbose error dialog information + + + + Reads a Session Archive Zip file into an array of Session objects + + Filename to load + + Loaded array of sessions or null, in case of failure + + + + Reads a Session Archive Zip file into an array of Session objects + + Filename to load + + Loaded array of sessions or null, in case of failure + + + + Ensures a value is within a specified range. + + Type of the value + Current value + Min value + Max value + Returns the provided value, unless it is outside of the specified range, in which case the nearest "fencepost" is returned. + + + + A static byte array containing 0 elements. Use to avoid having many copies of an empty byte[] floating around. + + + + + Queries the user for a filename + + Dialog title + String representing file dialog filter + Filename or null + + + + Queries the user for a filename + + Dialog title + String representing file dialog filter + Initial directory or null + Filename or null + + + + Adds a place to a FileDialog's "Places" collection. + Includes error handling for internal .NET Framework bug. + + Note: CustomPlaces requires SP2 of .NET Framework v2. Attempting to call this method will throw System.MissingMethodException + if the required service pack is not installed. + + + + + + + Queries the user for an OPEN filename + + Dialog title + String representing file dialog filter (e.g. "All files (*.*)|*.*") + Filename or null + + + + Queries the user for an OPEN filename + + Dialog title + String representing file dialog filter + Initial directory or null + Filename or null + + + + Check to see that the target assembly defines a RequiredVersionAttribute and that the current Fiddler instance meets that requirement + + The assembly to test + The "type" of extension for display in error message + TRUE if the assembly includes a requirement and Fiddler meets it. + + + + Typically, a version number is displayed as "major number.minor number.build number.private part number". + + Version required + Version of the binary being tested + Returns 0 if exact match, else greater than 0 if Required version greater than verTest + + + + Address the problem where the target "PATH" calls for a directoryname is already a filename + + + + + + + Ensure that the target file does not yet exist. If it does, generates a new filename with an embedded identifier, e.g. out[1].txt instead. + Attempts to ensure filename is creatable; e.g. if a path component needs to be a directory but is a file already, injects [#] into that + path component. + + Candidate filename + New filename which does not yet exist + + + + Ensure that the target path exists and if a file exists there, it is not readonly or hidden. + WARNING: Can throw if target "Filename" calls for a parent directoryname that is already used as a filename by a non-directory. + E.g. EnsureOverwriteable(C:\io.sys\filename.txt); would throw. + + The candidate filename + + + + Writes arrBytes to a file, creating the target directory and overwriting if the file exists. + + Path to File to write. + Bytes to write. + + + + Fills an array completely using the provided stream. Unlike a normal .Read(), this one will always fully fill the array unless the Stream throws. + + The stream from which to read. + The byte array into which the data should be stored. + The count of bytes read. + + + + Create a new byte[] containing the contents of two other byte arrays. + + + + + + + + Returns the Value from a (case-insensitive) token in the header string. Correctly handles double-quoted strings. + Allows comma and semicolon as delimiter. Trailing whitespace may be present. + + Name of the header + Name of the token + Value of the token if present; otherwise, null + + + + Ensures that the target string is iMaxLength or fewer characters + + The string to trim from + The maximum number of characters to return + Up to iMaxLength characters from the "Head" of the string. + + + + Ensures that the target string is iMaxLength or fewer characters, appending ... if truncation occurred + + The string to trim from + The maximum number of characters to return + The string, or up to iMaxLength-1 characters from the "Head" of the string, with \u2026 appeneded. + + + + Returns the "Head" of a string, before and not including a specified search string. + + The string to trim from + The delimiting string at which the trim should end. + Part of a string up to (but not including) sDelim, or the full string if sDelim was not found. + + + + Returns the "Head" of a string, before and not including the first instance of specified delimiter. + + The string to trim from. + The delimiting character at which the trim should end. + Part of a string up to (but not including) chDelim, or the full string if chDelim was not found. + + + + [Deprecated] Ensures that the target string is iMaxLength or fewer characters + + The string to trim from + The maximum number of characters to return + Identical to the method. + Up to iMaxLength characters from the "Head" of the string. + + + + Returns the "Tail" of a string, after (but NOT including) the First instance of specified delimiter. + See also + + The string to trim from. + The delimiting character after which the text should be returned. + Part of a string after (but not including) chDelim, or the full string if chDelim was not found. + + + + Returns the "Tail" of a string, after (but NOT including) the First instance of specified search string. + + + The string to trim from. + The delimiting string after which the text should be returned. + Part of a string after (but not including) sDelim, or the full string if sDelim was not found. + + + + Returns the "Tail" of a string, after (and including) the first instance of specified search string. + + The string to trim from. + The delimiting string at which the text should be returned. + Part of the string starting with sDelim, or the entire string if sDelim not found. + + + + Returns the "Tail" of a string, after (but not including) the Last instance of specified delimiter. + + + The string to trim from. + The delimiting character after which text should be returned. + Part of a string after (but not including) the final chDelim, or the full string if chDelim was not found. + + + + Returns the "Tail" of a string, after (but not including) the Last instance of specified substring. + + + The string to trim from. + The delimiting string after which text should be returned. + Part of a string after (but not including) the final sDelim, or the full string if sDelim was not found. + + + + Strip any IPv6-Literal brackets, needed when creating a Certificate + + + + + + + Determines true if a request with the specified HTTP Method/Verb MUST contain a entity body + + The Method/Verb + TRUE if the HTTP Method MUST contain a request body. + + + + http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-4.2.2 + + HTTPMethod + TRUE if the method is deemed idempotent + + + + Returns true if a request with the specified HTTP Method/Verb may contain a entity body + + The Method/Verb + TRUE if the HTTP Method MAY contain a request body. + + + + Detects whether string ends in a file extension generally recognized as an image file extension. + Pass lowercase into this function. + + *Lowercase* string + TRUE if string ends with common image file extension + + + + Determines if the specified MIME type is "binary" in nature. + + The MIME type + TRUE if the MIME type is likely binary in nature + + + + Gets a string from a byte-array, stripping a Byte Order Marker preamble if present. + + + This function really shouldn't need to exist. Why doesn't calling .GetString on a string with a preamble remove the preamble??? + + The byte array + The encoding to convert from *if* there's no Byte-order-marker + The string + + + + WARNING: May throw. + Gets an encoding, with proper respect for "utf8" as an alias for "utf-8"; Microsoft products don't support + this prior to 2015-era, but it turns out to be common. We do have a linter elsewhere that reports a warning + if it sees the dashless form. + https://github.com/telerik/fiddler/issues/38 + + Textual name of the encoding + + + + WARNING: Potentially slow. + WARNING: Does not decode the HTTP Response body; if compressed, embedded META or _charset_ will not be checked + Gets (via Headers or Sniff) the provided body's text Encoding. If not found, returns CONFIG.oHeaderEncoding (usually UTF-8). + + HTTP Headers, ideally containing a Content-Type header with a charset attribute. + byte[] containing the entity body. + A character encoding, if one could be determined + + + + Gets (via Headers or Sniff) the Response Text Encoding. Returns CONFIG.oHeaderEncoding (usually UTF-8) if unknown. + Perf: May be quite slow; cache the response + + The session + The encoding of the response body + + + + Set of encodings for which we'll attempt to sniff. (List order matters, I think) + + + + + HtmlEncode a string. + In Fiddler itself, this is a simple wrapper for the System.Web.HtmlEncode function. + The .NET3.5/4.0 Client Profile doesn't include System.Web, so we must provide our + own implementation of HtmlEncode for FiddlerCore's use. + + String to encode + String encoded according to the rules of HTML Encoding, or null. + + + + This function accepts a string and an offset into the string. It reads one or more %XX sequences from the + string converting them into a UTF-8 string based on the input text + + + + + + + + Convert the %-encoded string into a string, interpreting %-escape sequences as UTF-8 characters + + %-encoded string + Unencoded string + + + + Replaces System.Web.HttpUtility.UrlPathEncode(str). + + String to encode as a URL Path + Encoded string + + + + Tokenize a string into tokens. Delimits on unquoted whitespace ; quote marks are dropped unless preceded by \ characters. + Some special hackery to allow trailing slash not escape the final character of the entire input, so that: + prefs set fiddler.config.path.vsplugins "F:\users\ericlaw\VSWebTest\" + ...doesn't end up with a trailing quote. + + The string to tokenize + Are single-quotes allowed to as escapes? + An array of strings + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + String containing a pretty-printed array + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + The maximum number of bytes to pretty-print + String containing a pretty-printed array + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + The maximum number of bytes to pretty-print + Show ASCII text at the end of each line + String containing a pretty-printed array + + + + Print an byte array to a hex string. + Slow. + + Byte array + String of hex bytes, or "null"/"empty" if no bytes provided + + + + Create a string in CF_HTML format + + The HTML string + The HTML string wrapped with a CF_HTML prelude + + + + Returns an integer from the registry, or a default. + + The Registry key in which to find the value. + The registry value name. + Default to return if the registry key is missing or cannot be used as an integer + The retrieved integer, or the default. + + + + Save a string to the registry. Correctly handles null Value, saving as String.Empty + + The registry key into which the value will be written. + The name of the value. + The value to write. + + + + Returns an Float from the registry, or a default. + + Registry key in which to find the value. + The value name. + The default float value if the registry key is missing or cannot be used as a float. + Float representing the value, or the default. + + + + Get a bool from the registry + + The RegistryKey + The Value name + The default value + Returns an bool from the registry, or bDefault if the registry key is missing or cannot be used as an bool. + + + + Maps a MIMEType to a file extension. + Pass only the TYPE (e.g. use oResponse.MIMEType), to ensure no charset info in the string. + + The MIME Type + A file extension for the type, or .TXT + + + + Return the content type of a target file, or application/octet-stream if unknown. + + A filename, including the extension + + + + + Determines if we have a complete chunked response body (RFC2616 Section 3.6.1) + + The session object, used for error reporting + The response data stream. Note: We do not touch the POSITION property. + The start of the HTTP body to scan for chunk size info + Returns the start of the final received/partial chunk + End of byte data in stream representing this chunked content, or -1 if error + True, if we've found the complete last chunk, false otherwise. + + + + Takes a byte array and applies HTTP Chunked Transfer Encoding to it + + The byte array to convert + The number of chunks to try to create + The byte array with Chunked Transfer Encoding applied + + + + Removes HTTP chunked encoding from the data in writeData and returns the resulting array. + + Some chunked data + Unchunked data. Throws InvalidDataException on data format errors. + + + + Removes HTTP chunked encoding from the data in writeData and returns the resulting array. + + Array to unchunk + Optional Session (for UI error messages) + TRUE to suppress error messages, FALSE to show alert boxes + Unchunked data. Throws InvalidDataException on data format errors. + + + + Returns TRUE if the Array contains nulls. TODO: Extend to check for other chars which are clearly non-Unicode + + + + + + + Implements a BlockList for "unknown" encodings that the utilDecode* functions cannot handle + + Transfer-Encoding + Content-Encoding + TRUE if any encoding is known to be unsupported + + + + Removes one or more encodings in the proper order to reconstruct the unencoded body. + If removing Transfer-Encoding and Content-Encoding, ALWAYS remove Transfer-Encoding first. + + The list of encodings in the order that they were applied + RFC2616: If multiple encodings have been applied to an entity, the content codings MUST be listed in the order in which they were applied. + Should unchunking be permitted (TRUE for Transfer-Encoding, FALSE for Content-Encoding) + The bytes of the body + + + + Content-Encodings + + + + + + + + + + Remove all encodings from arrBody, based on those specified in the supplied HTTP headers; DOES NOT MODIFY HEADERS. + Throws on errors. + + *Readonly* headers specifying what encodings are applied + In/Out array to be modified + + + + Remove all encodings from arrBody, based on those specified in the supplied HTTP headers; + DOES NOT MODIFY HEADERS. DOES NOT HANDLE UNSUPPORTED ENCODINGS WELL. + Throws on errors. + + *Readonly* headers specifying what encodings are applied + In/Out array to be modified + FALSE to show dialog boxes on errors, TRUE to remain silent + + + + Attempts to remove all Content-Encodings from a HTTP body. May throw if content is malformed. + MODIFIES HEADERS. + + Headers for the body; Content-Encoding and Content-Length will be modified + Reference to the body array + FALSE if error dialog boxes should be shown + TRUE if the body was decoded completely. + + + + Decompress an array compressed using an Zlib DEFLATE stream. Not a HTTP Encoding; it's used internally in the PNG format. + + The array to expand + byte[] of decompressed data + + + + GZIPs a byte-array + + Input byte array + byte[] containing a gzip-compressed copy of writeData[] + + + + GZIP-Expand function which shows no UI and will throw on error + + TRUE if you want to use Xceed to decompress; false if you want to use System.IO + byte[] to decompress + A decompressed byte array, or byte[0]. Throws on errors. + + + + Expands a GZIP-compressed byte array + + The array to decompress + byte[] containing an un-gzipped copy of compressedData[] + + + + Compress a byte array using RFC1951 DEFLATE + + Array to compress + byte[] containing a DEFLATE'd copy of writeData[] + + + + UnDeflate function which shows no UI and will throw on error + + TRUE if you want to use Xceed to decompress; false if you want to use System.IO + byte[] to decompress + A decompressed byte array, or byte[0]. Throws on errors. + + + + Decompress a byte array that was compressed using Microsoft's Xpress Raw format. + Available only on Windows 8+ + + Array to decompress + byte[] of decompressed data + + + + Decompress a byte array that was compressed using RFC1951 DEFLATE + + Array to decompress + byte[] of decompressed data + + + + Compress a byte[] using the bzip2 algorithm + + Array to compress + byte[] of data compressed using bzip2 + + + + Decompress an array compressed using bzip2 + + The array to expand + byte[] of decompressed data + + + + Decompress an array compressed using bzip2 + + The array to expand + byte[] of decompressed data + + + + Try parsing the string for a Hex-formatted int. If it fails, return false and 0 in iOutput. + + The hex number + The int value + TRUE if the parsing succeeded + + + + Returns TRUE if two ORIGIN (scheme+host+port) values are functionally equivalent. + + The first ORIGIN + The second ORIGIN + The default port, if a port is not specified + TRUE if the two origins are equivalent + + + + This function cracks a sHostPort string to determine if the address + refers to a "local" site + + The string to evaluate, potentially containing a port + True if the address is local + + + + This function cracks a sHostPort string to determine if the address + refers to the local computer + + The string to evaluate, potentially containing a port + True if the address is 127.0.0.1, 'localhost', or ::1 + + + + Determines if the specified Hostname is a either 'localhost' or an IPv4 or IPv6 loopback literal + + Hostname (no port) + TRUE if the hostname is equivalent to localhost + + + + This function cracks the Hostname/Port combo, removing IPV6 brackets if needed + + Hostname/port combo, like www.foo.com or www.example.com:8888 or [::1]:80 + The hostname, minus any IPv6 literal brackets, if present + Port #, 80 if not specified, -1 if corrupt + + + + Given a string/list in the form HOSTNAME:PORT#;HOSTNAME2:PORT2#, this function returns the FIRST IPEndPoint. Defaults to port 80 if not specified. + Warning: DNS resolution is slow, so use this function wisely. + + HOSTNAME:PORT#;OPTHOST2:PORT2# + An IPEndPoint or null + + + + Given a string/list in the form HOSTNAME:PORT#;HOSTNAME2:PORT2#, this function returns all IPEndPoints for ALL listed hosts. Defaults to port 80 if not specified. + Warning: DNS resolution is slow, so use this function wisely. + + HOSTNAME:PORT#;OPTHOST2:PORT2# + An array of IPEndPoints or null if no results were obtained + + + + This function attempts to be a ~fast~ way to return an IP from a hoststring that contains an IPv4/6-Literal. + + Hostname + IPAddress, or null, if the sHost wasn't an IP-Literal + + + + Launch the user's browser to a hyperlink. This function traps exceptions and notifies the user via UI dialog. + + The URL to ShellExecute. + TRUE if the ShellExecute call succeeded. + + + + Wrapper for Process.Start that shows error messages in the event of failure. + + Fully-qualified filename to execute. + Command line parameters to pass. + TRUE if the execution succeeded. FALSE if the execution failed. An error message will be shown for any error except the user declining UAC. + + + + Run an executable and wait for it to exit, notifying the user of any exceptions. + + Fully-qualified filename of file to execute. + Command-line parameters to pass. + TRUE if the execution succeeded. FALSE if the error message was shown. + + + + Run an executable, wait for it to exit, and return its output as a string. + NOTE: Uses CreateProcess, so you cannot launch applications which require Elevation. + + Fully-qualified filename of file to Execute + Command-line parameters to pass + Exit code returned by the executable + String containing the standard-output of the executable + + + + Copy a string to the clipboard, notifying the user of any exceptions + + The text to copy + TRUE if the copy succeeded + + + + Copy an object to the clipboard, notifying the user of any exceptions + + The object to copy + True if successful + + + + This method prepares a string to be converted into a regular expression by escaping special characters and CONVERTING WILDCARDS. + This method was originally meant for parsing WPAD proxy script strings. + + You typically should use the Static RegEx.Escape method for most purposes, as it doesn't convert "*" into ".*" + + + + + + + + + Determines whether the arrData array STARTS WITH with the supplied arrMagics bytes. Used for Content-Type sniffing. + + The data, or null + The MagicBytes to look for + TRUE if arrData begins with arrMagics + + + + Determines whether the arrData array begins with the supplied sMagics ASCII text. Used for Content-Type sniffing. + + The data, or null + The ASCII text to look for + TRUE if arrData begins with sMagics (encoded as ASCII octets) + + + + Is this HTTPMethod used for RPC-over-HTTPS? + + + + + Determine if a given byte array has the start of a HTTP/1.* 200 response. + Useful primarily to determine if a CONNECT request to a proxy returned success. + + + + + + + Determine if a given byte array has the start of a HTTP/1.* 407 response. + Useful primarily to determine if a CONNECT request to a proxy returned an auth challenge + + + + + + + For a given process name, returns a bool indicating whether this is a known browser process name. + + The Process name (e.g. "abrowser.exe") + Returns true if the process name starts with a common browser process name (e.g. ie, firefox, etc) + + + + Ensure that a given path is absolute, if not, applying the root path. + WARNING: This function only works as well as Path.IsPathRooted, which returns "True" for things like "/NoDriveSpecified/fuzzle.txt" + A better approach would be to look at the internal Path.IsRelative method + + + + + + + + If sFilename is absolute, returns it, otherwise, combines the leaf filename with local response folders hunting for a match. + Trims at the first ? character, if any + + Either a fully-qualified path, or a leaf filename + File path + + + + Get a TickCount (milliseconds since system start) as an unsigned 64bit value. On Windows Vista+, uses the GetTickCount64 API that + won't rollover, but on any other platform, this unsigned wrapper moves the rollover point to 49 days of uptime. + + Number of ms since the system started + + + + Returns a succinct version of Environment.OSVersion.VersionString + + + + + + Returns TRUE on *Windows* (not Mono) when OS Version is Win8+ (NT6.2+) + + + + + + Turns a string into a SslProtocol Flags enum. Ignores our magic <client> token. + + e.g. tls1.0;ssl3.0 + + + + + Duplicate a byte array, replacing null with byte[0]. + Doing this instead of .Clone() because it better handles nulls and it may be faster. + + The array to copy + The new array. + + + + Warning: This will throw if FIPS mode is enabled + + + + + + + Returns TRUE if the array is null or contains 0 bytes + + byte[] to test + + + + + Returns TRUE if the string is non-empty and not of the pattern "[#123]" + Necessary because SAZ-saving logic autogenerates comments of that form + + + + + + + + + + True if ClientChatter is non-null and its headers are non-null + + + + True if ClientChatter is non-null and its headers are non-null + + + True if ClientChatter is non-null and its headers are non-null + + + + Return a multi-line string describing the NetworkInterfaces[] + + + + + + Checks a DLL's filename for signals that it doesn't contain extensions. + This hack is only needed because I wasn't smart enough to require that the assembly be named something like Fiddler.* in the original design. + + DLL filename + TRUE if we should skip this assembly during enumeration + + + + Garbage collect and, if possible, compact the Large Object heap + + + + + Common functions we'll want to use on Strings. Fiddler makes extensive use of strings which + should be interpreted in a case-insensitive manner. + + WARNING: Methods assume that the calling object is not null, which is lame for reliability but arguably good for performance. + + + + + The WebSocket class represents a "tunnel" through which WebSocket messages flow. + The class' messages may be deserialized from a SAZ file. + + + + + Should this WebSocket Tunnel parse the WS traffic within into individual messages? + + + + + Is this WebSocket open/connected? + + + + + Writes all of the messages stored in this WebSocket to a stream. + + + + + + + Approximate size of the data of the stored messages, used for memory tracking + + + + + + Read headers from the stream. + + The Stream from which WebSocketSerializationHeaders should be read + The Array of headers, or String[0] + + + + Boolean that determines whether the WebSocket tunnel tracks messages. + + + + + Number of bytes received from the client + + + + + Number of bytes received from the server + + + + + Returns number of bytes sent from the Server to the Client on this WebSocket + + + + + Returns number of bytes sent from the Client to the Server on this WebSocket + + + + + Creates a "detached" WebSocket which contains messages loaded from the specified stream + + Session to which the WebSocket messages belong + The Stream containing messages, which will be closed upon completion + + + + This factory method creates a new WebSocket Tunnel and executes it on a background (non-pooled) thread. + + The Session containing the HTTP CONNECT request + + + + Creates a WebSocket tunnel. External callers instead use the CreateTunnel static method. + + The session for which this tunnel was initially created. + The client pipe + The server pipe + + + + This function keeps the Tunnel/Thread alive until it is signaled that the traffic is complete + + + + + Performs cleanup of the WebSocket instance. Call this after the WebSocket closes normally or after abort/exceptions. + + + + + Executes the WebSocket tunnel on a background thread + + + + + Interface Method + Close the WebSocket and signal the event to let its service thread die. Also called by oSession.Abort() + WARNING: This should not be allowed to throw any exceptions, because it will do so on threads that don't + catch them, and this will kill the application. + + + + + When we get a buffer from the client, we push it into the memory stream + + + + + When we get a buffer from the server, we push it into the memory stream + + + + + This method parses the data in strmClientBytes to extact one or more WebSocket messages. It then sends each message + through the pipeline. + + + + This method parses the data in strmServerBytes to extact one or more WebSocket messages. It then sends each message + through the pipeline to the client. + + + + Called when we have received data from the local client. + + The result of the asynchronous operation. + + + Called when we have received data from the remote host. Incoming data will immediately be forwarded to the local client. + The result of the asynchronous operation. + + + + This enumeration provides the values for the WebSocketMessage object's BitFlags field + + + + + No flags are set + + + + + Message was eaten ("dropped") by Fiddler + + + + + Message was generated ("injected") by Fiddler itself + + + + + Fragmented Message was reassembled by Fiddler + + + + + Breakpointed + + + + + A WebSocketMessage stores a single frame of a single WebSocket message + http://tools.ietf.org/html/rfc6455 + + + + + 3 bits frame-rsv1,frame-rsv2,frame-rsv3 + + + + + Unmasks the first array into the third, using the second as a masking key. + + + + + + + + Masks the first array's data using the key in the second + + The data to be masked + A 4-byte obfuscation key, or null. + + + + Replaces the WebSocketMessage's payload with the specified string, masking if needed. + + + + + + Copies the provided byte array over the WebSocketMessage's payload, masking if needed. + + + + + + Masks the provided array (if necessary) and assigns it to the WebSocketMessage's payload. + + New array of data + + + + Return the WebSocketMessage's payload as a string. + + + + + + Copy the WebSocketMessage's payload into a new Byte Array. + + A new byte array containing the (unmasked) payload. + + + + Is this a Request message? + + + + + The WebSocketTimers collection tracks the timestamps for this message + + + + + The raw payload data, which may be masked. + + + + + The four-byte payload masking key, if any + + + + + The type of the WebSocket Message's frame + + + + + Serialize this message to a stream + + + + + + Add the content of the subequent continuation to me. + + + + + + Timers + + + + + When was this message read from the sender + + + + + When did transmission of this message to the recipient begin + + + + + When did transmission of this message to the recipient end + + + + + Return the timers formatted to be placed in pseudo-headers used in saving the WebSocketMessage to a stream (SAZ). + NOTE: TRAILING \r\n is critical. + + + + + + The AutoProxy class is used to handle upstream gateways when the client was configured to use WPAD or a Proxy AutoConfig (PAC) script. + + + + + Indication as to whether AutoProxy information is valid. 0=Unknown/Enabled; 1=Valid/Enabled; -1=Invalid/Disabled + + + + + Get the text of the file located at a specified file URI, or null if the URI is non-file or the file is not found. + + + + + Returns a string containing the currently selected autoproxy options + + + + + + Get WPAD-discovered URL for display purposes (e.g. Help> About); note that we don't actually use this when determining the gateway, + instead relying on the this.autoProxy.TryGetProxyForUrl method to do this work for us. + + A WPAD url, if found, or String.Empty + + + + Return gateway endpoint for requested Url. TODO: Add caching layer on our side? TODO: Support multiple results? + + The URL for which the gateway should be determined + The Endpoint of the Gateway, or null + TRUE if WinHttpGetProxyForUrl succeeded + + + + Dispose AutoProxy. + + + + + Wrapper for WinINET cache APIs. + + + + + Clear all HTTP Cookies from the WinINET Cache + + + + + Clear all files from the WinINET Cache + + + + + Delete all permanent WinINET cookies for sHost; won't clear memory-only session cookies. Supports hostnames with an optional leading wildcard, e.g. *example.com. NOTE: Will not work on VistaIE Protected Mode cookies. + + The hostname whose cookies should be cleared + + + + Clear the Cache items. Note: May be synchronous, may be asynchronous. + + TRUE if cache files should be cleared + TRUE if cookies should be cleared + + + + Writes the ContentTypes XML to the ZIP so Packaging APIs can read it. + See http://en.wikipedia.org/wiki/Open_Packaging_Conventions + + + + + + Implement this interface to handle upstream gateways when the client is configured to use WPAD or a Proxy AutoConfig (PAC) script. + + + + + Outs the for the requested . + + The URL for which the should be determined. + One or more of the following strings separated by semicolons. + ([<scheme>=][<scheme>"://"]<server>[":"<port>]) + If the method fails this parameter should contain the error message, null otherwise. + True if the method succeeds, false otherwise. + + + + Outs WPAD-discovered URL of the Proxy Auto-Config file. + + The Proxy Auto-Config URL. + True if the method succeeds, false otherwise. + + + + Implement this interface in order to provide FiddlerCore with platform specific functionality. + + + + + Map a local port number to the originating process ID. + + The port number. + true to include processes using IPv6 addresses in the mapping. + Contains the originating process ID if the operation is successful. + Contains an error message if the operation fails. + true if the operation is successful, false otherwise. + + + + Gets any process' name and ID which listens on a port. + + The port number. + Contains the process name of a process if there is one listening on the port, otherwise contains an empty string. + Contains the process ID of a process if there is one listening on the port, otherwise contains 0. + Contains an error message if the operation fails. + true if the operation is successful, false otherwise. + + + + Changes system-wide timer's resolution. + + true to increase the resolution for better accuracy of timestamps, false to decrease it to the default value for the system. + true if the operation is successful, false otherwise. + + + + Returns true if the system-wide timer's resolution is increased, false otherwise. + + + + + Gets a proxy helper, which can be used to manipulate proxy settings. + + + + + This event is raised when a debug message is being spewed. + + + + + This event is raised when an error has occured. + + + + + This event is raised when a message is being logged. + + + + + Decompresses a byte[] that is compressed with XPRESS. + + The compressed byte[]. + The decompressed byte[]. + + + + This method is used to post-process the name of a process, in order to resolve it more accurately. + + The ID of the process, whose name should be post-processed. + The process name that should be post-processed. + The post-processed process name. + + + + This method is used to set the user-agent string for the current process. + + The user-agent string. + + + + This method is used to get the number of milliseconds since the system start. + + Contains the system uptime in milliseconds if the operation is successful. + true if the operation is successful, false otherwise. + + + + Creates . + + True if the must use the WPAD protocol, false otherwise. + URL of the Proxy Auto-Config file. Can be null. + True if the WPAD processing should be done in the current process, false otherwise. + Specifies whether the client's domain credentials should be automatically sent + in response to an NTLM or Negotiate Authentication challenge when the requests the PAC file. + + + + + Implement this interface in order to implement a factory, which is used to create objects. + + + + + Creates new object. + + The platform extensions object. + + + + Implement this interface, in order to provide FiddlerCore with platform-specific proxy helper. + This interface contains members used to manipulate proxy settings. + + + + + Configures the current process to use no proxy. + + + + + Returns the current process' proxy settings. + + String containing a HEX view of the current process' proxy settings. + + + + Configures current process' proxy settings to default. + + + + + Configures current process' proxy settings. + + The proxy information (IP and port). It can be per connection type + (e.g. http=127.0.0.1:8080;https=127.0.0.1:444) or global (e.g. 127.0.0.1:8888). + Semi-colon delimted list of hosts to bypass proxy + (e.g. www.google.com;www.microsoft.com) + + + + Implement this interface in order to provide FiddlerCore with Windows-specific functionality. + + + + + Gets a WinINet helper, which can be used to access WinINet native API. + + + + + Implement this interface in order to provide FiddlerCore with access to native WinINet API. + + + + + Clears WinINet's cache. + + true if cache files should be cleared, false otherwise. + true if cookies should be cleared, false otherwise. + + + + Delete all permanent WinINet cookies for a . + + The hostname whose cookies should be cleared. + + + + Use this method in order to get cache information for a . + + The URL for which the cache info is requested. + String, containing cache information for the given . + + + + This class is used to pass a simple string message to a event handler. + + + + + Creates and initializes new instance of the . + + The message. + + + + Gets the message. + + + + + Given a local port number, uses GetExtendedTcpTable to find the originating process ID. + First checks the IPv4 connections, then looks at IPv6 connections. + + Client applications' port + ProcessID, or 0 if not found + + + + Calls the GetExtendedTcpTable function to map a port to a process ID. + This function is (over) optimized for performance. + + Client port + AF_INET or AF_INET6 + PID, if found, or 0 + + + + Enumeration of possible queries that can be issued using GetExtendedTcpTable + http://msdn2.microsoft.com/en-us/library/aa366386.aspx + + + + + Processes listening on Ports + + + + + Processes with active TCP/IP connections + + + + + Outs WPAD-discovered URL for display purposes (e.g. Help> About); note that we don't actually use this when determining the gateway, + instead relying on the WinHTTPGetProxyForUrl function to do this work for us. + + A WPAD url, if found, or String.Empty + + + + Note: Be sure to use the same hSession to prevent redownload of the proxy script + + + + + Set to true to send Negotiate creds when challenged to download the script + + + + + For PInvoke: Contains information about an entry in the Internet cache + + + + + Requires Win8+ + Decompress Xpress|Raw blocks used by WSUS, etc. + Introduction to the API is at http://msdn.microsoft.com/en-us/library/windows/desktop/hh920921(v=vs.85).aspx + + + + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + String containing a pretty-printed array + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + The maximum number of bytes to pretty-print + String containing a pretty-printed array + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + The maximum number of bytes to pretty-print + Show ASCII text at the end of each line + String containing a pretty-printed array + + + + Returns the "Tail" of a string, after (but not including) the Last instance of specified delimiter. + + + The string to trim from. + The delimiting character after which text should be returned. + Part of a string after (but not including) the final chDelim, or the full string if chDelim was not found. + + + + Format an Exception message, including InnerException message if present. + + + + + + + How long should we wait for parallel creations + + + + + "SHA256WITHRSA", "SHA384WITHRSA", "SHA512WITHRSA", "MD5WITHRSA", etc + + + + + Cache of EndEntity certificates that have been generated in this session. + + + + + The ReaderWriter lock gates access to the certCache + + + + + Queue of creations in progress, indexed by certificate CN. + ManualResetEvent info: http://msdn.microsoft.com/en-us/library/ksb7zs2x(v=vs.95).aspx + + + + + The ReaderWriter lock gates access to the Queue which ensures we only have one Certificate-Generating-per-Host + + + + + The BouncyCastle Root certificate + + + + + The BouncyCastle Root Private key + + + + + The EE Certificate Public/Private key that we'll reuse for all EE certificates if the + preference fiddler.certmaker.bc.ReusePrivateKeys is set. + + + + + Object we use to lock on when updating oEEKeyPair + + + + + Object we use to lock on when updating oCACert / OCAKey + + + + + Should Fiddler automatically generate wildcard certificates? + + + + + TLDs for which should Fiddler generate wildcarded 3rd-level-domain certs + + + + + Length for the Public/Private Key used in the EE certificate + + + + + Length for the Public/Private Key used in the Root certificate + + + + + Should verbose logging information be emitted? + + + + + Controls whether we use the same Public/Private keypair for all Server Certificates (improves perf) + + + + + Controls whether we use the same Public/Private keypair for the root AND all Server Certificates (improves perf) + + + + + Get the base name for the KeyContainer into which the private key goes. If EE Keys are being reused, then we use only + this ID. + + + + + + Returns the Subject O field. Note that Fiddler's normal root uses "DO_NOT_TRUST" rather than "DO_NOT_TRUST_BC". + + + + + + Flush EE certificates to force regeneration + + + + + Free the KeyContainer that contains this private key. + Avoids pollution of %USERPROFILE%\appdata\roaming\microsoft\crypto\ with orphaned keys + + + + + + + + + FindByIssuer{Distinguished}Name requires a complete match of the SUBJECT, including CN, O, and OU + + + + + Converts from a BouncyCastle Certificate object into a .NET X509Certificate2 object + + A BouncyCastle X509Certificate + The .NET X509Certificate2 + + + + Converts a BouncyCastle PrivateKey object into a .NET-compatible object + + + + + + + Copy BC cert to Windows Certificate Storage, without key. THROWS on Errors + + + + + + + + + Generates a new EE Certificate using the given CA Certificate to sign it. Throws on Crypto Exceptions. + + + + + + + + + Generates (or retrieves from cache) a Public/Private keypair to attach to an EE Certificate + + The CN for the certificate being generated (used for Logging only) + A KeyPair + + + + Called to make a new cert. + + + + + + + Waits on the provided event until it is signaled, then returns the contents of the Cert Cache for the specified sHostname + + The hostname of a Certificate which is pending creation + The event which will be signaled when the cert is ready (max wait is 15 seconds) + The Certificate (or possibly null) + + + + Signals anyone waiting that the certificate desired is now available. + + Hostname of the target certificate + + + + Ensure that the Root Certificate exists, loading or generating it if necessary. + Throws if the root could not be ensured. + + + + + Finds cert, uses Reader lock. + + + + + + + Store a generated Root Certificate and PrivateKey in Preferences. + + + + + Load a previously-generated Root Certificate and PrivateKey from Preferences. + + + + + + Copies the Root certificate into the Current User's Root store. This will show a prompt even if run at Admin. + + + + + + Clears the in-memory caches including the Root Certificate. + + + + This method does not delete the private keys of the certificates. + + + In order to delete them, please cast this instance to + and get a copy of the cache by using the property. + + + TRUE if successful + + + + Clears the in-memory caches. + + + + This method does not delete the private keys of the certificates. + + + In order to delete them, please cast this instance to + and get a copy of the cache by using the property. + + + TRUE to clear the Root Certificate from the cache. + TRUE if successful + + + + Reads the root certificate and its private key from a PKCS#12 formated stream. + + The PKCS#12 formated stream. + The password which is used to protect the private key. Could be null or empty if the private key is not protected. + The alias for the certificate and the private key. If null, the first alias found (if any) will be used. + + + + Writes the root certificate and its private key to a PKCS#12 stream. + + The PKCS#12 stream. + The password which is used to protect the private key. If null or empty, the private key is written unprotected. + The alias for the certificate and the private key. If null, a random alias will be created. + + + + Writes the root certificate without the private key to a stream using DER encoding. + + The stream. + + + + Reads the root certificate and its private key from the PKCS#12 file (.pfx | .p12). + + The filename of the PKCS#12 file (.pfx | .p12) + The password which is used to protect the private key. + The alias for the certificate and the private key. If null, the first alias in the pkcs12 will be used. + + + + Writes the root certificate and its private key to a PKCS#12 file (.pfx | .p12). + + The filename of the PKCS#12 file (.pfx | .p12). + The password which is used to protect the private key. + The alias for the certificate and the private key. If null, a random alias will be created. + + + + Writes the root certificate without the private key to a DER encoded file(.cer | .crt | .der). + + The filename of the DER encoded file (.cer | .crt | .der) + + + + Dispose by clearing all of the EE Certificates' private keys, preventing pollution of the user's \Microsoft\Crypto\RSA\ folder. + + + + + Dimensions in pixels. + + + + + Creates a new object to store dimensions. + + The width in pixels. + The height in pixels. + + + + Gets the width in pixels. + + + + + Gets the height in pixels. + + + + + Class to construct product related information for a Google Analytics hit. Use this class to report information about products sold by merchants or impressions of products seen by users. Instances of this class can be associated with both s via addProduct(Product) and Product Impressions via addImpression(Product, String). + + + + + Creates a new instance of the class. + + + + + Gets or sets the brand associated with the product in GA reports. + + + + + Gets or sets the category associated with the product in GA reports. + + + + + Gets or sets the coupon code associated with the product. + + + + + Gets or sets the custom dimensions associated with the product. + + + + + Gets or sets the custom metrics associated with the product. + + + + + Gets or sets the id that is used to identify a product in GA reports. + + + + + Gets or sets the name that is used to identify the product in GA reports. + + + + + Gets or sets the position of the product on the page/product impression list etc. + + + + + Gets or sets the price of the product. + + + + + Gets or sets the quantity of the product. + + + + + Gets or sets the variant of the product. + + + + + Class to construct transaction/checkout or other product interaction related information for a Google Analytics hit. Use this class to report information about products sold, viewed or refunded. This class is intended to be used with . Instances of this class can be associated with . + + + + + Creates a new instance of with the product action for all the products included in the hit. Valid values include "detail", "click", "add", "remove", "checkout", "checkout_option", "purchase" and "refund". All these values are also defined in this class for ease of use. You also also send additional values with the hit for some specific actions. See the action documentation for details. + + The action type to send. + + + + Gets or sets the product action for all the products included in the hit. + + + + + Gets or sets the label associated with the checkout. This value is used for and actions. + + + + + Gets or sets the checkout processes's progress. This value is used for and actions. + + + + + Gets or sets the list name associated with the products in the analytics hit. This value is used for and actions. + + + + + Gets or sets the list source name associated with the products in the analytics hit. This value is used for and actions. + + + + + Gets or sets the transaction's affiliation value. This value is used for and actions. + + + + + Gets or sets the coupon code used in a transaction. This value is used for and actions. + + + + + The unique id associated with the transaction. This value is used for and actions. + + + + + Gets or sets the transaction's total revenue. This value is used for and actions. + + + + + Gets or sets the transaction's shipping costs. This value is used for and actions. + + + + + Gets or sets the transaction's total tax. This value is used for and actions. + + + + + The product action for all the products included in the hit. + + + + + Action to use when a product is added to the cart. + + + + + Action to use for hits with checkout data. + + + + + Action to be used for supplemental checkout data that needs to be provided after a checkout hit. + + + + + Action to use when the user clicks on a set of products. + + + + + Action to use when the user views detailed descriptions of products. + + + + + Action that is used to report all the transaction data to GA. + + + + + Action to use while reporting refunded transactions to GA. + + + + + Action to use when a product is removed from the cart. + + + + + Class to construct promotion related fields for Google Analytics hits. The fields from this class can be used to represent internal promotions that run within an app, such as banners, banner ads etc. + + + + + Gets or sets the name of the creative associated with the promotion. + + + + + Gets or sets the id that is used to identify a promotion in GA reports. + + + + + Gets or sets the name that is used to identify the promotion in GA reports. + + + + + Gets or sets the position of the promotion. + + + + + The product action for all the products included in the hit. + + + + + Action to use when the user clicks/taps on a promotion. + + + + + Action to use when the user views a promotion. + + + + + Represents a single event to track. + + + + + Gets the key value pairs to send to Google Analytics. + + + + + Gets the timestamp that the event was created. + + + + + Class to build hits. You can add any of the other fields to the builder using common set and get methods. + + + + + Creates an event hit to track events. + + Specifies the event category. Must not be empty. + Specifies the event action. Must not be empty. + Specifies the event label. Optional if null. + Specifies the event value. Values must be non-negative. Optional if zero. + + + + Creates an exception hit to track errors. + + Specifies the description of an exception. + Specifies whether the exception was fatal. + + + + Creates a screen view hit. + + Specifies the 'Screen Name' of the screenview hit. Note: this will not affect subsequent hits. To do this, set the ScreenName property on the instead. + + + + Creates a social networking interaction hit. + + Specifies the social network, for example Facebook or Google Plus. + Specifies the social interaction action. For example on Google Plus when a user clicks the +1 button, the social action is 'plus'. + Specifies the target of a social interaction. This value is typically a URL but can be any text. + + + + Creates a user timing hit to measure app timing and performance. + + Specifies the user timing category. + Specifies the user timing variable. + Specifies the user timing value. + Specifies the user timing label. + + + + Looks up a value by name from the current instance. + + The parameter name to get the value for. + The value associated with the supplied parameter name. + + + + Sets the value for the given parameter name. These values will be added to the hit when it is built. This function should only be used for advanced cases where none of the explicit setters do not work. This function should usually be called after all the explicit setter have been called. + + The parameter name to set the value for. + The value associated with the parameter name. + The builder object that you can use to chain calls. + + + + Adds a set of key, value pairs to the hit builder. These values will be added to the hit when it is built. This function should only be used for advanced cases where none of the explicit setters work. This function should usually be called after all the explicit setter have been called. + + A dictionary of all the values to be added to the builder. + The builder object that you can use to chain calls. + + + + Adds a custom dimension to the current hit builder. Calling this method with the same index will overwrite the previous dimension with the new one. Refer for details on how to set the custom dimensions up. + + The index/slot in which the dimension will be set. + The value of the dimension for the given index. + The builder object that you can use to chain calls. + + + + Adds a custom metric to the current hit builder. Calling this method with the same index will overwrite the previous metric with the new one. Refer for details on how to set the custom metrics up. + + The index/slot in which the metric will be set. + The value of the metric for the given index. + The builder object that you can use to chain calls. + + + + Starts a new session for the hit. + + The builder object that you can use to chain calls. + + + + Indicates that the hit did not involve a user interaction. + + The builder object that you can use to chain calls. + + + + Adds product information to be sent with a given hit. The action provided affects how the products passed in through this method get processed. + + The product you wish to add. + The builder object that you can use to chain calls. + + + + Adds promotion related information to the hit. + + The promotion related to the hit. + The builder object that you can use to chain calls. + + + + Sets a product action for all the products included in this hit. The action and its associated properties affect how the products added through are processed. + + The product action associated with the hit. + The builder object that you can use to chain calls. + + + + Adds an action associated with the promotions in a given hit. + + The action associated with the hit. + The builder object that you can use to chain calls. + + + + Builds a dictionary of parameters and values that can be set on the object. + + The dictionary to send to . + + + + Interface to offer a way to provide all environment and platform level information required by Google Analytics. + + + + + Gets the value that anonymously identifies a particular user, device, or browser instance. For the web, this is generally stored as a first-party cookie with a two-year expiration. For mobile apps, this is randomly generated for each particular instance of an application install. The value of this field should be a random UUID (version 4) as described in . + + + + + Callback that indicates something is about to be logged. + + This allows lazy loading of values that might not be available immediately. + + + + Gets the screen color depth. + + + + + Gets the screen resolution. + + + + + Gets the language (e.g. 'en-us'). + + + + + Gets the Viewport Resolution. + + + + + Gets the User Agent of the browser. This is what Google uses to identify the operating system and device used. + + + + + Raised to indicate that the has changed. + + + + + Raised to indicate that the has changed. + + + + + Interface for a service manager used to send hits to Google Analytics. + + + + + Enqueues the hit so it is sent at the next opportunity. + + Dictionary of hit data to send. + + + + Implements a service manager used to send s to Google Analytics. + + + + + Provides notification that a has been been successfully sent. + + + + + Provides notification that a failed to send. + + Failed s will be added to the queue in order to reattempt at the next dispatch time. + + + + Provides notification that a was malformed and rejected by Google Analytics. + + + + + Instantiates a new instance of . + + A proxy to be used by the manager when dispatching hits. If null, the default IE proxy is used. + + + + Gets or sets whether s should be sent via SSL. Default is true. + + + + + Gets or sets whether s should be sent to the debug endpoint. Default is false. + + + + + Gets or sets whether throttling should be used. Default is false. + + + + + Gets or sets whether data should be sent via POST or GET method. Default is POST. + + + + + Gets or sets whether a cache buster should be applied to all requests. Default is false. + + + + + Gets or sets the user agent request header used by Google Analytics to determine the platform and device generating the hits. + + + + + Gets or sets the frequency at which hits should be sent to the service. Default is immediate. + + Setting to TimeSpan.Zero will cause the hit to get sent immediately. + + + + Gets or sets whether the dispatcher is enabled. If disabled, hits will be queued but not dispatched. + + Typically this is used to indicate whether or not the network is available. + + + + Empties the queue of s waiting to be dispatched. + + If a is actively beeing sent, this will not abort the request. + + + + Dispatches all hits in the queue. + + Returns once all items that were in the queue at the time the method was called have finished being sent. + + + + + + + Suspends operations and flushes the queue. + + Call when returning from a suspended state to resume operations. + Operation returns when all s have been flushed. + + + + Resumes operations after is called. + + + + + Supplies additional information when s fail to send. + + + + + Gets the thrown when the failure occurred. + + + + + Gets the associated with the event. + + + + + Supplies additional information when s are successfully sent. + + + + + Gets the response text. + + + + + Gets the associated with the event. + + + + + Supplies additional information when s are malformed and cannot be sent. + + + + + Gets the HTTP status code that may provide more information about the problem. + + + + + Gets the associated with the event. + + + + + Represents an object capable of tracking events for a single Google Analytics property. + + + + + Instantiates a new instance of . + + the property ID to track to. + the object responsible for receiving hits ready to be sent to the service. + + + + Gets or sets the tracking ID / web property ID. The format is UA-XXXX-Y. All collected data is associated by this ID. + + Required for all hit types. + + + + + Gets or sets whether the IP address of the sender will be anonymized. + + Optional. + + + + + Gets or sets the value that anonymously identifies a particular user, device, or browser instance. For the web, this is generally stored as a first-party cookie with a two-year expiration. For mobile apps, this is randomly generated for each particular instance of an application install. The value of this field should be a random UUID (version 4) as described in . + + Required for all hit types. + + + + + Gets or sets the IP address of the user. This should be a valid IP address in IPv4 or IPv6 format. It will always be anonymized just as though anonymize IP had been used. + + Optional. + + + + + Gets or sets the User Agent of the browser. Note that Google has libraries to identify real user agents. Hand crafting your own agent could break at any time. + + Optional. + + + + + Gets or sets the geographical location of the user. The geographical ID should be a two letter country code or a criteria ID representing a city or region (see http://developers.google.com/analytics/devguides/collection/protocol/v1/geoid). This parameter takes precedent over any location derived from IP address, including the IP Override parameter. An invalid code will result in geographical dimensions to be set to '(not set)'. + + Optional. + + + + + Specifies which referral source brought traffic to a website. This value is also used to compute the traffic source. The format of this value is a URL. + + Optional. + + + + + Gets or sets the screen resolution. + + Optional. + + + + + Gets or sets the viewable area of the browser / device. + + Optional. + + + + + Gets or sets the character set used to encode the page / document. + + Optional. + + + + + Gets or sets the screen color depth. + + Optional. + + + + + Gets or sets the language. + + Optional. + + + + + Gets or sets the hostname from which content was hosted. + + Optional. + + + + + Gets or sets the path portion of the page URL. + + Optional. Should begin with '/'. + + + + + Gets or sets the title of the page / document. + + Optional. + + + + + Gets or sets the 'Screen Name' of the screenview hit. On web properties this will default to the unique URL of the page. + + Required for screenview hit type. Note: This parameter is optional on web properties, and required on mobile properties for screenview hits. + + + + + Gets or sets the application name. This field is required for any hit that has app related data (i.e., app version, app ID, or app installer ID). For hits sent to web properties, this field is optional. + + Optional. + + + + + Gets or sets the application identifier. + + Optional. + + + + + Gets or sets the application version. + + Optional. + + + + + Gets or sets the application installer identifier. + + Optional. + + + + + Gets or sets the parameter that specifies that this user has been exposed to an experiment with the given ID. It should be sent in conjunction with the Experiment Variant parameter. + + Optional. + + + + + Gets or sets the parameter that specifies that this user has been exposed to a particular variation of an experiment. It should be sent in conjunction with the Experiment ID parameter. + + Optional. + + + + + Gets or sets the rate at which s should be excluded for sampling purposes. Default is 100. + + 100 means no items should be excluded, 50 means half should be excluded, and 0 means all items should be excluded. + + + + Gets the model value for the given key added through . + + The key to retrieve the value for. + The value associated with the key. + + + + Sets the model value for the given key. + + The key of the field that needs to be set. It starts with "&" followed by the parameter name. The complete list of fields can be found at . + A string value to be sent to Google servers. A null value denotes that the value should not be sent over wire. + + + + Merges the model values set on this Tracker with params and generates a hit to be sent. + + Dictionary of hit data to values which are merged with the existing values which are already set (using Set(String, String)). Values in this dictionary will override the values set earlier. The values in this dictionary will not be reused for the subsequent hits. If you need to send a value in multiple hits, you can use the Set(String, String) method. + The hit may not be dispatched immediately. + + + + Represents an object capable of tracking events for a single Google Analytics property. + + + + + Instantiates a new instance of . + + the property ID to track to. + An object capable of providing platform and environment specific information. + The object used to send s to the service. + + + + Provides a way to manage multiple instances. + + + + + Instantiates a new instance of . + + An object capable of providing platform and environment specific information. + A proxy to be used by the manager when dispatching hits. If null, the default IE proxy is used. + + + + Gets the collection of instances. + + + + + Gets or sets the default tracker instance for easy access. + + This always returns the last tracker instance created. + + + + Gets or sets whether the app should log information to Google Analtyics. + + See Google Analytics usage guidelines for more information. + + + + Gets a using a given property ID. Will creates a new instance if one does not exist yet. + + The property ID that the should log to. + The new or existing instance keyed on the property ID. + + + + Removes and cleans up a given . + + The instance to remove and clean up. + + + + Gets the instance of used by all instances. + + + + + +
+
diff --git a/packages/FiddlerCore.Trial.5.0.0/lib/netstandard2.0/FiddlerCore.dll b/packages/FiddlerCore.Trial.5.0.0/lib/netstandard2.0/FiddlerCore.dll new file mode 100644 index 0000000..b8293d8 Binary files /dev/null and b/packages/FiddlerCore.Trial.5.0.0/lib/netstandard2.0/FiddlerCore.dll differ diff --git a/packages/FiddlerCore.Trial.5.0.0/lib/netstandard2.0/FiddlerCore.xml b/packages/FiddlerCore.Trial.5.0.0/lib/netstandard2.0/FiddlerCore.xml new file mode 100644 index 0000000..ffc9dc0 --- /dev/null +++ b/packages/FiddlerCore.Trial.5.0.0/lib/netstandard2.0/FiddlerCore.xml @@ -0,0 +1,8694 @@ + + + + FiddlerCore + + + + + A generic builder class for . + + + + + + + The FiddlerCoreStartupSettings instance being built. + + + + + Reference to this. Return this field instead of (T)this in your methods in order to avoid multiple casting. + + + + + Initializes a new instance of + + The instance of FiddlerCoreStartupSettings which is going to be built. + + + + The port on which the FiddlerCore app will listen on. If 0, a random port will be used. + + The port on which the FiddlerCore app should listen on. + + + + + Registers as the system proxy. + + + + + + Decrypts HTTPS Traffic. + + + + + + Accepts requests from remote computers or devices. WARNING: Security Impact + + + Use caution when allowing Remote Clients to connect. If a hostile computer is able to proxy its traffic through your + FiddlerCore instance, he could circumvent IPSec traffic rules, circumvent intranet firewalls, consume memory on your PC, etc. + + + + + + Forwards requests to any upstream gateway. + + + + + + Sets all connections to use FiddlerCore, otherwise only the Local LAN is pointed to FiddlerCore. + + + + + + Sets connections to use a self-generated PAC File. + + + + + + Passes the <-loopback> token to the proxy exception list. + + + + + + Registers FiddlerCore as the FTP proxy. + + + + + + Calls ThreadPool.SetMinThreads for improved performance. + + + + + + Sets manual upstream gateway. + + The upstream gateway which FiddlerCore will use in the format "address:port | protocol=address:port(;protocol=address:port)*" + + + + + Sets manual upstream gateway with a bypass list. + + The upstream gateway which FiddlerCore will use in the format "address:port | protocol=address:port(;protocol=address:port)*" + List of hosts which should bypass the manually configured upstream gateway. Format: "example.com;*.another-example.com". + + + + + Sets the proxy settings which FiddlerCore uses to find the upstream proxy. + + + + + + + Builds the FiddlerCoreStartupSettings instance. + + The instance of FiddlerCoreStartupSettings. + + + + A generic builder interface for . + + + + + + + The port on which the FiddlerCore app will listen on. If 0, a random port will be used. + + The port on which the FiddlerCore app should listen on. + + + + + Registers as the system proxy. + + + + + + Decrypts HTTPS Traffic. + + + + + + Accepts requests from remote computers or devices. WARNING: Security Impact + + + Use caution when allowing Remote Clients to connect. If a hostile computer is able to proxy its traffic through your + FiddlerCore instance, he could circumvent IPSec traffic rules, circumvent intranet firewalls, consume memory on your PC, etc. + + + + + + Forwards requests to any upstream gateway. + + + + + + Sets all connections to use FiddlerCore, otherwise only the Local LAN is pointed to FiddlerCore. + + + + + + Sets connections to use a self-generated PAC File. + + + + + + Passes the <-loopback> token to the proxy exception list. + + + + + + Registers FiddlerCore as the FTP proxy. + + + + + + Calls ThreadPool.SetMinThreads for improved performance. + + + + + + Sets manual upstream gateway. + + The upstream gateway which FiddlerCore will use in the format "address:port | protocol=address:port(;protocol=address:port)*" + + + + + Sets the proxy settings which FiddlerCore uses to find the upstream proxy. + + + + + + + Sets manual upstream gateway with a bypass list. + + The upstream gateway which FiddlerCore will use in the format "address:port | protocol=address:port(;protocol=address:port)*" + List of hosts which should bypass the manually configured upstream gateway. Format: "example.com;*.another-example.com". + + + + + Builds the FiddlerCoreStartupSettings instance. + + The instance of FiddlerCoreStartupSettings. + + + + Holds startup settings for FiddlerCore. + Use the to build an instance of this class. + Then pass the instance to the method to start FiddlerCore. + + + + + Initializes a new instance of . + + + + + The port on which the FiddlerCore app will listen on. If 0, a random port will be used. + + + + + If set to true, FiddlerCore registers as the system proxy. + + + + + If set to true, FiddlerCore decrypts HTTPS Traffic. + + + + + If set to true, FiddlerCore accepts requests from remote computers or devices. WARNING: Security Impact. + + + Use caution when allowing Remote Clients to connect. If a hostile computer is able to proxy its traffic through your + FiddlerCore instance, he could circumvent IPSec traffic rules, circumvent intranet firewalls, consume memory on your PC, etc. + + + + + If set to true, FiddlerCore forwards requests to any upstream gateway. + + + + + If set to true, FiddlerCore sets all connections to use it, otherwise only the Local LAN is pointed to FiddlerCore. + + + + + If set to true, FiddlerCore sets connections to use a self-generated PAC File. + + + + + If set to true, FiddlerCore passes the <-loopback> token to the proxy exception list. + + + + + If set to true, FiddlerCore registers as the FTP proxy. + + + + + If set to true, FiddlerCore calls ThreadPool.SetMinThreads to improve performance. + + + + + The upstream gateway which FiddlerCore will use in the format "address:port | protocol=address:port(;protocol=address:port)*". + + + + + The proxy settings which FiddlerCore uses to find the upstream proxy. + + + + + List of hosts which should bypass the manually configured upstream gateway. Format: "example.com;*.another-example.com". + + + + + A builder class for . + + + + + Initializes a new instance of + + + + + ISessionImport allows loading of password-protected Session data + + + + + Import Sessions from a password-protected data source + + Shortname of the format + Dictionary of options that the Importer class may use + Callback event on which progress is reported or the host may cancel + Callback that is used to request passwords from the host + Array of Session objects imported from source + + + + The class that is used to store MIME-type-to-file-extension mapping. + + + + + Gets or sets the MIME type for this mapping. The provided MIME type should be in the format "top-level type name / subtype name" + and should not include the parameters section of the MIME type. E.g. application/json, text/html, image/gif etc. This property + should not be null, empty string or string containing only white spaces, in order Telerik FiddlerCore to load it. + + + + + Gets or sets the file extension for this mapping. The provided file extension should start with . (dot). E.g. .txt, .html, .png etc. + This property should not be null, empty string or string containing only white spaces, in order Telerik FiddlerCore to load it. + + + + + This class is used to deserialize and store MIME-type-to-file-extension mappings from given XML file. + + + The XML file should be in the following format: + + + mime/type + .ext + + + + ]]> + + + + + Initializes new instance of with the specified file path. + + A relative or absolute path to the XML file. + + + + Type of Upstream Gateway + + + + + Traffic should be sent directly to the server + + + + + Traffic should be sent to a manually-specified proxy + + + + + Traffic should be sent to the System-configured proxy + + + + + Proxy should be automatically detected + + + + + A simple Process Type enumeration used by various filtering features + + + + + Include all Processes + + + + + Processes which appear to be Web Browsers + + + + + Processes which appear to NOT be Web Browsers + + + + + Include only traffic where Process ID isn't known (e.g. remote clients) + + + + + When may requests be resent on a new connection? + + + + + The request may always be retried. + + + + + The request may never be retried + + + + + The request may only be resent if the HTTP Method is idempotent. + This SHOULD be the default per HTTP spec, but this appears to break tons of servers. + + + + + Dictionary of all Connectoids, indexed by the Connectoid's Name + + + + + Return the configured default connectoid's proxy information. + + Either proxy information from "DefaultLAN" or the user-specified connectoid + + + + Enumerates all of the connectoids and determines if the bIsHooked field is incorrect. If so, correct the value + and return TRUE to indicate that work was done. + + The Proxy:Port string to look for (e.g. Config.FiddlerListenHostPort) + TRUE if any of the connectoids' Hook state was inaccurate. + + + + Updates all (or CONFIG.sHookConnectionNamed-specified) connectoids to point at the argument-provided proxy information. + + The proxy info to set into the Connectoid + TRUE if updating at least one connectoid was successful + + + + Restore original proxy settings for any connectoid we changed. + + FALSE if any connectoids failed to unhook + + + + Map a local port number to the originating process ID + + The local port number + The originating process ID + + + + Returns a string containing the process listening on a given port + + + + + This class is used to find and create certificates for use in HTTPS interception. + The default implementation (DefaultCertProvider object) uses the Windows Certificate store, + but if a plugin ICertificateProvider is provided, it is used instead. + + + + + Enables specification of a delegate certificate provider that generates certificates for HTTPS interception. + + + + + Lock on this object when TestExistenceOf/Create oCertProvider + + + + + Ensures that the Certificate Generator is ready; thread-safe + + + + + Load a delegate Certificate Provider + + The provider, or null + + + + Removes Fiddler-generated certificates from the Windows certificate store + + + + + Removes Fiddler-generated certificates from the Windows certificate store + + Indicates whether Root certificates should also be cleaned up + + + + Returns the Root certificate that Fiddler uses to generate per-site certificates used for HTTPS interception. + + Returns the root certificate, if present, or null if the root certificate does not exist. + + + + Return the raw byte[]s of the root certificate, or null + + + + + + Request a certificate with the specified SubjectCN + + A string of the form: "www.hostname.com" + A certificate or /null/ if the certificate could not be found or created + + + + Pre-cache a Certificate in the Certificate Maker that should be returned in subsequent calls to FindCert + + The hostname for which this certificate should be returned. + The X509Certificate2 with attached Private Key + TRUE if the Certificate Provider succeeded in pre-caching the certificate. FALSE if Provider doesn't support pre-caching. THROWS if supplied Certificate lacks Private Key. + + + + Pre-cache a Certificate in the Certificate Maker that should be returned in subsequent calls to FindCert + + The hostname for which this certificate should be returned. + The filename of the PFX file containing the certificate and private key + The password for the PFX file + Throws if the Certificate Provider failed to pre-cache the certificate + + + + Determine if the self-signed root certificate exists + + True if the Root certificate returned from GetRootCertificate is non-null, False otherwise. + + + + Is Fiddler's root certificate in the Root store? + + TRUE if so + + + + Is Fiddler's root certificate in the Machine Root store? + + TRUE if so + + + + Create a self-signed root certificate to use as the trust anchor for HTTPS interception certificate chains + + TRUE if successful + + + + Finds the Fiddler root certificate and prompts the user to add it to the TRUSTED store. + Note: The system certificate store is used by most applications (IE, Chrome, etc) but not + all; for instance, Firefox uses its own certificate store. + + True if successful + + + + Dispose of the Certificate Provider, if any. + + + + + The ClientChatter object, exposed as the oRequest object on the Session object, represents a single web request. + + + + + Size of buffer passed to pipe.Receive when reading from the client. + + + + + Discardable State of Read Operation + + While it is reading a request from the client, the ClientChatter class uses a RequestReaderState object to track + the state of the read. This state is discarded when the request has been completely read. + + + + + The Host pulled from the URI + + + + + Buffer holds this request's data as it is read from the pipe. + + + + + Offset to first byte of body in m_requestData + + + + + Optimization: Offset of most recent transfer-encoded chunk + + + + + Optimization: tracks how far we've previously looked when determining iEntityBodyOffset + + + + + Did the request specify Transfer-Encoding: chunked + + + + + The integer value of the Content-Length header, if any + + + + + Count of body bytes read from the client. If no body bytes have yet been read, returns count of header bytes. + + + + + + Scans requestData stream for the \r\n\r\n (or variants) sequence + which indicates that the header block is complete. + + SIDE EFFECTS: + iBodySeekProgress is updated and maintained across calls to this function + iEntityBodyOffset is updated if the end of headers is found + + True, if requestData contains a full set of headers + + + + Tracks the progress of reading the request from the client. Because of the multi-threaded nature + of some users of this field, most will make a local copy before accessing its members. + + + + + The ClientPipe object which is connected to the client, or null. + + + + + Parsed Headers + + + + + The Session object which owns this ClientChatter + + + + + Returns the port on which Fiddler read the request (typically 8888) + + + + + Count of body bytes read from the client. If no body bytes have yet been read, returns count of header bytes. + + + + + HTTP Headers sent in the client request, or null. + + + + + Was this request received from a reused client connection? Looks at SessionFlags.ClientPipeReused flag on owning Session. + + + + + Note: This returns the request's HOST header, which may include a trailing port #. + If the Host is an IPv6 literal, it will be enclosed in brackets '[' and ']' + + + + + Controls whether the request body is streamed to the server as it is read from the client. + + + + + Create a ClientChatter object initialized with a set of HTTP headers + Called primarily when loading session data from a file. + + The Session object which will own this request + The string containing the request data + + + + Loads a HTTP request body from a file rather than a memory stream. + + The file to load + TRUE if the file existed. THROWS on most errors other than File-Not-Found + + + + Based on this session's data, determine the expected Transfer-Size of the request body. See RFC2616 Section 4.4 Message Length. + Note, there's currently no support for "multipart/byteranges" requests anywhere in Fiddler. + + Expected Transfer-Size of the body, in bytes. + + + + Free Request data. Called by TakeEntity or by ReadRequest method on request failure + + + + + Extract byte array representing the entity, put any excess bytes back in the pipe, free the RequestReadState, and + return the entity. + + Byte array containing the entity body + + + + Simple indexer into the Request Headers object + + + + + Send a HTTP/XXX Error Message to the Client, calling FiddlerApplication.BeforeReturningError and DoReturningError in FiddlerScript. + Note: This method does not poison the Server pipe, so if poisoning is desired, it's the caller's responsibility to do that. + Note: Because this method uses Connection: close on the returned response, it has the effect of poisoning the client pipe + + Response code + Response status text + Body of the HTTP Response + + + + Return a HTTP response and signal that the client should close the connection + + A Delegate that fires to give one final chance to modify the Session before + calling the DoBeforeReturningError and returning the response + + + + Parse the headers from the requestData buffer. + Precondition: Call AFTER having set the correct iEntityBodyOffset. + + Note: This code used to be a lot simpler before, when it used strings instead of byte[]s. Sadly, + we've gotta use byte[]s to ensure nothing in the URI gets lost. + + TRUE if successful. + + + + This function decides if the request string represents a complete HTTP request + + + + + + Read a (usually complete) request from pipeClient. If RequestStreamed flag is set, only the headers have been read. + + TRUE, if a request could be read. FALSE, otherwise. + + + + Verifies that the Hostname specified in the request line is compatible with the HOST header + + + + + The CONFIG object is Fiddler's legacy settings object, introduced before the advent of the Preferences system. + + + + + Underlying Preferences container whose IFiddlerPreferences interface is + exposed by the FiddlerApplication.Prefs property. + + + + + Generally, callers should use FiddlerApplication.Prefs, but RawPrefs allows use of the PreferenceBag members that + are not a part of IFiddlerPreferences + + + + + Response files larger than this (2^28 = ~262mb) will NOT be loaded into memory when using LoadResponseFromFile + + + + + Cached layout info for columns. + + + + + Control which processes have HTTPS traffic decryption enabled + + + + + True if this is a "Viewer" instance of Fiddler that will not persist its settings. Exposed as FiddlerApplication.IsViewerMode + + + TODO: ARCH: This setting shouldn't exist in FiddlerCore, but it's used in a dozen places + + + + TODO: Why is this defaulted to FALSE? Has been since 2009, probably due to some bug. Should keep better records. (Sigh). + + + + + Boolean controls whether Fiddler should map inbound connections to their original process using IPHLPAPI + + + + + Controls whether Fiddler should attempt to decrypt HTTPS Traffic + + + + + Boolean controls whether Fiddler will attempt to use the Server Name Indicator TLS extension to generate the SubjectCN for certificates + + + + + Should Audio/Video types automatically stream by default? + + + + + Returns 127.0.0.1:{ListenPort} or fiddler.network.proxy.RegistrationHostName:{ListenPort} + + + + + Use 128bit AES Encryption when password-protecting .SAZ files. Note that, while this + encryption is much stronger than the default encryption algorithm, it is significantly + slower to save and load these files, and the Windows Explorer ZIP utility cannot open them. + + + + + SSL/TLS Protocols we allow the client to choose from (when we call AuthenticateAsServer) + We allow all protocols by default (Ssl2,Ssl3,Tls1) and also 'Bitwise OR' in the constants for TLS1.1 and TLS1.2 in case we happen to be running on .NET4.5. + + + + + SSL/TLS Protocols we request the server use (when we call AuthenticateAsClient). By default, SSL3 and TLS1 are accepted; we exclude SSL2 so that TLS Extensions may be sent. + We do NOT enable TLS1.1 or TLS1.2 by default because many servers will fail if you offer them and unlike browsers, .NET has no fallback code. + + + + + When True, Fiddler will offer the latest TLS protocol version offered by the client in its request + + + + + Version information for the Fiddler/FiddlerCore assembly + + + + + Will send traffic to an upstream proxy? + OBSOLETE -- DO NOT USE. see instead. + + + + + Gets a value indicating what mechanism, if any, will be used to find the upstream proxy/gateway. + + + + + The encoding with which HTTP Headers should be parsed. Defaults to UTF8, but may be overridden by specifying a REG_SZ containing the encoding name in the registry key \Fiddler2\HeaderEncoding + + + + + Controls whether Fiddler will reuse server connections for multiple sessions + + + + + Controls whether Fiddler will reuse client connections for multiple sessions + + + + + Controls whether Fiddler should register as the HTTPS proxy + + + + + Controls whether Fiddler should register as the FTP proxy + + + + + Controls whether Fiddler will try to write exceptions to the System Event log. Note: Usually fails due to ACLs on the Event Log. + + + + + Controls whether Fiddler will attempt to log on to the upstream proxy server to download the proxy configuration script + + + + + Controls whether Fiddler will attempt to connect to IPv6 addresses + + + + + Name of connection to which Fiddler should autoattach if MonitorAllConnections is not set + + + + + The username to send to the upstream gateway if the Version Checking webservice request requires authentication + + + + + The password to send to the upstream gateway if the Version Checking webservice request requires authentication + + + + + Set this flag if m_ListenPort is a "temporary" port (E.g. specified on command-line) and it shouldn't be overridden in the registry + + + + + Controls whether Certificate-Generation output will be spewed to the Fiddler Log + + + + + Port to which Fiddler should forward inbound requests when configured to run as a Reverse Proxy + + + + + Alternative hostname which Fiddler should recognize as an alias for the local machine. The + default value of ? will never be usable, as it's the QueryString delimiter + + + + + (Lowercase) Machine Name + + + + + (Lowercase) Machine Domain Name + + + + + On attach, will configure WinINET to bypass Fiddler for these hosts. + + + + + List of hostnames for which HTTPS decryption (if enabled) should be skipped + + + + + True if Fiddler should be maximized on restart + + + + + Boolean indicating whether Fiddler will open the listening port exclusively + + + + + Controls whether server certificate errors are ignored when decrypting HTTPS traffic. + + + + + The port upon which Fiddler is configured to listen. + + + + + Return a Special URL. + + String constant describing the URL to return. CASE-SENSITIVE! + Returns target URL + + + + Get a registry path for a named constant + + The path to retrieve [Root, UI, Dynamic, Prefs] + The registry path + + + + Return an app path (ending in Path.DirectorySeparatorChar) or a filename + + CASE-SENSITIVE + The specified filesystem path + + + + Returns the path and filename of the editor used to edit the Rules script file. + + + + + Returns true if Fiddler should permit remote connections. Requires restart. + + + + + Ensure that the per-user folders used by Fiddler are present. + + + + + Loads Preferences from the Registry and fills appropriate fields + + + + + Interface for the WebSocket and CONNECT Tunnel classes + + + + + The CONNECTTunnel class represents a "blind tunnel" through which a CONNECT request is serviced to shuffle bytes between a client and the server. + + + See pg 206 in HTTP: The Complete Reference for details on how Tunnels work. + When HTTPS Decryption is disabled, Fiddler accepts a CONNECT request from the client. Then, we open a connection to the remote server. + We shuttle bytes back and forth between the client and the server in this tunnel, keeping Fiddler itself out of the loop + (no tampering, etc). + + + + + Number of bytes received from the client + + + + + Number of bytes received from the server + + + + + TRUE if this is a Blind tunnel, FALSE if decrypting + + + + + Returns number of bytes sent from the Server to the Client + + + + + Returns number of bytes sent from the Client to the Server + + + + + This "Factory" method creates a new HTTPS Tunnel and executes it on a background (non-pooled) thread. + + The Session containing the HTTP CONNECT request + + + + Creates a HTTPS tunnel. External callers instead use the CreateTunnel static method. + + The session for which this tunnel was initially created. + Client Pipe + Server Pipe + + + + This function keeps the thread alive until it is signaled that the traffic is complete + + + + + Executes the HTTPS tunnel inside an All-it-can-eat exception handler. + Call from a background thread. + + + + + Close the HTTPS tunnel and signal the event to let the service thread die. + WARNING: This MUST not be allowed to throw any exceptions, because it will do so on threads that don't catch them, and this will kill the application. + + + + + Called when we have received data from the local client. + Incoming data will immediately be forwarded to the remote host. + + The result of the asynchronous operation. + + + Called when we have sent data to the local client.
When all the data has been sent, we will start receiving again from the remote host.
+ The result of the asynchronous operation. +
+ + Called when we have sent data to the remote host.
When all the data has been sent, we will start receiving again from the local client.
+ The result of the asynchronous operation. +
+ + Called when we have received data from the remote host.
Incoming data will immediately be forwarded to the local client.
+ The result of the asynchronous operation. +
+ + + [DEPRECATED] Use the BCCertMaker instead. + This is the default Fiddler certificate provider. + + + + + CertEnroll is an ActiveX Control available on Windows Vista and later that allows programmatic generation of X509 certificates. + We can use it as an alternative to MakeCert.exe; it offers better behavior (e.g. setting AKID) and doesn't require redistributing makecert.exe + + + + + Factory method. Returns null if this engine cannot be created + + + + + Invoke CertEnroll + + Target CN + TRUE if the certificate is a root cert + TRUE if we should validate that we're running in a MTA thread and switch if not + A Cert + + + + Factory method. Returns null if this engine cannot be created + + + + + File path pointing to the location of MakeCert.exe + + + + + Hash to use when signing certificates. + Note: sha1 is required on XP (even w/SP3, using sha256 throws 0x80090008). + + + + + Constructor: Simply cache the path to MakeCert + + + + + The underlying Certificate Generator (MakeCert or CertEnroll) + + + + + Cache of previously-generated EE certificates. Thread safety managed by _oRWLock + + + + + Cache of previously-generated Root certificate + + + + + Should Fiddler automatically generate wildcard certificates? + + + + + Reader/Writer lock gates access to the certificate cache and generation functions. + + We must set the SupportsRecursion flag because there are cases where the thread holds the lock in Write mode and then enters Read mode in a nested call. + + + + Find certificates that have the specified full subject. + + The store to search + FindBySubject{Distinguished}Name requires a complete match of the SUBJECT, including CN, O, and OU + Matching certificates + + + + Find all certificates (in the CurrentUser Personal store) that have the specified issuer. + + The store to search + FindByIssuer{Distinguished}Name requires a complete match of the SUBJECT, including CN, O, and OU + Matching certificates + + + + Interface method: Clear the in-memory caches and Windows certificate stores + + TRUE to clear the Root Certificate from the cache and Windows stores + TRUE if successful + + + + Interface method: Clear the in-memory caches and Windows certificate stores + + + + + + Use MakeCert to generate a unique self-signed certificate + + TRUE if the Root certificate was generated successfully + + + + Get the root certificate from cache or storage, only IF IT ALREADY EXISTS. + + + + + + Returns an Interception certificate for the specified hostname + + Hostname for the target certificate + This method uses a Reader lock when checking the cache and a Writer lock when updating the cache. + An Interception Certificate, or NULL + + + + Find a certificate from the certificate store, creating a new certificate if it was not found. + + A SubjectCN hostname, of the form www.example.com + TRUE if the cert wasn't found in the Windows Certificate store and this function attempted to create it. + No locks are acquired by this method itself. + A certificate or /null/ + + + + Find (but do not create!) a certificate from the CurrentUser certificate store, if present. + + No locks are acquired by this method itself. + A certificate or /null/ + + + + Updates the Server Certificate cache under the Writer lock + + The target hostname + The certificate to cache + + + + + Creates a certificate for ServerAuth. If isRoot is set, designates that this is a self-signed root. + + Uses a reader lock when checking for the Root certificate. Uses a Writer lock when creating a certificate. + A string of the form: "www.hostname.com" + A boolean indicating if this is a request to create the root certificate + Newly-created certificate, or Null + + + + Cache of Hostname->Address mappings + + + + + Number of milliseconds that a DNS cache entry may be reused without validation. + + + + + Maximum number of A/AAAA records to cache for DNS entries. + Beware: Changing this number changes how many IP-failovers Fiddler will perform if fiddler.network.dns.fallback is set, + and increasing the number will consume more memory in the cache. + + + + + Clear the DNS Cache. Called by the NetworkChange event handler in the oProxy object + + + + + Remove all expired DNSCache entries; called by the Janitor + + + + + Show the contents of the DNS Resolver cache + + + + + + Gets first available IP Address from DNS. Throws if address not found! + + String containing the host + True to use Fiddler's DNS cache. + IPAddress of target, if found. + + + + Gets IP Addresses for host from DNS. Throws if address not found! + + String containing the host + True to use Fiddler's DNS cache. + The Timers object to which the DNS lookup time should be stored, or null + List of IPAddresses of target, if any found. + + + + Trim an address list, removing the duplicate entries, any IPv6-entries if IPv6 is disabled, + and entries beyond the COUNT_MAX_A_RECORDS limit. + + The list to filter + A filtered address list + + + + A DNSCacheEntry holds a cached resolution from the DNS + + + + + TickCount of this record's creation + + + + + IPAddresses for this hostname + + + + + Construct a new cache entry + + The address information to add to the cache + + + + Attribute used to specify the minimum version of Fiddler compatible with this extension assembly. + + + + + Attribute used to specify the minimum version of Fiddler compatible with this extension assembly. + + The minimal version string (e.g. "2.2.8.8") + + + + Getter for the required version string + + + + + Attribute allowing developer to specify that a class supports the specified Import/Export Format. + + + + + Attribute allowing developer to specify that a class supports the specified Import/Export Format + + Shortname of the Format (e.g. WebText XML) + Description of the format + + + + Attribute allowing developer to specify that a class supports the specified Import/Export Format + + Shortname of the Format (e.g. WebText XML) + Description of the format + Semi-colon delimited file extensions (e.g. ".har;.harx") + + + + Returns the Shortname for this format + + + + + Returns the Description of this format + + + + + This tuple maps a display descriptive string to a Import/Export type. + (The parent dictionary contains the shortname string) + + + + + Textual description of the Format + + + + + Class implementing the format + + + + + All metadata about the provider + + + + + Create a new Transcoder Tuple + + Proffer format description + Type implementing this format + + + + ISessionImport allows loading of Session data + + + + + Import Sessions from a data source + + Shortname of the format + Dictionary of options that the Importer class may use + Callback event on which progress is reported or the host may cancel + Array of Session objects imported from source + + + + ISessionExport allows saving of Session data + + + + + Export Sessions to a data store + + Shortname of the format + Array of Sessions being exported + Dictionary of options that the Exporter class may use + Callback event on which progress is reported or the host may cancel + TRUE if the export was successful + + + + EventArgs class for the ISessionImporter and ISessionExporter interface callbacks + + + + + Set to TRUE to request that Import/Export process be aborted as soon as convenient + + + + + Progress Callback + + Float indicating completion ratio, 0.0 to 1.0. Set to 0 if unknown. + Short string describing current operation, progress, etc + + + + The string message of the notification + + + + + The percentage completed + + + + + Implement ICertificateProvider2 instead + + + + + Return a certificate to secure this traffic. Generally, it's expected that this method WILL create a new certificate if needed. + + Hostname (e.g. "www.example.com") + An X509Certificate, or null on error + + + + Return the root certificate to which Host Certificates are chained. Generally, it's expected that this method will NOT create a root certificate. + + An X509Certificate, or null on error + + + + When this method is called, your extension should create a Root certificate. + + TRUE if the operation was successful + + + + When this method is called, your extension should copy the your Root certificate into + the user's (or machines's) Root certificate store. + + TRUE if the operation was successful + + + + When this method is called, your extension should discard all certificates and + clear any certificates that have been added to the user's certificate store. + + TRUE, if all certificates were removed; FALSE if any certificates were preserved + + + + When this method is called, your extension should check to see if the User or Machine Root + certificate store contains your Root certificate. + + Set to TRUE if StoreLocation.CurrentUser StoreName.Root has the certificate + Set to TRUE if StoreLocation.LocalMachine StoreName.Root has the certificate + TRUE if either bUserTrusted or bMachineTrusted + + + + To override default certificate handling, your class should implement this interface in an assembly + referenced by the fiddler.certmaker.assembly preference; by default, "certmaker.dll" in the application + folder is loaded + + + + + When this method is called, your extension should discard all certificates and + clear any certificates that have been added to the user's certificate store + + TRUE if the root certificate should also be cleared + TRUE, if all certificates were removed; FALSE if any certificates were preserved + + + + Call this function to cache a certificate in the Certificate Provider + + The hostname to match + The certificate that the Provider should later provide when GetCertificateForHost is called + True if the request was successful + + + + Copy of the cache of the EndEntity certificates that have been generated in this session. + + + + + When this method is called, your extension should read the root certificate and its private key from a stream. + + The stream. + The password which is used to protect the private key. Could be null or empty if the private key is not protected. + The alias for the certificate and the private key. Could be null. + + + + When this method is called, your extension should write the root certificate and its private key to a stream. + + The stream. + The password protecting the private key. If null or empty, the private key is written unprotected. + The alias for the certificate and the private key. If null, a random alias could be created. + + + + When this method is called, your extension should write the root certificate without the private key to a stream. + + The stream. + + + + When this method is called, your extension should read the root certificate and its private key from the PKCS#12 file(.pfx | .p12). + + The filename of the PKCS#12 file (.pfx | .p12). + The password which is used to protect the private key. Could be null or empty if the private key is not protected. + The alias for the certificate and the private key. Could be null. + + + + When this method is called, your extension should write the root certificate and its private key to a PKCS#12 file(.pfx | .p12). + + The filename of the PKCS#12 file (.pfx | .p12). + The password which is used to protect the private key. If null or empty, the private key is written unprotected. + The alias for the certificate and the private key. If null, a random alias could be created. + + + + When this method is called, your extension should write the root certificate without the private key to a DER encoded file(.cer | .crt | .der). + + The filename of the DER encoded file (.cer | .crt | .der) + + + + Return a string describing the current configuration of the Certificate Provider. For instance, list + the configured key size, hash algorithms, etc. + + + + + Fiddler Transcoders allow import and export of Sessions from Fiddler + + + + + Create the FiddlerTranscoders object + + + + + True if one or more classes implementing ISessionImporter are available. + + + + + List all of the Transcoder objects that are loaded + + + + + + True if one or more classes implementing ISessionImporter are available. + + + + + Add Import/Export encoders to FiddlerApplication.oTranscoders + + Assembly to import exporters and importers + FALSE on obvious errors + + + + Add Import/Export encoders to FiddlerApplication.oTranscoders + + Assembly to scan for transcoders + FALSE on obvious errors + + + + Loads any assembly in the specified path that ends with .dll and does not start with "_", checks that a compatible version requirement was specified, + and adds the importer and exporters within to the collection. + + The path to scan for extensions + + + + Ensures that Import/Export Transcoders have been loaded + + + + + Returns a TranscoderTuple willing to handle the specified format + + The Format + TranscoderTuple, or null + + + + Returns a TranscoderTuple willing to handle the specified format + + The Format + TranscoderTuple, or null + + + + Gets the format list of the specified type and adds that type to the collection. + + + + TRUE if any formats were found; FALSE otherwise + + + + Clear Importer and Exporter collections + + + + + The IFiddlerPreferences Interface is exposed by the FiddlerApplication.Prefs object, and enables + callers to Add, Update, and Remove preferences, as well as observe changes to the preferences. + + + + + Store a boolean value for a preference + + The named preference + The boolean value to store + + + + Store an Int32 value for a preference + + The named preference + The int32 value to store + + + + Store a string value for a preference + + The named preference + The string value to store + + + + Store multiple preferences. + + An enumeration of the preferences' names and values to store. + + + + Get a preference's value as a boolean + + The Preference Name + The default value for missing or invalid preferences + A Boolean + + + + Gets a preference's value as a string + + The Preference Name + The default value for missing preferences + A string + + + + Gets a preference's value as a 32-bit integer + + The Preference Name + The default value for missing or invalid preferences + An integer + + + + Removes a named preference from storage + + The name of the preference to remove + + + + Add a Watcher that will be notified when a value has changed within the specified prefix. + + The prefix of preferences for which changes are interesting + The Event handler to notify + Returns the Watcher object added to the notification list + + + + Removes a previously-created preference Watcher from the notification queue + + The Watcher to remove + + + + Indexer. Returns the value of the preference as a string + + The Preference Name + The Preference value as a string, or null + + + + EventArgs for preference-change events. See http://msdn.microsoft.com/en-us/library/ms229011.aspx. + + + + + The name of the preference being added, changed, or removed + + + + + The string value of the preference, or null if the preference is being removed + + + + + Returns TRUE if ValueString=="true", case-insensitively + + + + + The PreferenceBag is used to maintain a threadsafe Key/Value list of preferences, persisted in the registry, and with appropriate eventing when a value changes. + + + + + Returns a string naming the current profile + + + + + Indexer into the Preference collection. + + The name of the Preference to update/create or return. + The string value of the preference, or null. + + + + Get a string array of the preference names + + string[] of preference names + + + + Gets a preference's value as a string + + The Preference Name + The default value if the preference is missing + A string + + + + Return a bool preference. + + The Preference name + The default value to return if the specified preference does not exist + The boolean value of the Preference, or the default value + + + + Return an Int32 Preference. + + The Preference name + The default value to return if the specified preference does not exist + The Int32 value of the Preference, or the default value + + + + Update or create a string preference. + + The name of the Preference + The value to assign to the Preference + + + + Update or create a Int32 Preference + + The name of the Preference + The value to assign to the Preference + + + + Update or create a Boolean preference. + + The name of the Preference + The value to assign to the Preference + + + + Update or create multiple preferences. + + An enumeration of the preferences' names and values to store. + + + + Delete a Preference from the collection. + + The name of the Preference to be removed. + + + + Remove all Watchers + + + + + Remove all watchers and write the registry. + + + + + Return a description of the contents of the preference bag + + Multi-line string + + + + Return a string-based serialization of the Preferences settings. + + TRUE for a multi-line format with all preferences + String + + + + Returns a CRLF-delimited string containing all Preferences whose Name case-insensitively contains the specified filter string. + + Partial string to match + A string + + + + A simple struct which contains a Branch identifier and EventHandler + + + + + Add a watcher for changes to the specified preference or preference branch. + + Preference branch to monitor, or String.Empty to watch all + The EventHandler accepting PrefChangeEventArgs to notify + Returns the PrefWatcher object which has been added, store to pass to RemoveWatcher later. + + + + Remove a previously attached Watcher + + The previously-specified Watcher + + + + This function executes on a single background thread and notifies any registered + Watchers of changes in preferences they care about. + + A string containing the name of the Branch that changed + + + + Spawn a background thread to notify any interested Watchers of changes to the Target preference branch. + + The arguments to pass to the interested Watchers + + + + Use this method to ensure that the passed protocols are consecutive. It is done by adding missing + protocols from the sequence, thus filling the gaps, if any. Works only with Tls, Tls11 and Tls12. + + + Passed protocols: Tls, Tls12 + Return value: Tls, Tls11, Tls12 + + The input SSL protocols + Consecutive version of the input SSL protocols + + + + CodeDescription attributes are used to enable the FiddlerScript Editor to describe available methods, properties, fields, and events. + + + + + CodeDescription attributes should be constructed by annotating a property, method, or field. + + The descriptive string which should be displayed for this this property, method, or field + + + + The descriptive string which should be displayed for this this property, method, or field + + + + + A simple delegate for functions which accept no parameters. (MethodInvoker is the identical Framework version of this delegate) + + + + + An event handling delegate which is called during report calculation with the set of sessions being evaluated. + + The sessions in this report. + + + + An event handling delegate which is called as a part of the HTTP pipeline at various stages. + + The Web Session in the pipeline. + + + + This class acts as the central point for script/extensions to interact with Fiddler components. + + + + + TRUE if Fiddler is currently shutting down. Suspend all work that won't have side-effects. + + + + + The default certificate used for client authentication + + + + + Fiddler's logging system + + + + + Fiddler's "Janitor" clears up unneeded resources (e.g. server sockets, DNS entries) + + + + + Fiddler's Preferences collection. Learn more at http://fiddler.wikidot.com/prefs + + + + + Gets Fiddler* version info + + A string indicating the build/flavor of the Fiddler* assembly + + + + Set the DisplayName for the application + + 1 to 64 character name to be displayed in error messages, etc + + + + Fiddler's core proxy object. + + + + + By setting this property you can provide Telerik Fiddler Core with custom MIME-type-to-file-extension mappings. + + + + + Fiddler Import/Export Transcoders + + + + + This event fires when the user instructs Fiddler to clear the cache or cookies + + + + + This event fires each time FiddlerCore reads data from network for the server's response. Note that this data + is not formatted in any way, and must be parsed by the recipient. + + + + + This event fires each time FiddlerCore reads data from network for the client's request. Note that this data + is not formatted in any way, and must be parsed by the recipient. + + + + + This event fires when a client request is received by Fiddler + + + + + This event fires when a server response is received by Fiddler + + + + + This event fires when Request Headers are available + + + + + This event fires when Response Headers are available + + + + + This event fires when an error response is generated by Fiddler + + + + + This event fires when Fiddler captures a WebSocket message + + + + + This event fires when a session has been completed + + + + + This event fires when Fiddler evaluates the validity of a server-provided certificate. Adjust the value of the ValidityState property if desired. + + + + + Sync this event to be notified when FiddlerCore has attached as the system proxy.")] + + + + + Sync this event to be notified when FiddlerCore has detached as the system proxy. + + + + + List of "leaked" temporary files to be deleted as Fiddler exits. + + + + + Checks if FiddlerCore is running. + + TRUE if FiddlerCore is started/listening; FALSE otherwise. + + + + Checks if FiddlerCore is running and registered as the System Proxy. + + TRUE if FiddlerCore IsStarted AND registered as the system proxy; FALSE otherwise. + + + + Recommended way to Start FiddlerCore. + + + + + + Start a new proxy endpoint instance, listening on the specified port + + The port to listen on + TRUE if remote clients should be permitted to connect to this endpoint + A Hostname (e.g. EXAMPLE.com) if this endpoint should be treated as a HTTPS Server + A Proxy object, or null if unsuccessful + + + + Start a new proxy endpoint instance, listening on the specified port + + The port to listen on + TRUE if remote clients should be permitted to connect to this endpoint + A certificate to return when clients connect, or null + A Proxy object, or null if unsuccessful + + + + Shuts down the FiddlerCore proxy and disposes it. Note: If there's any traffic in progress while you're calling this method, + your background threads are likely to blow up with ObjectDisposedExceptions or NullReferenceExceptions. In many cases, you're + better off simply calling oProxy.Detach() and letting the garbage collector clean up when your program exits. + + + + + Notify a listener that a block of a response was read. + + The session for which the response is being read + byte buffer (not completely full) + bytes set. + FALSE if AbortReading was set + + + + Notify a listener that a block of a request was read. Note that this event may fire with overlapping blocks of data but + different sessions if the client uses HTTP Pipelining. + + The session for which the response is being read + byte buffer (not completely full) + bytes set. + FALSE if AbortReading was set + + + + Export Sessions in the specified format + + Shortname of desired format + Sessions to export + Options to pass to the ISessionExport interface + Your callback event handler, or NULL to allow Fiddler to handle + TRUE if successful, FALSE if desired format doesn't exist or other error occurs + + + + Calls a Fiddler Session Importer and returns the list of loaded Sessions. + + String naming the Import format, e.g. HTTPArchive + Should sessions be added to WebSessions list? (Not meaningful for FiddlerCore) + Dictionary of Options to pass to the Transcoder + Your callback event handler, or NULL to allow Fiddler to handle + Callback that is used to request passwords from the host if needed + Loaded Session[], or null on Failure + + + + Reset the SessionID counter to 0. This method can lead to confusing UI, so call sparingly. + + + + + Show the user a message when an HTTP Error was encountered + + Session with error + Set to true to prevent pooling/reuse of client connection + The SessionFlag which should be set to log this violation + Set to true to prevent pooling/reuse of server connection + Information about the problem + + + + Process ID of this Fiddler instance + + + + + processname:PID of Fiddler + + + + + We really don't want this method to get inlined, because that would cause the Xceed DLLs to get loaded in the Main() function instead + of when _SetXceedLicenseKeys is called; that, in turn, would delay the SplashScreen. + + + + + Used to track errors with addons. + + + + + + + Record that a temporary file was created and handed to an external tool. We'll do our best to delete this file on exit. + + The filename of the file to be deleted + + + + Clean up any Temporary files that were created + + + + + Fired each time Fiddler successfully establishes a TCP/IP connection + + + + + Fired each time Fiddler successfully accepts a TCP/IP connection + + + + + Does this Fiddler instance support the specified feature? + + Feature name (e.g. "bzip2") + TRUE if the specified feature is supported; false otherwise + + + + The Socket which was just Connected or Accepted + + + + + The Session which owns the this new connection + + + + + Enumeration of possible responses specified by the ValidateServerCertificateEventArgs as modified by FiddlerApplication's OnValidateServerCertificate event + + + + + The certificate will be considered valid if CertificatePolicyErrors == SslPolicyErrors.None, otherwise the certificate will be invalid unless the user manually allows the certificate. + + + + + The certificate will be confirmed with the user even if CertificatePolicyErrors == SslPolicyErrors.None. + Note: FiddlerCore does not support user-prompting and will always treat this status as ForceInvalid. + + + + + Force the certificate to be considered Invalid, regardless of the value of CertificatePolicyErrors. + + + + + Force the certificate to be considered Valid, regardless of the value of CertificatePolicyErrors. + + + + + These EventArgs are passed to the FiddlerApplication.OnValidateServerCertificate event handler when a server-provided HTTPS certificate is evaluated + + + + + EventArgs for the ValidateServerCertificateEvent that allows host to override default certificate handling policy + + The session + The CN expected for this session + The certificate provided by the server + The certificate chain of that certificate + Errors from default validation + + + + The port to which this request was targeted + + + + + The SubjectCN (e.g. Hostname) that should be expected on this HTTPS connection, based on the request's Host property. + + + + + The Session for which a HTTPS certificate was received. + + + + + The server's certificate chain. + + + + + The SslPolicyErrors found during default certificate evaluation. + + + + + Set this property to override the certificate validity + + + + + The X509Certificate provided by the server to vouch for its authenticity + + + + + These EventArgs are constructed when FiddlerApplication.OnClearCache is called. + + + + + True if the user wants cache files to be cleared + + + + + True if the user wants cookies to be cleared + + + + + Constructs the Event Args + + Should Cache Files be cleared? + Should Cookies be cleared? + + + + When the FiddlerApplication.OnReadResponseBuffer event fires, the raw bytes are available via this object. + + + + + Set to TRUE to request that upload or download process be aborted as soon as convenient + + + + + Session for which this responseRead is occurring + + + + + Byte buffer returned from read. Note: Always of fixed size, check iCountOfBytes to see which bytes were set + + + + + Count of latest read from Socket. If less than 1, response was ended. + + + + + This FTP Gateway class is used if Fiddler is configured as the FTP proxy and there's no upstream gateway configured. + Fiddler must act as a HTTP->FTP protocol converter, which it does by using the .NET FTP classes. + + + + + Make a FTP request using the .NET FTPWebRequest class. + WARNING: This method will throw. + + Session bearing an FTP request + Returns Response body stream + Returns generated Response headers + + + + The GenericTunnel class represents a "blind tunnel" to shuffle bytes between a client and the server. + + + + + Is streaming started in the downstream direction? + + + + + Number of bytes received from the client + + + + + Number of bytes received from the server + + + + + Returns number of bytes sent from the Server to the Client + + + + + Returns number of bytes sent from the Client to the Server + + + + + This "Factory" method creates a new HTTPS Tunnel and executes it on a background (non-pooled) thread. + + The Session containing the HTTP CONNECT request + + + + Creates a tunnel. External callers instead use the CreateTunnel static method. + + The session for which this tunnel was initially created. + Client Pipe + Server Pipe + + + + This function keeps the thread alive until it is signaled that the traffic is complete + + + + + Executes the HTTPS tunnel inside an All-it-can-eat exception handler. + Call from a background thread. + + + + + Executes the WebSocket tunnel on a background thread + + + + + Instructs the tunnel to take over the server pipe and begin streaming responses to the client + + + + + Close the HTTPS tunnel and signal the event to let the service thread die. + WARNING: This MUST not be allowed to throw any exceptions, because it will do so on threads that don't catch them, and this will kill the application. + + + + + Called when we have received data from the local client. + Incoming data will immediately be forwarded to the remote host. + + The result of the asynchronous operation. + + + Called when we have sent data to the local client.
When all the data has been sent, we will start receiving again from the remote host.
+ The result of the asynchronous operation. +
+ + Called when we have sent data to the remote host.
When all the data has been sent, we will start receiving again from the local client.
+ The result of the asynchronous operation. +
+ + Called when we have received data from the remote host.
Incoming data will immediately be forwarded to the local client.
+ The result of the asynchronous operation. +
+ + + The HostList allows fast determination of whether a given host is in the list. It supports leading wildcards (e.g. *.foo.com), and the special tokens <local> <nonlocal> and <loopback>. + Note: List is *not* threadsafe; instead of updating it, construct a new one. + + + + + This private tuple allows us to associate a Hostname and a Port + + + + + Port specified in the rule + + + + + Hostname specified in the rule + + + + + Create a new HostPortTuple + + + + + Generate an empty HostList + + + + + Create a hostlist and assign it an initial set of sites + + List of hostnames, including leading wildcards, and optional port specifier. Special tokens are *, <local>, <nonlocal>, and <loopback>. + + + + Clear the HostList + + + + + Clear the List and assign the new string as the contents of the list. + + List of hostnames, including leading wildcards, and optional port specifier. Special tokens are *, <local>, <nonlocal>, and <loopback>. + TRUE if the list was constructed without errors + + + + Clear the list and assign the new string as the contents of the list. + + List of hostnames, including leading wildcards, and optional port specifier. Special tokens are *, <local>, <nonlocal>, and <loopback>. + Outparam string containing list of parsing errors + TRUE if the list was constructed without errors + + + + Return the current list of rules as a string + + String containing current rules, using "; " as a delimiter between entries + + + + Determine if a given Host is in the list + + A Host string, potentially including a port + TRUE if the Host's hostname matches a rule in the list + + + + Determine if a given Hostname is in the list + + A hostname, NOT including a port + TRUE if the hostname matches a rule in the list + + + + Determine if a given Host:Port pair matches an entry in the list + + A hostname, NOT including the port + The port + TRUE if the hostname matches a rule in the list + + + + HTTP Response headers object + + + + + Protect your enumeration using GetReaderLock + + + + + Protect your enumeration using GetReaderLock + + + + + Clone this HTTPResponseHeaders object and return the result cast to an Object + + The new response headers object, cast to an object + + + + Status code from HTTP Response. If setting, also set HTTPResponseStatus too! + + + + + Code AND Description of Response Status (e.g. '200 OK'). + + + + + Gets or sets the text associated with the response code (e.g. "OK", "Not Found", etc) + + + + + Update the response status code and text + + HTTP Status code (e.g. 401) + HTTP Status text (e.g. "Access Denied") + + + + Constructor for HTTP Response headers object + + + + + Constructor for HTTP Response headers object + + Text encoding to be used for this set of Headers when converting to a byte array + + + + Returns a byte array representing the HTTP headers. + + TRUE if the response status line should be included + TRUE if there should be a trailing \r\n byte sequence included + Byte[] containing the headers + + + + Returns a string containing http headers + + TRUE if the response status line should be included + TRUE if there should be a trailing CRLF included + String containing http headers + + + + Returns a string containing the http headers + + + Returns a string containing http headers with a status line but no trailing CRLF + + + + + Parses a string and assigns the headers parsed to this object + + The header string + TRUE if the operation succeeded, false otherwise + + + + HTTP Request headers object + + + + + Warning: You should protect your enumeration using the GetReaderLock + + + + + Warning: You should protect your enumeration using the GetReaderLock + + + + + Clones the HTTP request headers + + The new HTTPRequestHeaders object, cast to an object + + + + The HTTP Method (e.g. GET, POST, etc) + + + + + Constructor for HTTP Request headers object + + + + + Constructor for HTTP Request headers object + + Text encoding to be used for this set of Headers when converting to a byte array + + + + The (lowercased) URI scheme for this request (https, http, or ftp) + + + + + Username:Password info for FTP URLs. (either null or "user:pass@") + (Note: It's silly that this contains a trailing @, but whatever...) + + + + + Get or set the request path as a string + + + + + Get or set the request path as a byte array + + + + + Parses a string and assigns the headers parsed to this object + + The header string + TRUE if the operation succeeded, false otherwise + + + + Returns a byte array representing the HTTP headers. + + TRUE if the HTTP REQUEST line (method+path+httpversion) should be included + TRUE if there should be a trailing \r\n byte sequence included + TRUE if the SCHEME and HOST should be included in the HTTP REQUEST LINE + The HTTP headers as a byte[] + + + + Returns a byte array representing the HTTP headers. + + TRUE if the HTTP REQUEST line (method+path+httpversion) should be included + TRUE if there should be a trailing \r\n byte sequence included + TRUE if the SCHEME and HOST should be included in the HTTP REQUEST LINE + Only meaningful if prependVerbLine is TRUE, the host to use in the HTTP REQUEST LINE + The HTTP headers as a byte[] + + + + Returns a string representing the HTTP headers. + + TRUE if the HTTP REQUEST line (method+path+httpversion) should be included + TRUE if there should be a trailing CRLF sequence included + TRUE if the SCHEME and HOST should be included in the HTTP REQUEST LINE (Automatically set to FALSE for CONNECT requests) + The HTTP headers as a string. + + + + Returns a string representing the HTTP headers, without the SCHEME+HOST in the HTTP REQUEST line + + TRUE if the HTTP REQUEST line (method+path+httpversion) should be included + TRUE if there should be a trailing CRLF sequence included + The header string + + + + Returns a string representing the HTTP headers, without the SCHEME+HOST in the HTTP request line, and no trailing CRLF + + The header string + + + + Base class for RequestHeaders and ResponseHeaders + + + + + Get the Reader Lock if you plan to enumerate the Storage collection. + + + + + Get the Writer Lock if you plan to change the Storage collection. + NB: You only need this lock if you plan to change the collection itself; you can party on the items in the collection if you like without locking. + + + + + If you get the Writer lock, Free it ASAP or you're going to hang or deadlock the Session + + + + + Text encoding to be used when converting this header object to/from a byte array + + + + + HTTP version (e.g. HTTP/1.1) + + + + + Storage for individual HTTPHeaderItems in this header collection + NB: Using a list is important, as order can matter + + + + + Get byte count of this HTTP header instance. + NOTE: This method should've been abstract. + + Byte Count + + + + Number of HTTP headers + + Number of HTTP headers + + + + Returns all instances of the named header + + Header name + List of instances of the named header + + + + Copies the Headers to a new array. + Prefer this method over the enumerator to avoid cross-thread problems. + + An array containing HTTPHeaderItems + + + + Returns all values of the named header in a single string, delimited by commas + + Header + Each, Header's, Value + + + + Returns the count of instances of the named header + + Header name + Count of instances of the named header + + + + Enumerator for HTTPHeader storage collection + + Enumerator + + + + Gets or sets the value of a header. In the case of Gets, the value of the first header of that name is returned. + If the header does not exist, returns null. + In the case of Sets, the value of the first header of that name is updated. + If the header does not exist, it is added. + + + + + Indexer property. Returns HTTPHeaderItem by index. Throws Exception if index out of bounds + + + + + Adds a new header containing the specified name and value. + + Name of the header to add. + Value of the header. + Returns the newly-created HTTPHeaderItem. + + + + Adds one or more headers + + + + + Returns the Value from a token in the header. Correctly handles double-quoted strings. Requires semicolon for delimiting tokens + Limitation: FAILS if semicolon is in token's value, even if quoted. + FAILS in the case of crazy headers, e.g. Header: Blah="SoughtToken=Blah" SoughtToken=MissedMe + + We really need a "proper" header parser + + Name of the header + Name of the token + Value of the token if present; otherwise, null + + + + Determines if the Headers collection contains a header of the specified name, with any value. + + The name of the header to check. (case insensitive) + True, if the header exists. + + + + Determines if the Headers collection contains any header from the specified list, with any value. + + list of headers + True, if any named header exists. + + + + Determines if the Headers collection contains one or more headers of the specified name, and + sHeaderValue is part of one of those Headers' value. + + The name of the header to check. (case insensitive) + The partial header value. (case insensitive) + True if the header is found and the value case-insensitively contains the parameter + + + + Determines if the Headers collection contains a header of the specified name, and sHeaderValue=Header's value. Similar + to a case-insensitive version of: headers[sHeaderName]==sHeaderValue, although it checks all instances of the named header. + + The name of the header to check. (case insensitive) + The full header value. (case insensitive) + True if the header is found and the value case-insensitively matches the parameter + + + + Removes all headers from the header collection which have the specified name. + + The name of the header to remove. (case insensitive) + + + + Removes all headers from the header collection which have the specified names. + + Array of names of headers to remove. (case insensitive) + + + + Removes a HTTPHeader item from the collection + + The HTTPHeader item to be removed + + + + Removes all HTTPHeader items from the collection + + + + + Renames all headers in the header collection which have the specified name. + + The name of the header to rename. (case insensitive) + The new name for the header. + True if one or more replacements were made. + + + + Represents a single HTTP header + + + + + Clones a single HTTP header and returns the clone cast to an object + + HTTPHeader Name: Value pair, cast to an object + + + + The name of the HTTP header + + + + + The value of the HTTP header + + + + + Creates a new HTTP Header item. WARNING: Doesn't do any trimming or validation on the name. + + Header name + Header value + + + + Return a string of the form "NAME: VALUE" + + "NAME: VALUE" Header string + + + + Utility functions common to parsing both ClientHello and ServerHello messages + + + + + Gets a textual string from a TLS extension + + + + + Builds a string from an ALPN List of strings + + + + + List Sig/Hash pairs from RFC5246 and TLS/1.3 spec + + + + + + + Describes a block of padding, with a friendly summary if all bytes are 0s + https://www.ietf.org/archive/id/draft-agl-tls-padding-03.txt + + + + + List defined Supported Groups & ECC Curves from RFC4492 + + + + + + List defined ECC Point Formats from RFC4492 + + + + + + + Converts a HTTPS version to a "Major.Minor (Friendly)" string + + + + + The HTTPSClientHello class is used to parse the bytes of a HTTPS ClientHello message. + + + + + Map cipher id numbers to names. See http://www.iana.org/assignments/tls-parameters/ + Format is PROTOCOL_KEYAGREEMENT_AUTHENTICATIONMECHANISM_CIPHER_MACPRIMITIVE + + + + + Parse ClientHello from stream. See Page 77 of SSL & TLS Essentials + + + + + Parse a single extension using the list from http://tools.ietf.org/html/rfc6066 + https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xml + https://src.chromium.org/viewvc/chrome/trunk/src/net/third_party/nss/ssl/sslt.h + + + + + + + Did client use ALPN to go to SPDY? + http://tools.ietf.org/html/draft-ietf-tls-applayerprotoneg-01#section-3.1 + + + + + Did this ServerHello Handshake specify an upgrade to SPDY? + + + + + Did this ServerHello Handshake specify an upgrade to SPDY? + + + + + Parse a single extension using the list from http://tools.ietf.org/html/rfc6066 + + + + + + + The Logger object is a simple event log message dispatcher + + + + + The Event to raise when a string is logged + + + + + Queue of Messages that are be logged (usually during application startup) until another object has loaded and registered for notification of such Messages + + + + + Creates a Logger object + + True if a queue should be created to store messages during Fiddler's startup + + + + Flushes previously-queued messages to the newly attached listener. + + + + + Log a string with specified string formatting + + The format string + The arguments to replace in the string + + + + Log a string + + The string to log + + + + EventArgs class for the LogEvent handler + + + + + The String which has been logged + + + + + The MockTunnel represents a CONNECT tunnel which was reloaded from a SAZ file. + + + + + Flags that indicate what problems, if any, were encountered in parsing HTTP headers + + + + + There were no problems parsing the HTTP headers + + + + + The HTTP headers ended incorrectly with \n\n + + + + + The HTTP headers ended incorrectly with \n\r\n + + + + + The HTTP headers were malformed. + + + + + The Parser class exposes static methods used to parse strings or byte arrays into HTTP messages. + + + + + Given a byte[] representing a request, determines the offsets of the components of the line. WARNING: Input MUST contain a LF or an exception will be thrown + + Byte array of the request + Returns the index of the byte of the URI in the Request line + Returns the length of the URI in the Request line + Returns the index of the first byte of the name/value header pairs + + + + + + + Index of final byte of headers, if found, or location that search should resume next time + + + + + + + Parse out HTTP Header lines. + + Header collection to *append* headers to + Array of Strings + Index into array at which parsing should start + String containing any errors encountered + TRUE if there were no errors, false otherwise + + + + Given a byte array, determines the Headers length + + Input array of data + Returns the calculated length of the headers. + Returns the calculated start of the response body. + Any HTTPHeaderParseWarnings discovered during parsing. + True, if the parsing was successful. + + + + Given a MemoryStream, attempts to parse a HTTP Request starting at the current position. + + TRUE if a request could be parsed, FALSE otherwise + + + + Given a MemoryStream, attempts to parse a HTTP Response starting at the current position + + TRUE if a response could be parsed, FALSE otherwise + + + + Parse the HTTP Request into a headers object. + + The HTTP Request string, including *at least the headers* with a trailing CRLFCRLF + HTTPRequestHeaders parsed from the string. + + + + Break headers off, then convert CRLFs into LFs + + + + + + + Parse the HTTP Response into a headers object. + + The HTTP response as a string, including at least the headers. + HTTPResponseHeaders parsed from the string. + + + + Class allows finding the end of a body sent using Transfer-Encoding: Chunked + + + + + Number of bytes in the body (sans chunk headers, CRLFs, and trailers) + + + + + + Read the first character of the hexadecimal size + + + + + Read the first character of the next Trailer header (if any) + + + + + We're in a trailer. Read up to the next \r + + + + + We've just read a trailer CR, now read its LF + + + + + We read a CR on an "empty" Trailer line, so now we just need the final LF + + + + + The chunked body was successfully read with no excess + + + + + Completed, but we read too many bytes. Call getOverage to return how many bytes to put back + + + + + The body was malformed + + + + + Somewhat similar to the Framework's "BackgroundWorker" class, the periodic worker performs a similar function on a periodic schedule. + NOTE: the callback occurs on a background thread. + + The PeriodicWorker class is used by Fiddler to perform "cleanup" style tasks on a timer. Put work in the queue, + and it will see that it's done at least as often as the schedule specified until Fiddler begins to close at which + point all work stops. + + + The underlying timer's interval is 1 second. + + + + I think a significant part of the reason that this class exists is that I thought the System.Threading.Timer consumed one thread for each + timer. In reality, per "CLR via C# 4e" all of the instances share one underlying thread and thus my concern was misplaced. Ah well. + + + + + Assigns a "job" to the Periodic worker, on the schedule specified by iMS. + + The function to run on the timer specified. + Warning: the function is NOT called on the UI thread, so use .Invoke() if needed. + The # of milliseconds to wait between runs + A taskItem which can be used to revokeWork later + + + + Revokes a previously-assigned task from this worker. + + + + + + The ScheduledTasks class allows addition of jobs by name. It ensures that ONE instance of the named + job will occur at *some* point in the future, between 0 and a specified max delay. If you queue multiple + instances of the same-named Task, it's only done once. + + + + + Under the lock, we enumerate the schedule to find work to do and remove that work from the schedule. + After we release the lock, we then do the queued work. + + + + + + A jobItem represents a Function+Time tuple. The function will run after the given time. + + + + + TickCount at which this job must run. + + + + + Method to invoke to complete the job + + + + + Abstract base class for the ClientPipe and ServerPipe classes. A Pipe represents a connection to either the client or the server, optionally encrypted using SSL/TLS. + + + + + The base socket wrapped in this pipe + + + + + The number of times that this Pipe has been used + + + + + The HTTPS stream wrapped around the base socket + + + + + The display name of this Pipe + + + + + Number of milliseconds to delay each 1024 bytes transmitted + + + + + Create a new pipe, an enhanced wrapper around a socket + + Socket which this pipe wraps + Identification string used for debugging purposes + + + + Return the Connected status of the base socket. + WARNING: This doesn't work as you might expect; you can see Connected == false when a READ timed out but a WRITE will succeed. + + + + + Poll the underlying socket for readable data (or closure/errors) + + TRUE if this Pipe requires attention + + + + Returns a bool indicating if the socket in this Pipe is CURRENTLY connected and wrapped in a SecureStream + + + + + Returns the SSL/TLS protocol securing this connection + + + + + Return the Remote Port to which this socket is attached. + + + + + Return the Local Port to which the base socket is attached. Note: May return a misleading port if the ISA Firewall Client is in use. + + + + + Returns the remote address to which this Pipe is connected, or 0.0.0.0 on error. + + + + + Gets or sets the transmission delay on this Pipe, used for performance simulation purposes. + + + + + Call this method when about to reuse a socket. Currently, increments the socket's UseCount and resets its transmit delay to 0. + + The session identifier of the new session, or zero + + + + Sends a byte array through this pipe + + The bytes + + + + Sends the data specified in oBytes (between iOffset and iOffset+iCount-1 inclusive) down the pipe. + + + + + + + + Receive bytes from the pipe into the DATA buffer. + + Throws IO exceptions from the socket/stream + Array of data read + Bytes read + + + + Return the raw socket this pipe wraps. Avoid calling this method if at all possible. + + The Socket object this Pipe wraps. + + + + Shutdown and close the socket inside this pipe. Eats exceptions. + + + + + Abruptly closes the socket by sending a RST packet + + + + + A ClientPipe wraps a socket connection to a client application. + + + + + By default, we now test for loopbackness before lookup of PID + https://github.com/telerik/fiddler/issues/83 + + + + + Timeout to wait for the *first* data from the client + + + + + Timeout to wait for the ongoing reads from the client (as headers and body are read) + + + + + Timeout before which an idle connection is closed (e.g. for HTTP Keep-Alive) + + + + + Client process name (e.g. "iexplore") + + + + + Client process ProcessID + + + + + Data which was previously "over-read" from the client. Populated when HTTP-pipelining is attempted + + + + + ID of the process that opened this socket, assuming that Port Mapping is enabled, and the connection is from the local machine + + + + + Does this Pipe have data (or closure/errors) to read? + + TRUE if this Pipe requires attention + + + + If you previously read more bytes than you needed from this client socket, you can put some back. + + Array of bytes to put back; now owned by this object + + + + Name of the Process referred to by LocalProcessID, or String.Empty if unknown + + + + + Sets the socket's timeout based on whether we're waiting for our first read or for an ongoing read-loop + + + + + Returns a semicolon-delimited string describing this ClientPipe + + A semicolon-delimited string + + + + Perform a HTTPS Server handshake to the client. Swallows exception and returns false on failure. + + + + + + + This function sends the client socket a CONNECT ESTABLISHED, and then performs a HTTPS authentication + handshake, with Fiddler acting as the server. + + Hostname Fiddler is pretending to be (NO PORT!) + The set of headers to be returned to the client in response to the client's CONNECT tunneling request + true if the handshake succeeds + + + + Timestamp of either 1> The underlying socket's creation from a .Accept() call, or 2> when this ClientPipe was created. + + + + + The PipePool maintains a collection of connected ServerPipes for reuse + + + + + Minimum idle time of pipes to be expired from the pool. + Note, we don't check the pipe's ulLastPooled value when extracting a pipe, + so its age could exceed the allowed lifetime by up to MSEC_POOL_CLEANUP_INTERVAL + WARNING: Don't change the timeout >2 minutes casually. Server bugs apparently exist: https://bugzilla.mozilla.org/show_bug.cgi?id=491541 + + + + + The Pool itself. + + + + + Time at which a "Clear before" operation was conducted. We store this + so that we don't accidentally put any pipes that were in use back into + the pool after a clear operation + + + + + Remove any pipes from Stacks if they exceed the age threshold + Remove any Stacks from pool if they are empty + + + + + Clear all pooled Pipes, calling .End() on each. + + + + + Return a string representing the Pipes in the Pool + + A string representing the pipes in the pool + + + + Get a Server connection for reuse, or null if a suitable connection is not in the pool. + + The key which identifies the connection to search for. + The ProcessID of the client requesting the Pipe + HACK to be removed; the SessionID# of the request for logging + A Pipe to reuse, or NULL + + + + Store a pipe for later use, if reuse is allowed by settings and state of the pipe. + + The Pipe to place in the pool + + + + This class holds a specialized memory stream with growth characteristics more suitable for reading from a HTTP Stream. + The default MemoryStream's Capacity will always grow to 256 bytes, then at least ~2x current capacity up to 1gb (2gb on .NET 4.6), then to the exact length after that. + That has three problems: + + The capacity may unnecessarily grow to >85kb, putting the object on the LargeObjectHeap even if we didn't really need 85kb. + On 32bit, we may hit a Address Space exhaustion ("Out of memory" exception) prematurely and unnecessarily due to size-doubling + After the capacity reaches 1gb in length, the capacity growth never exceeds the length, leading to huge reallocations and copies on every write (fixed in .NET 4.6) + + This class addresses those issues. http://textslashplain.com/2015/08/06/tuning-memorystream/ + + + + + A client may submit a "hint" of the expected size. We use that if present. + + + + + Used by the caller to supply a hint on the expected total size of reads from the pipe. + We cannot blindly trust this value because sometimes the client or server will lie and provide a + huge value that it will never use. This is common for RPC-over-HTTPS tunnels like that used by + Outlook, for instance. + + The Content-Length can also lie by underreporting the size. + + Suggested total buffer size in bytes + + + + The policy which describes how this pipe may be reused by a later request. Ordered by least restrictive to most. + + + + + The ServerPipe may be freely reused by any subsequent request + + + + + The ServerPipe may be reused only by a subsequent request from the same client process + + + + + The ServerPipe may be reused only by a subsequent request from the same client pipe + + + + + The ServerPipe may not be reused for a subsequent request + + + + + A ServerPipe wraps a socket connection to a server. + + + + + Policy for reuse of this pipe + + + + + DateTime of the completion of the TCP/IP Connection + + + + + TickCount when this Pipe was last placed in a PipePool + + + + + Returns TRUE if this ServerPipe is connected to a Gateway + + + + + Returns TRUE if this ServerPipe is connected to a SOCKS gateway + + + + + The Pooling key used for reusing a previously pooled ServerPipe. See sPoolKey property. + + + + + This field, if set, tracks the process ID to which this Pipe is permanently bound; set by MarkAsAuthenticated. + NOTE: This isn't actually checked by anyone; instead the PID is added to the POOL Key + + + + + Backing field for the isAuthenticated property + + + + + String containing representation of the server's certificate chain + + + + + Server's certificate + + + + + Wraps a socket in a Pipe + + The Socket + Pipe's human-readable name + True if the Pipe is attached to a gateway + The Pooling key used for socket reuse + + + + Returns TRUE if there is an underlying, mutually-authenticated HTTPS stream. + + WARNING: Results are a bit of a lie. System.NET IsMutuallyAuthenticated == true if a client certificate is AVAILABLE even + if that certificate was never SENT to the server. + + + + + Returns TRUE if this PIPE is marked as having been authenticated using a Connection-Oriented Auth protocol: + NTLM, Kerberos, or HTTPS Client Certificate. + + + + + Marks this Pipe as having been authenticated. Depending on the preference "fiddler.network.auth.reusemode" this may impact the reuse policy for this pipe + + The client's process ID, if known. + + + + Indicates if this pipe is connected to an upstream (non-SOCKS) Proxy. + + + + + Indicates if this pipe is connected to a SOCKS gateway + + + + + Sets the receiveTimeout based on whether this is a freshly opened server socket or a reused one. + + + + + Returns a semicolon-delimited string describing this ServerPipe + + A semicolon-delimited string + + + + Gets and sets the pooling key for this server pipe. + + + direct->{http|https}/{serverhostname}:{serverport} + gw:{gatewayaddr:port}->* + gw:{gatewayaddr:port}->{http|https}/{serverhostname}:{serverport} + socks:{gatewayaddr:port}->{http|https}/{serverhostname}:{serverport} + + + + + Returns the Server's certificate Subject CN (used by "x-UseCertCNFromServer") + + The *FIRST* CN field from the Subject of the certificate used to secure this HTTPS connection, or null if the connection is unsecure + + + + Return a string describing the HTTPS connection security, if this socket is secured + + A string describing the HTTPS connection's security. + + + + Returns a string describing how this connection is secured. + + + + + + Get the Transport Context for the underlying HTTPS connection so that Channel-Binding Tokens work correctly + + + + + + Returns the IPEndPoint to which this socket is connected, or null + + + + + Get the user's default client cert for authentication; caching if if possible and permitted. + + + + + + This method is called by the HTTPS Connection establishment to optionally attach a client certificate to the request. + Test Page: https://tower.dartmouth.edu/doip/OracleDatabases.jspx or ClientCertificate.ms in Test folder should request on initial connection + In contrast, this one: https://roaming.officeapps.live.com/rs/roamingsoapservice.svc appears to try twice (renego) + + + + + + + + + + + This function secures an existing connection and authenticates as client. This is primarily useful when + the socket is connected to a Gateway/Proxy and we had to send a CONNECT and get a HTTP/200 Connected back before + we actually secure the socket. + http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx + + The Session (a CONNECT) this tunnel wraps + The CN to use in the certificate + Path to client certificate file + The HTTPS protocol version of the Client Pipe; can influence which SslProtocols we offer the server + Reference-passed integer which returns the time spent securing the connection + TRUE if the connection can be secued + + + + Return a Certificate Collection containing certificate from the specified file. + + Path to the certificate. Relative Paths will be absolutified automatically + The Certificate collection, or null + + + + This class allows fast-lookup of a ProcessName from a ProcessID. + + + + + Static constructor which registers for cleanup + + + + + Prune the cache of expiring PIDs + + + + + Map a Process ID (PID) to a Process Name + + The PID + A Process Name (e.g. IEXPLORE.EXE) or String.Empty + + + + Structure mapping a Process ID (PID) to a ProcessName + + + + + The TickCount when this entry was created + + + + + The ProcessName (e.g. IEXPLORE.EXE) + + + + + Create a PID->ProcessName mapping + + The ProcessName (e.g. IEXPLORE.EXE) + + + + The core proxy object which accepts connections from clients and creates session objects from those connections. + + + + + Hostname if this Proxy Endpoint is terminating HTTPS connections + + + + + Certificate if this Proxy Endpoint is terminating HTTPS connections + + + + + Per-connectoid information about each WinINET connectoid + + + + + The upstream proxy settings. + + + + + The AutoProxy object, created if we're using WPAD or a PAC Script as a gateway + + + + + Allow binding to a specific egress adapter: "fiddler.network.egress.ip" + + + + + Watcher for Notification of Preference changes + + + + + Server connections may be pooled for performance reasons. + + + + + The Socket Endpoint on which this proxy receives requests + + + + + Flag indicating that Fiddler is in the process of detaching... + + + + + List of hosts which should bypass the upstream gateway + + + + + Returns a string of information about this instance and the ServerPipe reuse pool + + A multiline string + + + + Returns true if the proxy is listening on a port. + + + + + The port on which this instance is listening + + + + + Returns true if Fiddler believes it is currently registered as the Local System proxy + + + + + This event handler fires when Fiddler detects that it is (unexpectedly) no longer the system's registered proxy + + + + + Change the outbound IP address used to send traffic + + + + + + Watch for relevent changes on the Preferences object + + + + + + + Called whenever Windows reports that the system's NetworkAddress has changed + + + + + + + Called by Windows whenever network availability goes up or down. + + + + + + + Directly inject a session into the Fiddler pipeline, returning a reference to it. + NOTE: This method will THROW any exceptions to its caller. + + HTTP Request Headers + HTTP Request body (or null) + StringDictionary of Session Flags (or null) + The new Session + + + + Directly inject a session into the Fiddler pipeline, returning a reference to it. + NOTE: This method will THROW any exceptions to its caller. + + HTTP Request Headers + HTTP Request body (or null) + StringDictionary of Session Flags (or null) + Event Handler to notify when the session changes state + The new Session + + + + Directly inject a session into the Fiddler pipeline, returning a reference to it. + NOTE: This method will THROW any exceptions to its caller. + + String representing the HTTP request. If headers only, be sure to end with CRLFCRLF + StringDictionary of Session Flags (or null) + The new session + + + + [DEPRECATED] Directly inject a session into the Fiddler pipeline. + NOTE: This method will THROW any exceptions to its caller. + + + HTTP Request Headers + HTTP Request body (or null) + StringDictionary of Session Flags (or null) + + + + [DEPRECATED] Directly inject a session into the Fiddler pipeline. + NOTE: This method will THROW any exceptions to its caller. + + + String representing the HTTP request. If headers only, be sure to end with CRLFCRLF + StringDictionary of Session Flags (or null) + + + + [DEPRECATED]: This version does no validation of the request data, and doesn't set SessionFlags.RequestGeneratedByFiddler + Send a custom HTTP request to Fiddler's listening endpoint (127.0.0.1:8888 by default). + NOTE: This method will THROW any exceptions to its caller and blocks the current thread. + + + String representing the HTTP request. If headers only, be sure to end with CRLFCRLF + + + + This function, when given a scheme host[:port], returns the gateway information of the proxy to forward requests to. + + URIScheme: use http, https, or ftp + Host for which to return gateway information + IPEndPoint of gateway to use, or NULL + + + + Accept the connection and pass it off to a handler thread + + + + + + Register as the system proxy for WinINET and set the Dynamic registry key for other FiddlerHook + + True if the proxy registration was successful + + + + If we get a notice that the proxy registry key has changed, wait 50ms and then check to see + if the key is pointed at us. If not, raise the alarm. + + + + + + + If we are supposed to be "attached", we re-verify the registry keys, and if they are corrupt, notify + our host of the discrepency. + + + + + This method sets up the connectoid list and updates gateway information. Called by the Attach() method, or + called on startup if Fiddler isn't configured to attach automatically. + + + + + Given an address list, walks the list until it's able to successfully make a connection. + Used for finding an available Gateway when we have a list to choose from + + A string, e.g. PROXY1:80 + The IP:Port of the first alive endpoint for the specified host/port + + + + Set internal fields pointing at upstream proxies. + + + + + Detach the proxy by setting the registry keys and sending a Windows Message + + True if the proxy settings were successfully detached + + + + Detach the proxy by setting the registry keys and sending a Windows Message + + True if the proxy settings were successfully detached + + + + Stop the proxy by closing the socket. + + + + + Start the proxy by binding to the local port and accepting connections + + Port to listen on + TRUE to allow remote connections + + + + + Dispose Fiddler's listening socket + + + + + Clear the pool of Server Pipes. May be called by extensions. + + + + + Assign HTTPS Certificate for this endpoint + + Certificate to return to clients who connect + + + + Sets the upstream gateway to match the specified ProxySettings + + + + + + Generate or find a certificate for this endpoint + + Subject FQDN + TRUE if the certificate could be found/generated, false otherwise + + + + Return a simple string indicating what upstream proxy/gateway is in use. + + + + + + This class maintains the Proxy Bypass List for the upstream gateway. + In the constructor, pass the desired proxy bypass string, as retrieved from WinINET for the Options screen. + Then, call the IsBypass(sTarget) method to determine if the Gateway should be bypassed + + + + + List of regular expressions for matching against request Scheme://HostPort. + NB: This list is either null or contains at least one item. + + + + + Boolean flag indicating whether the bypass list contained a <local> token. + + + + + Pass the desired proxy bypass string retrieved from WinINET. + + + + + + Does the bypassList contain any rules at all? + + + + + Given the rules for this bypasslist, should this target bypass the proxy? + + The URI Scheme + The Host and PORT + True if this request should not be sent to the gateway proxy + + + + Convert the string representing the bypass list into an array of rules escaped and ready to be turned into regular expressions + + + + + + The ServerChatter object is responsible for transmitting the Request to the destination server and retrieving its Response. + + + This class maintains its own PipeReadBuffer that it fills from the created or reused ServerPipe. After it determines that + a complete response is present, it allows the caller to grab that array using the TakeEntity method. If + unsatisfied with the result (e.g. a network error), the caller can call Initialize() and SendRequest() again. + + + + + Size of buffer passed to pipe.Receive when reading from the server + + + PERF: Currently, I use [32768]; but I'd assume bigger buffers are faster. Does ReceiveBufferSize/SO_RCVBUF figure in here? + Anecdotal data suggests that current reads rarely fill the full 32k buffer. + + + + + Interval, in milliseconds, after which Fiddler will check to see whether a response should continue to be read. Otherwise, + a never-ending network stream can accumulate ever larger amounts of data that will never be seen by the garbage collector. + + + + + The pipeServer represents Fiddler's connection to the server. + + + + + The session to which this ServerChatter belongs + + + + + The inbound headers on this response + + + + + Indicates whether this request was sent to a (non-SOCKS) Gateway, which influences whether the protocol and host are + mentioned in the Request line + When True, the session should have SessionFlags.SentToGateway set. + + + + + Buffer holds this response's data as it is read from the pipe. + + + + + The total count of bytes read for this response. Typically equals m_responseData.Length unless + Streaming & Log-Drop-Response-Body - in which case it will be larger since the m_responseData is cleared after every read. + + BUG BUG: This value is reset to 0 when clearing streamed data. It probably shouldn't be; the problem is that this field is getting used for two purposes + + + + + Pointer to first byte of Entity body (or to the start of the next set of headers in the case where there's a HTTP/1xx intermediate header) + Note: This gets reset to 0 if we're streaming and dropping the response body. + + + + + Optimization: tracks how far we've looked into the Request when determining iEntityBodyOffset + + + + + True if final (non-1xx) HTTP Response headers have been returned to the client. + + + + + Indicates how much of _responseData buffer has already been streamed to the client + + + + + Position in responseData of the start of the latest parsed chunk size information + + + + + Locals used by the Connect-to-Host state machine + + + + + The ExecutionState object holds information that is used by the Connect-to-Host state machine + + + + + Peek at number of bytes downloaded thus far. + + + + + Get the MIME type (sans Character set or other attributes) from the HTTP Content-Type response header, or String.Empty if missing. + + + + + DEPRECATED: You should use the Timers object on the Session object instead. + The number of milliseconds between the start of sending the request to the server to the first byte of the server's response + + + + + DEPRECATED: You should use the Timers object on the Session object instead. + The number of milliseconds between the start of sending the request to the server to the last byte of the server's response. + + + + + Was this request forwarded to a gateway? + + + + + Was this request serviced from a reused server connection? + + + + + The HTTP headers of the server's response + + + + + Simple indexer into the Response Headers object + + + + + Create a ServerChatter object and initialize its headers from the specified string + + + + + + + Reset the response-reading fields on the object. Also used on a retry. + + If TRUE, allocates a buffer (m_responseData) to read from a pipe. If FALSE, nulls m_responseData. + + + + Peek at the current response body and return it as an array + + The response body as an array, or byte[0] + + + + Get the response body byte array from the PipeReadBuffer, then dispose of it. + + WARNING: This eats all of the bytes in the Pipe, even if that includes bytes of a + future, as-yet-unrequested response. Fiddler does not pipeline requests, so that works okay for now. + For now, the caller should validate that the returned entity is of the expected size (e.g. based on Content-Length) + + + + + Scans responseData stream for the \r\n\r\n (or variants) sequence + which indicates that the header block is complete. + + SIDE EFFECTS: + iBodySeekProgress is updated and maintained across calls to this function + iEntityBodyOffset is updated if the end of headers is found + + True, if responseData contains a full set of headers + + + + Parse the HTTP Response into Headers and Body. + + + + + + Attempt to pull the final (non-1xx) Headers from the stream. If HTTP/100 messages are found, the method + will recurse into itself to find the next set of headers. + + + + + Deletes a single HTTP/1xx header block from the Response stream + and adjusts all header-reading state to start over from the top of the stream. + Note: If 'fiddler.network.leakhttp1xx' is TRUE, then the 1xx message will have been leaked before calling this method. + + + + + Adjusts PipeServer's ReusePolicy if response headers require closure. Then calls _detachServerPipe() + + + + + Queues or End()s the ServerPipe, depending on its ReusePolicy + + + + + Determines whether a given PIPE is suitable for a given Session, based on that Session's SID + + The Client Process ID, if any + The base (no PID) PoolKey expected by the session + The pipe's pool key + TRUE if the connection should be used, FALSE otherwise + + + + If a Connection cannot be established, we need to report the failure to our caller + + + + + + Given an address list and port, attempts to create a socket to the first responding host in the list (retrying via DNS Failover if needed). + + IPEndpoints to attempt to reach + Session object to annotate with timings and errors + Connected Socket. Throws Exceptions on errors. + + + + If the Session was configured to stream the request body, we need to read from the client + and send it to the server here. + + + FALSE on transfer error, TRUE otherwise. + + + + + Sends (or resends) the Request to the server or upstream proxy. If the request is a CONNECT and there's no + gateway, this method ~only~ establishes the connection to the target, but does NOT send a request. + + Note: THROWS on failures + + + + + May request be resent on a different connection because the .Send() of the request did not complete? + + TRUE if the request may be resent + + + + Performs a SOCKSv4A handshake on the socket + + + + + Build the SOCKS4 outbound connection handshake as a byte array. + http://en.wikipedia.org/wiki/SOCKS#SOCKS4a + + + + + Replaces body with an error message + + Error to send if client was remote + Error to send if cilent was local + + + + The Session object will call this method if it wishes to stream a file from disk instead + of loading it into memory. This method sets default headers. + + + + + + Loads a HTTP response from a file + + The name of the file from which a response should be loaded + False if the file wasn't found. Throws on other errors. + + + + Reads the response from the ServerPipe. + + TRUE if a response was read + + + + When the headers first arrive, update bBufferResponse based on their contents. + + + + + Detects whether this is an direct FTP request and if so executes it and returns true. + + FALSE if the request wasn't FTP or wasn't direct. + + + + Remove from memory the response data that we have already returned to the client. + + + + + Remove from memory the response data that we have already returned to the client, up to the last chunk + size indicator, which we need to keep around for chunk-integrity purposes. + + + + + Leak the current bytes of the response to client. We wait for the full header + set before starting to stream for a variety of impossible-to-change reasons. + + Returns TRUE if response bytes were leaked, false otherwise (e.g. write error). THROWS if "fiddler.network.streaming.abortifclientaborts" is TRUE + + + + Mark this connection as non-reusable + + + + + The Session object manages the complete HTTP session including the UI listitem, the ServerChatter, and the ClientChatter. + + + + + This event fires when new session is created. + + + + + This event fires when one of its fields is changed + + + + + Should we try to use the SPNToken type? + Cached for performance reasons. + ISSUE: It's technically possible to use FiddlerCorev2/v3 on .NET/4.5 but we won't set this field if you do that. + + + + + Sorta hacky, we may use a .NET WebRequest object to generate a valid NTLM/Kerberos response if the server + demands authentication and the Session is configured to automatically respond. + + + + + Used if the Session is bound to a WebSocket or CONNECTTunnel + + + + + File to stream if responseBodyBytes is null + + + + + Bitflags of commonly-queried session attributes + + + + + DO NOT USE. TEMPORARY WHILE REFACTORING VISIBILITY OF MEMBERS + + + + + + + Sets or unsets the specified SessionFlag(s) + + SessionFlags + Desired set value + + + + Test the session's BitFlags + + One or more (OR'd) SessionFlags + TRUE if ALL specified flag(s) are set + + + + Test the session's BitFlags + + One or more (OR'd) SessionFlags + TRUE if ANY of specified flag(s) are set + + + + When a client socket is reused, this field holds the next Session until its execution begins + + + + + Should response be buffered for tampering. + + ARCH: This should have been a property instead of a field, so we could throw an InvalidStateException if code tries to manipulate this value after the response has begun + + + + Timers stored as this Session progresses + + + + + Field is set to False if socket is poisoned due to HTTP errors. + + + + + Returns True if this is a HTTP CONNECT tunnel. + + + + + Object representing the HTTP Response. + + + + + Object representing the HTTP Request. + + + + + Fiddler-internal flags set on the Session. + + TODO: ARCH: This shouldn't be exposed directly; it should be wrapped by a ReaderWriterLockSlim to prevent + exceptions while enumerating the flags for storage, etc + + + + A common use for the Tag property is to store data that is closely associated with the Session. + It is NOT marshalled during drag/drop and is NOT serialized to a SAZ file. + + + + + Contains the bytes of the request body. + + + + + Contains the bytes of the response body. + + + + + IP Address of the client for this session. + + + + + Client port attached to Fiddler. + + + + + IP Address of the server for this session. + + + + + Event object used for pausing and resuming the thread servicing this session + + + + + This event fires at any time the session's State changes. Use with caution due to the potential for performance impact. + + + + + This event fires if this Session automatically yields a new one, for instance, if Fiddler is configured to automatically + follow redirects or perform multi-leg authentication (X-AutoAuth). + + + + + If this session is a Tunnel, and the tunnel's IsOpen property is TRUE, returns TRUE. Otherwise returns FALSE. + + + + + If this session is a Tunnel, returns number of bytes sent from the Server to the Client + + + + + If this session is a Tunnel, returns number of bytes sent from the Client to the Server + + + + + Gets or Sets the HTTP Request body bytes. + Setter adjusts Content-Length header, and removes Transfer-Encoding and Content-Encoding headers. + Setter DOES NOT CLONE the passed array. + Setter will throw if the Request object does not exist for some reason. + Use utilSetRequestBody(sStr) to ensure proper character encoding if you need to use a string. + + + + + Gets or Sets the HTTP Response body bytes. + Setter adjusts Content-Length header, and removes Transfer-Encoding and Content-Encoding headers. + Setter DOES NOT CLONE the passed array. + Setter will throw if the Response object has not yet been created. (See utilCreateResponseAndBypassServer) + Use utilSetResponseBody(sStr) to ensure proper character encoding if you need to use a string. + + + + + When true, this session was conducted using the HTTPS protocol. + + + + + When true, this session was conducted using the FTP protocol. + + + + + Returns TRUE if the Session's HTTP Method is available and matches the target method. + + The target HTTP Method being compared. + true, if the method is specified and matches sTestFor (case-insensitive); otherwise false. + + + + Returns TRUE if the Session's target hostname (no port) matches sTestHost (case-insensitively). + + The host to which this session's host should be compared. + True if this session is targeted to the specified host. + + + + Get the process ID of the application which made this request, or 0 if it cannot be determined. + + + + + Get the Process Info of the application which made this request, or String.Empty if it is not known + + + + + Replaces any characters in a filename that are unsafe with safe equivalents, and trim to 160 characters. + + + + + + + Gets a path-less filename suitable for saving the Response entity. Uses Content-Disposition if available. + + + + + Examines the MIME type, and if ambiguous, returns sniffs the body. + + + + + + Set to true in OnBeforeRequest if this request should bypass the gateway + + + + + Returns the port used by the client to communicate to Fiddler. + + + + + State of session. Note Side-Effects: If setting to .Aborted, calls FinishUISession. If setting to/from a Tamper state, calls RefreshMyInspectors + + + + + Notify extensions if this Session naturally led to another (e.g. due to redirect chasing or Automatic Authentication) + + The original session + The new session created + + + + Returns the path and query part of the URL. (For a CONNECT request, returns the host:port to be connected.) + + + + + Retrieves the complete URI, including protocol/scheme, in the form http://www.host.com/filepath?query. + Or sets the complete URI, adjusting the UriScheme and/or Host. + + + + + Gets or sets the URL (without protocol) being requested from the server, in the form www.host.com/filepath?query. + + + + + DNS Name of the host server targeted by this request. May include IPv6 literal brackets. NB: a port# may be included. + + + + + DNS Name of the host server (no port) targeted by this request. Will include IPv6-literal brackets for IPv6-literal addresses + + + + + Returns the server port to which this request is targeted. + + + + + Returns the sequential number of this session. Note, by default numbering is restarted at zero when the session list is cleared. + + + + + Returns the Address used by the client to communicate to Fiddler. + + + + + Gets or Sets the HTTP Status code of the server's response + + + + + Returns HTML representing the Session. Call Utilities.StringToCF_HTML on the result of this function before placing it on the clipboard. + + TRUE if only the headers should be copied. + A HTML-formatted fragment representing the current session. + + + + Store this session's request and response to a string. + + If true, return only the request and response headers + String representing this session + + + + Store this session's request and response to a string. + + A string containing the content of the request and response. + + + + This method resumes the Session's thread in response to "Continue" commands from the UI + + + + + Set the SessionFlags.Ignore bit for this Session, also configuring it to stream, drop read data, and bypass event handlers. + For a CONNECT Tunnel, traffic will be blindly shuffled back and forth. Session will be hidden. + + + + + Called by an AcceptConnection-spawned background thread, create a new session object from a client socket + and execute the session + + Parameter object defining client socket and endpoint's HTTPS certificate, if present + + + + Call this method to AuthenticateAsServer on the client pipe (e.g. Fiddler itself is acting as a HTTPS server). + If configured, the pipe will first sniff the request's TLS ClientHello ServerNameIndicator extension. + + The default certificate to use + TRUE if a HTTPS handshake was achieved; FALSE for any exceptions or other errors. + + + + Call this function while in the "reading response" state to update the responseBodyBytes array with + the partially read response. + + TRUE if the peek succeeded; FALSE if not in the ReadingResponse state + + + + Prevents the server pipe from this session from being pooled for reuse + + + + + Ensures that, after the response is complete, the client socket is closed and not reused. + Does NOT (and must not) close the pipe. + + + + + Immediately close client and server sockets. Call in the event of errors-- doesn't queue server pipes for future reuse. + + + + + + Closes both client and server pipes and moves state to Aborted; unpauses thread if paused. + + + + + Checks whether this is a WebSocket, and if so, whether it has logged any parsed messages. + + + + + Returns TRUE if this session's State > ReadingResponse, and oResponse, oResponse.headers, and responseBodyBytes are all non-null. Note that + bHasResponse returns FALSE if the session is currently reading, even if a body was copied using the COMETPeek feature + + + + + Save HTTP response body to Fiddler Captures folder. You likely want to call utilDecodeResponse first. + + True if the response body was successfully saved + + + + Save HTTP response body to specified location. You likely want to call utilDecodeResponse first. + + The name of the file to which the response body should be saved. + True if the file was successfully written. + + + + Save the request body to a file. You likely want to call utilDecodeRequest first. + + The name of the file to which the request body should be saved. + True if the file was successfully written. + + + + Save the request and response to a single file. + + The filename to which the session should be saved. + TRUE if only the headers should be written. + + + + Save the request to a file. + The headers' Request Line will not contain the scheme or host, which is probably not what you want. + + The name of the file to which the request should be saved. + TRUE to save only the headers + + + + Save the request to a file. Throws if file cannot be written. + + The name of the file to which the request should be saved. + TRUE to save only the headers. + TRUE to include the Scheme and Host in the Request Line. + + + + Read metadata about this session from a stream. NB: Closes the Stream when done. + + The stream of XML text from which session metadata will be loaded. + True if the Metadata was successfully loaded; False if any exceptions were trapped. + + + + Writes this session's metadata to a file. + + The name of the file to which the metadata should be saved in XML format. + True if the file was successfully written. + + + + Saves the response (headers and body) to a file + + The File to write + TRUE if only heaers should be written + + + + Write the metadata about this Session to a stream. The Stream is left open! + + The Stream to write to + + + + Write the session's Request to the specified stream + + TRUE if only the headers should be be written + TRUE if the Scheme and Host should be written in the Request Line + The Stream to which the request should be written + True if the request was written to the stream. False if the request headers do not exist. Throws on other stream errors. + + + + Write the session's Request to the specified stream + + TRUE if only the headers should be be written + TRUE if the Scheme and Host should be written in the Request Line + TRUE if binary bodies should be encoded in base64 for text-safe transport (e.g. used by Composer drag/drop) + The Stream to which the request should be written + True if the request was written to the stream. False if the request headers do not exist. Throws on other stream errors. + + + + Write the session's Response to the specified stream + + The stream to which the response should be written + TRUE if only the headers should be written + TRUE if the response was written to the stream. False if the response headers do not exist. Throws on other stream errors. + + + + Write the session to the specified stream + + The stream to which the session should be written + TRUE if only the request and response headers should be written + False on any exceptions; True otherwise + + + + Replace HTTP request body using the specified file. + + The file containing the request + True if the file was successfully loaded as the request body + + + + Replace HTTP response headers and body using the specified stream. + + The stream containing the response. + True if the Stream was successfully loaded. + + + + Replace HTTP response headers and body using the specified file. + + The file containing the response. + True if the file was successfully loaded. + + + + Return a string generated from the request body, decoding it and converting from a codepage if needed. Throws on errors. + + A string containing the request body. + + + + Return a string generated from the response body, decoding it and converting from a codepage if needed. Throws on errors. + + A string containing the response body. + + + + Find the text encoding of the request + WARNING: Will not decompress body to scan for indications of the character set + + Returns the Encoding of the requestBodyBytes + + + + Find the text encoding of the response + WARNING: Will not decompress body to scan for indications of the character set + + The Encoding of the responseBodyBytes + + + + Returns true if the absolute request URI contains the specified string. Case-insensitive. + + Case-insensitive string to find + TRUE if the URI contains the string + + + + Removes chunking and HTTP Compression from the Response. Adds or updates Content-Length header. + + Returns TRUE if the response was decoded; returns FALSE on failure, or if response didn't have headers that showed encoding. + + + + Removes chunking and HTTP Compression from the Response. Adds or updates Content-Length header. + + TRUE if error messages should be suppressed. False otherwise. + TRUE if the decoding was successsful. + + + + Removes chunking and HTTP Compression from the Request. Adds or updates Content-Length header. + + Returns TRUE if the request was decoded; returns FALSE on failure, or if request didn't have headers that showed encoding. + + + + Use GZIP to compress the request body. Throws exceptions to caller. + + TRUE if compression succeeded + + + + Use GZIP to compress the response body. Throws exceptions to caller. + + TRUE if compression succeeded + + + + Use DEFLATE to compress the response body. Throws exceptions to caller. + + TRUE if compression succeeded + + + + Use BZIP2 to compress the response body. Throws exceptions to caller. + + TRUE if compression succeeded + + + + Introduces HTTP Chunked encoding on the response body + + The number of chunks to try to create + TRUE if the chunking could be performed. + + + + Perform a string replacement on the request body. Adjusts the Content-Length header if needed. + + The case-sensitive string to search for. + The text to replace. + TRUE if one or more replacements occurred. + + + + Call inside OnBeforeRequest to create a response object and bypass the server. + + + + + Perform a regex-based string replacement on the response body. Adjusts the Content-Length header if needed. + + The regular expression used to search the body. Specify RegEx Options via leading Inline Flags, e.g. (?im) for case-Insensitive Multi-line. + The text or expression used to replace + TRUE if replacements occured + + + + Perform a string replacement on the response body (potentially multiple times). Adjust the Content-Length header if needed. + + String to find (case-sensitive) + String to use to replace + TRUE if replacements occurred + + + + Perform a one-time string replacement on the response body. Adjust the Content-Length header if needed. + + String to find (case-sensitive) + String to use to replace + TRUE for Case-Sensitive + TRUE if a replacement occurred + + + + Replaces the request body with sString. Sets Content-Length header and removes Transfer-Encoding/Content-Encoding. + + The desired request Body as a string + + + + Replaces the response body with sString. Sets Content-Length header and removes Transfer-Encoding/Content-Encoding + + The desired response Body as a string + + + + Add a string to the top of the response body, updating Content-Length. (Call utilDecodeResponse first!) + + The string to prepend + + + + Find a string in the request body. Return its index, or -1. + + Term to search for + Require case-sensitive match? + Location of sSearchFor,or -1 + + + + Find a string in the response body. Return its index, or -1. + + Term to search for + Require case-sensitive match? + Location of sSearchFor,or -1 + + + + Reset the SessionID counter to 0. This method can lead to confusing UI, so use sparingly. + + + + + Create a Session object from two byte[] representing request and response. + + The client data bytes + The server data bytes + + + + Create a Session object from a (serializable) SessionData object + + + + + + Create a Session object from two byte[] representing request and response. This is used when loading a Session Archive Zip. + + The client data bytes + The server data bytes + SessionFlags for this session + + + + Creates a new session and attaches it to the pipes passed as arguments + + The client pipe from which the request is read and to which the response is written. + The server pipe to which the request is sent and from which the response is read. May be null. + + + + Initialize a new session from a given request headers and body request builder data. Note: No Session ID is assigned here. + + NB: If you're copying an existing request, use oRequestHeaders.Clone() + The bytes of the request's body + + + + Copy Constructor. . + + Session to clone into a new Session instance + + + + Factory constructor + + + + + + + + + + + + Indexer property into SESSION flags, REQUEST headers, and RESPONSE headers. e.g. oSession["Request", "Host"] returns string value for the Request host header. If null, returns String.Empty + + SESSION, REQUEST or RESPONSE + The name of the flag or header + String value or String.Empty + + + + Simple indexer into the Session's oFlags object; returns null if flag is not present. + + + Returns the string value if the specified flag is present, or null if it is not. + + + + + Called when the Session is ready to begin processing. Eats exceptions to prevent unhandled exceptions on background threads from killing the application. + + Unused parameter (required by ThreadPool) + + + + Current step in the SessionProcessing State Machine + + + + + InnerExecute() implements Fiddler's HTTP Pipeline + + + + + Initiate bi-directional streaming on the RPC connection + + + + + Ensure that the Session's state is >= ss, updating state if necessary + + TargetState + + + + May this Session be resent on a different connection because reading of the response did not succeed? + + TRUE if the entire session may be resent on a new connection + + + + If the response demands credentials and the Session is configured to have Fiddler provide those + credentials, try to do so now. + + TRUE if Fiddler has generated a response to an Auth challenge; FALSE otherwise. + + + + This method will perform obtain authentication credentials from System.NET using a reflection trick to grab the internal value. + It's needed to cope with Channel-Binding-Tokens (CBT). + + This MUST live within its own non-inlined method such that when it's run on an outdated version of the .NET Framework, the outdated + version of the target object triggers a TypeLoadException in such a way that the caller can catch it and warn the user without + killing Fiddler.exe. + + TRUE if we didn't hit any exceptions + + + + Copies process-owner information from a source session to a destination session. Used during handling of AutoRedirects + and auto-Authentications + + + + + + Returns a Kerberos-usable SPN for the target + http://dev.chromium.org/developers/design-documents/http-authentication + "HttpAuthHandlerNegotiate::CreateSPN" + http://blog.michelbarneveld.nl/michel/archive/2009/11/14/the-reason-why-kb911149-and-kb908209-are-not-the-soluton.aspx + + + + + + + Returns the fully-qualified URL to which this Session's response points, or null. + This method is needed because many servers (illegally) return a relative url in HTTP/3xx Location response headers. + + null, or Target URL. Note, you may want to call Utilities.TrimAfter(sTarget, '#'); on the response + + + + Gets a redirect-target from a base URI and a Location header + + + + null, or Target URL. Note, you may want to call Utilities.TrimAfter(sTarget, '#'); + + + + Fiddler can only auto-follow redirects to HTTP/HTTPS/FTP. + + The BASE URL to which a relative redirection should be applied + Response "Location" header + TRUE if the auto-redirect target is allowed + + + + Handles a Response's Redirect if the Session is configured to do so. + + TRUE if a redirect was handled, FALSE otherwise + + + + Check for common mistakes in HTTP Responses and notify the user if they are found. Called only if Linting is enabled. + + + + + Assign a Session ID. Called by ClientChatter when headers are available + + + + + Called only by InnerExecute, this method reads a request from the client and performs tampering/manipulation on it. + + TRUE if there's a Request object and we should continue processing. FALSE if reading the request failed + *OR* if script or an extension changed the session's State to DONE or ABORTED. + + + + + If the executeObtainRequest called failed, we perform cleanup + + + + + Returns TRUE if response is a NTLM or NEGO challenge + + True for HTTP/401,407 with NEGO or NTLM demand + + + + Returns TRUE if response is a Digest, NTLM, or Nego challenge + + True for HTTP/401,407 with Digest, NEGO, NTLM demand + + + + Replace the "ipv*.fiddler "fake" hostnames with the IP-literal equvalents. + + + + + Determines if request host is pointing directly at Fiddler. + + + + + + Echo the client's request back as a HTTP Response, encoding to prevent XSS. + + + + + Send a Proxy Configuration script back to the client. + + + + + Send a Proxy Configuration script back to WinHTTP, so that Fiddler can use an upstream proxy specified + by a script on a fileshare. (WinHTTP only allows HTTP/HTTPS-hosted script files) + + + + + Send the Fiddler Root certificate back to the client + + + + + This method indicates to the client that a secure tunnel was created, + without actually talking to an upstream server. + + If Fiddler's AutoResponder is enabled, and that autoresponder denies passthrough, + then Fiddler itself will always indicate "200 Connection Established" and wait for + another request from the client. That subsequent request can then potentially be + handled by the AutoResponder engine. + + BUG BUG: This occurs even if Fiddler isn't configured for HTTPS Decryption + + + The hostname to use in the Certificate returned to the client + + + + This method adds a Proxy-Support: Session-Based-Authentication header and indicates whether the response is Nego:Type2. + + Returns TRUE if server returned a credible Type2 NTLM Message + + + + This helper evaluates the conditions for client socket reuse. + + + + + + Sends the Response that Fiddler received from the server back to the client socket. + + Should the client and server pipes be tightly-bound together? + True, if the response was successfully sent to the client + + + + Sets up the next Session on these pipes, binding this Session's pipes to that new Session, as appropriate. When this method is called, + the nextSession variable is populated with the new Session, and that object is executed at the appropriate time. + + TRUE if both the client and server pipes should be bound regardless of the serverPipe's ReusePolicy + + + + This object holds Session information as a set of four easily-marshalled byte arrays. + It is serializable, which enables cross-process transfer of this data (as in a drag/drop operation). + (Internally, data is serialized as if it were being stored in a SAZ file) + + + + + Create a SessionData object. + Note: Method must run as cheaply as possible, since it runs on all Drag/Dropped sessions within Fiddler itself. + + + + + + Parameters passed into the AcceptConnection method. + + + + + The Socket which represents the newly-accepted Connection + + + + + The Certificate to pass to SecureClientPipeDirect immediately after accepting the connection. + Normally null, this will be set if the proxy endpoint is configured as a "Secure" endpoint + by AssignEndpointCertificate / ActAsHTTPSEndpointForHostname. + + + + + The DateTime of Creation of this connection + + + + + Unknown + + + + + The new Session is needed to respond to an Authentication Challenge + + + + + The new Session is needed to follow a Redirection + + + + + The new Session is needed to generate a CONNECT tunnel + + + + + Event arguments constructed for the OnStateChanged event raised when a Session's state property changed + + + + + The prior state of this session + + + + + The new state of this session + + + + + Constructor for the change in state + + The old state + The new state + + + + States for the (future) Session-processing State Machine. + + Fun Idea: We can omit irrelevant states from FiddlerCore and thus not have to litter + our state machine itself with a bunch of #if FIDDLERCORE checks... + ... except no, that doesn't work because compiler still cares. Rats. + + + + + + State of the current session + + + + + Object created but nothing's happening yet + + + + + Thread is reading the HTTP Request + + + + + AutoTamperRequest pass 1 (IAutoTamper, OnBeforeRequest script method) + + + + + User can tamper using Fiddler Inspectors + + + + + AutoTamperRequest pass 2 (Only used by IAutoTamper) + + + + + Thread is sending the Request to the server + + + + + Thread is reading the HTTP Response + + + + + AutoTamperResponse pass 1 (Only used by IAutoTamper) + + + + + User can tamper using Fiddler Inspectors + + + + + AutoTamperResponse pass 2 (Only used by IAutoTamper) + + + + + Sending response to client application + + + + + Session complete + + + + + Session was aborted (client didn't want response, fatal error, etc) + + + + + This enumeration provides the values for the Session object's BitFlags field + + + + + No flags are set + + + + + The request originally arrived with a URL specifying the HTTPS protocol. + + + + + The request originally arrived with a URL specifying the FTP protocol. + + + + + Ignore this traffic; do not buffer, store, or call event handlers + + + + + The client pipe was reused + + + + + The server pipe was reused + + + + + The request was transmitted to the server when its headers were complete + + + + + The response was streamed + + + + + The request was generated by Fiddler itself (e.g. the Composer tab) + + + + + The response was generated by Fiddler itself (e.g. AutoResponder or utilCreateResponseAndBypassServer) + + + + + This session was loaded from a .SAZ File + + + + + This session was loaded from some other tool + + + + + This request was sent to an upstream (CERN) gateway proxy + + + + + This is a "blind" CONNECT tunnel for HTTPS traffic + + + + + This is a CONNECT tunnel which decrypts HTTPS traffic as it flows through + + + + + This response was served from a client cache, bypassing Fiddler. Fiddler only "sees" this session because other software reported it to Fiddler + + + + + There was a HTTP Protocol violation in the client's request + + + + + There was a HTTP Protocol violation in the server's response + + + + + Response body was dropped, e.g due to fiddler.network.streaming.ForgetStreamedData or log-drop-response-body flag + + + + + This is a CONNECT tunnel for WebSocket traffic + + + + + This request was sent using the SOCKS protocol + + + + + Request body was dropped, e.g due to log-drop-request-body flag + + + + + The request was to create a RPC tunnel (e.g. on an RPC_OUT_DATA request) + + + + + A SessionTimers object holds timing information about a single Session. + + + + + Log a Read's size and timestamp + + Number of milliseconds since first calling .Read() + Number of bytes returned in this read + + + + Return the ReadTimings as an array. Only one read is counted per millisecond + + + + + + Create a new List and append to it + + + + + + + The time at which the client's HTTP connection to Fiddler was established + + + + + The time at which the request's first Send() to Fiddler completes + + + + + The time at which the request headers were received + + + + + The time at which the request to Fiddler completes (aka RequestLastWrite) + + + + + The time at which the server connection has been established + + + + + The time at which Fiddler begins sending the HTTP request to the server (FiddlerRequestFirstSend) + + + + + The time at which Fiddler has completed sending the HTTP request to the server (FiddlerRequestLastSend). + BUG: Should be named "FiddlerEndRequest". + NOTE: Value here is often misleading due to buffering inside WinSock's send() call. + + + + + The time at which Fiddler receives the first byte of the server's response (ServerResponseFirstRead) + + + + + The time at which Fiddler received the server's headers + + + + + The time at which Fiddler has completed receipt of the server's response (ServerResponseLastRead) + + + + + The time at which Fiddler has begun sending the Response to the client (ClientResponseFirstSend) + + + + + The time at which Fiddler has completed sending the Response to the client (ClientResponseLastSend) + + + + + The number of milliseconds spent determining which gateway should be used to handle this request + (Should be mutually exclusive to DNSTime!=0) + + + + + The number of milliseconds spent waiting for DNS + + + + + The number of milliseconds spent waiting for the server TCP/IP connection establishment + + + + + The number of milliseconds elapsed while performing the HTTPS handshake with the server + + + + + Override of ToString shows timer info in a fancy format + + Timing information as a string + + + + Override of ToString shows timer info in a fancy format + + TRUE if the result can contain linebreaks; false if comma-delimited format preferred + Timing information as a string + + + + Enables High-Resolution timers, which are bad for battery-life but good for the accuracy of timestamps. + See http://technet.microsoft.com/en-us/sysinternals/bb897568 for the ClockRes utility that shows current clock resolution. + NB: Exiting Fiddler reverts this to the default value. + + + + + URLMon Interop Class + + + + + Set the user-agent string for the current process + + New UA string + + + + Query WinINET for the current process' proxy settings. Oddly, there's no way to UrlMkGetSessionOption for the current proxy. + + String of hex suitable for display + + + + Configures the current process to use the system proxy for URLMon/WinINET traffic. + + + + + Configures the current process to use no Proxy for URLMon/WinINET traffic. + + + + + Sets the proxy for the current process to the specified list. See http://msdn.microsoft.com/en-us/library/aa383996(VS.85).aspx + + e.g. "127.0.0.1:8888" or "http=insecProxy:80;https=secProxy:444" + Semi-colon delimted list of hosts to bypass proxy; use <local> to bypass for Intranet + + + + Holds a variety of useful functions used in Fiddler and its addons. + + + + + Create a Session Archive Zip file containing the specified sessions + + The filename of the SAZ file to store + Array of sessions to store + Password to encrypt the file with, or null + TRUE if verbose error dialogs should be shown. + + + + + This is a refactored helper function which writes a single session to an open SAZ file. + + The session to write to the file + The ZIP File + The number of this file + The format string (e.g. "D3") to use when formatting the file number + The HTML String builder to write index information + TRUE to show verbose error dialog information + + + + Reads a Session Archive Zip file into an array of Session objects + + Filename to load + + Loaded array of sessions or null, in case of failure + + + + Reads a Session Archive Zip file into an array of Session objects + + Filename to load + + Loaded array of sessions or null, in case of failure + + + + Ensures a value is within a specified range. + + Type of the value + Current value + Min value + Max value + Returns the provided value, unless it is outside of the specified range, in which case the nearest "fencepost" is returned. + + + + A static byte array containing 0 elements. Use to avoid having many copies of an empty byte[] floating around. + + + + + Check to see that the target assembly defines a RequiredVersionAttribute and that the current Fiddler instance meets that requirement + + The assembly to test + The "type" of extension for display in error message + TRUE if the assembly includes a requirement and Fiddler meets it. + + + + Typically, a version number is displayed as "major number.minor number.build number.private part number". + + Version required + Version of the binary being tested + Returns 0 if exact match, else greater than 0 if Required version greater than verTest + + + + Address the problem where the target "PATH" calls for a directoryname is already a filename + + + + + + + Ensure that the target file does not yet exist. If it does, generates a new filename with an embedded identifier, e.g. out[1].txt instead. + Attempts to ensure filename is creatable; e.g. if a path component needs to be a directory but is a file already, injects [#] into that + path component. + + Candidate filename + New filename which does not yet exist + + + + Ensure that the target path exists and if a file exists there, it is not readonly or hidden. + WARNING: Can throw if target "Filename" calls for a parent directoryname that is already used as a filename by a non-directory. + E.g. EnsureOverwriteable(C:\io.sys\filename.txt); would throw. + + The candidate filename + + + + Writes arrBytes to a file, creating the target directory and overwriting if the file exists. + + Path to File to write. + Bytes to write. + + + + Fills an array completely using the provided stream. Unlike a normal .Read(), this one will always fully fill the array unless the Stream throws. + + The stream from which to read. + The byte array into which the data should be stored. + The count of bytes read. + + + + Create a new byte[] containing the contents of two other byte arrays. + + + + + + + + Returns the Value from a (case-insensitive) token in the header string. Correctly handles double-quoted strings. + Allows comma and semicolon as delimiter. Trailing whitespace may be present. + + Name of the header + Name of the token + Value of the token if present; otherwise, null + + + + Ensures that the target string is iMaxLength or fewer characters + + The string to trim from + The maximum number of characters to return + Up to iMaxLength characters from the "Head" of the string. + + + + Ensures that the target string is iMaxLength or fewer characters, appending ... if truncation occurred + + The string to trim from + The maximum number of characters to return + The string, or up to iMaxLength-1 characters from the "Head" of the string, with \u2026 appeneded. + + + + Returns the "Head" of a string, before and not including a specified search string. + + The string to trim from + The delimiting string at which the trim should end. + Part of a string up to (but not including) sDelim, or the full string if sDelim was not found. + + + + Returns the "Head" of a string, before and not including the first instance of specified delimiter. + + The string to trim from. + The delimiting character at which the trim should end. + Part of a string up to (but not including) chDelim, or the full string if chDelim was not found. + + + + [Deprecated] Ensures that the target string is iMaxLength or fewer characters + + The string to trim from + The maximum number of characters to return + Identical to the method. + Up to iMaxLength characters from the "Head" of the string. + + + + Returns the "Tail" of a string, after (but NOT including) the First instance of specified delimiter. + See also + + The string to trim from. + The delimiting character after which the text should be returned. + Part of a string after (but not including) chDelim, or the full string if chDelim was not found. + + + + Returns the "Tail" of a string, after (but NOT including) the First instance of specified search string. + + + The string to trim from. + The delimiting string after which the text should be returned. + Part of a string after (but not including) sDelim, or the full string if sDelim was not found. + + + + Returns the "Tail" of a string, after (and including) the first instance of specified search string. + + The string to trim from. + The delimiting string at which the text should be returned. + Part of the string starting with sDelim, or the entire string if sDelim not found. + + + + Returns the "Tail" of a string, after (but not including) the Last instance of specified delimiter. + + + The string to trim from. + The delimiting character after which text should be returned. + Part of a string after (but not including) the final chDelim, or the full string if chDelim was not found. + + + + Returns the "Tail" of a string, after (but not including) the Last instance of specified substring. + + + The string to trim from. + The delimiting string after which text should be returned. + Part of a string after (but not including) the final sDelim, or the full string if sDelim was not found. + + + + Strip any IPv6-Literal brackets, needed when creating a Certificate + + + + + + + Determines true if a request with the specified HTTP Method/Verb MUST contain a entity body + + The Method/Verb + TRUE if the HTTP Method MUST contain a request body. + + + + http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-4.2.2 + + HTTPMethod + TRUE if the method is deemed idempotent + + + + Returns true if a request with the specified HTTP Method/Verb may contain a entity body + + The Method/Verb + TRUE if the HTTP Method MAY contain a request body. + + + + Detects whether string ends in a file extension generally recognized as an image file extension. + Pass lowercase into this function. + + *Lowercase* string + TRUE if string ends with common image file extension + + + + Determines if the specified MIME type is "binary" in nature. + + The MIME type + TRUE if the MIME type is likely binary in nature + + + + Gets a string from a byte-array, stripping a Byte Order Marker preamble if present. + + + This function really shouldn't need to exist. Why doesn't calling .GetString on a string with a preamble remove the preamble??? + + The byte array + The encoding to convert from *if* there's no Byte-order-marker + The string + + + + WARNING: May throw. + Gets an encoding, with proper respect for "utf8" as an alias for "utf-8"; Microsoft products don't support + this prior to 2015-era, but it turns out to be common. We do have a linter elsewhere that reports a warning + if it sees the dashless form. + https://github.com/telerik/fiddler/issues/38 + + Textual name of the encoding + + + + WARNING: Potentially slow. + WARNING: Does not decode the HTTP Response body; if compressed, embedded META or _charset_ will not be checked + Gets (via Headers or Sniff) the provided body's text Encoding. If not found, returns CONFIG.oHeaderEncoding (usually UTF-8). + + HTTP Headers, ideally containing a Content-Type header with a charset attribute. + byte[] containing the entity body. + A character encoding, if one could be determined + + + + Gets (via Headers or Sniff) the Response Text Encoding. Returns CONFIG.oHeaderEncoding (usually UTF-8) if unknown. + Perf: May be quite slow; cache the response + + The session + The encoding of the response body + + + + Set of encodings for which we'll attempt to sniff. (List order matters, I think) + + + + + HtmlEncode a string. + In Fiddler itself, this is a simple wrapper for the System.Web.HtmlEncode function. + The .NET3.5/4.0 Client Profile doesn't include System.Web, so we must provide our + own implementation of HtmlEncode for FiddlerCore's use. + + String to encode + String encoded according to the rules of HTML Encoding, or null. + + + + This function accepts a string and an offset into the string. It reads one or more %XX sequences from the + string converting them into a UTF-8 string based on the input text + + + + + + + + Convert the %-encoded string into a string, interpreting %-escape sequences as UTF-8 characters + + %-encoded string + Unencoded string + + + + Replaces System.Web.HttpUtility.UrlPathEncode(str). + + String to encode as a URL Path + Encoded string + + + + Tokenize a string into tokens. Delimits on unquoted whitespace ; quote marks are dropped unless preceded by \ characters. + Some special hackery to allow trailing slash not escape the final character of the entire input, so that: + prefs set fiddler.config.path.vsplugins "F:\users\ericlaw\VSWebTest\" + ...doesn't end up with a trailing quote. + + The string to tokenize + Are single-quotes allowed to as escapes? + An array of strings + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + String containing a pretty-printed array + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + The maximum number of bytes to pretty-print + String containing a pretty-printed array + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + The maximum number of bytes to pretty-print + Show ASCII text at the end of each line + String containing a pretty-printed array + + + + Print an byte array to a hex string. + Slow. + + Byte array + String of hex bytes, or "null"/"empty" if no bytes provided + + + + Create a string in CF_HTML format + + The HTML string + The HTML string wrapped with a CF_HTML prelude + + + + Returns an integer from the registry, or a default. + + The Registry key in which to find the value. + The registry value name. + Default to return if the registry key is missing or cannot be used as an integer + The retrieved integer, or the default. + + + + Save a string to the registry. Correctly handles null Value, saving as String.Empty + + The registry key into which the value will be written. + The name of the value. + The value to write. + + + + Returns an Float from the registry, or a default. + + Registry key in which to find the value. + The value name. + The default float value if the registry key is missing or cannot be used as a float. + Float representing the value, or the default. + + + + Get a bool from the registry + + The RegistryKey + The Value name + The default value + Returns an bool from the registry, or bDefault if the registry key is missing or cannot be used as an bool. + + + + Maps a MIMEType to a file extension. + Pass only the TYPE (e.g. use oResponse.MIMEType), to ensure no charset info in the string. + + The MIME Type + A file extension for the type, or .TXT + + + + Return the content type of a target file, or application/octet-stream if unknown. + + A filename, including the extension + + + + + Determines if we have a complete chunked response body (RFC2616 Section 3.6.1) + + The session object, used for error reporting + The response data stream. Note: We do not touch the POSITION property. + The start of the HTTP body to scan for chunk size info + Returns the start of the final received/partial chunk + End of byte data in stream representing this chunked content, or -1 if error + True, if we've found the complete last chunk, false otherwise. + + + + Takes a byte array and applies HTTP Chunked Transfer Encoding to it + + The byte array to convert + The number of chunks to try to create + The byte array with Chunked Transfer Encoding applied + + + + Removes HTTP chunked encoding from the data in writeData and returns the resulting array. + + Some chunked data + Unchunked data. Throws InvalidDataException on data format errors. + + + + Removes HTTP chunked encoding from the data in writeData and returns the resulting array. + + Array to unchunk + Optional Session (for UI error messages) + TRUE to suppress error messages, FALSE to show alert boxes + Unchunked data. Throws InvalidDataException on data format errors. + + + + Returns TRUE if the Array contains nulls. TODO: Extend to check for other chars which are clearly non-Unicode + + + + + + + Implements a BlockList for "unknown" encodings that the utilDecode* functions cannot handle + + Transfer-Encoding + Content-Encoding + TRUE if any encoding is known to be unsupported + + + + Removes one or more encodings in the proper order to reconstruct the unencoded body. + If removing Transfer-Encoding and Content-Encoding, ALWAYS remove Transfer-Encoding first. + + The list of encodings in the order that they were applied + RFC2616: If multiple encodings have been applied to an entity, the content codings MUST be listed in the order in which they were applied. + Should unchunking be permitted (TRUE for Transfer-Encoding, FALSE for Content-Encoding) + The bytes of the body + + + + Content-Encodings + + + + + + + + + + Remove all encodings from arrBody, based on those specified in the supplied HTTP headers; DOES NOT MODIFY HEADERS. + Throws on errors. + + *Readonly* headers specifying what encodings are applied + In/Out array to be modified + + + + Remove all encodings from arrBody, based on those specified in the supplied HTTP headers; + DOES NOT MODIFY HEADERS. DOES NOT HANDLE UNSUPPORTED ENCODINGS WELL. + Throws on errors. + + *Readonly* headers specifying what encodings are applied + In/Out array to be modified + FALSE to show dialog boxes on errors, TRUE to remain silent + + + + Attempts to remove all Content-Encodings from a HTTP body. May throw if content is malformed. + MODIFIES HEADERS. + + Headers for the body; Content-Encoding and Content-Length will be modified + Reference to the body array + FALSE if error dialog boxes should be shown + TRUE if the body was decoded completely. + + + + Decompress an array compressed using an Zlib DEFLATE stream. Not a HTTP Encoding; it's used internally in the PNG format. + + The array to expand + byte[] of decompressed data + + + + GZIPs a byte-array + + Input byte array + byte[] containing a gzip-compressed copy of writeData[] + + + + GZIP-Expand function which shows no UI and will throw on error + + TRUE if you want to use Xceed to decompress; false if you want to use System.IO + byte[] to decompress + A decompressed byte array, or byte[0]. Throws on errors. + + + + Expands a GZIP-compressed byte array + + The array to decompress + byte[] containing an un-gzipped copy of compressedData[] + + + + Compress a byte array using RFC1951 DEFLATE + + Array to compress + byte[] containing a DEFLATE'd copy of writeData[] + + + + UnDeflate function which shows no UI and will throw on error + + TRUE if you want to use Xceed to decompress; false if you want to use System.IO + byte[] to decompress + A decompressed byte array, or byte[0]. Throws on errors. + + + + Decompress a byte array that was compressed using Microsoft's Xpress Raw format. + Available only on Windows 8+ + + Array to decompress + byte[] of decompressed data + + + + Decompress a byte array that was compressed using RFC1951 DEFLATE + + Array to decompress + byte[] of decompressed data + + + + Compress a byte[] using the bzip2 algorithm + + Array to compress + byte[] of data compressed using bzip2 + + + + Decompress an array compressed using bzip2 + + The array to expand + byte[] of decompressed data + + + + Decompress an array compressed using bzip2 + + The array to expand + byte[] of decompressed data + + + + Try parsing the string for a Hex-formatted int. If it fails, return false and 0 in iOutput. + + The hex number + The int value + TRUE if the parsing succeeded + + + + Returns TRUE if two ORIGIN (scheme+host+port) values are functionally equivalent. + + The first ORIGIN + The second ORIGIN + The default port, if a port is not specified + TRUE if the two origins are equivalent + + + + This function cracks a sHostPort string to determine if the address + refers to a "local" site + + The string to evaluate, potentially containing a port + True if the address is local + + + + This function cracks a sHostPort string to determine if the address + refers to the local computer + + The string to evaluate, potentially containing a port + True if the address is 127.0.0.1, 'localhost', or ::1 + + + + Determines if the specified Hostname is a either 'localhost' or an IPv4 or IPv6 loopback literal + + Hostname (no port) + TRUE if the hostname is equivalent to localhost + + + + This function cracks the Hostname/Port combo, removing IPV6 brackets if needed + + Hostname/port combo, like www.foo.com or www.example.com:8888 or [::1]:80 + The hostname, minus any IPv6 literal brackets, if present + Port #, 80 if not specified, -1 if corrupt + + + + Given a string/list in the form HOSTNAME:PORT#;HOSTNAME2:PORT2#, this function returns the FIRST IPEndPoint. Defaults to port 80 if not specified. + Warning: DNS resolution is slow, so use this function wisely. + + HOSTNAME:PORT#;OPTHOST2:PORT2# + An IPEndPoint or null + + + + Given a string/list in the form HOSTNAME:PORT#;HOSTNAME2:PORT2#, this function returns all IPEndPoints for ALL listed hosts. Defaults to port 80 if not specified. + Warning: DNS resolution is slow, so use this function wisely. + + HOSTNAME:PORT#;OPTHOST2:PORT2# + An array of IPEndPoints or null if no results were obtained + + + + This function attempts to be a ~fast~ way to return an IP from a hoststring that contains an IPv4/6-Literal. + + Hostname + IPAddress, or null, if the sHost wasn't an IP-Literal + + + + Launch the user's browser to a hyperlink. This function traps exceptions and notifies the user via UI dialog. + + The URL to ShellExecute. + TRUE if the ShellExecute call succeeded. + + + + Wrapper for Process.Start that shows error messages in the event of failure. + + Fully-qualified filename to execute. + Command line parameters to pass. + TRUE if the execution succeeded. FALSE if the execution failed. An error message will be shown for any error except the user declining UAC. + + + + Run an executable and wait for it to exit, notifying the user of any exceptions. + + Fully-qualified filename of file to execute. + Command-line parameters to pass. + TRUE if the execution succeeded. FALSE if the error message was shown. + + + + Run an executable, wait for it to exit, and return its output as a string. + NOTE: Uses CreateProcess, so you cannot launch applications which require Elevation. + + Fully-qualified filename of file to Execute + Command-line parameters to pass + Exit code returned by the executable + String containing the standard-output of the executable + + + + This method prepares a string to be converted into a regular expression by escaping special characters and CONVERTING WILDCARDS. + This method was originally meant for parsing WPAD proxy script strings. + + You typically should use the Static RegEx.Escape method for most purposes, as it doesn't convert "*" into ".*" + + + + + + + + + Determines whether the arrData array STARTS WITH with the supplied arrMagics bytes. Used for Content-Type sniffing. + + The data, or null + The MagicBytes to look for + TRUE if arrData begins with arrMagics + + + + Determines whether the arrData array begins with the supplied sMagics ASCII text. Used for Content-Type sniffing. + + The data, or null + The ASCII text to look for + TRUE if arrData begins with sMagics (encoded as ASCII octets) + + + + Is this HTTPMethod used for RPC-over-HTTPS? + + + + + Determine if a given byte array has the start of a HTTP/1.* 200 response. + Useful primarily to determine if a CONNECT request to a proxy returned success. + + + + + + + Determine if a given byte array has the start of a HTTP/1.* 407 response. + Useful primarily to determine if a CONNECT request to a proxy returned an auth challenge + + + + + + + For a given process name, returns a bool indicating whether this is a known browser process name. + + The Process name (e.g. "abrowser.exe") + Returns true if the process name starts with a common browser process name (e.g. ie, firefox, etc) + + + + Ensure that a given path is absolute, if not, applying the root path. + WARNING: This function only works as well as Path.IsPathRooted, which returns "True" for things like "/NoDriveSpecified/fuzzle.txt" + A better approach would be to look at the internal Path.IsRelative method + + + + + + + + If sFilename is absolute, returns it, otherwise, combines the leaf filename with local response folders hunting for a match. + Trims at the first ? character, if any + + Either a fully-qualified path, or a leaf filename + File path + + + + Get a TickCount (milliseconds since system start) as an unsigned 64bit value. On Windows Vista+, uses the GetTickCount64 API that + won't rollover, but on any other platform, this unsigned wrapper moves the rollover point to 49 days of uptime. + + Number of ms since the system started + + + + Returns a succinct version of Environment.OSVersion.VersionString + + + + + + Returns TRUE on *Windows* (not Mono) when OS Version is Win8+ (NT6.2+) + + + + + + Turns a string into a SslProtocol Flags enum. Ignores our magic <client> token. + + e.g. tls1.0;ssl3.0 + + + + + Duplicate a byte array, replacing null with byte[0]. + Doing this instead of .Clone() because it better handles nulls and it may be faster. + + The array to copy + The new array. + + + + Warning: This will throw if FIPS mode is enabled + + + + + + + Returns TRUE if the array is null or contains 0 bytes + + byte[] to test + + + + + Returns TRUE if the string is non-empty and not of the pattern "[#123]" + Necessary because SAZ-saving logic autogenerates comments of that form + + + + + + + + + + True if ClientChatter is non-null and its headers are non-null + + + + True if ClientChatter is non-null and its headers are non-null + + + True if ClientChatter is non-null and its headers are non-null + + + + Return a multi-line string describing the NetworkInterfaces[] + + + + + + Checks a DLL's filename for signals that it doesn't contain extensions. + This hack is only needed because I wasn't smart enough to require that the assembly be named something like Fiddler.* in the original design. + + DLL filename + TRUE if we should skip this assembly during enumeration + + + + Garbage collect and, if possible, compact the Large Object heap + + + + + Common functions we'll want to use on Strings. Fiddler makes extensive use of strings which + should be interpreted in a case-insensitive manner. + + WARNING: Methods assume that the calling object is not null, which is lame for reliability but arguably good for performance. + + + + + The WebSocket class represents a "tunnel" through which WebSocket messages flow. + The class' messages may be deserialized from a SAZ file. + + + + + Should this WebSocket Tunnel parse the WS traffic within into individual messages? + + + + + Is this WebSocket open/connected? + + + + + Writes all of the messages stored in this WebSocket to a stream. + + + + + + + Approximate size of the data of the stored messages, used for memory tracking + + + + + + Read headers from the stream. + + The Stream from which WebSocketSerializationHeaders should be read + The Array of headers, or String[0] + + + + Boolean that determines whether the WebSocket tunnel tracks messages. + + + + + Number of bytes received from the client + + + + + Number of bytes received from the server + + + + + Returns number of bytes sent from the Server to the Client on this WebSocket + + + + + Returns number of bytes sent from the Client to the Server on this WebSocket + + + + + Creates a "detached" WebSocket which contains messages loaded from the specified stream + + Session to which the WebSocket messages belong + The Stream containing messages, which will be closed upon completion + + + + This factory method creates a new WebSocket Tunnel and executes it on a background (non-pooled) thread. + + The Session containing the HTTP CONNECT request + + + + Creates a WebSocket tunnel. External callers instead use the CreateTunnel static method. + + The session for which this tunnel was initially created. + The client pipe + The server pipe + + + + This function keeps the Tunnel/Thread alive until it is signaled that the traffic is complete + + + + + Performs cleanup of the WebSocket instance. Call this after the WebSocket closes normally or after abort/exceptions. + + + + + Executes the WebSocket tunnel on a background thread + + + + + Interface Method + Close the WebSocket and signal the event to let its service thread die. Also called by oSession.Abort() + WARNING: This should not be allowed to throw any exceptions, because it will do so on threads that don't + catch them, and this will kill the application. + + + + + When we get a buffer from the client, we push it into the memory stream + + + + + When we get a buffer from the server, we push it into the memory stream + + + + + This method parses the data in strmClientBytes to extact one or more WebSocket messages. It then sends each message + through the pipeline. + + + + This method parses the data in strmServerBytes to extact one or more WebSocket messages. It then sends each message + through the pipeline to the client. + + + + Called when we have received data from the local client. + + The result of the asynchronous operation. + + + Called when we have received data from the remote host. Incoming data will immediately be forwarded to the local client. + The result of the asynchronous operation. + + + + This enumeration provides the values for the WebSocketMessage object's BitFlags field + + + + + No flags are set + + + + + Message was eaten ("dropped") by Fiddler + + + + + Message was generated ("injected") by Fiddler itself + + + + + Fragmented Message was reassembled by Fiddler + + + + + Breakpointed + + + + + A WebSocketMessage stores a single frame of a single WebSocket message + http://tools.ietf.org/html/rfc6455 + + + + + 3 bits frame-rsv1,frame-rsv2,frame-rsv3 + + + + + Unmasks the first array into the third, using the second as a masking key. + + + + + + + + Masks the first array's data using the key in the second + + The data to be masked + A 4-byte obfuscation key, or null. + + + + Replaces the WebSocketMessage's payload with the specified string, masking if needed. + + + + + + Copies the provided byte array over the WebSocketMessage's payload, masking if needed. + + + + + + Masks the provided array (if necessary) and assigns it to the WebSocketMessage's payload. + + New array of data + + + + Return the WebSocketMessage's payload as a string. + + + + + + Copy the WebSocketMessage's payload into a new Byte Array. + + A new byte array containing the (unmasked) payload. + + + + Is this a Request message? + + + + + The WebSocketTimers collection tracks the timestamps for this message + + + + + The raw payload data, which may be masked. + + + + + The four-byte payload masking key, if any + + + + + The type of the WebSocket Message's frame + + + + + Serialize this message to a stream + + + + + + Add the content of the subequent continuation to me. + + + + + + Timers + + + + + When was this message read from the sender + + + + + When did transmission of this message to the recipient begin + + + + + When did transmission of this message to the recipient end + + + + + Return the timers formatted to be placed in pseudo-headers used in saving the WebSocketMessage to a stream (SAZ). + NOTE: TRAILING \r\n is critical. + + + + + + The AutoProxy class is used to handle upstream gateways when the client was configured to use WPAD or a Proxy AutoConfig (PAC) script. + + + + + Indication as to whether AutoProxy information is valid. 0=Unknown/Enabled; 1=Valid/Enabled; -1=Invalid/Disabled + + + + + Get the text of the file located at a specified file URI, or null if the URI is non-file or the file is not found. + + + + + Returns a string containing the currently selected autoproxy options + + + + + + Get WPAD-discovered URL for display purposes (e.g. Help> About); note that we don't actually use this when determining the gateway, + instead relying on the this.autoProxy.TryGetProxyForUrl method to do this work for us. + + A WPAD url, if found, or String.Empty + + + + Return gateway endpoint for requested Url. TODO: Add caching layer on our side? TODO: Support multiple results? + + The URL for which the gateway should be determined + The Endpoint of the Gateway, or null + TRUE if WinHttpGetProxyForUrl succeeded + + + + Dispose AutoProxy. + + + + + Wrapper for WinINET cache APIs. + + + + + Clear all HTTP Cookies from the WinINET Cache + + + + + Clear all files from the WinINET Cache + + + + + Delete all permanent WinINET cookies for sHost; won't clear memory-only session cookies. Supports hostnames with an optional leading wildcard, e.g. *example.com. NOTE: Will not work on VistaIE Protected Mode cookies. + + The hostname whose cookies should be cleared + + + + Clear the Cache items. Note: May be synchronous, may be asynchronous. + + TRUE if cache files should be cleared + TRUE if cookies should be cleared + + + + Writes the ContentTypes XML to the ZIP so Packaging APIs can read it. + See http://en.wikipedia.org/wiki/Open_Packaging_Conventions + + + + + + Implement this interface to handle upstream gateways when the client is configured to use WPAD or a Proxy AutoConfig (PAC) script. + + + + + Outs the for the requested . + + The URL for which the should be determined. + One or more of the following strings separated by semicolons. + ([<scheme>=][<scheme>"://"]<server>[":"<port>]) + If the method fails this parameter should contain the error message, null otherwise. + True if the method succeeds, false otherwise. + + + + Outs WPAD-discovered URL of the Proxy Auto-Config file. + + The Proxy Auto-Config URL. + True if the method succeeds, false otherwise. + + + + Implement this interface in order to provide FiddlerCore with platform specific functionality. + + + + + Map a local port number to the originating process ID. + + The port number. + true to include processes using IPv6 addresses in the mapping. + Contains the originating process ID if the operation is successful. + Contains an error message if the operation fails. + true if the operation is successful, false otherwise. + + + + Gets any process' name and ID which listens on a port. + + The port number. + Contains the process name of a process if there is one listening on the port, otherwise contains an empty string. + Contains the process ID of a process if there is one listening on the port, otherwise contains 0. + Contains an error message if the operation fails. + true if the operation is successful, false otherwise. + + + + Changes system-wide timer's resolution. + + true to increase the resolution for better accuracy of timestamps, false to decrease it to the default value for the system. + true if the operation is successful, false otherwise. + + + + Returns true if the system-wide timer's resolution is increased, false otherwise. + + + + + Gets a proxy helper, which can be used to manipulate proxy settings. + + + + + This event is raised when a debug message is being spewed. + + + + + This event is raised when an error has occured. + + + + + This event is raised when a message is being logged. + + + + + Decompresses a byte[] that is compressed with XPRESS. + + The compressed byte[]. + The decompressed byte[]. + + + + This method is used to post-process the name of a process, in order to resolve it more accurately. + + The ID of the process, whose name should be post-processed. + The process name that should be post-processed. + The post-processed process name. + + + + This method is used to set the user-agent string for the current process. + + The user-agent string. + + + + This method is used to get the number of milliseconds since the system start. + + Contains the system uptime in milliseconds if the operation is successful. + true if the operation is successful, false otherwise. + + + + Creates . + + True if the must use the WPAD protocol, false otherwise. + URL of the Proxy Auto-Config file. Can be null. + True if the WPAD processing should be done in the current process, false otherwise. + Specifies whether the client's domain credentials should be automatically sent + in response to an NTLM or Negotiate Authentication challenge when the requests the PAC file. + + + + + Implement this interface in order to implement a factory, which is used to create objects. + + + + + Creates new object. + + The platform extensions object. + + + + Implement this interface, in order to provide FiddlerCore with platform-specific proxy helper. + This interface contains members used to manipulate proxy settings. + + + + + Configures the current process to use no proxy. + + + + + Returns the current process' proxy settings. + + String containing a HEX view of the current process' proxy settings. + + + + Configures current process' proxy settings to default. + + + + + Configures current process' proxy settings. + + The proxy information (IP and port). It can be per connection type + (e.g. http=127.0.0.1:8080;https=127.0.0.1:444) or global (e.g. 127.0.0.1:8888). + Semi-colon delimted list of hosts to bypass proxy + (e.g. www.google.com;www.microsoft.com) + + + + Implement this interface in order to provide FiddlerCore with Windows-specific functionality. + + + + + Gets a WinINet helper, which can be used to access WinINet native API. + + + + + Implement this interface in order to provide FiddlerCore with access to native WinINet API. + + + + + Clears WinINet's cache. + + true if cache files should be cleared, false otherwise. + true if cookies should be cleared, false otherwise. + + + + Delete all permanent WinINet cookies for a . + + The hostname whose cookies should be cleared. + + + + Use this method in order to get cache information for a . + + The URL for which the cache info is requested. + String, containing cache information for the given . + + + + This class is used to pass a simple string message to a event handler. + + + + + Creates and initializes new instance of the . + + The message. + + + + Gets the message. + + + + + Given a local port number, uses GetExtendedTcpTable to find the originating process ID. + First checks the IPv4 connections, then looks at IPv6 connections. + + Client applications' port + ProcessID, or 0 if not found + + + + Calls the GetExtendedTcpTable function to map a port to a process ID. + This function is (over) optimized for performance. + + Client port + AF_INET or AF_INET6 + PID, if found, or 0 + + + + Enumeration of possible queries that can be issued using GetExtendedTcpTable + http://msdn2.microsoft.com/en-us/library/aa366386.aspx + + + + + Processes listening on Ports + + + + + Processes with active TCP/IP connections + + + + + Outs WPAD-discovered URL for display purposes (e.g. Help> About); note that we don't actually use this when determining the gateway, + instead relying on the WinHTTPGetProxyForUrl function to do this work for us. + + A WPAD url, if found, or String.Empty + + + + Note: Be sure to use the same hSession to prevent redownload of the proxy script + + + + + Set to true to send Negotiate creds when challenged to download the script + + + + + For PInvoke: Contains information about an entry in the Internet cache + + + + + Requires Win8+ + Decompress Xpress|Raw blocks used by WSUS, etc. + Introduction to the API is at http://msdn.microsoft.com/en-us/library/windows/desktop/hh920921(v=vs.85).aspx + + + + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + String containing a pretty-printed array + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + The maximum number of bytes to pretty-print + String containing a pretty-printed array + + + + Pretty-print a Hex view of a byte array. Slow. + + The byte array + Number of bytes per line + The maximum number of bytes to pretty-print + Show ASCII text at the end of each line + String containing a pretty-printed array + + + + Returns the "Tail" of a string, after (but not including) the Last instance of specified delimiter. + + + The string to trim from. + The delimiting character after which text should be returned. + Part of a string after (but not including) the final chDelim, or the full string if chDelim was not found. + + + + Format an Exception message, including InnerException message if present. + + + + + + + How long should we wait for parallel creations + + + + + "SHA256WITHRSA", "SHA384WITHRSA", "SHA512WITHRSA", "MD5WITHRSA", etc + + + + + Cache of EndEntity certificates that have been generated in this session. + + + + + The ReaderWriter lock gates access to the certCache + + + + + Queue of creations in progress, indexed by certificate CN. + ManualResetEvent info: http://msdn.microsoft.com/en-us/library/ksb7zs2x(v=vs.95).aspx + + + + + The ReaderWriter lock gates access to the Queue which ensures we only have one Certificate-Generating-per-Host + + + + + The BouncyCastle Root certificate + + + + + The BouncyCastle Root Private key + + + + + The EE Certificate Public/Private key that we'll reuse for all EE certificates if the + preference fiddler.certmaker.bc.ReusePrivateKeys is set. + + + + + Object we use to lock on when updating oEEKeyPair + + + + + Object we use to lock on when updating oCACert / OCAKey + + + + + Should Fiddler automatically generate wildcard certificates? + + + + + TLDs for which should Fiddler generate wildcarded 3rd-level-domain certs + + + + + Length for the Public/Private Key used in the EE certificate + + + + + Length for the Public/Private Key used in the Root certificate + + + + + Should verbose logging information be emitted? + + + + + Controls whether we use the same Public/Private keypair for all Server Certificates (improves perf) + + + + + Controls whether we use the same Public/Private keypair for the root AND all Server Certificates (improves perf) + + + + + Get the base name for the KeyContainer into which the private key goes. If EE Keys are being reused, then we use only + this ID. + + + + + + Returns the Subject O field. Note that Fiddler's normal root uses "DO_NOT_TRUST" rather than "DO_NOT_TRUST_BC". + + + + + + Flush EE certificates to force regeneration + + + + + + + + FindByIssuer{Distinguished}Name requires a complete match of the SUBJECT, including CN, O, and OU + + + + + Converts from a BouncyCastle Certificate object into a .NET X509Certificate2 object + + A BouncyCastle X509Certificate + The .NET X509Certificate2 + + + + Copy BC cert to Windows Certificate Storage, without key. THROWS on Errors + + + + + + + + + Generates a new EE Certificate using the given CA Certificate to sign it. Throws on Crypto Exceptions. + + + + + + + + + Generates (or retrieves from cache) a Public/Private keypair to attach to an EE Certificate + + The CN for the certificate being generated (used for Logging only) + A KeyPair + + + + Called to make a new cert. + + + + + + + Waits on the provided event until it is signaled, then returns the contents of the Cert Cache for the specified sHostname + + The hostname of a Certificate which is pending creation + The event which will be signaled when the cert is ready (max wait is 15 seconds) + The Certificate (or possibly null) + + + + Signals anyone waiting that the certificate desired is now available. + + Hostname of the target certificate + + + + Ensure that the Root Certificate exists, loading or generating it if necessary. + Throws if the root could not be ensured. + + + + + Finds cert, uses Reader lock. + + + + + + + Store a generated Root Certificate and PrivateKey in Preferences. + + + + + Load a previously-generated Root Certificate and PrivateKey from Preferences. + + + + + + Copies the Root certificate into the Current User's Root store. This will show a prompt even if run at Admin. + + + + + + Clears the in-memory caches including the Root Certificate. + + + + This method does not delete the private keys of the certificates. + + + In order to delete them, please cast this instance to + and get a copy of the cache by using the property. + + + TRUE if successful + + + + Clears the in-memory caches. + + + + This method does not delete the private keys of the certificates. + + + In order to delete them, please cast this instance to + and get a copy of the cache by using the property. + + + TRUE to clear the Root Certificate from the cache. + TRUE if successful + + + + Reads the root certificate and its private key from a PKCS#12 formated stream. + + The PKCS#12 formated stream. + The password which is used to protect the private key. Could be null or empty if the private key is not protected. + The alias for the certificate and the private key. If null, the first alias found (if any) will be used. + + + + Writes the root certificate and its private key to a PKCS#12 stream. + + The PKCS#12 stream. + The password which is used to protect the private key. If null or empty, the private key is written unprotected. + The alias for the certificate and the private key. If null, a random alias will be created. + + + + Writes the root certificate without the private key to a stream using DER encoding. + + The stream. + + + + Reads the root certificate and its private key from the PKCS#12 file (.pfx | .p12). + + The filename of the PKCS#12 file (.pfx | .p12) + The password which is used to protect the private key. + The alias for the certificate and the private key. If null, the first alias in the pkcs12 will be used. + + + + Writes the root certificate and its private key to a PKCS#12 file (.pfx | .p12). + + The filename of the PKCS#12 file (.pfx | .p12). + The password which is used to protect the private key. + The alias for the certificate and the private key. If null, a random alias will be created. + + + + Writes the root certificate without the private key to a DER encoded file(.cer | .crt | .der). + + The filename of the DER encoded file (.cer | .crt | .der) + + + + Dispose by clearing all of the EE Certificates' private keys, preventing pollution of the user's \Microsoft\Crypto\RSA\ folder. + + + + + Dimensions in pixels. + + + + + Creates a new object to store dimensions. + + The width in pixels. + The height in pixels. + + + + Gets the width in pixels. + + + + + Gets the height in pixels. + + + + + Class to construct product related information for a Google Analytics hit. Use this class to report information about products sold by merchants or impressions of products seen by users. Instances of this class can be associated with both s via addProduct(Product) and Product Impressions via addImpression(Product, String). + + + + + Creates a new instance of the class. + + + + + Gets or sets the brand associated with the product in GA reports. + + + + + Gets or sets the category associated with the product in GA reports. + + + + + Gets or sets the coupon code associated with the product. + + + + + Gets or sets the custom dimensions associated with the product. + + + + + Gets or sets the custom metrics associated with the product. + + + + + Gets or sets the id that is used to identify a product in GA reports. + + + + + Gets or sets the name that is used to identify the product in GA reports. + + + + + Gets or sets the position of the product on the page/product impression list etc. + + + + + Gets or sets the price of the product. + + + + + Gets or sets the quantity of the product. + + + + + Gets or sets the variant of the product. + + + + + Class to construct transaction/checkout or other product interaction related information for a Google Analytics hit. Use this class to report information about products sold, viewed or refunded. This class is intended to be used with . Instances of this class can be associated with . + + + + + Creates a new instance of with the product action for all the products included in the hit. Valid values include "detail", "click", "add", "remove", "checkout", "checkout_option", "purchase" and "refund". All these values are also defined in this class for ease of use. You also also send additional values with the hit for some specific actions. See the action documentation for details. + + The action type to send. + + + + Gets or sets the product action for all the products included in the hit. + + + + + Gets or sets the label associated with the checkout. This value is used for and actions. + + + + + Gets or sets the checkout processes's progress. This value is used for and actions. + + + + + Gets or sets the list name associated with the products in the analytics hit. This value is used for and actions. + + + + + Gets or sets the list source name associated with the products in the analytics hit. This value is used for and actions. + + + + + Gets or sets the transaction's affiliation value. This value is used for and actions. + + + + + Gets or sets the coupon code used in a transaction. This value is used for and actions. + + + + + The unique id associated with the transaction. This value is used for and actions. + + + + + Gets or sets the transaction's total revenue. This value is used for and actions. + + + + + Gets or sets the transaction's shipping costs. This value is used for and actions. + + + + + Gets or sets the transaction's total tax. This value is used for and actions. + + + + + The product action for all the products included in the hit. + + + + + Action to use when a product is added to the cart. + + + + + Action to use for hits with checkout data. + + + + + Action to be used for supplemental checkout data that needs to be provided after a checkout hit. + + + + + Action to use when the user clicks on a set of products. + + + + + Action to use when the user views detailed descriptions of products. + + + + + Action that is used to report all the transaction data to GA. + + + + + Action to use while reporting refunded transactions to GA. + + + + + Action to use when a product is removed from the cart. + + + + + Class to construct promotion related fields for Google Analytics hits. The fields from this class can be used to represent internal promotions that run within an app, such as banners, banner ads etc. + + + + + Gets or sets the name of the creative associated with the promotion. + + + + + Gets or sets the id that is used to identify a promotion in GA reports. + + + + + Gets or sets the name that is used to identify the promotion in GA reports. + + + + + Gets or sets the position of the promotion. + + + + + The product action for all the products included in the hit. + + + + + Action to use when the user clicks/taps on a promotion. + + + + + Action to use when the user views a promotion. + + + + + Represents a single event to track. + + + + + Gets the key value pairs to send to Google Analytics. + + + + + Gets the timestamp that the event was created. + + + + + Class to build hits. You can add any of the other fields to the builder using common set and get methods. + + + + + Creates an event hit to track events. + + Specifies the event category. Must not be empty. + Specifies the event action. Must not be empty. + Specifies the event label. Optional if null. + Specifies the event value. Values must be non-negative. Optional if zero. + + + + Creates an exception hit to track errors. + + Specifies the description of an exception. + Specifies whether the exception was fatal. + + + + Creates a screen view hit. + + Specifies the 'Screen Name' of the screenview hit. Note: this will not affect subsequent hits. To do this, set the ScreenName property on the instead. + + + + Creates a social networking interaction hit. + + Specifies the social network, for example Facebook or Google Plus. + Specifies the social interaction action. For example on Google Plus when a user clicks the +1 button, the social action is 'plus'. + Specifies the target of a social interaction. This value is typically a URL but can be any text. + + + + Creates a user timing hit to measure app timing and performance. + + Specifies the user timing category. + Specifies the user timing variable. + Specifies the user timing value. + Specifies the user timing label. + + + + Looks up a value by name from the current instance. + + The parameter name to get the value for. + The value associated with the supplied parameter name. + + + + Sets the value for the given parameter name. These values will be added to the hit when it is built. This function should only be used for advanced cases where none of the explicit setters do not work. This function should usually be called after all the explicit setter have been called. + + The parameter name to set the value for. + The value associated with the parameter name. + The builder object that you can use to chain calls. + + + + Adds a set of key, value pairs to the hit builder. These values will be added to the hit when it is built. This function should only be used for advanced cases where none of the explicit setters work. This function should usually be called after all the explicit setter have been called. + + A dictionary of all the values to be added to the builder. + The builder object that you can use to chain calls. + + + + Adds a custom dimension to the current hit builder. Calling this method with the same index will overwrite the previous dimension with the new one. Refer for details on how to set the custom dimensions up. + + The index/slot in which the dimension will be set. + The value of the dimension for the given index. + The builder object that you can use to chain calls. + + + + Adds a custom metric to the current hit builder. Calling this method with the same index will overwrite the previous metric with the new one. Refer for details on how to set the custom metrics up. + + The index/slot in which the metric will be set. + The value of the metric for the given index. + The builder object that you can use to chain calls. + + + + Starts a new session for the hit. + + The builder object that you can use to chain calls. + + + + Indicates that the hit did not involve a user interaction. + + The builder object that you can use to chain calls. + + + + Adds product information to be sent with a given hit. The action provided affects how the products passed in through this method get processed. + + The product you wish to add. + The builder object that you can use to chain calls. + + + + Adds promotion related information to the hit. + + The promotion related to the hit. + The builder object that you can use to chain calls. + + + + Sets a product action for all the products included in this hit. The action and its associated properties affect how the products added through are processed. + + The product action associated with the hit. + The builder object that you can use to chain calls. + + + + Adds an action associated with the promotions in a given hit. + + The action associated with the hit. + The builder object that you can use to chain calls. + + + + Builds a dictionary of parameters and values that can be set on the object. + + The dictionary to send to . + + + + Interface to offer a way to provide all environment and platform level information required by Google Analytics. + + + + + Gets the value that anonymously identifies a particular user, device, or browser instance. For the web, this is generally stored as a first-party cookie with a two-year expiration. For mobile apps, this is randomly generated for each particular instance of an application install. The value of this field should be a random UUID (version 4) as described in . + + + + + Callback that indicates something is about to be logged. + + This allows lazy loading of values that might not be available immediately. + + + + Gets the screen color depth. + + + + + Gets the screen resolution. + + + + + Gets the language (e.g. 'en-us'). + + + + + Gets the Viewport Resolution. + + + + + Gets the User Agent of the browser. This is what Google uses to identify the operating system and device used. + + + + + Raised to indicate that the has changed. + + + + + Raised to indicate that the has changed. + + + + + Interface for a service manager used to send hits to Google Analytics. + + + + + Enqueues the hit so it is sent at the next opportunity. + + Dictionary of hit data to send. + + + + Implements a service manager used to send s to Google Analytics. + + + + + Provides notification that a has been been successfully sent. + + + + + Provides notification that a failed to send. + + Failed s will be added to the queue in order to reattempt at the next dispatch time. + + + + Provides notification that a was malformed and rejected by Google Analytics. + + + + + Instantiates a new instance of . + + A proxy to be used by the manager when dispatching hits. If null, the default IE proxy is used. + + + + Gets or sets whether s should be sent via SSL. Default is true. + + + + + Gets or sets whether s should be sent to the debug endpoint. Default is false. + + + + + Gets or sets whether throttling should be used. Default is false. + + + + + Gets or sets whether data should be sent via POST or GET method. Default is POST. + + + + + Gets or sets whether a cache buster should be applied to all requests. Default is false. + + + + + Gets or sets the user agent request header used by Google Analytics to determine the platform and device generating the hits. + + + + + Gets or sets the frequency at which hits should be sent to the service. Default is immediate. + + Setting to TimeSpan.Zero will cause the hit to get sent immediately. + + + + Gets or sets whether the dispatcher is enabled. If disabled, hits will be queued but not dispatched. + + Typically this is used to indicate whether or not the network is available. + + + + Empties the queue of s waiting to be dispatched. + + If a is actively beeing sent, this will not abort the request. + + + + Dispatches all hits in the queue. + + Returns once all items that were in the queue at the time the method was called have finished being sent. + + + + + + + Suspends operations and flushes the queue. + + Call when returning from a suspended state to resume operations. + Operation returns when all s have been flushed. + + + + Resumes operations after is called. + + + + + Supplies additional information when s fail to send. + + + + + Gets the thrown when the failure occurred. + + + + + Gets the associated with the event. + + + + + Supplies additional information when s are successfully sent. + + + + + Gets the response text. + + + + + Gets the associated with the event. + + + + + Supplies additional information when s are malformed and cannot be sent. + + + + + Gets the HTTP status code that may provide more information about the problem. + + + + + Gets the associated with the event. + + + + + Represents an object capable of tracking events for a single Google Analytics property. + + + + + Instantiates a new instance of . + + the property ID to track to. + the object responsible for receiving hits ready to be sent to the service. + + + + Gets or sets the tracking ID / web property ID. The format is UA-XXXX-Y. All collected data is associated by this ID. + + Required for all hit types. + + + + + Gets or sets whether the IP address of the sender will be anonymized. + + Optional. + + + + + Gets or sets the value that anonymously identifies a particular user, device, or browser instance. For the web, this is generally stored as a first-party cookie with a two-year expiration. For mobile apps, this is randomly generated for each particular instance of an application install. The value of this field should be a random UUID (version 4) as described in . + + Required for all hit types. + + + + + Gets or sets the IP address of the user. This should be a valid IP address in IPv4 or IPv6 format. It will always be anonymized just as though anonymize IP had been used. + + Optional. + + + + + Gets or sets the User Agent of the browser. Note that Google has libraries to identify real user agents. Hand crafting your own agent could break at any time. + + Optional. + + + + + Gets or sets the geographical location of the user. The geographical ID should be a two letter country code or a criteria ID representing a city or region (see http://developers.google.com/analytics/devguides/collection/protocol/v1/geoid). This parameter takes precedent over any location derived from IP address, including the IP Override parameter. An invalid code will result in geographical dimensions to be set to '(not set)'. + + Optional. + + + + + Specifies which referral source brought traffic to a website. This value is also used to compute the traffic source. The format of this value is a URL. + + Optional. + + + + + Gets or sets the screen resolution. + + Optional. + + + + + Gets or sets the viewable area of the browser / device. + + Optional. + + + + + Gets or sets the character set used to encode the page / document. + + Optional. + + + + + Gets or sets the screen color depth. + + Optional. + + + + + Gets or sets the language. + + Optional. + + + + + Gets or sets the hostname from which content was hosted. + + Optional. + + + + + Gets or sets the path portion of the page URL. + + Optional. Should begin with '/'. + + + + + Gets or sets the title of the page / document. + + Optional. + + + + + Gets or sets the 'Screen Name' of the screenview hit. On web properties this will default to the unique URL of the page. + + Required for screenview hit type. Note: This parameter is optional on web properties, and required on mobile properties for screenview hits. + + + + + Gets or sets the application name. This field is required for any hit that has app related data (i.e., app version, app ID, or app installer ID). For hits sent to web properties, this field is optional. + + Optional. + + + + + Gets or sets the application identifier. + + Optional. + + + + + Gets or sets the application version. + + Optional. + + + + + Gets or sets the application installer identifier. + + Optional. + + + + + Gets or sets the parameter that specifies that this user has been exposed to an experiment with the given ID. It should be sent in conjunction with the Experiment Variant parameter. + + Optional. + + + + + Gets or sets the parameter that specifies that this user has been exposed to a particular variation of an experiment. It should be sent in conjunction with the Experiment ID parameter. + + Optional. + + + + + Gets or sets the rate at which s should be excluded for sampling purposes. Default is 100. + + 100 means no items should be excluded, 50 means half should be excluded, and 0 means all items should be excluded. + + + + Gets the model value for the given key added through . + + The key to retrieve the value for. + The value associated with the key. + + + + Sets the model value for the given key. + + The key of the field that needs to be set. It starts with "&" followed by the parameter name. The complete list of fields can be found at . + A string value to be sent to Google servers. A null value denotes that the value should not be sent over wire. + + + + Merges the model values set on this Tracker with params and generates a hit to be sent. + + Dictionary of hit data to values which are merged with the existing values which are already set (using Set(String, String)). Values in this dictionary will override the values set earlier. The values in this dictionary will not be reused for the subsequent hits. If you need to send a value in multiple hits, you can use the Set(String, String) method. + The hit may not be dispatched immediately. + + + + Represents an object capable of tracking events for a single Google Analytics property. + + + + + Instantiates a new instance of . + + the property ID to track to. + An object capable of providing platform and environment specific information. + The object used to send s to the service. + + + + Provides a way to manage multiple instances. + + + + + Instantiates a new instance of . + + An object capable of providing platform and environment specific information. + A proxy to be used by the manager when dispatching hits. If null, the default IE proxy is used. + + + + Gets the collection of instances. + + + + + Gets or sets the default tracker instance for easy access. + + This always returns the last tracker instance created. + + + + Gets or sets whether the app should log information to Google Analtyics. + + See Google Analytics usage guidelines for more information. + + + + Gets a using a given property ID. Will creates a new instance if one does not exist yet. + + The property ID that the should log to. + The new or existing instance keyed on the property ID. + + + + Removes and cleans up a given . + + The instance to remove and clean up. + + + + Gets the instance of used by all instances. + + + + + +
+
diff --git a/packages/Telerik.NetworkConnections.0.2.0/EULA.txt b/packages/Telerik.NetworkConnections.0.2.0/EULA.txt new file mode 100644 index 0000000..adc011a --- /dev/null +++ b/packages/Telerik.NetworkConnections.0.2.0/EULA.txt @@ -0,0 +1,176 @@ +End User License Agreement + +READ THIS END USER LICENSE AGREEMENT ("EULA") BEFORE INSTALLING OR USING THE PRODUCT TO WHICH THIS EULA APPLIES. BY ACCEPTING THIS EULA, COMPLETING THE REGISTRATION PROCESS, AND/OR INSTALLING OR USING THE PRODUCT, YOU AGREE ON BEHALF OF YOURSELF AND YOUR COMPANY (IF APPLICABLE) TO THE TERMS BELOW. IF YOU DO NOT AGREE WITH THESE TERMS, OR DO NOT HAVE THE AUTHORITY TO BIND YOUR COMPANY, DO NOT INSTALL, REGISTER FOR OR USE THE PRODUCT, AND DESTROY OR RETURN ALL COPIES OF THE PRODUCT. ONCE YOU HAVE DONE THIS, YOU MAY REQUEST FROM THE POINT OF PURCHASE A FULL REFUND OF THE LICENSE FEES, IF ANY, PAID FOR THE PRODUCT (OR, IF THE PRODUCT IS PROVIDED TO YOU AS A HOSTED SERVICE, A REFUND OF THE PREPAID SERVICE FEES FOR THE REMAINDER OF THE SUBSCRIPTION PERIOD OF THE PRODUCT). SUCH REQUEST MUST BE COMPLETED WITHIN THIRTY (30) DAYS OF DELIVERY OF THE PRODUCT TO YOU. UNLESS OTHERWISE SPECIFIED IN THIS EULA, PROGRESS SOFTWARE CORPORATION IS THE LICENSOR OF THE PRODUCT. THE LICENSOR MAY BE REFERRED TO HEREIN AS "Licensor", "we", "us", or "our". IF YOU ARE AGREEING TO THIS EULA ON BEHALF OF YOURSELF IN YOUR INDIVIDUAL CAPACITY, THEN YOU ARE THE LICENSEE AND YOU MAY BE REFERRED TO HEREIN AS "Licensee", "you", or "your". IF YOU ARE AGREEING TO THIS EULA ON BEHALF OF YOUR COMPANY, THEN YOUR COMPANY IS THE LICENSEE AND ANY REFERENCES TO "Licensee", "you", or "your" WILL MEAN YOUR COMPANY. + +This EULA includes the following sections: + +1. GENERAL TERMS AND CONDITIONS - these terms apply to all Products; + +2.A. TERMS FOR ON-PREMISE PRODUCTS - these terms apply to Products that you or Permitted Third Parties install on computers; + +2.B. TERMS FOR HOSTED SERVICES - these terms apply to Products that we host; + +3. PRODUCT FAMILY SPECIFIC TERMS - these terms apply to all Products that are part of the family of Products referenced in this section; and + +4. PRODUCT SPECIFIC TERMS - these terms apply to specific Products referenced in this section. + + + +1. GENERAL TERMS AND CONDITIONS +1.1. Definitions. +1.1.1. "Affiliate" means any legal entity that directly or indirectly controls, is controlled by, or is under common control with you or us. For the purposes of this definition, "control" means ownership, directly or indirectly, of more than fifty percent (50%) of the voting shares or other equity interest in an entity. +1.1.2. "Applicable Laws" means national, federal, state, and local laws, rules, and regulations including, without limitation, those laws and regulations relating to data privacy and security in each applicable jurisdiction. +1.1.3. "Authorized Reseller" means a third party who is not our Affiliate and who is authorized by us or our Affiliate to resell the Product. +1.1.4. "Authorized User" means you, your employee or a third-party consultant or agent that you authorize to use the Product for your benefit in accordance with section 1.2.3 (Third Party Use). +1.1.5. "Documentation" means any technical instructions or materials describing the operation of the Product made available to you (electronically or otherwise) by us for use with the Product, expressly excluding any user blogs, reviews or forums. +1.1.6. "Hosted Services" means computer software program(s), content and related services provided by us on a software-as-a-service basis through computers we or our Affiliates or our respective contractors (including cloud infrastructure suppliers) control. +1.1.7. "Intellectual Property Rights" means any and all current and future (a) rights associated with works of authorship, including copyrights, mask work rights, and moral rights; (b) trademark or service mark rights; (c) trade secret rights; (d) patents, patent rights, and industrial property rights; (e) layout design rights, design rights, and other proprietary rights of every kind and nature other than trademarks, service marks, trade dress, and similar rights; and (f) registrations, applications, renewals, extensions, or reissues of any of (a) to (e) , in each case, in any jurisdiction throughout the world. +1.1.8. "On-Premise Product(s)" means computer software program(s) provided to you to download, install and use on computer(s) controlled directly or indirectly by you. +1.1.9. "Order" means a written or electronic order document entered into between you and us (or our Affiliate or an Authorized Reseller) for the Product. Unless an Order says something different, each Order will be governed by the terms of this EULA and include the name of the Product being licensed and any usage limitations, applicable fees, and any other details related to the transaction. +1.1.10. "Our Technology" means any software, code, tools, libraries, scripts, application programming interfaces, templates, algorithms, data science recipes (including any source code for data science recipes and any modifications to such source code), data science workflows, user interfaces, links, proprietary methods and systems, know-how, trade secrets, techniques, designs, inventions, and other tangible or intangible technical material, information and works of authorship underlying or otherwise used to make available the Product, including, without limitation, all Intellectual Property Rights therein and thereto. +1.1.11. "Permitted Third Party" has the meaning given in section 1.2.3 (Third Party Use). +1.1.12. "Product" means the On-Premise Product(s) or Hosted Services, as applicable, identified in an Order, and any Updates. +1.1.13. "Update" means any update, enhancement, error correction, modification or new release to the Product that we make available to you. +1.2. General License Terms, Restrictions and Order of Precedence. +1.2.1. General License Terms. The Product is licensed, not sold, to you by us under the terms of this EULA and the Order. The scope of license granted by us to you for the Product is set out in section 3 (Product Family Specific Terms) and section 4 (Product Specific Terms). +1.2.2. Authorized Users. Anything your Authorized Users do or fail to do will be considered your act or omission, and you accept full responsibility for any such act or omission to the extent you would be liable if it were your act or omission. +1.2.3. Third Party Use. You may allow your agents, contractors and outsourcing service providers (each a "Permitted Third Party") to use the Product(s) licensed to you hereunder solely for your benefit in accordance with the terms of this EULA and you are responsible for any such Permitted Third Party's compliance with this EULA in such use. Any breach by any Permitted Third Party of the terms of this EULA will be considered your breach. +1.2.4. Restrictions. Except as otherwise expressly permitted in this EULA, you will not (and will not allow any of your Affiliates or any third party to): +(a) copy, modify, adapt, translate, or otherwise create derivative works of the Product, Documentation, or any software, services, or other technology of third party vendor(s) or hosting provider(s) that we or our Affiliate engage; +(b) disassemble, decompile or "unlock", decode or otherwise reverse translate or engineer, or attempt in any manner to reconstruct or discover the source code or underlying structure, ideas, or algorithms of the Product except as expressly permitted by law in effect in the jurisdiction in which you are located; +(c) rent, lease, sell, distribute, pledge, assign, sublicense or otherwise transfer or encumber rights to the Product; +(d) make the Product available on a timesharing or service bureau basis or otherwise allow any third party to use or access the Product; +(e) remove or modify any proprietary notices, legends, or labels on the Product or Documentation; +(f) use or access the Product in a manner that: (i) violates any Applicable Laws; (ii) violates the rights of any third party; (iii) purports to subject us or our Affiliates to any other obligations; (iv) could be fraudulent; or (v) is not permitted under this EULA; +(g) use the Product to develop, test, support or market products that are competitive with and/or provide similar functionality to the Product; or +(h) permit your Affiliates to access or use the Product unless specifically authorized elsewhere in this EULA or the Order. +1.2.5. Limitations on Evaluation or Trial Licenses. If the Product is licensed to you on an evaluation or trial basis, then you may use the Product only for such purposes until the earlier of: (a) the end of the evaluation period, if any, specified in the Order, this EULA or otherwise communicated by us to you at the time of delivery; or (b) the start date of a paid for license to the Product; or (c) termination in accordance with the terms of this EULA. You may not extend the evaluation period by uninstalling and re-installing the Product(s) or by any other means other than our written consent. You must not use the Product in a production environment. You will be required to pay for a license for the Product at our then applicable license price if you continue to use the Product, whether in a production or non-production environment, after the evaluation license expires or terminates, and the terms and conditions of the EULA in effect at that time will apply to your continued use of the Product. A Product licensed to you on an evaluation or trial basis may be subject to one or more usage limits specified in section 3 (Product Family Specific Terms), section 4 (Product Specific Terms), the Order or otherwise communicated at the time of delivery (including posting of such limits at the location where you download the Product for evaluation). We may, at our sole discretion, decide whether to offer any maintenance and support for the Product during the evaluation period, and to include any conditions or limits on such maintenance and support. You may not circumvent any technical limitations included in the Product licensed to you on an evaluation or trial basis. +1.2.6. Redistribution. If the Order or section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms) grants you the express right to redistribute or offer access to all or a portion of the Product ("Redistributables"), then, in conjunction with any such grant, you must comply with any limitations or requirements specified in the Order, section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms), as applicable, and you must distribute or offer access to the Redistributables subject to a license agreement or terms of use between you and each third party receiving or accessing the Redistributables ("your customer") that: (a) protects our interests consistent with the terms contained in this EULA, (b) prohibits your customer from any further distribution of the Redistributables (unless expressly permitted pursuant to section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms)), (c) includes a limitation of damages clause that, to the maximum extent permitted by applicable law, disclaims on behalf of us, our Affiliates or our or their respective licensors, suppliers or Authorized Resellers, liability for any and all damages, whether direct, special, incidental or consequential damages, (e) contains terms substantially similar to those in subparts (a) through (g) of section 1.2.4 (Restrictions), section 1.5.1 (Export Compliance) and section 1.5.2 (U.S. Government Customers), and (f) includes a notice substantially similar to section 1.2.7 (Third Party Notices). +1.2.7. Third Party Notices. The Product may contain or be accompanied by certain third-party components which are subject to additional restrictions. These components, are identified in, and subject to, special license terms and conditions which, in the case of On-Premise Product(s), are set out in the "readme.txt" file, the "notices.txt" file, or the "Third Party Software" file accompanying the Product or portions thereof, and in the case of Hosted Services, are set out in the third-party license agreement or notices that comes with the third-party component or is otherwise provided on the web page on which such third-party component is made available ("Special Notices"). The Special Notices include important licensing and warranty information and disclaimers. Unless otherwise expressly stated for a given third-party component, all such third-party components may be used solely in connection with the use of the Product subject to and in accordance with the terms and conditions of this EULA and the Special Notices. In the event of conflict between the Special Notices and the other portions of this EULA, the Special Notices will take precedence (but solely with respect to the third-party component(s) to which the Special Notice relates). +1.2.8. Order of Precedence between EULA and Order. If there is any conflict between the terms and conditions in the Order and the terms and conditions of this EULA, or if the Order changes any of the terms of this EULA, the terms and conditions of the Order will apply, except if the Order is between you and an Authorized Reseller, or the Order is issued/generated by you. In the case where the Order is between you and an Authorized Reseller, the terms of the Order will apply subject to the following: (a) any terms and conditions in the Order imposing obligations on the Authorized Reseller that are in addition to or different from the obligations we have to you pursuant to this EULA will be born solely by the Authorized Reseller and our obligations to you and limits on our liability will be governed solely by the terms and conditions of this EULA and (b) any terms and conditions that conflict with or would otherwise alter any of the following under this EULA will have no effect unless expressly agreed to in a written instrument executed by us: our ownership rights, yours and our confidentiality obligations, your export compliance obligations, limitations on your rights as a U.S. Government customer (if applicable), our audit rights, restrictions on your right to assign, our publicity rights or governing law and jurisdiction. In cases where the Order is issued/generated by you, the terms and conditions of Section 1.19.2. of this EULA, governing a purchase order or other document you supply in connection with this EULA, shall apply to such Order. +1.2.9. Order of Precedence within EULA. If there is any conflict among the terms and conditions of this EULA, or if a section changes the terms of another section within this EULA, the order of precedence will be as follows: first, section 4 (Product Specific Terms) (if any); second, section 3 (Product Family Specific Terms) (if any); third, section 2.A (Terms for On-Premise Products) and/or section 2.B (Terms for Hosted Services), as applicable; and fourth and finally, section 1 (General Terms and Conditions). +1.3. License Types. +1.3.1. Overview of License Types. The license type for the Product will, unless otherwise specified in this EULA, be one of the following license types: perpetual, term or subscription. This will be confirmed in the Order or will be the default license type listed in section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms). +1.3.2. Perpetual License Type. Your license to use the Product will continue in perpetuity unless earlier terminated in accordance with the terms of this EULA. +1.3.3. Term License Type. Your license to use the Product will continue until the expiration of the term identified in the Order unless earlier terminated in accordance with the terms of this EULA. If we continue to make the Product generally available to our customers, you may purchase a new term license for the Product from us or our Authorized Reseller. +1.3.4. Subscription License Type. Your license to use the Product will continue until the expiration of the subscription period identified in the Order unless earlier terminated in accordance with the terms of this EULA. The procedure for renewing your license to the Product is set out in section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms). If you upgrade your subscription to the Product, the upgrade will take effect immediately and you will be charged and must pay the applicable fee, and the term of your then-current subscription period may be extended, as described at the time you upgrade. You may not downgrade a subscription to the Product. +1.4. Our Business Principles. We will apply the principles set out in our Code of Conduct and Business Ethics (published on our website at http://investors.progress.com/governance.cfm) in our performance under this EULA. +1.5. Export Compliance and U.S. Government Customers. +1.5.1. Export Compliance. Export laws and regulations of the United States and any other relevant local export laws and regulations apply to the Products. You agree that such export control laws, including, without limitation, the U.S. Export Administration Act and its associated regulations, govern your use of the Product (including technical data), and you agree to comply with all such export laws and regulations (including "deemed export" and "deemed re-export" regulations). You agree that no data, information and/or Product (or direct product thereof) will be exported, directly or indirectly, in violation of these laws, or will be used for any purpose prohibited by these laws including, without limitation, nuclear, chemical, or biological weapons proliferation, or development of missile technology. +1.5.2. U.S. Government Customers. If the Product is being acquired by or on behalf of the U.S. Government or by a U.S. Government prime contractor or subcontractor (at any tier), then the U.S. Government's rights in the Product will be only as set out herein. The Product and Documentation are "commercial items" as that term is defined at 48 C.F.R. 2.101, consisting of "commercial computer software" and "commercial software documentation" as such terms are used in 48 C.F.R. 12.212. Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4, all U.S. Government end users acquire the Product and such Documentation with only those rights set out herein. +1.6. IP Ownership and Feedback. +1.6.1. IP Ownership. The Product, Our Technology, Documentation, and all other current or future intellectual property developed by us or our Affiliates, and all worldwide Intellectual Property Rights in each of the foregoing and all Updates, upgrades, enhancements, new versions, releases, corrections, and other modifications thereto and derivative works thereof, are the exclusive property of us or our Affiliates or our or their licensors or suppliers. Except for the rights and licenses expressly granted herein, all such rights are reserved by us and our Affiliates and our or their licensors and suppliers. All title and Intellectual Property Rights in and to the content that may be accessed through use of the Product is the property of the respective content owner and may be protected by applicable copyright or other intellectual property laws and treaties. This EULA grants you no rights to use such content. +1.6.2. Feedback. If you provide us any ideas, thoughts, criticisms, suggested improvements or other feedback related to Our Technology (collectively "Feedback") you own the Feedback and you grant to us a worldwide, royalty-free, fully paid, perpetual, irrevocable license to use, reproduce, modify, translate, distribute, perform, display, import, sell, license, offer for sale, make, have made and otherwise exploit the Feedback in any form, media, or technology, whether now known or hereafter developed, and to allow others to do the same without restriction or obligation of any kind, on account of confidential information, intellectual property rights or otherwise, and may incorporate into our products or services any service, product, technology, enhancement, documentation or other development ("Improvement") incorporating or derived from any Feedback with no obligation to license or to make available the Improvement to you or any other person or entity. This is true whether you provide the Feedback through use of the Product or through any other method of communication with us, unless we have entered into a separate agreement with you that provides otherwise. +1.7. Maintenance. +1.7.1. Our Maintenance and Support Policies. If we offer and you purchase maintenance and support for the Product, then it will be provided in accordance with our then current maintenance and support policies for the applicable Product in effect at the time of purchase. You may access our maintenance and support policies by clicking on the applicable Product family link located at https://www.progress.com/support. +1.7.2. Maintenance and Support for Perpetual or Term License Types. For Perpetual and Term License Types, unless otherwise expressly stated by us in the Order, first year annual maintenance and support (if offered by us) is required for the Product and starts on the date the Product is delivered. Thereafter, you may choose to purchase annual maintenance and support (if offered by us). If you do not purchase renewal maintenance and support services for a Product, then you will not receive any maintenance and support services for that Product and will have no entitlement to any benefits of maintenance and support services including, bug fixes, patches, upgrades, enhancements, new releases or technical support. If you want to reinstate lapsed maintenance and support services on a Product, and we offer reinstatement to our customers, then you may re-instate maintenance and support services by paying the then-current fee, plus a reinstatement fee for the lapsed maintenance and support period in accordance with our maintenance and support reinstatement policies then in effect. +1.7.3. Maintenance and Support for Subscription License Type. If the license type for the Product licensed to you is the subscription license type, then maintenance and support (if offered by us) is included in the subscription fees for each subscription period. +1.8. Fees and Taxes. +1.8.1. Payment Terms and Taxes. All fees payable to us are payable in the currency specified in the Order, or if no currency is specified, in United States Dollars, are due within 30 days from the invoice date and, except as otherwise expressly specified herein, are non-cancellable and non-refundable. We may charge you interest at a rate of 1.5% per month (or the highest rate permitted by law, if less) on all overdue payments. You agree to pay any sales, value-added or other similar taxes imposed by applicable law that we must pay on such fees, except those based on our income. Invoices may be issued by our Affiliate. If you and we agree that you will pay by credit card, you will provide us with valid and updated credit card information and you authorize us to store such information and bill such credit card for all fees applicable: (a) at the time that you order the Product and (b) at the time of any renewal or upgrade. +1.8.2. Fees for Renewal Subscription Licenses. If the license type for the Product licensed to you is the Subscription License Type then each renewal subscription will be calculated at the then-current price offered for the Product at the time of renewal. +1.8.3. Fees for Renewal Maintenance Terms. If the license type for the Product licensed to you is a Perpetual license or Term license, then, unless otherwise specified in the Order or in section 3 (Product Family Specific Terms) or section 4 (Product-Specific Terms), the fee for an optional annual renewal maintenance and support term for the Product will be calculated based on the annual rate applicable for the initial maintenance and support term or immediately preceding renewal maintenance and support term, whichever is applicable, plus a rate increase, if applicable, calculated at the lesser of any standard price increase or CPI (or equivalent index) after applying any increases as a consequence of our Lifetime Support policy, if applicable. +1.8.4. Orders between You and Our Authorized Reseller. Notwithstanding the above terms of this section 1.8 (Fees and Taxes), if you purchased your license to the Product and/or maintenance and support from an Authorized Reseller, then the fees will be set out in the Order between you and the Authorized Reseller. The Authorized Reseller may be responsible for billing and/or collecting payment from you and if so, the billing and collection terms agreed to between you and the Authorized Reseller may differ from the terms set out in this section 1.8 (Fees and Taxes). +1.8.5. No Reliance on Future Availability of any Product or Update. You agree that you have not relied on the future availability of any Product or Updates in your purchasing decision or in entering into the payment obligations in your Order. +1.9. Warranties. +1.9.1. Authority. Each party represents and warrants that it has the legal power and authority to enter into this EULA. +1.9.2. Product Compliance with Documentation. We warrant to you that, for six (6) months from delivery (in the case of an On-Premise Product) or for the duration of the license (in the case of a Hosted Service), the Product will comply with the applicable Documentation in all material respects. Your exclusive remedy, and our sole liability, with respect to any breach of this warranty will be for us to use commercially reasonable efforts to promptly correct the non-compliance (provided that you notify us in writing within the warranty period and allow us a reasonable cure period). If we, at our discretion, reasonably determine that correction is not economically or technically feasible, we may terminate your license to the Product and provide you a full refund of the fees paid to us with respect to the Product (in the case of an On-Premise Product) or a refund of the prepaid fees for the unused portion of the license period (in the case of a Hosted Service). Delivery of additional copies of, or Updates to, the Product will not restart or otherwise affect the warranty period. +1.9.3. Warranty Exclusions. The warranty specified in section 1.9.2 (Product Compliance with Documentation) does not cover any Product provided on an unpaid evaluation or trial basis, or defects to the Product due to accident, abuse, service, alteration, modification or improper installation or configuration by you, your Affiliates, your or their personnel or any third party not engaged by us. +1.9.4. Warranty Disclaimers. EXCEPT FOR THE WARRANTIES EXPRESSLY STATED IN THIS SECTION 1.9 OR THE ADDITIONAL WARRANTIES (IF ANY) EXPRESSLY STATED IN SECTION 3 (PRODUCT FAMILY SPECIFIC TERMS) OR SECTION 4 (PRODUCT SPECIFIC TERMS), THE PRODUCT, DOCUMENTATION AND OUR TECHNOLOGY ARE PROVIDED "AS IS", WITH ALL FAULTS, AND WE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, NONINFRINGEMENT, AVAILABILITY, ERROR-FREE OR UNINTERRUPTED OPERATION, AND ANY WARRANTIES ARISING FROM COURSE OF DEALING, COURSE OF PERFORMANCE, OR USAGE OF TRADE. TO THE EXTENT THAT WE MAY NOT AS A MATTER OF APPLICABLE LAW DISCLAIM ANY IMPLIED WARRANTY, THE SCOPE AND DURATION OF SUCH WARRANTY WILL BE THE MINIMUM PERMITTED UNDER APPLICABLE LAW. +1.10. Indemnification. +1.10.1. Our Indemnification Obligation. +1.10.1.1. Intellectual Property Infringement. We will defend you, and your officers, directors, employees, and agents from and against any and all third party claims, lawsuits, and proceedings alleging that your use of the Product, in accordance with the terms and conditions of this EULA, constitutes a direct infringement or misappropriation of such third party's patent, copyright or trade secret rights (the "IP Claim"), and we will indemnify you for damages finally awarded against you by a court of competent jurisdiction with respect to the IP Claim. +1.10.1.2. Exceptions. We will not indemnify you to the extent that the alleged infringement or misappropriation results from (a) use of the Product in combination with any other software or item not supplied by us; (b) failure to promptly implement an Update provided by us pursuant to 1.10.1.3 (Our Options); (c) modification of the Product not made or provided by us; or (d) use of the Product in a manner not permitted by this EULA. We also will not indemnify you if we notify you of our decision to terminate this EULA, and the license to the Product granted hereunder, in accordance with section 1.10.1.3 (Our Options) and you have not ceased all use of the Product within thirty (30) days of such notification. +1.10.1.3. Our Options. If a final injunction is, or we reasonably believe that it could be, obtained against your use of the Product, or if in our opinion the Product is likely to become the subject of a successful claim of infringement, we may, at our option and expense, (a) replace or modify the Product so that it becomes non-infringing (provided that the functionality is substantially equivalent), (b) obtain for you a license to continue to use the Product, or (c) if neither (a) nor (b) are reasonably practicable, terminate this EULA on thirty (30) days' notice and, if the Product was licensed to you on a Perpetual License or Term License basis, refund to you the license fee paid to us for the Product less an amount for depreciation determined on a straight-line five year (or actual term if shorter) depreciation basis with a commencement date as of the date of delivery of the Product, or if the Product was licensed to you on a Subscription License basis, refund to you the unused portion of the fees paid in advance to us for the then-current subscription period for the Product. THE INDEMNIFICATION PROVISIONS SET OUT IN THIS SECTION 1.10.1 STATE OUR ENTIRE LIABILITY AND YOUR SOLE AND EXCLUSIVE REMEDY WITH RESPECT TO ANY INFRINGEMENT OR ALLEGED INFRINGEMENT BY US OF ANY INTELLECTUAL PROPERTY RIGHTS OR PROPRIETARY RIGHTS IN RESPECT OF THE PRODUCT OR ITS USE. +1.10.2. Your Indemnification Obligation. +1.10.2.1. Indemnification for Third Party-Claims. To the extent permitted by applicable law, you will defend us and our Affiliates, and our and their respective officers, directors, employees, and agents from and against any and all third party claims, lawsuits, and proceedings that arise or result from (a) your breach of this EULA, (b) your use, distribution and/or licensing of the Redistributables, if applicable, except to the extent it arises from an IP Claim covered under section 1.10.1 above, or (c) your failure or alleged failure to comply with Applicable Laws or any violation of a third party's rights in connection with your use of the Product (each a "Third-Party Claim" and collectively "Third-Party Claims") and you will indemnify for damages finally awarded by a court of competent jurisdiction with respect to any Third-Party Claim. +1.10.3. Control of the Defense or Settlement. For any indemnification obligation covered in section 1.10.1,"Indemnifying Party" means us, "Indemnified Party" means you, and "Claim" means an IP Claim. For any indemnification obligation covered in section 1.10.2, "Indemnifying Party" means you, "Indemnified Party" means us, and "Claim" means a Third-Party Claim. The Indemnified Party must provide the Indemnifying Party with prompt written notice of a Claim; however, the Indemnified Party's failure to provide or delay in providing such notice will not relieve the Indemnifying Party of its obligations under this section except to the extent the Indemnifying Party is prejudiced by the Indemnified Party's failure or delay. The Indemnified Party will give the Indemnifying Party full control of the defense and settlement of the Claim as long as such settlement does not include a financial obligation on or admission of liability by the Indemnified Party. If the Indemnified Party does not do so, then the Indemnified Party waives the Indemnifying Party's indemnification obligations under section 1.10.1 or 1.10.2, as applicable. The Indemnified Party will reasonably cooperate in the defense of the Claim and may appear, at its own expense, through counsel reasonably acceptable to the Indemnifying Party. +1.11. Confidentiality. +1.11.1. Confidentiality Obligations. Except as otherwise provided herein, each party agrees to retain in confidence all information and know-how transmitted or disclosed to the other that the disclosing party has identified as being proprietary and/or confidential or should reasonably be understood to be confidential given the nature of the information and the circumstances surrounding its disclosure, and agrees to make no use of such information and know-how except under the terms of this EULA. However, neither party will have an obligation to maintain the confidentiality of information that (a) it received rightfully from a third party without an obligation to maintain such information in confidence; (b) was known to the receiving party prior to its disclosure by the disclosing party; (c) is or becomes a matter of public knowledge through no fault of the receiving party; or (d) is independently developed by the receiving party without use of the confidential information of the disclosing party. Further, either party may disclose confidential information of the other party as required by governmental or judicial order, provided such party gives the other party prompt written notice prior to such disclosure (unless such prior notice is not permitted by applicable law) and complies with any protective order (or equivalent) imposed on such disclosure. You will treat any source code for the Product as our confidential information and will not disclose, disseminate or distribute such materials to any third party without our prior written permission. Each party's obligations under this section 1.11 will apply during the term of this EULA and for five (5) years following termination of this EULA, provided, however, that (i) obligations with respect to source code will survive forever and (ii) trade secrets will be maintained as such until they fall into the public domain. +1.11.2. Product Benchmark Results. You acknowledge that any benchmark results pertaining to the Product are our confidential information and may not be disclosed or published without our prior written consent. This provision applies regardless of whether the benchmark tests are conducted by you or us. +1.11.3. Remedies for Breach of Confidentiality Obligations. Each party acknowledges that in the event of a breach or threat of breach of this section 1.11, money damages will not be adequate. Therefore, in addition to any other legal or equitable remedies, the non-breaching party will be entitled to seek injunctive or similar equitable relief against such breach or threat of breach without proof of actual injury and without posting of a bond. +1.12. Data Collection and Personal Data. +1.12.1. Data Collection through use of the Product. THE PRODUCT MAY INCLUDE FEATURE(S) THAT (A) GATHER PRODUCT ACTIVATION, USAGE AND/OR ENVIRONMENT INFORMATION, (B) IDENTIFY TRENDS AND/OR BUGS, (C) COLLECT USAGE STATISTICS, AND/OR (D) TRACK OTHER DATA RELATED TO YOUR USE OF THE PRODUCT, AS FURTHER DESCRIBED IN THE CURRENT VERSION OF OUR PRIVACY POLICY AVAILABLE AT https://www.progress.com/legal/privacy-policy. BY YOUR ACCEPTANCE OF THE TERMS OF THIS EULA AND/OR USE OF THE PRODUCT, YOU AUTHORIZE THE COLLECTION, USE AND DISCLOSURE OF THIS DATA FOR THE PURPOSES PROVIDED FOR IN THIS EULA AND/OR THE PRIVACY POLICY. +1.12.2. Additional Data Collection Terms. Depending on the Product licensed to you, this EULA may contain additional data collection terms in section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms) and/or, if we are hosting the Product, in section 2.B (Terms for Hosted Services). +1.12.3. Your Personal Data. If you determine that you will be supplying us with your Personal Data (as defined in the Data Processing Addendum referenced below) for us to process on your behalf, in the provision of maintenance and support services or hosting services (if the Product licensed to you is a Hosted Service) or during the course of any audits we conduct pursuant to section 1.14 (Audit), you may submit a written request at privacy@progress.com for the mutual execution of a Data Processing Addendum substantially in the form we make available at https://www.progress.com/docs/default-source/progress-software/data-processing-addendum.pdf and we will enter into such Data Processing Addendum with you. To the extent there is any conflict between this EULA and such Data Processing Addendum, the Data Processing Addendum will prevail with respect to our handling and processing of your Personal Data. +1.13. Limitation of Liability and Disclaimer of Certain Types of Damages. +1.13.1. Limitation of Liability. EXCEPT FOR A PARTY'S INDEMNIFICATION OBLIGATIONS SET OUT IN THIS EULA OR A PARTY'S BREACH OF ITS CONFIDENTIALITY OBLIGATIONS PURSUANT TO SECTION 1.11 (CONFIDENTIALITY), OR YOUR MATERIAL VIOLATION OF OUR INTELLECTUAL PROPERTY RIGHTS OR OF THE LICENSE RESTRICTIONS SET OUT IN THIS EULA, TO THE EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL EITHER PARTY'S LIABILITY FOR ALL COSTS, DAMAGES, AND EXPENSES ARISING OUT OF OR RELATED TO THIS EULA WHETHER BASED UPON WARRANTY, CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE AT LAW EXCEED, IN THE AGGREGATE, THE FEES PAID TO US FOR THE PRODUCT AND/OR SERVICE THAT IS THE SUBJECT OF THE CLAIM, PROVIDED, HOWEVER, THAT IF THE FEES PAID FOR SUCH PRODUCT AND/OR SERVICE ARE PAID ON A RECURRING BASIS, THEN THE NOT TO EXCEED LIMIT WILL BE THE FEES PAID TO US FOR THE PRODUCT AND/OR SERVICE DURING THE TWELVE (12) MONTH PERIOD IMMEDIATELY PRECEDING THE DATE THE CLAIM AROSE. OUR AFFILIATES AND LICENSORS, AND THE SUPPLIERS TO US, OUR AFFILIATES OR LICENSORS, WILL, TO THE EXTENT PERMITTED BY APPLICABLE LAW, HAVE NO LIABILITY TO YOU OR TO ANY OTHER PERSON OR ENTITY FOR DAMAGES, DIRECT OR OTHERWISE, ARISING OUT OF THIS EULA, INCLUDING, WITHOUT LIMITATION, DAMAGES IN CONNECTION WITH THE PERFORMANCE OR OPERATION OF OUR PRODUCTS OR OUR PERFORMANCE OF SERVICES. +1.13.2 Disclaimer of Certain Types of Damages. EXCEPT FOR A PARTY'S INDEMNIFICATION OBLIGATIONS SET OUT IN THIS EULA OR YOUR MATERIAL VIOLATION OF OUR INTELLECTUAL PROPERTY RIGHTS OR THE LICENSE RESTRICTIONS SET OUT IN THIS EULA, TO THE EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL EITHER PARTY, ITS AFFILIATES OR ITS LICENSORS OR THEIR RESPECTIVE SUPPLIERS BE LIABLE FOR ANY SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL, PUNITIVE OR TORT DAMAGES ARISING IN CONNECTION WITH THIS EULA OR EITHER PARTY'S PERFORMANCE UNDER THIS EULA OR THE PERFORMANCE OF OUR PRODUCTS, OR FOR ANY DAMAGES RESULTING FROM LOSS OF USE, LOSS OF OPPORTUNITY, LOSS OF DATA, LOSS OF REVENUE, LOSS OF PROFITS, OR LOSS OF BUSINESS, EVEN IF THE PARTY, ITS AFFILIATES, ITS LICENSORS, OR ANY OF THEIR RESPECTIVE SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF THOSE DAMAGES. +1.14. Audit. We may install and use automated license tracking, management and/or enforcement solutions with the Product, which you may not disrupt or alter. You will maintain records in connection with this EULA and the use of the Product and any Updates and/or services provided hereunder. Such records will include at a minimum the number of licenses purchased and being used by you. At our expense and with reasonable written notice to you, we or a third party appointed by us may audit the records, and if necessary and as applicable, the systems on which the Product or any Update is installed for the sole purpose of ensuring compliance with the terms of this EULA. We will have the right to conduct audits as necessary. These audits may be conducted on site at a location where you have installed the Product, remotely from our offices, or a combination of both, if applicable to the Product. On-site audits will be conducted during regular business hours, and neither on-site nor remote audits will interfere unreasonably with your business operations. You agree to share with us copies of all records referenced herein, as well as Product log files and other information reasonably requested by us promptly following such request, but in no event more than five (5) business days following receipt of our written request (or such longer period, if applicable, that we specify in the written request). We will treat all such information obtained or accessed by us during the audit as confidential information pursuant to section 1.11 (Confidentiality) for use by us only as necessary to ensure compliance with and enforcement of the terms of this EULA. If any audit reveals that you have underpaid license, maintenance and support or subscription fees, you will be invoiced for all such underpaid fees based on our list price in effect at the time the audit is completed. If the underpaid fees exceed five percent (5%) of the fees previously paid by you, then you will also pay our reasonable costs of conducting the audit and enforcement of this EULA. +1.15. Termination. +1.15.1. Termination for Breach. We may terminate this EULA by written notice at any time if you do not comply with any of your obligations under this EULA and fail to cure such failure to our satisfaction within thirty (30) days after such notice. This remedy will not be exclusive and will be in addition to any other remedies which we may have under this EULA or otherwise. +1.15.2. Effect of Termination. Upon expiration of your license term to the Product (if applicable) or earlier termination of this EULA, your license to access and/or use the Product and/or distribute the Redistributables (if applicable) will terminate. You must immediately cease use of the Product and destroy all copies of the Product in your possession (and required any Permitted Third Parties to do the same). Any licenses you have granted to the Redistributables in accordance with the terms and conditions of this EULA will, unless otherwise specified in section 3 (Product Family Specific Terms) or section 4 (Product Specific Terms), survive termination of this EULA. +1.15.3. Survival. Any provisions of this EULA containing licensing restrictions, warranties and warranty disclaimers, confidentiality obligations, limitations of liability and/or indemnity terms, audits rights, and any term of this EULA which, by its nature, is intended to survive termination or expiration, will remain in effect following any termination or expiration if this EULA, as will your obligation to pay any fees accrued and owing to us as of termination or expiration. +1.16. Assignment. You may not, without our prior written consent, assign or novate this EULA, any of your rights or obligations under this EULA, or the Products or any of our Confidential Information, in whole or in part, by operation of law, sale of assets, merger or otherwise, to any other party, including any parent, subsidiary or affiliated entity. Your Change of Control will constitute an assignment for purposes of the preceding sentence. A "Change of Control" will include, but not be limited to, any merger, consolidation, amalgamation, reorganization or sale, transfer or exchange of the capital stock or equity interests of you in a transaction or series of transactions which results in the holders of your capital stock or equity interests holding less than 50% of the outstanding capital stock or equity interests immediately following such transaction(s). +1.17. Choice of Law. This EULA is governed by the laws of the Commonwealth of Massachusetts, U.S.A., without regard to the conflict of laws principles thereof. If any dispute, controversy, or claim cannot be resolved by a good-faith discussion between the parties, then it will be submitted for resolution to a state or federal court in Boston, Massachusetts, USA, and the parties hereby irrevocably and unconditionally agree to submit to the exclusive jurisdiction and venue of such court. The Uniform Computer Information Transactions Act and the United Nations Convention on the International Sale of Goods will not apply to this EULA. +1.18. Publicity. You agree that we may, in our sole discretion, publicize your use of the Product, and you license to us (and our Affiliates and necessary sublicensees) any intellectual property rights required to allow us (and our Affiliates and necessary sublicensees) to use your name, trade name(s), trademark(s), service mark(s), logo(s) and domain name(s) in connection with such publicity. +1.19. Miscellaneous. +1.19.1. Notices. Notices of termination, material breach, your insolvency or an indemnifiable claim ("Legal Notices") must be clearly identified as Legal Notices and sent via overnight courier or certified mail with proof of delivery to the following addresses: For us: 14 Oak Park Drive, Bedford, MA 01730, Attention: General Counsel. For you: your address set out in the Order. Legal Notices sent in accordance with the above will be effective upon the second business day after mailing. Either party may change its address for receipt of notices upon written notice to the other party. +1.19.2. Entire Agreement. This EULA, and any terms expressly incorporated herein by reference, will constitute the entire agreement between you and us with respect to the subject matter of this EULA and supersedes all prior and contemporaneous communications, oral or written, signed or unsigned, regarding such subject matter. Use of any purchase order or other document you supply in connection with this EULA will be for administrative convenience only and all terms and conditions stated therein will be void and of no effect. Except as otherwise expressly contemplated in this EULA, this EULA may not be modified or amended other than in writing signed by you and us. +1.19.3. Severability. If any provision of this EULA is terminated or held by a court of competent jurisdiction to be invalid, illegal, or unenforceable, the remainder of this EULA will remain in full force and effect. +1.19.4. Waiver. Failure or delay in exercising any right, power, privilege or remedy hereunder will not constitute a waiver thereof. A waiver of default will not operate as a waiver of any other default or of the same type of default on future occasions. +1.19.5. English Language. This EULA has been drawn up in English at the express wish of the parties. Le present contrat a ete redige en anglais a la demande expresse des parties. +1.19.6. Force Majeure. Neither you nor we will be liable for any delay or failure to take any action required under this EULA (except for payment) due to any cause beyond the reasonable control of you or us, as the case may be, including, but not limited to unavailability or shortages of labour, materials, or equipment, failure or delay in the delivery of vendors and suppliers and delays in transportation. +1.19.7. Our Use of Our Affiliates. We may, at our discretion, engage one or more of our Affiliates in the fulfilment of our obligations, including, our obligations for delivery of the Product to you and/or the provision of any maintenance and support services. + +2.A. TERMS FOR ON-PREMISE PRODUCTS +2.A.1. Delivery. Unless otherwise specified by us, On-Premise Product(s) will be provided to you via electronic delivery, and delivery is deemed complete when the On-Premise Product(s) is/are made available at the electronic software download site specified by us and you are e-mailed or otherwise provided with any necessary instructions, password and/or license keys required for you to be able to access, download and install the On-Premise Product(s). If we provide the On-Premise Product(s) on physical media, shipping terms will be FOB shipping point. +2.A.2. Updates. Each Update to an On-Premise Product replaces part or all of the On-Premise Product (or earlier Update) previously licensed to you ("Replaced Product") and will terminate such previously licensed Replaced Product to the extent replaced by the Update; provided, however, that you may continue to operate the Replaced Product for up to ninety (90) days from delivery of the Update to allow you to complete your implementation of the Update. You must cease all use of the Replaced Product at the end of the ninety (90) day period. Each Update will be subject to the terms and conditions of the license agreement accompanying the Update which must be accepted by you at the time you download or install the Update. If you do not agree to the license agreement accompanying the Update, do not download or install the Update. +2.A.3. Cloud Environment. You may upload the On-Premise Product(s) licensed to you pursuant to this EULA onto a cloud instance supplied by a third party, provided that the operation of the On-Premise Product(s) in the cloud instance complies with all license model restrictions and usage limitations applicable to the On-Premise Product(s). You may also allow the third party to upload, install, operate and/or use the On-Premise Products on the cloud instance, provided that the third party's access to and use of the On-Premise Products is solely for your benefit in accordance with the terms of this EULA. The third party will be considered a Permitted Third Party, and you will be responsible for the Permitted Third Party's compliance with this EULA in accordance with section 1.2.3 (Third Party Use). + +2.B. TERMS FOR HOSTED SERVICES THIS SECTION IS NOT APPLICABLE + +3. PRODUCT FAMILY SPECIFIC TERMS +This section specifies terms and conditions that are applicable to the following On-Premise Products: FiddlerCore Embedded Engine. The terms and conditions set forth in this Section 3 and in Section 4 apply to the Product. The specific Product(s) to which you are granted a license hereunder shall be only those Product(s) identified in the Order. + +Default License Type for each of the above-referenced On-Premise Products: Perpetual, with the exception of any Product obtained under a Trial License. +3.1. Product Family Definitions. +Any defined term used in this section 3 (Product Family Specific Terms) but not defined herein will have the meaning ascribed to it in section 1 (General Terms and Conditions) or section 2.A (Terms for On-Premise Products). +3.1.3. "Licensed Developer" means one of your employees or third-party consultants authorized to develop Your Integrated Product specifically for you using the Product Package in accordance with this EULA. Each Licensed Developer is an Authorized User as defined in section 1.1.3 and all terms and conditions in section 1 (General Terms and Conditions) and section 2.A (Terms for On-Premise Software) pertaining to Authorized Users will apply to a Licensed Developer. +3.1.2. "Permitted End User" means your own employees or subcontractors, each of whom is authorized to use the Software as part of Your Integrated Product solely for Your benefit and in accordance with the requirements of this EULA. +3.1.4. "Product Package" means the Product and the Documentation, collectively. +3.1.5. "Your Integrated Product" means a single internal-facing Licensee software product into which the Product is integrated. "Your Integrated Product" as defined herein, is further limited to Licensee's software product which: (i) is developed by Your Licensed Developers; (ii) adds substantial functionality beyond the functionality provided by the incorporated components of the Product; (iii) has functionalities which would be considered improvements within the natural progression of the software product; and (iv) is not a commercial alternative for, or competitive in the marketplace with, the Product or any components of the Product. +3.2. Restrictions on Eligibility to Purchase a License. Content Management System, .NET, PHP, Java and/or JavaScript component vendors are not allowed to use the Product Package without our express permission. If you or the company you represent is a Content Management System, .NET, PHP, Java or JavaScript component vendor, you may not purchase a license for or use the Product Package unless you contact us directly and obtain permission. +3.3. Required Quantity of Licensed Developers. Licensed Developers must correspond to the maximum number of seats you have purchased for the Product Package from us hereunder. This means that, at any given time, the number of Licensed Developers cannot exceed the number of seats that you have purchased from us and for which you have paid us all the applicable license fees pursuant to this EULA. The Product Package is in "use" on a computer when it is loaded into temporary memory (i.e. RAM) or installed into permanent memory (e.g. hard disk or other storage device). Your Licensed Developers may install the Product Package on multiple machines, so long as the Product Package is not being used simultaneously for development purposes at any given time by more Licensed Developers than you have seats. +3.4. Trial License. +3.4.1. License Grant. If you downloaded the free trial license for the Product Package ("Trial License"), then your use of the Product Package is subject to the limitations and conditions specified in section 1.2.5 (Limitations on Evaluation or Trial Licenses). Without limiting the foregoing, you are not allowed to integrate the Product Package into end products or use it for any commercial, productive or training purpose. You may not redistribute the Product Package. The term of the Trial License will be 30 days. If you wish to continue using the Product Package beyond the expiration of the Trial License, you must purchase the applicable Internal Business Systems License, as defined in section 4 (Product-Specific Terms) or a FiddlerCore Embedded Engine Commercial License, as referenced at the end of section 4.A.1.3. +3.4.2. Support - Trial License. As described in greater detail here: http://www.telerik.com/purchase/support-plans, and subject to the limitations and restrictions described in the Fair Usage Policy, you are entitled to enter support requests via our ticketing system with a 72 hour response time (excluding Saturdays, Sundays and holidays) for thirty (30) days after download of your initial Trial License. For avoidance of doubt, you are not entitled to additional support requests for any Trial Licenses of the same or successor Products downloaded after your initial download (e.g. to evaluate a new release), for a period of one (1) year from the date of your initial download. +3.4.3. Updates - Trial License. At our sole discretion, you may receive certain Updates for the Product Package version you are evaluating. If Licensor makes Updates to the Product Package available to you, such Updates replace and/or supplement (and may disable) the version of the Product Package that formed the basis for your eligibility for the Update. You may use the resulting updated Product Package only in accordance with the terms of this Trial License. For the avoidance of doubt, Updates do not restart the term of the Trial License. +3.5. Support and Updates - Internal Business Systems License +3.5.1. Support. For any applicable period for which you have purchased maintenance and support (the "Maintenance Period"), you will receive minor and major Updates for the Product Package, and will be entitled to receive support, each as described in further detail below. Except as otherwise set forth in Section 4, during the Maintenance Period, you are entitled to either the "Lite", "Priority", or "Ultimate" support package as determined at time of purchase and set forth on the Order and described in greater detail here: http://www.telerik.com/purchase/support-plans subject to the limitations and restrictions described in the following Fair Usage Policy. You will lose the right to receive support and Updates at the end of your Maintenance Period, unless you renew your access to updates and support for additional Maintenance Period(s) with us at additional cost. Your level of support (Lite, Priority or Ultimate) is determined at the time of initial license purchase. You may upgrade your level of support for individually purchased Products at any time during an active Maintenance Period provided we continue to make such levels of support generally available. Any support level upgrades (if purchased) and all access to support and Updates thereunder will be bound to the term of the then active Maintenance Period (i.e. the renewal/expiration date of your Maintenance Period will not change as a result of the support level upgrade). You generally may not downgrade your level of support and there is no automated mechanism available to you by which to downgrade. The following additional terms apply to support hereunder: + (a) We may apply a Fair Usage Policy that allows us to limit or terminate your access to any or all of the support services if your use of the support services is determined by us, in our sole and reasonable discretion, to be excessive. + (b) In no event will we provide support of any kind to your Permitted End Users. +3.5.2. Updates. During the Maintenance Period, you will be eligible to receive all major Updates and minor Updates for the version of the Product Package that you license hereunder. Notwithstanding anything to the contrary in Section 2.A.2., you may use the resulting updated Product Package in accordance with the terms of this EULA, except that: (i) to the extent the Update contains new or updated Special Notices, your use of any third party components shall be subject to Section 1.2.7 of this EULA and the Special Notices accompanying the Update; and, (ii) to the extent the Update contains new Products, components, features and/or functionality which are subject to additional or conflicting terms and conditions than those set forth in this EULA, your use of such new Products, components, features and/or functionality will be subject to the terms and conditions of the license agreement accompanying the Update which must be accepted by you at the time you download or install the Update. If you do not agree to such additional or conflicting terms and conditions, do not download or install the Update. +3.7. No Publicity. Licensee may not publicize or disclose its use of the Product Package (or any portion thereof) in any way nor use Licensor's name, trademarks, service marks or logos without Licensor's prior written consent. For avoidance of doubt, use of the Product within Your Integrated Product (if permitted in accordance with Section 4) shall be "white label". +3.8. Destruction Requirement upon Termination. Upon termination of this EULA, all licenses granted to you hereunder will terminate automatically and the terms of section 1.15.2 (Effect of Termination) will apply. Additionally, you must destroy: (i) all copies of the Product Package not integrated into a live, functioning instance(s) of Your Integrated Product(s) already installed, implemented and deployed for your Permitted End Users, and (ii) any product and company logos provided by us in connection with this EULA. +3.9. Product Discontinuance. We reserve the right to discontinue any Product Package or any component of any Product Package, whether offered as a standalone product or solely as a component, at any time. However, we are obligated to provide support in accordance with the terms of this EULA for the discontinued Product Package or any discontinued component of the Product Package for a period of one year after the date of discontinuance (provided you are under an active Maintenance Period). + +4. PRODUCT-SPECIFIC TERMS +Any defined term used in this section 4 (Product-Specific Terms) but not defined herein will have the meaning ascribed to it in section 1 (General Terms and Conditions), section 2.A (Terms for On-Premise Products), or 3 (Product Family Specific Terms). +4.A FiddlerCore Embedded Engine. +This section specifies terms and conditions that are applicable to the FiddlerCore Embedded Engine. +4.A.1. License. +Subject to the terms of this EULA, we grant to you the following limited, non-exclusive, non-transferable license (the "License") to use the Product Package as set out herein. You are granted either a Trial License pursuant to section 3.4 (Trial License) or an internal business systems license ("Internal Business Systems License") pursuant to section 4.A.1.1 (Internal Business Systems License). Which version of the License applies (i.e., Trial License or Internal Business Systems License) is determined at the time of the License purchase. +4.A.1.1 Internal Business Systems License +If You purchase an Internal Business Systems License with Updates and Support, your Licensed Developers may use the Product Package in object code form only in the development of one (1) Your Integrated Product. In addition, for the applicable period of one (1), two (2), or three (3) years from the date on which you purchased a license to use the Product Package, for which you have purchased updates and support (the "Subscription Period"), you will receive minor and major updates for the Product Package, as well as the "Priority" support package, each as described in 4.A.1.2. +4.A.1.2 Maintenance and Support- Internal Business Systems License +During the Subscription Period, you are entitled to the "Priority" support package as described in greater detail here: http://www.telerik.com/purchase/support-plans/, subject to the limitations and restrictions described herein. +Licensor may limit or terminate your access to any or all of the support services available under the "Priority" support package if your use of the support services is determined by Licensor, in its sole and reasonable discretion, to be excessive. + +4.A.1.3 Third-Party Libraries + +In addition to and without limiting the applicability of any Special Notices, the Product Package installation includes optional third-party libraries which are licensed by third-parties under their own separate terms. If you choose to utilize these libraries, you must comply with the terms outlined by their owners, each as described in section 4.A.1.3.1 and 4.A.1.3.2. + +4.A.1.3.1 Library BCMakeCert.dll + +The included library BCMakeCert.dll is the C# version of "The Legion of the Bouncy Castle" http://www.bouncycastle.org/ and its use and redistribution are governed by the terms specified by its owners. See http://www.bouncycastle.org/csharp/licence.html for details. + +4.A.1.3.2 Library MakeCert.exe + +The included library MakeCert.exe is Microsoft's certificate generation library. This library is redistributed under the license terms included with Visual Studio 2008. + +4.A.1.3 Redistribution + +If you have purchased an Internal Business Systems License, subject to the terms of this EULA, Licensee is granted a limited, non-transferable right to internally distribute the Product in object code form only as embedded in Your Integrated Product to your Permitted End Users for use solely within your organization. You are not permitted to distribute the Product pursuant to this section: (i) in any format other than in object form, (ii) as a standalone product, or (iii) as a part of any product other than Your Integrated Product, or (iv) in any manner which causes the Product to be stored on a server not owned or controlled by you. You must ensure that the Product is not distributed in any form that allows it to be reused by any application other than Your Integrated Product. Licensee is not allowed to and is expressly prohibited from granting its Permitted End Users any right to further sublicense the Product. For avoidance of doubt, your Permitted End Users are not permitted to use the Product, or any portions thereof, for software development or application development purposes unless they also purchase a separate commercial license from Licensor for each of the users. This EULA does not grant you a license or any rights to use or distribute the FiddlerCore Embedded Engine in a public facing, redistributable Your Integrated Product. For the FiddlerCore Embedded Engine Commercial License, please contact sales at sales@telerik.com. + + + diff --git a/packages/Telerik.NetworkConnections.0.2.0/THIRD-PARTY-NOTICES.txt b/packages/Telerik.NetworkConnections.0.2.0/THIRD-PARTY-NOTICES.txt new file mode 100644 index 0000000..b441e13 --- /dev/null +++ b/packages/Telerik.NetworkConnections.0.2.0/THIRD-PARTY-NOTICES.txt @@ -0,0 +1,86 @@ +Progress Telerik FiddlerCore v5 + +Copyright © 2010-2019 Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved. + +Portions of the Product include certain open source and commercial third-party components listed below (“Third-Party Components”). The authors of the Third-Party Components require Progress Software Corporation (“PSC”) to include the following notices and additional licensing terms as a condition of PSC’s use of such Third-Party Components. You acknowledge that the authors of the Third-Party Components have no obligation to provide support to you for the Third-Party Components or the Product. You hereby undertake to comply with all licenses related to the applicable Third-Party Components. Notwithstanding anything to the contrary, to the extent that any of the terms and conditions of the Progress Agreement conflict, vary, or are in addition to the terms and conditions of the aforementioned third-party licenses for these technologies, such terms and conditions are offered by PSC alone and not by any other party. + +1. Special Notices Regarding Open Source Third Party Components incorporated in the Product: + +(1) MIT-Style Licenses: + +(a) Progress Telerik FiddlerCore v5 incorporates Bouncy Castle C# API v1.8.1. Such technology is subject to the following terms and conditions: +LICENSE +Copyright (c) 2000 - 2019 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org) +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +(b) Progress Telerik FiddlerCore v5 incorporates Windows SDK for Google Analytics v1.5.0.0.Feb.2017. Such technology is subject to the following terms and conditions: +MIT License +Copyright (c) 2017 .NET Foundation +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +(2) Microsoft Public License (Ms-PL): + +Progress Telerik FiddlerCore v5 incorporates DotNetZip Library v1.13.4. Such technology is subject to the following terms and conditions: +Software Licenses that apply to the DotNetZip library and tools +As DotNetZip includes work derived from other projects, you are required to comply with the terms and conditions for each of them. These licenses include BSD, Apache, and zlib. +To use the software, you must accept the licenses. If you do not accept the licenses, do not use the software. +Original intellectual property in DotNetZip is provided under the Ms-PL: +Copyright (c) 2006 - 2011 Dino Chiesa +Copyright (c) 2006, 2007, 2008, 2009 Dino Chiesa and Microsoft Corporation. +Microsoft Public License (Ms-PL) +This license governs use of the accompanying software, the DotNetZip library ("the software"). If you use the software, you accept this license. If you do not accept the license, do not use the software. +1. Definitions +The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. +A "contribution" is the original software, or any additions or changes to the software. +A "contributor" is any person that distributes its contribution under this license. +"Licensed patents" are a contributor's patent claims that read directly on its contribution. +2. Grant of Rights +(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. +(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. +3. Conditions and Limitations +(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. +(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. +(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. +(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. +(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. +-------------------------------------------------------------- +The managed ZLIB code included in Ionic.Zlib.dll and Ionic.Zip.dll is derived from jzlib. +jzlib ( https://github.com/ymnk/jzlib ) is provided under a BSD-style (3 clause) +Copyright (c) 2000,2001,2002,2003 ymnk, JCraft, Inc. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------- +The jzlib library, itself, is a re-implementation of ZLIB v1.1.3 in pure Java. +zlib is provided under the zlib license: +Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler + The ZLIB software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + Jean-loup Gailly jloup@gzip.org? Mark Adler madler@alumni.caltech.edu +-------------------------------------------------------------- +The managed BZIP2 code included in Ionic.BZip2.dll and Ionic.Zip.dll is modified code, based on Java code in the Apache commons compress library. +Apache Commons Compress ( http://commons.apache.org/proper/commons-compress/ ) is provided under the Apache 2 license: +Apache Commons Compress +Copyright 2002-2014 The Apache Software Foundation + Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. +Many thanks to Julian Seward for the original C implementation of BZip2 ( http://www.bzip.org/ ). + + +2. Special Notices Regarding Commercially Licensed Third-Party Components incorporated in the Product: None + + +NOTICE FROM PROGRESS SOFTWARE CORPORATION: Additional notices may be included in the release notes or other documentation that accompanies updates received in connection with support of the Product. + + +Updated 11/6/2019 diff --git a/packages/Telerik.NetworkConnections.0.2.0/Telerik.NetworkConnections.0.2.0.nupkg b/packages/Telerik.NetworkConnections.0.2.0/Telerik.NetworkConnections.0.2.0.nupkg new file mode 100644 index 0000000..0153246 Binary files /dev/null and b/packages/Telerik.NetworkConnections.0.2.0/Telerik.NetworkConnections.0.2.0.nupkg differ diff --git a/packages/Telerik.NetworkConnections.0.2.0/icon.png b/packages/Telerik.NetworkConnections.0.2.0/icon.png new file mode 100644 index 0000000..0f81c91 Binary files /dev/null and b/packages/Telerik.NetworkConnections.0.2.0/icon.png differ diff --git a/packages/Telerik.NetworkConnections.0.2.0/lib/net40/Telerik.NetworkConnections.dll b/packages/Telerik.NetworkConnections.0.2.0/lib/net40/Telerik.NetworkConnections.dll new file mode 100644 index 0000000..964be11 Binary files /dev/null and b/packages/Telerik.NetworkConnections.0.2.0/lib/net40/Telerik.NetworkConnections.dll differ diff --git a/packages/Telerik.NetworkConnections.0.2.0/lib/net40/Telerik.NetworkConnections.pdb b/packages/Telerik.NetworkConnections.0.2.0/lib/net40/Telerik.NetworkConnections.pdb new file mode 100644 index 0000000..75c1302 Binary files /dev/null and b/packages/Telerik.NetworkConnections.0.2.0/lib/net40/Telerik.NetworkConnections.pdb differ diff --git a/packages/Telerik.NetworkConnections.0.2.0/lib/net40/Telerik.NetworkConnections.xml b/packages/Telerik.NetworkConnections.0.2.0/lib/net40/Telerik.NetworkConnections.xml new file mode 100644 index 0000000..8399a2e --- /dev/null +++ b/packages/Telerik.NetworkConnections.0.2.0/lib/net40/Telerik.NetworkConnections.xml @@ -0,0 +1,174 @@ + + + + Telerik.NetworkConnections + + + + + Factory for creating instances. + + + + + Factory method for creating instances. + + + + + + An abstraction which allows manipulation and monitoring of proxy settings for specific network connection. + + + + + + Initializes a new instance of the class. + + The full name. + + + + Finalizes an instance of the class. + + + + + Occurs when proxy settings for this connection are changed. + + + + + Gets the full name of the connection. + + + The full name of the connection. + + + + + Indicates whether the current object is equal to another object of the same type. + + An object to compare with this object. + + true if the current object is equal to the other parameter; otherwise, false. + + + + + Determines whether the specified , is equal to this instance. + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Performs releasing of resources. + + + + + Raises the event. + + The instance containing the event data. + + + + Releases resources for this instance. + + + + + Manager for the available network connections. The class can be instantiated with the + constructor, + or composed using MEF. + + + + + + Initializes a new instance of the class. + + The network connections detectors to be executed. + + + + Finalizes an instance of the class. + + + + + Occurs when proxy settings for any of the detected network connection changes. + + + + + Gets the names of all detected network connections. + + + + + + Releases the instance. + + + + + Detector for Windows-specific RAS network connection. + + + + + + Factory method for creating instances. + + + + + + Fires when the specified registry key has changed. + + + + + Watch a registry key for changes to its values. + + The Registry Hive in which the key lives + The key, e.g. \Software\Microsoft\Fiddler2\ + The Event Handler to invoke when a change occurs. + A new RegistryWatcher object. + + + + Start monitoring. + + + + + Stops the monitoring thread. + + + + + Detector for Windows-specific Windows Internet (WinINET) network component connection. + + + + + + Factory method for creating instances. + + + + + diff --git a/packages/Telerik.NetworkConnections.0.2.0/lib/netstandard2.0/Telerik.NetworkConnections.dll b/packages/Telerik.NetworkConnections.0.2.0/lib/netstandard2.0/Telerik.NetworkConnections.dll new file mode 100644 index 0000000..c04bb0a Binary files /dev/null and b/packages/Telerik.NetworkConnections.0.2.0/lib/netstandard2.0/Telerik.NetworkConnections.dll differ diff --git a/packages/Telerik.NetworkConnections.0.2.0/lib/netstandard2.0/Telerik.NetworkConnections.xml b/packages/Telerik.NetworkConnections.0.2.0/lib/netstandard2.0/Telerik.NetworkConnections.xml new file mode 100644 index 0000000..0a042c1 --- /dev/null +++ b/packages/Telerik.NetworkConnections.0.2.0/lib/netstandard2.0/Telerik.NetworkConnections.xml @@ -0,0 +1,265 @@ + + + + Telerik.NetworkConnections + + + + + Factory for creating instances. + + + + + Factory method for creating instances. + + + + + + Detector for Linux-specific network connection. + + + + + + Factory method for creating instances. + + + + + Detector for Mac-specific network connections. + + + + + Factory method for creating instances. + + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to #!/bin/bash + + services=$(networksetup -listnetworkserviceorder | grep 'Hardware Port') + + while read line; do + sname=$(echo $line | awk -F "(, )|(: )|[)]" '{print $2}') + sdev=$(echo $line | awk -F "(, )|(: )|[)]" '{print $4}') + if [ -n "$sdev" ]; then + ifconfig $sdev 2>/dev/null | grep 'status: active' > /dev/null 2>&1 + rc="$?" + if [ "$rc" -eq 0 ]; then + currentservice="$sname" + break + fi + fi + done <<< "$(echo "$services")" + + if [ -n "$currentservic [rest of string was truncated]";. + + + + + Looks up a localized string similar to #!/bin/bash + + networksetup -getproxyautodiscovery {0} + networksetup -getautoproxyurl {0} + networksetup -getproxybypassdomains {0} + networksetup -getwebproxy {0} + networksetup -getsecurewebproxy {0} + networksetup -getftpproxy {0} + networksetup -getsocksfirewallproxy {0}. + + + + + Looks up a localized string similar to #!/bin/bash + + networksetup -setproxyautodiscovery {0} {1} + networksetup -setautoproxyurl {0} {2} + networksetup -setautoproxystate {0} {3} + networksetup -setwebproxy {0} {4} {5} off + networksetup -setwebproxystate {0} {6} + networksetup -setsecurewebproxy {0} {7} {8} off + networksetup -setsecurewebproxystate {0} {9} + networksetup -setftpproxy {0} {10} {11} off + networksetup -setftpproxystate {0} {12} + networksetup -setsocksfirewallproxy {0} {13} {14} off + networksetup -setsocksfirewallproxystate {0} {15} + networksetup -s [rest of string was truncated]";. + + + + + An abstraction which allows manipulation and monitoring of proxy settings for specific network connection. + + + + + + Initializes a new instance of the class. + + The full name. + + + + Finalizes an instance of the class. + + + + + Occurs when proxy settings for this connection are changed. + + + + + Gets the full name of the connection. + + + The full name of the connection. + + + + + Indicates whether the current object is equal to another object of the same type. + + An object to compare with this object. + + true if the current object is equal to the other parameter; otherwise, false. + + + + + Determines whether the specified , is equal to this instance. + + The to compare with this instance. + + true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Performs releasing of resources. + + + + + Raises the event. + + The instance containing the event data. + + + + Releases resources for this instance. + + + + + Manager for the available network connections. The class can be instantiated with the + constructor, + or composed using MEF. + + + + + + Initializes a new instance of the class. + + The network connections detectors to be executed. + + + + Finalizes an instance of the class. + + + + + Occurs when proxy settings for any of the detected network connection changes. + + + + + Gets the names of all detected network connections. + + + + + + Releases the instance. + + + + + Detector for Windows-specific RAS network connection. + + + + + + Factory method for creating instances. + + + + + + Fires when the specified registry key has changed. + + + + + Watch a registry key for changes to its values. + + The Registry Hive in which the key lives + The key, e.g. \Software\Microsoft\Fiddler2\ + The Event Handler to invoke when a change occurs. + A new RegistryWatcher object. + + + + Start monitoring. + + + + + Stops the monitoring thread. + + + + + Detector for Windows-specific Windows Internet (WinINET) network component connection. + + + + + + Factory method for creating instances. + + + + +