Ionic.Zip.xml 870 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132
  1. <?xml version="1.0"?>
  2. <doc>
  3. <assembly>
  4. <name>Ionic.Zip</name>
  5. </assembly>
  6. <members>
  7. <member name="T:Ionic.Zip.ZipEntrySource">
  8. <summary>
  9. An enum that specifies the source of the ZipEntry.
  10. </summary>
  11. </member>
  12. <member name="F:Ionic.Zip.ZipEntrySource.None">
  13. <summary>
  14. Default value. Invalid on a bonafide ZipEntry.
  15. </summary>
  16. </member>
  17. <member name="F:Ionic.Zip.ZipEntrySource.FileSystem">
  18. <summary>
  19. The entry was instantiated by calling AddFile() or another method that
  20. added an entry from the filesystem.
  21. </summary>
  22. </member>
  23. <member name="F:Ionic.Zip.ZipEntrySource.Stream">
  24. <summary>
  25. The entry was instantiated via <see cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,System.String)"/> or
  26. <see cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,System.IO.Stream)"/> .
  27. </summary>
  28. </member>
  29. <member name="F:Ionic.Zip.ZipEntrySource.ZipFile">
  30. <summary>
  31. The ZipEntry was instantiated by reading a zipfile.
  32. </summary>
  33. </member>
  34. <member name="F:Ionic.Zip.ZipEntrySource.WriteDelegate">
  35. <summary>
  36. The content for the ZipEntry will be or was provided by the WriteDelegate.
  37. </summary>
  38. </member>
  39. <member name="F:Ionic.Zip.ZipEntrySource.JitStream">
  40. <summary>
  41. The content for the ZipEntry will be obtained from the stream dispensed by the <c>OpenDelegate</c>.
  42. The entry was instantiated via <see cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,Ionic.Zip.OpenDelegate,Ionic.Zip.CloseDelegate)"/>.
  43. </summary>
  44. </member>
  45. <member name="F:Ionic.Zip.ZipEntrySource.ZipOutputStream">
  46. <summary>
  47. The content for the ZipEntry will be or was obtained from a <c>ZipOutputStream</c>.
  48. </summary>
  49. </member>
  50. <member name="T:Ionic.Zip.ZipOutputStream">
  51. <summary>
  52. Provides a stream metaphor for generating zip files.
  53. </summary>
  54. <remarks>
  55. <para>
  56. This class writes zip files, as defined in the <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">specification
  57. for zip files described by PKWare</see>. The compression for this
  58. implementation is provided by a managed-code version of Zlib, included with
  59. DotNetZip in the classes in the Ionic.Zlib namespace.
  60. </para>
  61. <para>
  62. This class provides an alternative programming model to the one enabled by the
  63. <see cref="T:Ionic.Zip.ZipFile"/> class. Use this when creating zip files, as an
  64. alternative to the <see cref="T:Ionic.Zip.ZipFile"/> class, when you would like to use a
  65. <c>Stream</c> type to write the zip file.
  66. </para>
  67. <para>
  68. Both the <c>ZipOutputStream</c> class and the <c>ZipFile</c> class can be used
  69. to create zip files. Both of them support many of the common zip features,
  70. including Unicode, different compression levels, and ZIP64. They provide
  71. very similar performance when creating zip files.
  72. </para>
  73. <para>
  74. The <c>ZipFile</c> class is generally easier to use than
  75. <c>ZipOutputStream</c> and should be considered a higher-level interface. For
  76. example, when creating a zip file via calls to the <c>PutNextEntry()</c> and
  77. <c>Write()</c> methods on the <c>ZipOutputStream</c> class, the caller is
  78. responsible for opening the file, reading the bytes from the file, writing
  79. those bytes into the <c>ZipOutputStream</c>, setting the attributes on the
  80. <c>ZipEntry</c>, and setting the created, last modified, and last accessed
  81. timestamps on the zip entry. All of these things are done automatically by a
  82. call to <see cref="M:Ionic.Zip.ZipFile.AddFile(System.String,System.String)">ZipFile.AddFile()</see>.
  83. For this reason, the <c>ZipOutputStream</c> is generally recommended for use
  84. only when your application emits arbitrary data, not necessarily data from a
  85. filesystem file, directly into a zip file, and does so using a <c>Stream</c>
  86. metaphor.
  87. </para>
  88. <para>
  89. Aside from the differences in programming model, there are other
  90. differences in capability between the two classes.
  91. </para>
  92. <list type="bullet">
  93. <item>
  94. <c>ZipFile</c> can be used to read and extract zip files, in addition to
  95. creating zip files. <c>ZipOutputStream</c> cannot read zip files. If you want
  96. to use a stream to read zip files, check out the <see cref="T:Ionic.Zip.ZipInputStream"/> class.
  97. </item>
  98. <item>
  99. <c>ZipOutputStream</c> does not support the creation of segmented or spanned
  100. zip files.
  101. </item>
  102. <item>
  103. <c>ZipOutputStream</c> cannot produce a self-extracting archive.
  104. </item>
  105. </list>
  106. <para>
  107. Be aware that the <c>ZipOutputStream</c> class implements the <see cref="T:System.IDisposable"/> interface. In order for
  108. <c>ZipOutputStream</c> to produce a valid zip file, you use use it within
  109. a using clause (<c>Using</c> in VB), or call the <c>Dispose()</c> method
  110. explicitly. See the examples for how to employ a using clause.
  111. </para>
  112. <para>
  113. Also, a note regarding compression performance: On the desktop .NET
  114. Framework, DotNetZip can use a multi-threaded compression implementation
  115. that provides significant speed increases on large files, over 300k or so,
  116. at the cost of increased memory use at runtime. (The output of the
  117. compression is almost exactly the same size). But, the multi-threaded
  118. approach incurs a performance hit on smaller files. There's no way for the
  119. ZipOutputStream to know whether parallel compression will be beneficial,
  120. because the ZipOutputStream does not know how much data you will write
  121. through the stream. You may wish to set the <see cref="P:Ionic.Zip.ZipOutputStream.ParallelDeflateThreshold"/> property to zero, if you are compressing
  122. large files through <c>ZipOutputStream</c>. This will cause parallel
  123. compression to be used, always.
  124. </para>
  125. </remarks>
  126. </member>
  127. <member name="M:Ionic.Zip.ZipOutputStream.#ctor(System.IO.Stream)">
  128. <summary>
  129. Create a ZipOutputStream, wrapping an existing stream.
  130. </summary>
  131. <remarks>
  132. <para>
  133. The <see cref="T:Ionic.Zip.ZipFile"/> class is generally easier to use when creating
  134. zip files. The ZipOutputStream offers a different metaphor for creating a
  135. zip file, based on the <see cref="T:System.IO.Stream"/> class.
  136. </para>
  137. </remarks>
  138. <param name="stream">
  139. The stream to wrap. It must be writable. This stream will be closed at
  140. the time the ZipOutputStream is closed.
  141. </param>
  142. <example>
  143. This example shows how to create a zip file, using the
  144. ZipOutputStream class.
  145. <code lang="C#">
  146. private void Zipup()
  147. {
  148. if (filesToZip.Count == 0)
  149. {
  150. System.Console.WriteLine("Nothing to do.");
  151. return;
  152. }
  153. using (var raw = File.Open(_outputFileName, FileMode.Create, FileAccess.ReadWrite ))
  154. {
  155. using (var output= new ZipOutputStream(raw))
  156. {
  157. output.Password = "VerySecret!";
  158. output.Encryption = EncryptionAlgorithm.WinZipAes256;
  159. foreach (string inputFileName in filesToZip)
  160. {
  161. System.Console.WriteLine("file: {0}", inputFileName);
  162. output.PutNextEntry(inputFileName);
  163. using (var input = File.Open(inputFileName, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Write ))
  164. {
  165. byte[] buffer= new byte[2048];
  166. int n;
  167. while ((n= input.Read(buffer,0,buffer.Length)) &gt; 0)
  168. {
  169. output.Write(buffer,0,n);
  170. }
  171. }
  172. }
  173. }
  174. }
  175. }
  176. </code>
  177. <code lang="VB">
  178. Private Sub Zipup()
  179. Dim outputFileName As String = "XmlData.zip"
  180. Dim filesToZip As String() = Directory.GetFiles(".", "*.xml")
  181. If (filesToZip.Length = 0) Then
  182. Console.WriteLine("Nothing to do.")
  183. Else
  184. Using raw As FileStream = File.Open(outputFileName, FileMode.Create, FileAccess.ReadWrite)
  185. Using output As ZipOutputStream = New ZipOutputStream(raw)
  186. output.Password = "VerySecret!"
  187. output.Encryption = EncryptionAlgorithm.WinZipAes256
  188. Dim inputFileName As String
  189. For Each inputFileName In filesToZip
  190. Console.WriteLine("file: {0}", inputFileName)
  191. output.PutNextEntry(inputFileName)
  192. Using input As FileStream = File.Open(inputFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
  193. Dim n As Integer
  194. Dim buffer As Byte() = New Byte(2048) {}
  195. Do While (n = input.Read(buffer, 0, buffer.Length) &gt; 0)
  196. output.Write(buffer, 0, n)
  197. Loop
  198. End Using
  199. Next
  200. End Using
  201. End Using
  202. End If
  203. End Sub
  204. </code>
  205. </example>
  206. </member>
  207. <member name="M:Ionic.Zip.ZipOutputStream.#ctor(System.String)">
  208. <summary>
  209. Create a ZipOutputStream that writes to a filesystem file.
  210. </summary>
  211. <remarks>
  212. The <see cref="T:Ionic.Zip.ZipFile"/> class is generally easier to use when creating
  213. zip files. The ZipOutputStream offers a different metaphor for creating a
  214. zip file, based on the <see cref="T:System.IO.Stream"/> class.
  215. </remarks>
  216. <param name="fileName">
  217. The name of the zip file to create.
  218. </param>
  219. <example>
  220. This example shows how to create a zip file, using the
  221. ZipOutputStream class.
  222. <code lang="C#">
  223. private void Zipup()
  224. {
  225. if (filesToZip.Count == 0)
  226. {
  227. System.Console.WriteLine("Nothing to do.");
  228. return;
  229. }
  230. using (var output= new ZipOutputStream(outputFileName))
  231. {
  232. output.Password = "VerySecret!";
  233. output.Encryption = EncryptionAlgorithm.WinZipAes256;
  234. foreach (string inputFileName in filesToZip)
  235. {
  236. System.Console.WriteLine("file: {0}", inputFileName);
  237. output.PutNextEntry(inputFileName);
  238. using (var input = File.Open(inputFileName, FileMode.Open, FileAccess.Read,
  239. FileShare.Read | FileShare.Write ))
  240. {
  241. byte[] buffer= new byte[2048];
  242. int n;
  243. while ((n= input.Read(buffer,0,buffer.Length)) &gt; 0)
  244. {
  245. output.Write(buffer,0,n);
  246. }
  247. }
  248. }
  249. }
  250. }
  251. </code>
  252. <code lang="VB">
  253. Private Sub Zipup()
  254. Dim outputFileName As String = "XmlData.zip"
  255. Dim filesToZip As String() = Directory.GetFiles(".", "*.xml")
  256. If (filesToZip.Length = 0) Then
  257. Console.WriteLine("Nothing to do.")
  258. Else
  259. Using output As ZipOutputStream = New ZipOutputStream(outputFileName)
  260. output.Password = "VerySecret!"
  261. output.Encryption = EncryptionAlgorithm.WinZipAes256
  262. Dim inputFileName As String
  263. For Each inputFileName In filesToZip
  264. Console.WriteLine("file: {0}", inputFileName)
  265. output.PutNextEntry(inputFileName)
  266. Using input As FileStream = File.Open(inputFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
  267. Dim n As Integer
  268. Dim buffer As Byte() = New Byte(2048) {}
  269. Do While (n = input.Read(buffer, 0, buffer.Length) &gt; 0)
  270. output.Write(buffer, 0, n)
  271. Loop
  272. End Using
  273. Next
  274. End Using
  275. End If
  276. End Sub
  277. </code>
  278. </example>
  279. </member>
  280. <member name="M:Ionic.Zip.ZipOutputStream.#ctor(System.IO.Stream,System.Boolean)">
  281. <summary>
  282. Create a ZipOutputStream.
  283. </summary>
  284. <remarks>
  285. See the documentation for the <see cref="M:Ionic.Zip.ZipOutputStream.#ctor(System.IO.Stream)">ZipOutputStream(Stream)</see>
  286. constructor for an example.
  287. </remarks>
  288. <param name="stream">
  289. The stream to wrap. It must be writable.
  290. </param>
  291. <param name="leaveOpen">
  292. true if the application would like the stream
  293. to remain open after the <c>ZipOutputStream</c> has been closed.
  294. </param>
  295. </member>
  296. <member name="M:Ionic.Zip.ZipOutputStream.ToString">
  297. <summary>Provides a string representation of the instance.</summary>
  298. <remarks>
  299. <para>
  300. This can be useful for debugging purposes.
  301. </para>
  302. </remarks>
  303. <returns>a string representation of the instance.</returns>
  304. </member>
  305. <member name="M:Ionic.Zip.ZipOutputStream.ContainsEntry(System.String)">
  306. <summary>
  307. Returns true if an entry by the given name has already been written
  308. to the ZipOutputStream.
  309. </summary>
  310. <param name="name">
  311. The name of the entry to scan for.
  312. </param>
  313. <returns>
  314. true if an entry by the given name has already been written.
  315. </returns>
  316. </member>
  317. <member name="M:Ionic.Zip.ZipOutputStream.Write(System.Byte[],System.Int32,System.Int32)">
  318. <summary>
  319. Write the data from the buffer to the stream.
  320. </summary>
  321. <remarks>
  322. As the application writes data into this stream, the data may be
  323. compressed and encrypted before being written out to the underlying
  324. stream, depending on the settings of the <see cref="P:Ionic.Zip.ZipOutputStream.CompressionLevel"/>
  325. and the <see cref="P:Ionic.Zip.ZipOutputStream.Encryption"/> properties.
  326. </remarks>
  327. <param name="buffer">The buffer holding data to write to the stream.</param>
  328. <param name="offset">the offset within that data array to find the first byte to write.</param>
  329. <param name="count">the number of bytes to write.</param>
  330. </member>
  331. <member name="M:Ionic.Zip.ZipOutputStream.PutNextEntry(System.String)">
  332. <summary>
  333. Specify the name of the next entry that will be written to the zip file.
  334. </summary>
  335. <remarks>
  336. <para>
  337. Call this method just before calling <see cref="M:Ionic.Zip.ZipOutputStream.Write(System.Byte[],System.Int32,System.Int32)"/>, to
  338. specify the name of the entry that the next set of bytes written to
  339. the <c>ZipOutputStream</c> belongs to. All subsequent calls to <c>Write</c>,
  340. until the next call to <c>PutNextEntry</c>,
  341. will be inserted into the named entry in the zip file.
  342. </para>
  343. <para>
  344. If the <paramref name="entryName"/> used in <c>PutNextEntry()</c> ends in
  345. a slash, then the entry added is marked as a directory. Because directory
  346. entries do not contain data, a call to <c>Write()</c>, before an
  347. intervening additional call to <c>PutNextEntry()</c>, will throw an
  348. exception.
  349. </para>
  350. <para>
  351. If you don't call <c>Write()</c> between two calls to
  352. <c>PutNextEntry()</c>, the first entry is inserted into the zip file as a
  353. file of zero size. This may be what you want.
  354. </para>
  355. <para>
  356. Because <c>PutNextEntry()</c> closes out the prior entry, if any, this
  357. method may throw if there is a problem with the prior entry.
  358. </para>
  359. <para>
  360. This method returns the <c>ZipEntry</c>. You can modify public properties
  361. on the <c>ZipEntry</c>, such as <see cref="P:Ionic.Zip.ZipEntry.Encryption"/>, <see cref="P:Ionic.Zip.ZipEntry.Password"/>, and so on, until the first call to
  362. <c>ZipOutputStream.Write()</c>, or until the next call to
  363. <c>PutNextEntry()</c>. If you modify the <c>ZipEntry</c> <em>after</em>
  364. having called <c>Write()</c>, you may get a runtime exception, or you may
  365. silently get an invalid zip archive.
  366. </para>
  367. </remarks>
  368. <example>
  369. This example shows how to create a zip file, using the
  370. <c>ZipOutputStream</c> class.
  371. <code>
  372. private void Zipup()
  373. {
  374. using (FileStream fs raw = File.Open(_outputFileName, FileMode.Create, FileAccess.ReadWrite ))
  375. {
  376. using (var output= new ZipOutputStream(fs))
  377. {
  378. output.Password = "VerySecret!";
  379. output.Encryption = EncryptionAlgorithm.WinZipAes256;
  380. output.PutNextEntry("entry1.txt");
  381. byte[] buffer= System.Text.Encoding.ASCII.GetBytes("This is the content for entry #1.");
  382. output.Write(buffer,0,buffer.Length);
  383. output.PutNextEntry("entry2.txt"); // this will be zero length
  384. output.PutNextEntry("entry3.txt");
  385. buffer= System.Text.Encoding.ASCII.GetBytes("This is the content for entry #3.");
  386. output.Write(buffer,0,buffer.Length);
  387. }
  388. }
  389. }
  390. </code>
  391. </example>
  392. <param name="entryName">
  393. The name of the entry to be added, including any path to be used
  394. within the zip file.
  395. </param>
  396. <returns>
  397. The ZipEntry created.
  398. </returns>
  399. </member>
  400. <member name="M:Ionic.Zip.ZipOutputStream.Dispose(System.Boolean)">
  401. <summary>
  402. Dispose the stream
  403. </summary>
  404. <remarks>
  405. <para>
  406. This method writes the Zip Central directory, then closes the stream. The
  407. application must call Dispose() (or Close) in order to produce a valid zip file.
  408. </para>
  409. <para>
  410. Typically the application will call <c>Dispose()</c> implicitly, via a <c>using</c>
  411. statement in C#, or a <c>Using</c> statement in VB.
  412. </para>
  413. </remarks>
  414. <param name="disposing">set this to true, always.</param>
  415. </member>
  416. <member name="M:Ionic.Zip.ZipOutputStream.Flush">
  417. <summary>
  418. This is a no-op.
  419. </summary>
  420. </member>
  421. <member name="M:Ionic.Zip.ZipOutputStream.Read(System.Byte[],System.Int32,System.Int32)">
  422. <summary>
  423. This method always throws a NotSupportedException.
  424. </summary>
  425. <param name="buffer">ignored</param>
  426. <param name="offset">ignored</param>
  427. <param name="count">ignored</param>
  428. <returns>nothing</returns>
  429. </member>
  430. <member name="M:Ionic.Zip.ZipOutputStream.Seek(System.Int64,System.IO.SeekOrigin)">
  431. <summary>
  432. This method always throws a NotSupportedException.
  433. </summary>
  434. <param name="offset">ignored</param>
  435. <param name="origin">ignored</param>
  436. <returns>nothing</returns>
  437. </member>
  438. <member name="M:Ionic.Zip.ZipOutputStream.SetLength(System.Int64)">
  439. <summary>
  440. This method always throws a NotSupportedException.
  441. </summary>
  442. <param name="value">ignored</param>
  443. </member>
  444. <member name="P:Ionic.Zip.ZipOutputStream.Password">
  445. <summary>
  446. Sets the password to be used on the <c>ZipOutputStream</c> instance.
  447. </summary>
  448. <remarks>
  449. <para>
  450. When writing a zip archive, this password is applied to the entries, not
  451. to the zip archive itself. It applies to any <c>ZipEntry</c> subsequently
  452. written to the <c>ZipOutputStream</c>.
  453. </para>
  454. <para>
  455. Using a password does not encrypt or protect the "directory" of the
  456. archive - the list of entries contained in the archive. If you set the
  457. <c>Password</c> property, the password actually applies to individual
  458. entries that are added to the archive, subsequent to the setting of this
  459. property. The list of filenames in the archive that is eventually created
  460. will appear in clear text, but the contents of the individual files are
  461. encrypted. This is how Zip encryption works.
  462. </para>
  463. <para>
  464. If you set this property, and then add a set of entries to the archive via
  465. calls to <c>PutNextEntry</c>, then each entry is encrypted with that
  466. password. You may also want to change the password between adding
  467. different entries. If you set the password, add an entry, then set the
  468. password to <c>null</c> (<c>Nothing</c> in VB), and add another entry, the
  469. first entry is encrypted and the second is not.
  470. </para>
  471. <para>
  472. When setting the <c>Password</c>, you may also want to explicitly set the <see cref="P:Ionic.Zip.ZipOutputStream.Encryption"/> property, to specify how to encrypt the entries added
  473. to the ZipFile. If you set the <c>Password</c> to a non-null value and do not
  474. set <see cref="P:Ionic.Zip.ZipOutputStream.Encryption"/>, then PKZip 2.0 ("Weak") encryption is used.
  475. This encryption is relatively weak but is very interoperable. If
  476. you set the password to a <c>null</c> value (<c>Nothing</c> in VB),
  477. <c>Encryption</c> is reset to None.
  478. </para>
  479. <para>
  480. Special case: if you wrap a ZipOutputStream around a non-seekable stream,
  481. and use encryption, and emit an entry of zero bytes, the <c>Close()</c> or
  482. <c>PutNextEntry()</c> following the entry will throw an exception.
  483. </para>
  484. </remarks>
  485. </member>
  486. <member name="P:Ionic.Zip.ZipOutputStream.Encryption">
  487. <summary>
  488. The Encryption to use for entries added to the <c>ZipOutputStream</c>.
  489. </summary>
  490. <remarks>
  491. <para>
  492. The specified Encryption is applied to the entries subsequently
  493. written to the <c>ZipOutputStream</c> instance.
  494. </para>
  495. <para>
  496. If you set this to something other than
  497. EncryptionAlgorithm.None, you will also need to set the
  498. <see cref="P:Ionic.Zip.ZipOutputStream.Password"/> to a non-null, non-empty value in
  499. order to actually get encryption on the entry.
  500. </para>
  501. </remarks>
  502. <seealso cref="P:Ionic.Zip.ZipOutputStream.Password">ZipOutputStream.Password</seealso>
  503. <seealso cref="P:Ionic.Zip.ZipEntry.Encryption">ZipEntry.Encryption</seealso>
  504. </member>
  505. <member name="P:Ionic.Zip.ZipOutputStream.CodecBufferSize">
  506. <summary>
  507. Size of the work buffer to use for the ZLIB codec during compression.
  508. </summary>
  509. <remarks>
  510. Setting this may affect performance. For larger files, setting this to a
  511. larger size may improve performance, but I'm not sure. Sorry, I don't
  512. currently have good recommendations on how to set it. You can test it if
  513. you like.
  514. </remarks>
  515. </member>
  516. <member name="P:Ionic.Zip.ZipOutputStream.Strategy">
  517. <summary>
  518. The compression strategy to use for all entries.
  519. </summary>
  520. <remarks>
  521. Set the Strategy used by the ZLIB-compatible compressor, when compressing
  522. data for the entries in the zip archive. Different compression strategies
  523. work better on different sorts of data. The strategy parameter can affect
  524. the compression ratio and the speed of compression but not the correctness
  525. of the compresssion. For more information see <see cref="T:Ionic.Zlib.CompressionStrategy"/>.
  526. </remarks>
  527. </member>
  528. <member name="P:Ionic.Zip.ZipOutputStream.Timestamp">
  529. <summary>
  530. The type of timestamp attached to the ZipEntry.
  531. </summary>
  532. <remarks>
  533. Set this in order to specify the kind of timestamp that should be emitted
  534. into the zip file for each entry.
  535. </remarks>
  536. </member>
  537. <member name="P:Ionic.Zip.ZipOutputStream.CompressionLevel">
  538. <summary>
  539. Sets the compression level to be used for entries subsequently added to
  540. the zip archive.
  541. </summary>
  542. <remarks>
  543. <para>
  544. Varying the compression level used on entries can affect the
  545. size-vs-speed tradeoff when compression and decompressing data streams
  546. or files.
  547. </para>
  548. <para>
  549. As with some other properties on the <c>ZipOutputStream</c> class, like <see cref="P:Ionic.Zip.ZipOutputStream.Password"/>, and <see cref="P:Ionic.Zip.ZipOutputStream.Encryption"/>,
  550. setting this property on a <c>ZipOutputStream</c>
  551. instance will cause the specified <c>CompressionLevel</c> to be used on all
  552. <see cref="T:Ionic.Zip.ZipEntry"/> items that are subsequently added to the
  553. <c>ZipOutputStream</c> instance.
  554. </para>
  555. <para>
  556. If you do not set this property, the default compression level is used,
  557. which normally gives a good balance of compression efficiency and
  558. compression speed. In some tests, using <c>BestCompression</c> can
  559. double the time it takes to compress, while delivering just a small
  560. increase in compression efficiency. This behavior will vary with the
  561. type of data you compress. If you are in doubt, just leave this setting
  562. alone, and accept the default.
  563. </para>
  564. </remarks>
  565. </member>
  566. <member name="P:Ionic.Zip.ZipOutputStream.CompressionMethod">
  567. <summary>
  568. The compression method used on each entry added to the ZipOutputStream.
  569. </summary>
  570. </member>
  571. <member name="P:Ionic.Zip.ZipOutputStream.Comment">
  572. <summary>
  573. A comment attached to the zip archive.
  574. </summary>
  575. <remarks>
  576. <para>
  577. The application sets this property to specify a comment to be embedded
  578. into the generated zip archive.
  579. </para>
  580. <para>
  581. According to <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE's
  582. zip specification</see>, the comment is not encrypted, even if there is a
  583. password set on the zip file.
  584. </para>
  585. <para>
  586. The specification does not describe how to indicate the encoding used
  587. on a comment string. Many "compliant" zip tools and libraries use
  588. IBM437 as the code page for comments; DotNetZip, too, follows that
  589. practice. On the other hand, there are situations where you want a
  590. Comment to be encoded with something else, for example using code page
  591. 950 "Big-5 Chinese". To fill that need, DotNetZip will encode the
  592. comment following the same procedure it follows for encoding
  593. filenames: (a) if <see cref="P:Ionic.Zip.ZipOutputStream.AlternateEncodingUsage"/> is
  594. <c>Never</c>, it uses the default encoding (IBM437). (b) if <see cref="P:Ionic.Zip.ZipOutputStream.AlternateEncodingUsage"/> is <c>Always</c>, it always uses the
  595. alternate encoding (<see cref="P:Ionic.Zip.ZipOutputStream.AlternateEncoding"/>). (c) if <see cref="P:Ionic.Zip.ZipOutputStream.AlternateEncodingUsage"/> is <c>AsNecessary</c>, it uses the
  596. alternate encoding only if the default encoding is not sufficient for
  597. encoding the comment - in other words if decoding the result does not
  598. produce the original string. This decision is taken at the time of
  599. the call to <c>ZipFile.Save()</c>.
  600. </para>
  601. </remarks>
  602. </member>
  603. <member name="P:Ionic.Zip.ZipOutputStream.EnableZip64">
  604. <summary>
  605. Specify whether to use ZIP64 extensions when saving a zip archive.
  606. </summary>
  607. <remarks>
  608. <para>
  609. The default value for the property is <see cref="F:Ionic.Zip.Zip64Option.Never"/>. <see cref="F:Ionic.Zip.Zip64Option.AsNecessary"/> is
  610. safest, in the sense that you will not get an Exception if a
  611. pre-ZIP64 limit is exceeded.
  612. </para>
  613. <para>
  614. You must set this property before calling <c>Write()</c>.
  615. </para>
  616. </remarks>
  617. </member>
  618. <member name="P:Ionic.Zip.ZipOutputStream.OutputUsedZip64">
  619. <summary>
  620. Indicates whether ZIP64 extensions were used when saving the zip archive.
  621. </summary>
  622. <remarks>
  623. The value is defined only after the <c>ZipOutputStream</c> has been closed.
  624. </remarks>
  625. </member>
  626. <member name="P:Ionic.Zip.ZipOutputStream.IgnoreCase">
  627. <summary>
  628. Whether the ZipOutputStream should use case-insensitive comparisons when
  629. checking for uniqueness of zip entries.
  630. </summary>
  631. <remarks>
  632. <para>
  633. Though the zip specification doesn't prohibit zipfiles with duplicate
  634. entries, Sane zip files have no duplicates, and the DotNetZip library
  635. cannot create zip files with duplicate entries. If an application attempts
  636. to call <see cref="M:Ionic.Zip.ZipOutputStream.PutNextEntry(System.String)"/> with a name that duplicates one
  637. already used within the archive, the library will throw an Exception.
  638. </para>
  639. <para>
  640. This property allows the application to specify whether the
  641. ZipOutputStream instance considers ordinal case when checking for
  642. uniqueness of zip entries.
  643. </para>
  644. </remarks>
  645. </member>
  646. <member name="P:Ionic.Zip.ZipOutputStream.UseUnicodeAsNecessary">
  647. <summary>
  648. Indicates whether to encode entry filenames and entry comments using
  649. Unicode (UTF-8).
  650. </summary>
  651. <remarks>
  652. <para>
  653. <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">The
  654. PKWare zip specification</see> provides for encoding file names and file
  655. comments in either the IBM437 code page, or in UTF-8. This flag selects
  656. the encoding according to that specification. By default, this flag is
  657. false, and filenames and comments are encoded into the zip file in the
  658. IBM437 codepage. Setting this flag to true will specify that filenames
  659. and comments that cannot be encoded with IBM437 will be encoded with
  660. UTF-8.
  661. </para>
  662. <para>
  663. Zip files created with strict adherence to the PKWare specification with
  664. respect to UTF-8 encoding can contain entries with filenames containing
  665. any combination of Unicode characters, including the full range of
  666. characters from Chinese, Latin, Hebrew, Greek, Cyrillic, and many other
  667. alphabets. However, because at this time, the UTF-8 portion of the PKWare
  668. specification is not broadly supported by other zip libraries and
  669. utilities, such zip files may not be readable by your favorite zip tool or
  670. archiver. In other words, interoperability will decrease if you set this
  671. flag to true.
  672. </para>
  673. <para>
  674. In particular, Zip files created with strict adherence to the PKWare
  675. specification with respect to UTF-8 encoding will not work well with
  676. Explorer in Windows XP or Windows Vista, because Windows compressed
  677. folders, as far as I know, do not support UTF-8 in zip files. Vista can
  678. read the zip files, but shows the filenames incorrectly. Unpacking from
  679. Windows Vista Explorer will result in filenames that have rubbish
  680. characters in place of the high-order UTF-8 bytes.
  681. </para>
  682. <para>
  683. Also, zip files that use UTF-8 encoding will not work well with Java
  684. applications that use the java.util.zip classes, as of v5.0 of the Java
  685. runtime. The Java runtime does not correctly implement the PKWare
  686. specification in this regard.
  687. </para>
  688. <para>
  689. As a result, we have the unfortunate situation that "correct" behavior by
  690. the DotNetZip library with regard to Unicode encoding of filenames during
  691. zip creation will result in zip files that are readable by strictly
  692. compliant and current tools (for example the most recent release of the
  693. commercial WinZip tool); but these zip files will not be readable by
  694. various other tools or libraries, including Windows Explorer.
  695. </para>
  696. <para>
  697. The DotNetZip library can read and write zip files with UTF8-encoded
  698. entries, according to the PKware spec. If you use DotNetZip for both
  699. creating and reading the zip file, and you use UTF-8, there will be no
  700. loss of information in the filenames. For example, using a self-extractor
  701. created by this library will allow you to unpack files correctly with no
  702. loss of information in the filenames.
  703. </para>
  704. <para>
  705. If you do not set this flag, it will remain false. If this flag is false,
  706. the <c>ZipOutputStream</c> will encode all filenames and comments using
  707. the IBM437 codepage. This can cause "loss of information" on some
  708. filenames, but the resulting zipfile will be more interoperable with other
  709. utilities. As an example of the loss of information, diacritics can be
  710. lost. The o-tilde character will be down-coded to plain o. The c with a
  711. cedilla (Unicode 0xE7) used in Portugese will be downcoded to a c.
  712. Likewise, the O-stroke character (Unicode 248), used in Danish and
  713. Norwegian, will be down-coded to plain o. Chinese characters cannot be
  714. represented in codepage IBM437; when using the default encoding, Chinese
  715. characters in filenames will be represented as ?. These are all examples
  716. of "information loss".
  717. </para>
  718. <para>
  719. The loss of information associated to the use of the IBM437 encoding is
  720. inconvenient, and can also lead to runtime errors. For example, using
  721. IBM437, any sequence of 4 Chinese characters will be encoded as ????. If
  722. your application creates a <c>ZipOutputStream</c>, does not set the
  723. encoding, then adds two files, each with names of four Chinese characters
  724. each, this will result in a duplicate filename exception. In the case
  725. where you add a single file with a name containing four Chinese
  726. characters, the zipfile will save properly, but extracting that file
  727. later, with any zip tool, will result in an error, because the question
  728. mark is not legal for use within filenames on Windows. These are just a
  729. few examples of the problems associated to loss of information.
  730. </para>
  731. <para>
  732. This flag is independent of the encoding of the content within the entries
  733. in the zip file. Think of the zip file as a container - it supports an
  734. encoding. Within the container are other "containers" - the file entries
  735. themselves. The encoding within those entries is independent of the
  736. encoding of the zip archive container for those entries.
  737. </para>
  738. <para>
  739. Rather than specify the encoding in a binary fashion using this flag, an
  740. application can specify an arbitrary encoding via the <see cref="P:Ionic.Zip.ZipOutputStream.ProvisionalAlternateEncoding"/> property. Setting the encoding
  741. explicitly when creating zip archives will result in non-compliant zip
  742. files that, curiously, are fairly interoperable. The challenge is, the
  743. PKWare specification does not provide for a way to specify that an entry
  744. in a zip archive uses a code page that is neither IBM437 nor UTF-8.
  745. Therefore if you set the encoding explicitly when creating a zip archive,
  746. you must take care upon reading the zip archive to use the same code page.
  747. If you get it wrong, the behavior is undefined and may result in incorrect
  748. filenames, exceptions, stomach upset, hair loss, and acne.
  749. </para>
  750. </remarks>
  751. <seealso cref="P:Ionic.Zip.ZipOutputStream.ProvisionalAlternateEncoding"/>
  752. </member>
  753. <member name="P:Ionic.Zip.ZipOutputStream.ProvisionalAlternateEncoding">
  754. <summary>
  755. The text encoding to use when emitting entries into the zip archive, for
  756. those entries whose filenames or comments cannot be encoded with the
  757. default (IBM437) encoding.
  758. </summary>
  759. <remarks>
  760. <para>
  761. In <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">its
  762. zip specification</see>, PKWare describes two options for encoding
  763. filenames and comments: using IBM437 or UTF-8. But, some archiving tools
  764. or libraries do not follow the specification, and instead encode
  765. characters using the system default code page. For example, WinRAR when
  766. run on a machine in Shanghai may encode filenames with the Big-5 Chinese
  767. (950) code page. This behavior is contrary to the Zip specification, but
  768. it occurs anyway.
  769. </para>
  770. <para>
  771. When using DotNetZip to write zip archives that will be read by one of
  772. these other archivers, set this property to specify the code page to use
  773. when encoding the <see cref="P:Ionic.Zip.ZipEntry.FileName"/> and <see cref="P:Ionic.Zip.ZipEntry.Comment"/> for each <c>ZipEntry</c> in the zip file, for
  774. values that cannot be encoded with the default codepage for zip files,
  775. IBM437. This is why this property is "provisional". In all cases, IBM437
  776. is used where possible, in other words, where no loss of data would
  777. result. It is possible, therefore, to have a given entry with a
  778. <c>Comment</c> encoded in IBM437 and a <c>FileName</c> encoded with the
  779. specified "provisional" codepage.
  780. </para>
  781. <para>
  782. Be aware that a zip file created after you've explicitly set the
  783. <c>ProvisionalAlternateEncoding</c> property to a value other than
  784. IBM437 may not be compliant to the PKWare specification, and may not be
  785. readable by compliant archivers. On the other hand, many (most?)
  786. archivers are non-compliant and can read zip files created in arbitrary
  787. code pages. The trick is to use or specify the proper codepage when
  788. reading the zip.
  789. </para>
  790. <para>
  791. When creating a zip archive using this library, it is possible to change
  792. the value of <c>ProvisionalAlternateEncoding</c> between each entry you
  793. add, and between adding entries and the call to <c>Close()</c>. Don't do
  794. this. It will likely result in a zipfile that is not readable. For best
  795. interoperability, either leave <c>ProvisionalAlternateEncoding</c>
  796. alone, or specify it only once, before adding any entries to the
  797. <c>ZipOutputStream</c> instance. There is one exception to this
  798. recommendation, described later.
  799. </para>
  800. <para>
  801. When using an arbitrary, non-UTF8 code page for encoding, there is no
  802. standard way for the creator application - whether DotNetZip, WinZip,
  803. WinRar, or something else - to formally specify in the zip file which
  804. codepage has been used for the entries. As a result, readers of zip files
  805. are not able to inspect the zip file and determine the codepage that was
  806. used for the entries contained within it. It is left to the application
  807. or user to determine the necessary codepage when reading zip files encoded
  808. this way. If you use an incorrect codepage when reading a zipfile, you
  809. will get entries with filenames that are incorrect, and the incorrect
  810. filenames may even contain characters that are not legal for use within
  811. filenames in Windows. Extracting entries with illegal characters in the
  812. filenames will lead to exceptions. It's too bad, but this is just the way
  813. things are with code pages in zip files. Caveat Emptor.
  814. </para>
  815. <para>
  816. One possible approach for specifying the code page for a given zip file is
  817. to describe the code page in a human-readable form in the Zip comment. For
  818. example, the comment may read "Entries in this archive are encoded in the
  819. Big5 code page". For maximum interoperability, the zip comment in this
  820. case should be encoded in the default, IBM437 code page. In this case,
  821. the zip comment is encoded using a different page than the filenames. To
  822. do this, Specify <c>ProvisionalAlternateEncoding</c> to your desired
  823. region-specific code page, once before adding any entries, and then set
  824. the <see cref="P:Ionic.Zip.ZipOutputStream.Comment"/> property and reset
  825. <c>ProvisionalAlternateEncoding</c> to IBM437 before calling <c>Close()</c>.
  826. </para>
  827. </remarks>
  828. </member>
  829. <member name="P:Ionic.Zip.ZipOutputStream.AlternateEncoding">
  830. <summary>
  831. A Text Encoding to use when encoding the filenames and comments for
  832. all the ZipEntry items, during a ZipFile.Save() operation.
  833. </summary>
  834. <remarks>
  835. <para>
  836. Whether the encoding specified here is used during the save depends
  837. on <see cref="P:Ionic.Zip.ZipOutputStream.AlternateEncodingUsage"/>.
  838. </para>
  839. </remarks>
  840. </member>
  841. <member name="P:Ionic.Zip.ZipOutputStream.AlternateEncodingUsage">
  842. <summary>
  843. A flag that tells if and when this instance should apply
  844. AlternateEncoding to encode the filenames and comments associated to
  845. of ZipEntry objects contained within this instance.
  846. </summary>
  847. </member>
  848. <member name="P:Ionic.Zip.ZipOutputStream.DefaultEncoding">
  849. <summary>
  850. The default text encoding used in zip archives. It is numeric 437, also
  851. known as IBM437.
  852. </summary>
  853. <seealso cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>
  854. </member>
  855. <member name="P:Ionic.Zip.ZipOutputStream.ParallelDeflateThreshold">
  856. <summary>
  857. The size threshold for an entry, above which a parallel deflate is used.
  858. </summary>
  859. <remarks>
  860. <para>
  861. DotNetZip will use multiple threads to compress any ZipEntry, when
  862. the <c>CompressionMethod</c> is Deflate, and if the entry is
  863. larger than the given size. Zero means "always use parallel
  864. deflate", while -1 means "never use parallel deflate".
  865. </para>
  866. <para>
  867. If the entry size cannot be known before compression, as with any entry
  868. added via a ZipOutputStream, then Parallel deflate will never be
  869. performed, unless the value of this property is zero.
  870. </para>
  871. <para>
  872. A parallel deflate operations will speed up the compression of
  873. large files, on computers with multiple CPUs or multiple CPU
  874. cores. For files above 1mb, on a dual core or dual-cpu (2p)
  875. machine, the time required to compress the file can be 70% of the
  876. single-threaded deflate. For very large files on 4p machines the
  877. compression can be done in 30% of the normal time. The downside
  878. is that parallel deflate consumes extra memory during the deflate,
  879. and the deflation is slightly less effective.
  880. </para>
  881. <para>
  882. Parallel deflate tends to not be as effective as single-threaded deflate
  883. because the original data stream is split into multiple independent
  884. buffers, each of which is compressed in parallel. But because they are
  885. treated independently, there is no opportunity to share compression
  886. dictionaries, and additional framing bytes must be added to the output
  887. stream. For that reason, a deflated stream may be slightly larger when
  888. compressed using parallel deflate, as compared to a traditional
  889. single-threaded deflate. For files of about 512k, the increase over the
  890. normal deflate is as much as 5% of the total compressed size. For larger
  891. files, the difference can be as small as 0.1%.
  892. </para>
  893. <para>
  894. Multi-threaded compression does not give as much an advantage when using
  895. Encryption. This is primarily because encryption tends to slow down
  896. the entire pipeline. Also, multi-threaded compression gives less of an
  897. advantage when using lower compression levels, for example <see cref="F:Ionic.Zlib.CompressionLevel.BestSpeed"/>. You may have to perform
  898. some tests to determine the best approach for your situation.
  899. </para>
  900. <para>
  901. The default value for this property is -1, which means parallel
  902. compression will not be performed unless you set it to zero.
  903. </para>
  904. </remarks>
  905. </member>
  906. <member name="P:Ionic.Zip.ZipOutputStream.ParallelDeflateMaxBufferPairs">
  907. <summary>
  908. The maximum number of buffer pairs to use when performing
  909. parallel compression.
  910. </summary>
  911. <remarks>
  912. <para>
  913. This property sets an upper limit on the number of memory
  914. buffer pairs to create when performing parallel
  915. compression. The implementation of the parallel
  916. compression stream allocates multiple buffers to
  917. facilitate parallel compression. As each buffer fills up,
  918. the stream uses <see cref="M:System.Threading.ThreadPool.QueueUserWorkItem(System.Threading.WaitCallback)">
  919. ThreadPool.QueueUserWorkItem()</see> to compress those
  920. buffers in a background threadpool thread. After a buffer
  921. is compressed, it is re-ordered and written to the output
  922. stream.
  923. </para>
  924. <para>
  925. A higher number of buffer pairs enables a higher degree of
  926. parallelism, which tends to increase the speed of compression on
  927. multi-cpu computers. On the other hand, a higher number of buffer
  928. pairs also implies a larger memory consumption, more active worker
  929. threads, and a higher cpu utilization for any compression. This
  930. property enables the application to limit its memory consumption and
  931. CPU utilization behavior depending on requirements.
  932. </para>
  933. <para>
  934. For each compression "task" that occurs in parallel, there are 2
  935. buffers allocated: one for input and one for output. This property
  936. sets a limit for the number of pairs. The total amount of storage
  937. space allocated for buffering will then be (N*S*2), where N is the
  938. number of buffer pairs, S is the size of each buffer (<see cref="P:Ionic.Zip.ZipOutputStream.CodecBufferSize"/>). By default, DotNetZip allocates 4 buffer
  939. pairs per CPU core, so if your machine has 4 cores, and you retain
  940. the default buffer size of 128k, then the
  941. ParallelDeflateOutputStream will use 4 * 4 * 2 * 128kb of buffer
  942. memory in total, or 4mb, in blocks of 128kb. If you then set this
  943. property to 8, then the number will be 8 * 2 * 128kb of buffer
  944. memory, or 2mb.
  945. </para>
  946. <para>
  947. CPU utilization will also go up with additional buffers, because a
  948. larger number of buffer pairs allows a larger number of background
  949. threads to compress in parallel. If you find that parallel
  950. compression is consuming too much memory or CPU, you can adjust this
  951. value downward.
  952. </para>
  953. <para>
  954. The default value is 16. Different values may deliver better or
  955. worse results, depending on your priorities and the dynamic
  956. performance characteristics of your storage and compute resources.
  957. </para>
  958. <para>
  959. This property is not the number of buffer pairs to use; it is an
  960. upper limit. An illustration: Suppose you have an application that
  961. uses the default value of this property (which is 16), and it runs
  962. on a machine with 2 CPU cores. In that case, DotNetZip will allocate
  963. 4 buffer pairs per CPU core, for a total of 8 pairs. The upper
  964. limit specified by this property has no effect.
  965. </para>
  966. <para>
  967. The application can set this value at any time, but it is
  968. effective only if set before calling
  969. <c>ZipOutputStream.Write()</c> for the first time.
  970. </para>
  971. </remarks>
  972. <seealso cref="P:Ionic.Zip.ZipOutputStream.ParallelDeflateThreshold"/>
  973. </member>
  974. <member name="P:Ionic.Zip.ZipOutputStream.CanRead">
  975. <summary>
  976. Always returns false.
  977. </summary>
  978. </member>
  979. <member name="P:Ionic.Zip.ZipOutputStream.CanSeek">
  980. <summary>
  981. Always returns false.
  982. </summary>
  983. </member>
  984. <member name="P:Ionic.Zip.ZipOutputStream.CanWrite">
  985. <summary>
  986. Always returns true.
  987. </summary>
  988. </member>
  989. <member name="P:Ionic.Zip.ZipOutputStream.Length">
  990. <summary>
  991. Always returns a NotSupportedException.
  992. </summary>
  993. </member>
  994. <member name="P:Ionic.Zip.ZipOutputStream.Position">
  995. <summary>
  996. Setting this property always returns a NotSupportedException. Getting it
  997. returns the value of the Position on the underlying stream.
  998. </summary>
  999. </member>
  1000. <member name="T:Ionic.Zip.ZipInputStream">
  1001. <summary>
  1002. Provides a stream metaphor for reading zip files.
  1003. </summary>
  1004. <remarks>
  1005. <para>
  1006. This class provides an alternative programming model for reading zip files to
  1007. the one enabled by the <see cref="T:Ionic.Zip.ZipFile"/> class. Use this when reading zip
  1008. files, as an alternative to the <see cref="T:Ionic.Zip.ZipFile"/> class, when you would
  1009. like to use a Stream class to read the file.
  1010. </para>
  1011. <para>
  1012. Some application designs require a readable stream for input. This stream can
  1013. be used to read a zip file, and extract entries.
  1014. </para>
  1015. <para>
  1016. Both the <c>ZipInputStream</c> class and the <c>ZipFile</c> class can be used
  1017. to read and extract zip files. Both of them support many of the common zip
  1018. features, including Unicode, different compression levels, and ZIP64. The
  1019. programming models differ. For example, when extracting entries via calls to
  1020. the <c>GetNextEntry()</c> and <c>Read()</c> methods on the
  1021. <c>ZipInputStream</c> class, the caller is responsible for creating the file,
  1022. writing the bytes into the file, setting the attributes on the file, and
  1023. setting the created, last modified, and last accessed timestamps on the
  1024. file. All of these things are done automatically by a call to <see cref="M:Ionic.Zip.ZipEntry.Extract">ZipEntry.Extract()</see>. For this reason, the
  1025. <c>ZipInputStream</c> is generally recommended for when your application wants
  1026. to extract the data, without storing that data into a file.
  1027. </para>
  1028. <para>
  1029. Aside from the obvious differences in programming model, there are some
  1030. differences in capability between the <c>ZipFile</c> class and the
  1031. <c>ZipInputStream</c> class.
  1032. </para>
  1033. <list type="bullet">
  1034. <item>
  1035. <c>ZipFile</c> can be used to create or update zip files, or read and
  1036. extract zip files. <c>ZipInputStream</c> can be used only to read and
  1037. extract zip files. If you want to use a stream to create zip files, check
  1038. out the <see cref="T:Ionic.Zip.ZipOutputStream"/>.
  1039. </item>
  1040. <item>
  1041. <c>ZipInputStream</c> cannot read segmented or spanned
  1042. zip files.
  1043. </item>
  1044. <item>
  1045. <c>ZipInputStream</c> will not read Zip file comments.
  1046. </item>
  1047. <item>
  1048. When reading larger files, <c>ZipInputStream</c> will always underperform
  1049. <c>ZipFile</c>. This is because the <c>ZipInputStream</c> does a full scan on the
  1050. zip file, while the <c>ZipFile</c> class reads the central directory of the
  1051. zip file.
  1052. </item>
  1053. </list>
  1054. </remarks>
  1055. </member>
  1056. <member name="M:Ionic.Zip.ZipInputStream.#ctor(System.IO.Stream)">
  1057. <summary>
  1058. Create a <c>ZipInputStream</c>, wrapping it around an existing stream.
  1059. </summary>
  1060. <remarks>
  1061. <para>
  1062. While the <see cref="T:Ionic.Zip.ZipFile"/> class is generally easier
  1063. to use, this class provides an alternative to those
  1064. applications that want to read from a zipfile directly,
  1065. using a <see cref="T:System.IO.Stream"/>.
  1066. </para>
  1067. <para>
  1068. Both the <c>ZipInputStream</c> class and the <c>ZipFile</c> class can be used
  1069. to read and extract zip files. Both of them support many of the common zip
  1070. features, including Unicode, different compression levels, and ZIP64. The
  1071. programming models differ. For example, when extracting entries via calls to
  1072. the <c>GetNextEntry()</c> and <c>Read()</c> methods on the
  1073. <c>ZipInputStream</c> class, the caller is responsible for creating the file,
  1074. writing the bytes into the file, setting the attributes on the file, and
  1075. setting the created, last modified, and last accessed timestamps on the
  1076. file. All of these things are done automatically by a call to <see cref="M:Ionic.Zip.ZipEntry.Extract">ZipEntry.Extract()</see>. For this reason, the
  1077. <c>ZipInputStream</c> is generally recommended for when your application wants
  1078. to extract the data, without storing that data into a file.
  1079. </para>
  1080. <para>
  1081. Aside from the obvious differences in programming model, there are some
  1082. differences in capability between the <c>ZipFile</c> class and the
  1083. <c>ZipInputStream</c> class.
  1084. </para>
  1085. <list type="bullet">
  1086. <item>
  1087. <c>ZipFile</c> can be used to create or update zip files, or read and extract
  1088. zip files. <c>ZipInputStream</c> can be used only to read and extract zip
  1089. files. If you want to use a stream to create zip files, check out the <see cref="T:Ionic.Zip.ZipOutputStream"/>.
  1090. </item>
  1091. <item>
  1092. <c>ZipInputStream</c> cannot read segmented or spanned
  1093. zip files.
  1094. </item>
  1095. <item>
  1096. <c>ZipInputStream</c> will not read Zip file comments.
  1097. </item>
  1098. <item>
  1099. When reading larger files, <c>ZipInputStream</c> will always underperform
  1100. <c>ZipFile</c>. This is because the <c>ZipInputStream</c> does a full scan on the
  1101. zip file, while the <c>ZipFile</c> class reads the central directory of the
  1102. zip file.
  1103. </item>
  1104. </list>
  1105. </remarks>
  1106. <param name="stream">
  1107. The stream to read. It must be readable. This stream will be closed at
  1108. the time the <c>ZipInputStream</c> is closed.
  1109. </param>
  1110. <example>
  1111. This example shows how to read a zip file, and extract entries, using the
  1112. <c>ZipInputStream</c> class.
  1113. <code lang="C#">
  1114. private void Unzip()
  1115. {
  1116. byte[] buffer= new byte[2048];
  1117. int n;
  1118. using (var raw = File.Open(inputFileName, FileMode.Open, FileAccess.Read))
  1119. {
  1120. using (var input= new ZipInputStream(raw))
  1121. {
  1122. ZipEntry e;
  1123. while (( e = input.GetNextEntry()) != null)
  1124. {
  1125. if (e.IsDirectory) continue;
  1126. string outputPath = Path.Combine(extractDir, e.FileName);
  1127. using (var output = File.Open(outputPath, FileMode.Create, FileAccess.ReadWrite))
  1128. {
  1129. while ((n= input.Read(buffer, 0, buffer.Length)) &gt; 0)
  1130. {
  1131. output.Write(buffer,0,n);
  1132. }
  1133. }
  1134. }
  1135. }
  1136. }
  1137. }
  1138. </code>
  1139. <code lang="VB">
  1140. Private Sub UnZip()
  1141. Dim inputFileName As String = "MyArchive.zip"
  1142. Dim extractDir As String = "extract"
  1143. Dim buffer As Byte() = New Byte(2048) {}
  1144. Using raw As FileStream = File.Open(inputFileName, FileMode.Open, FileAccess.Read)
  1145. Using input As ZipInputStream = New ZipInputStream(raw)
  1146. Dim e As ZipEntry
  1147. Do While (Not e = input.GetNextEntry Is Nothing)
  1148. If Not e.IsDirectory Then
  1149. Using output As FileStream = File.Open(Path.Combine(extractDir, e.FileName), _
  1150. FileMode.Create, FileAccess.ReadWrite)
  1151. Dim n As Integer
  1152. Do While (n = input.Read(buffer, 0, buffer.Length) &gt; 0)
  1153. output.Write(buffer, 0, n)
  1154. Loop
  1155. End Using
  1156. End If
  1157. Loop
  1158. End Using
  1159. End Using
  1160. End Sub
  1161. </code>
  1162. </example>
  1163. </member>
  1164. <member name="M:Ionic.Zip.ZipInputStream.#ctor(System.String)">
  1165. <summary>
  1166. Create a <c>ZipInputStream</c>, given the name of an existing zip file.
  1167. </summary>
  1168. <remarks>
  1169. <para>
  1170. This constructor opens a <c>FileStream</c> for the given zipfile, and
  1171. wraps a <c>ZipInputStream</c> around that. See the documentation for the
  1172. <see cref="M:Ionic.Zip.ZipInputStream.#ctor(System.IO.Stream)"/> constructor for full details.
  1173. </para>
  1174. <para>
  1175. While the <see cref="T:Ionic.Zip.ZipFile"/> class is generally easier
  1176. to use, this class provides an alternative to those
  1177. applications that want to read from a zipfile directly,
  1178. using a <see cref="T:System.IO.Stream"/>.
  1179. </para>
  1180. </remarks>
  1181. <param name="fileName">
  1182. The name of the filesystem file to read.
  1183. </param>
  1184. <example>
  1185. This example shows how to read a zip file, and extract entries, using the
  1186. <c>ZipInputStream</c> class.
  1187. <code lang="C#">
  1188. private void Unzip()
  1189. {
  1190. byte[] buffer= new byte[2048];
  1191. int n;
  1192. using (var input= new ZipInputStream(inputFileName))
  1193. {
  1194. ZipEntry e;
  1195. while (( e = input.GetNextEntry()) != null)
  1196. {
  1197. if (e.IsDirectory) continue;
  1198. string outputPath = Path.Combine(extractDir, e.FileName);
  1199. using (var output = File.Open(outputPath, FileMode.Create, FileAccess.ReadWrite))
  1200. {
  1201. while ((n= input.Read(buffer, 0, buffer.Length)) &gt; 0)
  1202. {
  1203. output.Write(buffer,0,n);
  1204. }
  1205. }
  1206. }
  1207. }
  1208. }
  1209. </code>
  1210. <code lang="VB">
  1211. Private Sub UnZip()
  1212. Dim inputFileName As String = "MyArchive.zip"
  1213. Dim extractDir As String = "extract"
  1214. Dim buffer As Byte() = New Byte(2048) {}
  1215. Using input As ZipInputStream = New ZipInputStream(inputFileName)
  1216. Dim e As ZipEntry
  1217. Do While (Not e = input.GetNextEntry Is Nothing)
  1218. If Not e.IsDirectory Then
  1219. Using output As FileStream = File.Open(Path.Combine(extractDir, e.FileName), _
  1220. FileMode.Create, FileAccess.ReadWrite)
  1221. Dim n As Integer
  1222. Do While (n = input.Read(buffer, 0, buffer.Length) &gt; 0)
  1223. output.Write(buffer, 0, n)
  1224. Loop
  1225. End Using
  1226. End If
  1227. Loop
  1228. End Using
  1229. End Sub
  1230. </code>
  1231. </example>
  1232. </member>
  1233. <member name="M:Ionic.Zip.ZipInputStream.#ctor(System.IO.Stream,System.Boolean)">
  1234. <summary>
  1235. Create a <c>ZipInputStream</c>, explicitly specifying whether to
  1236. keep the underlying stream open.
  1237. </summary>
  1238. <remarks>
  1239. See the documentation for the <see cref="M:Ionic.Zip.ZipInputStream.#ctor(System.IO.Stream)">ZipInputStream(Stream)</see>
  1240. constructor for a discussion of the class, and an example of how to use the class.
  1241. </remarks>
  1242. <param name="stream">
  1243. The stream to read from. It must be readable.
  1244. </param>
  1245. <param name="leaveOpen">
  1246. true if the application would like the stream
  1247. to remain open after the <c>ZipInputStream</c> has been closed.
  1248. </param>
  1249. </member>
  1250. <member name="M:Ionic.Zip.ZipInputStream.ToString">
  1251. <summary>Provides a string representation of the instance.</summary>
  1252. <remarks>
  1253. <para>
  1254. This can be useful for debugging purposes.
  1255. </para>
  1256. </remarks>
  1257. <returns>a string representation of the instance.</returns>
  1258. </member>
  1259. <member name="M:Ionic.Zip.ZipInputStream.Read(System.Byte[],System.Int32,System.Int32)">
  1260. <summary>
  1261. Read the data from the stream into the buffer.
  1262. </summary>
  1263. <remarks>
  1264. <para>
  1265. The data for the zipentry will be decrypted and uncompressed, as
  1266. necessary, before being copied into the buffer.
  1267. </para>
  1268. <para>
  1269. You must set the <see cref="P:Ionic.Zip.ZipInputStream.Password"/> property before calling
  1270. <c>Read()</c> the first time for an encrypted entry. To determine if an
  1271. entry is encrypted and requires a password, check the <see cref="P:Ionic.Zip.ZipEntry.Encryption">ZipEntry.Encryption</see> property.
  1272. </para>
  1273. </remarks>
  1274. <param name="buffer">The buffer to hold the data read from the stream.</param>
  1275. <param name="offset">the offset within the buffer to copy the first byte read.</param>
  1276. <param name="count">the number of bytes to read.</param>
  1277. <returns>the number of bytes read, after decryption and decompression.</returns>
  1278. </member>
  1279. <member name="M:Ionic.Zip.ZipInputStream.GetNextEntry">
  1280. <summary>
  1281. Read the next entry from the zip file.
  1282. </summary>
  1283. <remarks>
  1284. <para>
  1285. Call this method just before calling <see cref="M:Ionic.Zip.ZipInputStream.Read(System.Byte[],System.Int32,System.Int32)"/>,
  1286. to position the pointer in the zip file to the next entry that can be
  1287. read. Subsequent calls to <c>Read()</c>, will decrypt and decompress the
  1288. data in the zip file, until <c>Read()</c> returns 0.
  1289. </para>
  1290. <para>
  1291. Each time you call <c>GetNextEntry()</c>, the pointer in the wrapped
  1292. stream is moved to the next entry in the zip file. If you call <see cref="M:Ionic.Zip.ZipInputStream.Seek(System.Int64,System.IO.SeekOrigin)"/>, and thus re-position the pointer within
  1293. the file, you will need to call <c>GetNextEntry()</c> again, to insure
  1294. that the file pointer is positioned at the beginning of a zip entry.
  1295. </para>
  1296. <para>
  1297. This method returns the <c>ZipEntry</c>. Using a stream approach, you will
  1298. read the raw bytes for an entry in a zip file via calls to <c>Read()</c>.
  1299. Alternatively, you can extract an entry into a file, or a stream, by
  1300. calling <see cref="M:Ionic.Zip.ZipEntry.Extract"/>, or one of its siblings.
  1301. </para>
  1302. </remarks>
  1303. <returns>
  1304. The <c>ZipEntry</c> read. Returns null (or Nothing in VB) if there are no more
  1305. entries in the zip file.
  1306. </returns>
  1307. </member>
  1308. <member name="M:Ionic.Zip.ZipInputStream.Dispose(System.Boolean)">
  1309. <summary>
  1310. Dispose the stream.
  1311. </summary>
  1312. <remarks>
  1313. <para>
  1314. This method disposes the ZipInputStream. It may also close the
  1315. underlying stream, depending on which constructor was used.
  1316. </para>
  1317. <para>
  1318. Typically the application will call <c>Dispose()</c> implicitly, via
  1319. a <c>using</c> statement in C#, or a <c>Using</c> statement in VB.
  1320. </para>
  1321. <para>
  1322. Application code won't call this code directly. This method may
  1323. be invoked in two distinct scenarios. If disposing == true, the
  1324. method has been called directly or indirectly by a user's code,
  1325. for example via the public Dispose() method. In this case, both
  1326. managed and unmanaged resources can be referenced and disposed.
  1327. If disposing == false, the method has been called by the runtime
  1328. from inside the object finalizer and this method should not
  1329. reference other objects; in that case only unmanaged resources
  1330. must be referenced or disposed.
  1331. </para>
  1332. </remarks>
  1333. <param name="disposing">
  1334. true if the Dispose method was invoked by user code.
  1335. </param>
  1336. </member>
  1337. <member name="M:Ionic.Zip.ZipInputStream.Flush">
  1338. <summary>
  1339. This is a no-op.
  1340. </summary>
  1341. </member>
  1342. <member name="M:Ionic.Zip.ZipInputStream.Write(System.Byte[],System.Int32,System.Int32)">
  1343. <summary>
  1344. This method always throws a NotSupportedException.
  1345. </summary>
  1346. <param name="buffer">ignored</param>
  1347. <param name="offset">ignored</param>
  1348. <param name="count">ignored</param>
  1349. </member>
  1350. <member name="M:Ionic.Zip.ZipInputStream.Seek(System.Int64,System.IO.SeekOrigin)">
  1351. <summary>
  1352. This method seeks in the underlying stream.
  1353. </summary>
  1354. <remarks>
  1355. <para>
  1356. Call this method if you want to seek around within the zip file for random access.
  1357. </para>
  1358. <para>
  1359. Applications can intermix calls to <c>Seek()</c> with calls to <see cref="M:Ionic.Zip.ZipInputStream.GetNextEntry"/>. After a call to <c>Seek()</c>,
  1360. <c>GetNextEntry()</c> will get the next <c>ZipEntry</c> that falls after
  1361. the current position in the input stream. You're on your own for finding
  1362. out just where to seek in the stream, to get to the various entries.
  1363. </para>
  1364. </remarks>
  1365. <param name="offset">the offset point to seek to</param>
  1366. <param name="origin">the reference point from which to seek</param>
  1367. <returns>The new position</returns>
  1368. </member>
  1369. <member name="M:Ionic.Zip.ZipInputStream.SetLength(System.Int64)">
  1370. <summary>
  1371. This method always throws a NotSupportedException.
  1372. </summary>
  1373. <param name="value">ignored</param>
  1374. </member>
  1375. <member name="P:Ionic.Zip.ZipInputStream.ProvisionalAlternateEncoding">
  1376. <summary>
  1377. The text encoding to use when reading entries into the zip archive, for
  1378. those entries whose filenames or comments cannot be encoded with the
  1379. default (IBM437) encoding.
  1380. </summary>
  1381. <remarks>
  1382. <para>
  1383. In <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">its
  1384. zip specification</see>, PKWare describes two options for encoding
  1385. filenames and comments: using IBM437 or UTF-8. But, some archiving tools
  1386. or libraries do not follow the specification, and instead encode
  1387. characters using the system default code page. For example, WinRAR when
  1388. run on a machine in Shanghai may encode filenames with the Big-5 Chinese
  1389. (950) code page. This behavior is contrary to the Zip specification, but
  1390. it occurs anyway.
  1391. </para>
  1392. <para>
  1393. When using DotNetZip to read zip archives that use something other than
  1394. UTF-8 or IBM437, set this property to specify the code page to use when
  1395. reading encoded filenames and comments for each <c>ZipEntry</c> in the zip
  1396. file.
  1397. </para>
  1398. <para>
  1399. This property is "provisional". When the entry in the zip archive is not
  1400. explicitly marked as using UTF-8, then IBM437 is used to decode filenames
  1401. and comments. If a loss of data would result from using IBM436 -
  1402. specifically when encoding and decoding is not reflexive - the codepage
  1403. specified here is used. It is possible, therefore, to have a given entry
  1404. with a <c>Comment</c> encoded in IBM437 and a <c>FileName</c> encoded with
  1405. the specified "provisional" codepage.
  1406. </para>
  1407. <para>
  1408. When a zip file uses an arbitrary, non-UTF8 code page for encoding, there
  1409. is no standard way for the reader application - whether DotNetZip, WinZip,
  1410. WinRar, or something else - to know which codepage has been used for the
  1411. entries. Readers of zip files are not able to inspect the zip file and
  1412. determine the codepage that was used for the entries contained within it.
  1413. It is left to the application or user to determine the necessary codepage
  1414. when reading zip files encoded this way. If you use an incorrect codepage
  1415. when reading a zipfile, you will get entries with filenames that are
  1416. incorrect, and the incorrect filenames may even contain characters that
  1417. are not legal for use within filenames in Windows. Extracting entries with
  1418. illegal characters in the filenames will lead to exceptions. It's too bad,
  1419. but this is just the way things are with code pages in zip files. Caveat
  1420. Emptor.
  1421. </para>
  1422. </remarks>
  1423. </member>
  1424. <member name="P:Ionic.Zip.ZipInputStream.CodecBufferSize">
  1425. <summary>
  1426. Size of the work buffer to use for the ZLIB codec during decompression.
  1427. </summary>
  1428. <remarks>
  1429. Setting this affects the performance and memory efficiency of compression
  1430. and decompression. For larger files, setting this to a larger size may
  1431. improve performance, but the exact numbers vary depending on available
  1432. memory, and a bunch of other variables. I don't have good firm
  1433. recommendations on how to set it. You'll have to test it yourself. Or
  1434. just leave it alone and accept the default.
  1435. </remarks>
  1436. </member>
  1437. <member name="P:Ionic.Zip.ZipInputStream.Password">
  1438. <summary>
  1439. Sets the password to be used on the <c>ZipInputStream</c> instance.
  1440. </summary>
  1441. <remarks>
  1442. <para>
  1443. When reading a zip archive, this password is used to read and decrypt the
  1444. entries that are encrypted within the zip file. When entries within a zip
  1445. file use different passwords, set the appropriate password for the entry
  1446. before the first call to <c>Read()</c> for each entry.
  1447. </para>
  1448. <para>
  1449. When reading an entry that is not encrypted, the value of this property is
  1450. ignored.
  1451. </para>
  1452. </remarks>
  1453. <example>
  1454. This example uses the ZipInputStream to read and extract entries from a
  1455. zip file, using a potentially different password for each entry.
  1456. <code lang="C#">
  1457. byte[] buffer= new byte[2048];
  1458. int n;
  1459. using (var raw = File.Open(_inputFileName, FileMode.Open, FileAccess.Read ))
  1460. {
  1461. using (var input= new ZipInputStream(raw))
  1462. {
  1463. ZipEntry e;
  1464. while (( e = input.GetNextEntry()) != null)
  1465. {
  1466. input.Password = PasswordForEntry(e.FileName);
  1467. if (e.IsDirectory) continue;
  1468. string outputPath = Path.Combine(_extractDir, e.FileName);
  1469. using (var output = File.Open(outputPath, FileMode.Create, FileAccess.ReadWrite))
  1470. {
  1471. while ((n= input.Read(buffer,0,buffer.Length)) > 0)
  1472. {
  1473. output.Write(buffer,0,n);
  1474. }
  1475. }
  1476. }
  1477. }
  1478. }
  1479. </code>
  1480. </example>
  1481. </member>
  1482. <member name="P:Ionic.Zip.ZipInputStream.CanRead">
  1483. <summary>
  1484. Always returns true.
  1485. </summary>
  1486. </member>
  1487. <member name="P:Ionic.Zip.ZipInputStream.CanSeek">
  1488. <summary>
  1489. Returns the value of <c>CanSeek</c> for the underlying (wrapped) stream.
  1490. </summary>
  1491. </member>
  1492. <member name="P:Ionic.Zip.ZipInputStream.CanWrite">
  1493. <summary>
  1494. Always returns false.
  1495. </summary>
  1496. </member>
  1497. <member name="P:Ionic.Zip.ZipInputStream.Length">
  1498. <summary>
  1499. Returns the length of the underlying stream.
  1500. </summary>
  1501. </member>
  1502. <member name="P:Ionic.Zip.ZipInputStream.Position">
  1503. <summary>
  1504. Gets or sets the position of the underlying stream.
  1505. </summary>
  1506. <remarks>
  1507. Setting the position is equivalent to calling <c>Seek(value, SeekOrigin.Begin)</c>.
  1508. </remarks>
  1509. </member>
  1510. <member name="M:Ionic.Zip.ZipSegmentedStream.ForUpdate(System.String,System.UInt32)">
  1511. <summary>
  1512. Sort-of like a factory method, ForUpdate is used only when
  1513. the application needs to update the zip entry metadata for
  1514. a segmented zip file, when the starting segment is earlier
  1515. than the ending segment, for a particular entry.
  1516. </summary>
  1517. <remarks>
  1518. <para>
  1519. The update is always contiguous, never rolls over. As a
  1520. result, this method doesn't need to return a ZSS; it can
  1521. simply return a FileStream. That's why it's "sort of"
  1522. like a Factory method.
  1523. </para>
  1524. <para>
  1525. Caller must Close/Dispose the stream object returned by
  1526. this method.
  1527. </para>
  1528. </remarks>
  1529. </member>
  1530. <member name="M:Ionic.Zip.ZipSegmentedStream.Read(System.Byte[],System.Int32,System.Int32)">
  1531. <summary>
  1532. Read from the stream
  1533. </summary>
  1534. <param name="buffer">the buffer to read</param>
  1535. <param name="offset">the offset at which to start</param>
  1536. <param name="count">the number of bytes to read</param>
  1537. <returns>the number of bytes actually read</returns>
  1538. </member>
  1539. <member name="M:Ionic.Zip.ZipSegmentedStream.Write(System.Byte[],System.Int32,System.Int32)">
  1540. <summary>
  1541. Write to the stream.
  1542. </summary>
  1543. <param name="buffer">the buffer from which to write</param>
  1544. <param name="offset">the offset at which to start writing</param>
  1545. <param name="count">the number of bytes to write</param>
  1546. </member>
  1547. <member name="P:Ionic.Zip.ZipSegmentedStream.CurrentName">
  1548. <summary>
  1549. Name of the filesystem file corresponding to the current segment.
  1550. </summary>
  1551. <remarks>
  1552. <para>
  1553. The name is not always the name currently being used in the
  1554. filesystem. When rwMode is RwMode.Write, the filesystem file has a
  1555. temporary name until the stream is closed or until the next segment is
  1556. started.
  1557. </para>
  1558. </remarks>
  1559. </member>
  1560. <member name="T:Ionic.Zip.ComHelper">
  1561. <summary>
  1562. This class exposes a set of COM-accessible wrappers for static
  1563. methods available on the ZipFile class. You don't need this
  1564. class unless you are using DotNetZip from a COM environment.
  1565. </summary>
  1566. </member>
  1567. <member name="M:Ionic.Zip.ComHelper.IsZipFile(System.String)">
  1568. <summary>
  1569. A wrapper for <see cref="M:Ionic.Zip.ZipFile.IsZipFile(System.String)">ZipFile.IsZipFile(string)</see>
  1570. </summary>
  1571. <param name="filename">The filename to of the zip file to check.</param>
  1572. <returns>true if the file contains a valid zip file.</returns>
  1573. </member>
  1574. <member name="M:Ionic.Zip.ComHelper.IsZipFileWithExtract(System.String)">
  1575. <summary>
  1576. A wrapper for <see cref="M:Ionic.Zip.ZipFile.IsZipFile(System.String,System.Boolean)">ZipFile.IsZipFile(string, bool)</see>
  1577. </summary>
  1578. <remarks>
  1579. We cannot use "overloaded" Method names in COM interop.
  1580. So, here, we use a unique name.
  1581. </remarks>
  1582. <param name="filename">The filename to of the zip file to check.</param>
  1583. <returns>true if the file contains a valid zip file.</returns>
  1584. </member>
  1585. <member name="M:Ionic.Zip.ComHelper.CheckZip(System.String)">
  1586. <summary>
  1587. A wrapper for <see cref="M:Ionic.Zip.ZipFile.CheckZip(System.String)">ZipFile.CheckZip(string)</see>
  1588. </summary>
  1589. <param name="filename">The filename to of the zip file to check.</param>
  1590. <returns>true if the named zip file checks OK. Otherwise, false. </returns>
  1591. </member>
  1592. <member name="M:Ionic.Zip.ComHelper.CheckZipPassword(System.String,System.String)">
  1593. <summary>
  1594. A COM-friendly wrapper for the static method <see cref="M:Ionic.Zip.ZipFile.CheckZipPassword(System.String,System.String)"/>.
  1595. </summary>
  1596. <param name="filename">The filename to of the zip file to check.</param>
  1597. <param name="password">The password to check.</param>
  1598. <returns>true if the named zip file checks OK. Otherwise, false. </returns>
  1599. </member>
  1600. <member name="M:Ionic.Zip.ComHelper.FixZipDirectory(System.String)">
  1601. <summary>
  1602. A wrapper for <see cref="M:Ionic.Zip.ZipFile.FixZipDirectory(System.String)">ZipFile.FixZipDirectory(string)</see>
  1603. </summary>
  1604. <param name="filename">The filename to of the zip file to fix.</param>
  1605. </member>
  1606. <member name="M:Ionic.Zip.ComHelper.GetZipLibraryVersion">
  1607. <summary>
  1608. A wrapper for <see cref="P:Ionic.Zip.ZipFile.LibraryVersion">ZipFile.LibraryVersion</see>
  1609. </summary>
  1610. <returns>
  1611. the version number on the DotNetZip assembly, formatted as a string.
  1612. </returns>
  1613. </member>
  1614. <member name="T:Ionic.Zip.ZipErrorAction">
  1615. <summary>
  1616. An enum providing the options when an error occurs during opening or reading
  1617. of a file or directory that is being saved to a zip file.
  1618. </summary>
  1619. <remarks>
  1620. <para>
  1621. This enum describes the actions that the library can take when an error occurs
  1622. opening or reading a file, as it is being saved into a Zip archive.
  1623. </para>
  1624. <para>
  1625. In some cases an error will occur when DotNetZip tries to open a file to be
  1626. added to the zip archive. In other cases, an error might occur after the
  1627. file has been successfully opened, while DotNetZip is reading the file.
  1628. </para>
  1629. <para>
  1630. The first problem might occur when calling AddDirectory() on a directory
  1631. that contains a Clipper .dbf file; the file is locked by Clipper and
  1632. cannot be opened by another process. An example of the second problem is
  1633. the ERROR_LOCK_VIOLATION that results when a file is opened by another
  1634. process, but not locked, and a range lock has been taken on the file.
  1635. Microsoft Outlook takes range locks on .PST files.
  1636. </para>
  1637. </remarks>
  1638. </member>
  1639. <member name="F:Ionic.Zip.ZipErrorAction.Throw">
  1640. <summary>
  1641. Throw an exception when an error occurs while zipping. This is the default
  1642. behavior. (For COM clients, this is a 0 (zero).)
  1643. </summary>
  1644. </member>
  1645. <member name="F:Ionic.Zip.ZipErrorAction.Skip">
  1646. <summary>
  1647. When an error occurs during zipping, for example a file cannot be opened,
  1648. skip the file causing the error, and continue zipping. (For COM clients,
  1649. this is a 1.)
  1650. </summary>
  1651. </member>
  1652. <member name="F:Ionic.Zip.ZipErrorAction.Retry">
  1653. <summary>
  1654. When an error occurs during zipping, for example a file cannot be opened,
  1655. retry the operation that caused the error. Be careful with this option. If
  1656. the error is not temporary, the library will retry forever. (For COM
  1657. clients, this is a 2.)
  1658. </summary>
  1659. </member>
  1660. <member name="F:Ionic.Zip.ZipErrorAction.InvokeErrorEvent">
  1661. <summary>
  1662. When an error occurs, invoke the zipError event. The event type used is
  1663. <see cref="F:Ionic.Zip.ZipProgressEventType.Error_Saving"/>. A typical use of this option:
  1664. a GUI application may wish to pop up a dialog to allow the user to view the
  1665. error that occurred, and choose an appropriate action. After your
  1666. processing in the error event, if you want to skip the file, set <see cref="P:Ionic.Zip.ZipEntry.ZipErrorAction"/> on the
  1667. <c>ZipProgressEventArgs.CurrentEntry</c> to <c>Skip</c>. If you want the
  1668. exception to be thrown, set <c>ZipErrorAction</c> on the <c>CurrentEntry</c>
  1669. to <c>Throw</c>. If you want to cancel the zip, set
  1670. <c>ZipProgressEventArgs.Cancel</c> to true. Cancelling differs from using
  1671. Skip in that a cancel will not save any further entries, if there are any.
  1672. (For COM clients, the value of this enum is a 3.)
  1673. </summary>
  1674. </member>
  1675. <member name="T:Ionic.Zip.EncryptionAlgorithm">
  1676. <summary>
  1677. An enum that provides the various encryption algorithms supported by this
  1678. library.
  1679. </summary>
  1680. <remarks>
  1681. <para>
  1682. <c>PkzipWeak</c> implies the use of Zip 2.0 encryption, which is known to be
  1683. weak and subvertible.
  1684. </para>
  1685. <para>
  1686. A note on interoperability: Values of <c>PkzipWeak</c> and <c>None</c> are
  1687. specified in <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE's zip
  1688. specification</see>, and are considered to be "standard". Zip archives
  1689. produced using these options will be interoperable with many other zip tools
  1690. and libraries, including Windows Explorer.
  1691. </para>
  1692. <para>
  1693. Values of <c>WinZipAes128</c> and <c>WinZipAes256</c> are not part of the Zip
  1694. specification, but rather imply the use of a vendor-specific extension from
  1695. WinZip. If you want to produce interoperable Zip archives, do not use these
  1696. values. For example, if you produce a zip archive using WinZipAes256, you
  1697. will be able to open it in Windows Explorer on Windows XP and Vista, but you
  1698. will not be able to extract entries; trying this will lead to an "unspecified
  1699. error". For this reason, some people have said that a zip archive that uses
  1700. WinZip's AES encryption is not actually a zip archive at all. A zip archive
  1701. produced this way will be readable with the WinZip tool (Version 11 and
  1702. beyond).
  1703. </para>
  1704. <para>
  1705. There are other third-party tools and libraries, both commercial and
  1706. otherwise, that support WinZip's AES encryption. These will be able to read
  1707. AES-encrypted zip archives produced by DotNetZip, and conversely applications
  1708. that use DotNetZip to read zip archives will be able to read AES-encrypted
  1709. archives produced by those tools or libraries. Consult the documentation for
  1710. those other tools and libraries to find out if WinZip's AES encryption is
  1711. supported.
  1712. </para>
  1713. <para>
  1714. In case you care: According to <see href="http://www.winzip.com/aes_info.htm">the WinZip specification</see>, the
  1715. actual AES key used is derived from the <see cref="P:Ionic.Zip.ZipEntry.Password"/> via an
  1716. algorithm that complies with <see href="http://www.ietf.org/rfc/rfc2898.txt">RFC 2898</see>, using an iteration
  1717. count of 1000. The algorithm is sometimes referred to as PBKDF2, which stands
  1718. for "Password Based Key Derivation Function #2".
  1719. </para>
  1720. <para>
  1721. A word about password strength and length: The AES encryption technology is
  1722. very good, but any system is only as secure as the weakest link. If you want
  1723. to secure your data, be sure to use a password that is hard to guess. To make
  1724. it harder to guess (increase its "entropy"), you should make it longer. If
  1725. you use normal characters from an ASCII keyboard, a password of length 20 will
  1726. be strong enough that it will be impossible to guess. For more information on
  1727. that, I'd encourage you to read <see href="http://www.redkestrel.co.uk/Articles/RandomPasswordStrength.html">this
  1728. article.</see>
  1729. </para>
  1730. <para>
  1731. The WinZip AES algorithms are not supported with the version of DotNetZip that
  1732. runs on the .NET Compact Framework. This is because .NET CF lacks the
  1733. HMACSHA1 class that is required for producing the archive.
  1734. </para>
  1735. </remarks>
  1736. </member>
  1737. <member name="F:Ionic.Zip.EncryptionAlgorithm.None">
  1738. <summary>
  1739. No encryption at all.
  1740. </summary>
  1741. </member>
  1742. <member name="F:Ionic.Zip.EncryptionAlgorithm.PkzipWeak">
  1743. <summary>
  1744. Traditional or Classic pkzip encryption.
  1745. </summary>
  1746. </member>
  1747. <member name="F:Ionic.Zip.EncryptionAlgorithm.WinZipAes128">
  1748. <summary>
  1749. WinZip AES encryption (128 key bits).
  1750. </summary>
  1751. </member>
  1752. <member name="F:Ionic.Zip.EncryptionAlgorithm.WinZipAes256">
  1753. <summary>
  1754. WinZip AES encryption (256 key bits).
  1755. </summary>
  1756. </member>
  1757. <member name="F:Ionic.Zip.EncryptionAlgorithm.Unsupported">
  1758. <summary>
  1759. An encryption algorithm that is not supported by DotNetZip.
  1760. </summary>
  1761. </member>
  1762. <member name="T:Ionic.Zip.ExtractExistingFileAction">
  1763. <summary>
  1764. An enum for the options when extracting an entry would overwrite an existing file.
  1765. </summary>
  1766. <remarks>
  1767. <para>
  1768. This enum describes the actions that the library can take when an
  1769. <c>Extract()</c> or <c>ExtractWithPassword()</c> method is called to extract an
  1770. entry to a filesystem, and the extraction would overwrite an existing filesystem
  1771. file.
  1772. </para>
  1773. </remarks>
  1774. </member>
  1775. <member name="F:Ionic.Zip.ExtractExistingFileAction.Throw">
  1776. <summary>
  1777. Throw an exception when extraction would overwrite an existing file. (For
  1778. COM clients, this is a 0 (zero).)
  1779. </summary>
  1780. </member>
  1781. <member name="F:Ionic.Zip.ExtractExistingFileAction.OverwriteSilently">
  1782. <summary>
  1783. When extraction would overwrite an existing file, overwrite the file silently.
  1784. The overwrite will happen even if the target file is marked as read-only.
  1785. (For COM clients, this is a 1.)
  1786. </summary>
  1787. </member>
  1788. <member name="F:Ionic.Zip.ExtractExistingFileAction.DoNotOverwrite">
  1789. <summary>
  1790. When extraction would overwrite an existing file, don't overwrite the file, silently.
  1791. (For COM clients, this is a 2.)
  1792. </summary>
  1793. </member>
  1794. <member name="F:Ionic.Zip.ExtractExistingFileAction.InvokeExtractProgressEvent">
  1795. <summary>
  1796. When extraction would overwrite an existing file, invoke the ExtractProgress
  1797. event, using an event type of <see cref="F:Ionic.Zip.ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite"/>. In
  1798. this way, the application can decide, just-in-time, whether to overwrite the
  1799. file. For example, a GUI application may wish to pop up a dialog to allow
  1800. the user to choose. You may want to examine the <see cref="P:Ionic.Zip.ExtractProgressEventArgs.ExtractLocation"/> property before making
  1801. the decision. If, after your processing in the Extract progress event, you
  1802. want to NOT extract the file, set <see cref="P:Ionic.Zip.ZipEntry.ExtractExistingFile"/>
  1803. on the <c>ZipProgressEventArgs.CurrentEntry</c> to <c>DoNotOverwrite</c>.
  1804. If you do want to extract the file, set <c>ZipEntry.ExtractExistingFile</c>
  1805. to <c>OverwriteSilently</c>. If you want to cancel the Extraction, set
  1806. <c>ZipProgressEventArgs.Cancel</c> to true. Cancelling differs from using
  1807. DoNotOverwrite in that a cancel will not extract any further entries, if
  1808. there are any. (For COM clients, the value of this enum is a 3.)
  1809. </summary>
  1810. </member>
  1811. <member name="T:Ionic.LogicalConjunction">
  1812. <summary>
  1813. Enumerates the options for a logical conjunction. This enum is intended for use
  1814. internally by the FileSelector class.
  1815. </summary>
  1816. </member>
  1817. <member name="T:Ionic.FileSelector">
  1818. <summary>
  1819. FileSelector encapsulates logic that selects files from a source - a zip file
  1820. or the filesystem - based on a set of criteria. This class is used internally
  1821. by the DotNetZip library, in particular for the AddSelectedFiles() methods.
  1822. This class can also be used independently of the zip capability in DotNetZip.
  1823. </summary>
  1824. <remarks>
  1825. <para>
  1826. The FileSelector class is used internally by the ZipFile class for selecting
  1827. files for inclusion into the ZipFile, when the <see cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String,System.String)"/> method, or one of
  1828. its overloads, is called. It's also used for the <see cref="M:Ionic.Zip.ZipFile.ExtractSelectedEntries(System.String)"/> methods. Typically, an
  1829. application that creates or manipulates Zip archives will not directly
  1830. interact with the FileSelector class.
  1831. </para>
  1832. <para>
  1833. Some applications may wish to use the FileSelector class directly, to
  1834. select files from disk volumes based on a set of criteria, without creating or
  1835. querying Zip archives. The file selection criteria include: a pattern to
  1836. match the filename; the last modified, created, or last accessed time of the
  1837. file; the size of the file; and the attributes of the file.
  1838. </para>
  1839. <para>
  1840. Consult the documentation for <see cref="P:Ionic.FileSelector.SelectionCriteria"/>
  1841. for more information on specifying the selection criteria.
  1842. </para>
  1843. </remarks>
  1844. </member>
  1845. <member name="M:Ionic.FileSelector.#ctor(System.String)">
  1846. <summary>
  1847. Constructor that allows the caller to specify file selection criteria.
  1848. </summary>
  1849. <remarks>
  1850. <para>
  1851. This constructor allows the caller to specify a set of criteria for
  1852. selection of files.
  1853. </para>
  1854. <para>
  1855. See <see cref="P:Ionic.FileSelector.SelectionCriteria"/> for a description of
  1856. the syntax of the selectionCriteria string.
  1857. </para>
  1858. <para>
  1859. By default the FileSelector will traverse NTFS Reparse Points. To
  1860. change this, use <see cref="M:Ionic.FileSelector.#ctor(System.String,System.Boolean)">FileSelector(String, bool)</see>.
  1861. </para>
  1862. </remarks>
  1863. <param name="selectionCriteria">The criteria for file selection.</param>
  1864. </member>
  1865. <member name="M:Ionic.FileSelector.#ctor(System.String,System.Boolean)">
  1866. <summary>
  1867. Constructor that allows the caller to specify file selection criteria.
  1868. </summary>
  1869. <remarks>
  1870. <para>
  1871. This constructor allows the caller to specify a set of criteria for
  1872. selection of files.
  1873. </para>
  1874. <para>
  1875. See <see cref="P:Ionic.FileSelector.SelectionCriteria"/> for a description of
  1876. the syntax of the selectionCriteria string.
  1877. </para>
  1878. </remarks>
  1879. <param name="selectionCriteria">The criteria for file selection.</param>
  1880. <param name="traverseDirectoryReparsePoints">
  1881. whether to traverse NTFS reparse points (junctions).
  1882. </param>
  1883. </member>
  1884. <member name="M:Ionic.FileSelector.ToString">
  1885. <summary>
  1886. Returns a string representation of the FileSelector object.
  1887. </summary>
  1888. <returns>The string representation of the boolean logic statement of the file
  1889. selection criteria for this instance. </returns>
  1890. </member>
  1891. <member name="M:Ionic.FileSelector.SelectFiles(System.String)">
  1892. <summary>
  1893. Returns the names of the files in the specified directory
  1894. that fit the selection criteria specified in the FileSelector.
  1895. </summary>
  1896. <remarks>
  1897. This is equivalent to calling <see cref="M:Ionic.FileSelector.SelectFiles(System.String,System.Boolean)"/>
  1898. with recurseDirectories = false.
  1899. </remarks>
  1900. <param name="directory">
  1901. The name of the directory over which to apply the FileSelector
  1902. criteria.
  1903. </param>
  1904. <returns>
  1905. A collection of strings containing fully-qualified pathnames of files
  1906. that match the criteria specified in the FileSelector instance.
  1907. </returns>
  1908. </member>
  1909. <member name="M:Ionic.FileSelector.SelectFiles(System.String,System.Boolean)">
  1910. <summary>
  1911. Returns the names of the files in the specified directory that fit the
  1912. selection criteria specified in the FileSelector, optionally recursing
  1913. through subdirectories.
  1914. </summary>
  1915. <remarks>
  1916. This method applies the file selection criteria contained in the
  1917. FileSelector to the files contained in the given directory, and
  1918. returns the names of files that conform to the criteria.
  1919. </remarks>
  1920. <param name="directory">
  1921. The name of the directory over which to apply the FileSelector
  1922. criteria.
  1923. </param>
  1924. <param name="recurseDirectories">
  1925. Whether to recurse through subdirectories when applying the file
  1926. selection criteria.
  1927. </param>
  1928. <returns>
  1929. A collection of strings containing fully-qualified pathnames of files
  1930. that match the criteria specified in the FileSelector instance.
  1931. </returns>
  1932. </member>
  1933. <member name="M:Ionic.FileSelector.SelectEntries(Ionic.Zip.ZipFile)">
  1934. <summary>
  1935. Retrieve the ZipEntry items in the ZipFile that conform to the specified criteria.
  1936. </summary>
  1937. <remarks>
  1938. <para>
  1939. This method applies the criteria set in the FileSelector instance (as described in
  1940. the <see cref="P:Ionic.FileSelector.SelectionCriteria"/>) to the specified ZipFile. Using this
  1941. method, for example, you can retrieve all entries from the given ZipFile that
  1942. have filenames ending in .txt.
  1943. </para>
  1944. <para>
  1945. Normally, applications would not call this method directly. This method is used
  1946. by the ZipFile class.
  1947. </para>
  1948. <para>
  1949. Using the appropriate SelectionCriteria, you can retrieve entries based on size,
  1950. time, and attributes. See <see cref="P:Ionic.FileSelector.SelectionCriteria"/> for a
  1951. description of the syntax of the SelectionCriteria string.
  1952. </para>
  1953. </remarks>
  1954. <param name="zip">The ZipFile from which to retrieve entries.</param>
  1955. <returns>a collection of ZipEntry objects that conform to the criteria.</returns>
  1956. </member>
  1957. <member name="M:Ionic.FileSelector.SelectEntries(Ionic.Zip.ZipFile,System.String)">
  1958. <summary>
  1959. Retrieve the ZipEntry items in the ZipFile that conform to the specified criteria.
  1960. </summary>
  1961. <remarks>
  1962. <para>
  1963. This method applies the criteria set in the FileSelector instance (as described in
  1964. the <see cref="P:Ionic.FileSelector.SelectionCriteria"/>) to the specified ZipFile. Using this
  1965. method, for example, you can retrieve all entries from the given ZipFile that
  1966. have filenames ending in .txt.
  1967. </para>
  1968. <para>
  1969. Normally, applications would not call this method directly. This method is used
  1970. by the ZipFile class.
  1971. </para>
  1972. <para>
  1973. This overload allows the selection of ZipEntry instances from the ZipFile to be restricted
  1974. to entries contained within a particular directory in the ZipFile.
  1975. </para>
  1976. <para>
  1977. Using the appropriate SelectionCriteria, you can retrieve entries based on size,
  1978. time, and attributes. See <see cref="P:Ionic.FileSelector.SelectionCriteria"/> for a
  1979. description of the syntax of the SelectionCriteria string.
  1980. </para>
  1981. </remarks>
  1982. <param name="zip">The ZipFile from which to retrieve entries.</param>
  1983. <param name="directoryPathInArchive">
  1984. the directory in the archive from which to select entries. If null, then
  1985. all directories in the archive are used.
  1986. </param>
  1987. <returns>a collection of ZipEntry objects that conform to the criteria.</returns>
  1988. </member>
  1989. <member name="P:Ionic.FileSelector.SelectionCriteria">
  1990. <summary>
  1991. The string specifying which files to include when retrieving.
  1992. </summary>
  1993. <remarks>
  1994. <para>
  1995. Specify the criteria in statements of 3 elements: a noun, an operator,
  1996. and a value. Consider the string "name != *.doc" . The noun is
  1997. "name". The operator is "!=", implying "Not Equal". The value is
  1998. "*.doc". That criterion, in English, says "all files with a name that
  1999. does not end in the .doc extension."
  2000. </para>
  2001. <para>
  2002. Supported nouns include "name" (or "filename") for the filename;
  2003. "atime", "mtime", and "ctime" for last access time, last modfied time,
  2004. and created time of the file, respectively; "attributes" (or "attrs")
  2005. for the file attributes; "size" (or "length") for the file length
  2006. (uncompressed); and "type" for the type of object, either a file or a
  2007. directory. The "attributes", "type", and "name" nouns all support =
  2008. and != as operators. The "size", "atime", "mtime", and "ctime" nouns
  2009. support = and !=, and &gt;, &gt;=, &lt;, &lt;= as well. The times are
  2010. taken to be expressed in local time.
  2011. </para>
  2012. <para>
  2013. Specify values for the file attributes as a string with one or more of
  2014. the characters H,R,S,A,I,L in any order, implying file attributes of
  2015. Hidden, ReadOnly, System, Archive, NotContextIndexed, and ReparsePoint
  2016. (symbolic link) respectively.
  2017. </para>
  2018. <para>
  2019. To specify a time, use YYYY-MM-DD-HH:mm:ss or YYYY/MM/DD-HH:mm:ss as
  2020. the format. If you omit the HH:mm:ss portion, it is assumed to be
  2021. 00:00:00 (midnight).
  2022. </para>
  2023. <para>
  2024. The value for a size criterion is expressed in integer quantities of
  2025. bytes, kilobytes (use k or kb after the number), megabytes (m or mb),
  2026. or gigabytes (g or gb).
  2027. </para>
  2028. <para>
  2029. The value for a name is a pattern to match against the filename,
  2030. potentially including wildcards. The pattern follows CMD.exe glob
  2031. rules: * implies one or more of any character, while ? implies one
  2032. character. If the name pattern contains any slashes, it is matched to
  2033. the entire filename, including the path; otherwise, it is matched
  2034. against only the filename without the path. This means a pattern of
  2035. "*\*.*" matches all files one directory level deep, while a pattern of
  2036. "*.*" matches all files in all directories.
  2037. </para>
  2038. <para>
  2039. To specify a name pattern that includes spaces, use single quotes
  2040. around the pattern. A pattern of "'* *.*'" will match all files that
  2041. have spaces in the filename. The full criteria string for that would
  2042. be "name = '* *.*'" .
  2043. </para>
  2044. <para>
  2045. The value for a type criterion is either F (implying a file) or D
  2046. (implying a directory).
  2047. </para>
  2048. <para>
  2049. Some examples:
  2050. </para>
  2051. <list type="table">
  2052. <listheader>
  2053. <term>criteria</term>
  2054. <description>Files retrieved</description>
  2055. </listheader>
  2056. <item>
  2057. <term>name != *.xls </term>
  2058. <description>any file with an extension that is not .xls
  2059. </description>
  2060. </item>
  2061. <item>
  2062. <term>name = *.mp3 </term>
  2063. <description>any file with a .mp3 extension.
  2064. </description>
  2065. </item>
  2066. <item>
  2067. <term>*.mp3</term>
  2068. <description>(same as above) any file with a .mp3 extension.
  2069. </description>
  2070. </item>
  2071. <item>
  2072. <term>attributes = A </term>
  2073. <description>all files whose attributes include the Archive bit.
  2074. </description>
  2075. </item>
  2076. <item>
  2077. <term>attributes != H </term>
  2078. <description>all files whose attributes do not include the Hidden bit.
  2079. </description>
  2080. </item>
  2081. <item>
  2082. <term>mtime &gt; 2009-01-01</term>
  2083. <description>all files with a last modified time after January 1st, 2009.
  2084. </description>
  2085. </item>
  2086. <item>
  2087. <term>ctime &gt; 2009/01/01-03:00:00</term>
  2088. <description>all files with a created time after 3am (local time),
  2089. on January 1st, 2009.
  2090. </description>
  2091. </item>
  2092. <item>
  2093. <term>size &gt; 2gb</term>
  2094. <description>all files whose uncompressed size is greater than 2gb.
  2095. </description>
  2096. </item>
  2097. <item>
  2098. <term>type = D</term>
  2099. <description>all directories in the filesystem. </description>
  2100. </item>
  2101. </list>
  2102. <para>
  2103. You can combine criteria with the conjunctions AND, OR, and XOR. Using
  2104. a string like "name = *.txt AND size &gt;= 100k" for the
  2105. selectionCriteria retrieves entries whose names end in .txt, and whose
  2106. uncompressed size is greater than or equal to 100 kilobytes.
  2107. </para>
  2108. <para>
  2109. For more complex combinations of criteria, you can use parenthesis to
  2110. group clauses in the boolean logic. Absent parenthesis, the
  2111. precedence of the criterion atoms is determined by order of
  2112. appearance. Unlike the C# language, the AND conjunction does not take
  2113. precendence over the logical OR. This is important only in strings
  2114. that contain 3 or more criterion atoms. In other words, "name = *.txt
  2115. and size &gt; 1000 or attributes = H" implies "((name = *.txt AND size
  2116. &gt; 1000) OR attributes = H)" while "attributes = H OR name = *.txt
  2117. and size &gt; 1000" evaluates to "((attributes = H OR name = *.txt)
  2118. AND size &gt; 1000)". When in doubt, use parenthesis.
  2119. </para>
  2120. <para>
  2121. Using time properties requires some extra care. If you want to
  2122. retrieve all entries that were last updated on 2009 February 14,
  2123. specify "mtime &gt;= 2009-02-14 AND mtime &lt; 2009-02-15". Read this
  2124. to say: all files updated after 12:00am on February 14th, until
  2125. 12:00am on February 15th. You can use the same bracketing approach to
  2126. specify any time period - a year, a month, a week, and so on.
  2127. </para>
  2128. <para>
  2129. The syntax allows one special case: if you provide a string with no
  2130. spaces, it is treated as a pattern to match for the filename.
  2131. Therefore a string like "*.xls" will be equivalent to specifying "name
  2132. = *.xls". This "shorthand" notation does not work with compound
  2133. criteria.
  2134. </para>
  2135. <para>
  2136. There is no logic in this class that insures that the inclusion
  2137. criteria are internally consistent. For example, it's possible to
  2138. specify criteria that says the file must have a size of less than 100
  2139. bytes, as well as a size that is greater than 1000 bytes. Obviously
  2140. no file will ever satisfy such criteria, but this class does not check
  2141. for or detect such inconsistencies.
  2142. </para>
  2143. </remarks>
  2144. <exception cref="T:System.Exception">
  2145. Thrown in the setter if the value has an invalid syntax.
  2146. </exception>
  2147. </member>
  2148. <member name="P:Ionic.FileSelector.TraverseReparsePoints">
  2149. <summary>
  2150. Indicates whether searches will traverse NTFS reparse points, like Junctions.
  2151. </summary>
  2152. </member>
  2153. <member name="T:Ionic.EnumUtil">
  2154. <summary>
  2155. Summary description for EnumUtil.
  2156. </summary>
  2157. </member>
  2158. <member name="M:Ionic.EnumUtil.GetDescription(System.Enum)">
  2159. <summary>
  2160. Returns the value of the DescriptionAttribute if the specified Enum
  2161. value has one. If not, returns the ToString() representation of the
  2162. Enum value.
  2163. </summary>
  2164. <param name="value">The Enum to get the description for</param>
  2165. <returns></returns>
  2166. </member>
  2167. <member name="M:Ionic.EnumUtil.Parse(System.Type,System.String)">
  2168. <summary>
  2169. Converts the string representation of the name or numeric value of one
  2170. or more enumerated constants to an equivalent enumerated object.
  2171. Note: use the DescriptionAttribute on enum values to enable this.
  2172. </summary>
  2173. <param name="enumType">The System.Type of the enumeration.</param>
  2174. <param name="stringRepresentation">
  2175. A string containing the name or value to convert.
  2176. </param>
  2177. <returns></returns>
  2178. </member>
  2179. <member name="M:Ionic.EnumUtil.Parse(System.Type,System.String,System.Boolean)">
  2180. <summary>
  2181. Converts the string representation of the name or numeric value of one
  2182. or more enumerated constants to an equivalent enumerated object. A
  2183. parameter specified whether the operation is case-sensitive. Note:
  2184. use the DescriptionAttribute on enum values to enable this.
  2185. </summary>
  2186. <param name="enumType">The System.Type of the enumeration.</param>
  2187. <param name="stringRepresentation">
  2188. A string containing the name or value to convert.
  2189. </param>
  2190. <param name="ignoreCase">
  2191. Whether the operation is case-sensitive or not.</param>
  2192. <returns></returns>
  2193. </member>
  2194. <member name="T:Ionic.Zip.WinZipAesCrypto">
  2195. <summary>
  2196. This is a helper class supporting WinZip AES encryption.
  2197. This class is intended for use only by the DotNetZip library.
  2198. </summary>
  2199. <remarks>
  2200. Most uses of the DotNetZip library will not involve direct calls into
  2201. the WinZipAesCrypto class. Instead, the WinZipAesCrypto class is
  2202. instantiated and used by the ZipEntry() class when WinZip AES
  2203. encryption or decryption on an entry is employed.
  2204. </remarks>
  2205. </member>
  2206. <member name="T:Ionic.Zip.WinZipAesCipherStream">
  2207. <summary>
  2208. A stream that encrypts as it writes, or decrypts as it reads. The
  2209. Crypto is AES in CTR (counter) mode, which is compatible with the AES
  2210. encryption employed by WinZip 12.0.
  2211. </summary>
  2212. <remarks>
  2213. <para>
  2214. The AES/CTR encryption protocol used by WinZip works like this:
  2215. - start with a counter, initialized to zero.
  2216. - to encrypt, take the data by 16-byte blocks. For each block:
  2217. - apply the transform to the counter
  2218. - increement the counter
  2219. - XOR the result of the transform with the plaintext to
  2220. get the ciphertext.
  2221. - compute the mac on the encrypted bytes
  2222. - when finished with all blocks, store the computed MAC.
  2223. - to decrypt, take the data by 16-byte blocks. For each block:
  2224. - compute the mac on the encrypted bytes,
  2225. - apply the transform to the counter
  2226. - increement the counter
  2227. - XOR the result of the transform with the ciphertext to
  2228. get the plaintext.
  2229. - when finished with all blocks, compare the computed MAC against
  2230. the stored MAC
  2231. </para>
  2232. </remarks>
  2233. </member>
  2234. <member name="M:Ionic.Zip.WinZipAesCipherStream.#ctor(System.IO.Stream,Ionic.Zip.WinZipAesCrypto,System.Int64,Ionic.Zip.CryptoMode)">
  2235. <summary>
  2236. The constructor.
  2237. </summary>
  2238. <param name="s">The underlying stream</param>
  2239. <param name="mode">To either encrypt or decrypt.</param>
  2240. <param name="cryptoParams">The pre-initialized WinZipAesCrypto object.</param>
  2241. <param name="length">The maximum number of bytes to read from the stream.</param>
  2242. </member>
  2243. <member name="M:Ionic.Zip.WinZipAesCipherStream.Close">
  2244. <summary>
  2245. Close the stream.
  2246. </summary>
  2247. </member>
  2248. <member name="M:Ionic.Zip.WinZipAesCipherStream.Flush">
  2249. <summary>
  2250. Flush the content in the stream.
  2251. </summary>
  2252. </member>
  2253. <member name="M:Ionic.Zip.WinZipAesCipherStream.Seek(System.Int64,System.IO.SeekOrigin)">
  2254. <summary>
  2255. This method throws a NotImplementedException.
  2256. </summary>
  2257. </member>
  2258. <member name="M:Ionic.Zip.WinZipAesCipherStream.SetLength(System.Int64)">
  2259. <summary>
  2260. This method throws a NotImplementedException.
  2261. </summary>
  2262. </member>
  2263. <member name="P:Ionic.Zip.WinZipAesCipherStream.FinalAuthentication">
  2264. <summary>
  2265. Returns the final HMAC-SHA1-80 for the data that was encrypted.
  2266. </summary>
  2267. </member>
  2268. <member name="P:Ionic.Zip.WinZipAesCipherStream.CanRead">
  2269. <summary>
  2270. Returns true if the stream can be read.
  2271. </summary>
  2272. </member>
  2273. <member name="P:Ionic.Zip.WinZipAesCipherStream.CanSeek">
  2274. <summary>
  2275. Always returns false.
  2276. </summary>
  2277. </member>
  2278. <member name="P:Ionic.Zip.WinZipAesCipherStream.CanWrite">
  2279. <summary>
  2280. Returns true if the CryptoMode is Encrypt.
  2281. </summary>
  2282. </member>
  2283. <member name="P:Ionic.Zip.WinZipAesCipherStream.Length">
  2284. <summary>
  2285. Getting this property throws a NotImplementedException.
  2286. </summary>
  2287. </member>
  2288. <member name="P:Ionic.Zip.WinZipAesCipherStream.Position">
  2289. <summary>
  2290. Getting or Setting this property throws a NotImplementedException.
  2291. </summary>
  2292. </member>
  2293. <member name="T:Ionic.Zip.BadPasswordException">
  2294. <summary>
  2295. Issued when an <c>ZipEntry.ExtractWithPassword()</c> method is invoked
  2296. with an incorrect password.
  2297. </summary>
  2298. </member>
  2299. <member name="T:Ionic.Zip.ZipException">
  2300. <summary>
  2301. Base class for all exceptions defined by and throw by the Zip library.
  2302. </summary>
  2303. </member>
  2304. <member name="M:Ionic.Zip.ZipException.#ctor">
  2305. <summary>
  2306. Default ctor.
  2307. </summary>
  2308. </member>
  2309. <member name="M:Ionic.Zip.ZipException.#ctor(System.String)">
  2310. <summary>
  2311. Come on, you know how exceptions work. Why are you looking at this documentation?
  2312. </summary>
  2313. <param name="message">The message in the exception.</param>
  2314. </member>
  2315. <member name="M:Ionic.Zip.ZipException.#ctor(System.String,System.Exception)">
  2316. <summary>
  2317. Come on, you know how exceptions work. Why are you looking at this documentation?
  2318. </summary>
  2319. <param name="message">The message in the exception.</param>
  2320. <param name="innerException">The innerException for this exception.</param>
  2321. </member>
  2322. <member name="M:Ionic.Zip.ZipException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
  2323. <summary>
  2324. Come on, you know how exceptions work. Why are you looking at this documentation?
  2325. </summary>
  2326. <param name="info">The serialization info for the exception.</param>
  2327. <param name="context">The streaming context from which to deserialize.</param>
  2328. </member>
  2329. <member name="M:Ionic.Zip.BadPasswordException.#ctor">
  2330. <summary>
  2331. Default ctor.
  2332. </summary>
  2333. </member>
  2334. <member name="M:Ionic.Zip.BadPasswordException.#ctor(System.String)">
  2335. <summary>
  2336. Come on, you know how exceptions work. Why are you looking at this documentation?
  2337. </summary>
  2338. <param name="message">The message in the exception.</param>
  2339. </member>
  2340. <member name="M:Ionic.Zip.BadPasswordException.#ctor(System.String,System.Exception)">
  2341. <summary>
  2342. Come on, you know how exceptions work. Why are you looking at this documentation?
  2343. </summary>
  2344. <param name="message">The message in the exception.</param>
  2345. <param name="innerException">The innerException for this exception.</param>
  2346. </member>
  2347. <member name="M:Ionic.Zip.BadPasswordException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
  2348. <summary>
  2349. Come on, you know how exceptions work. Why are you looking at this documentation?
  2350. </summary>
  2351. <param name="info">The serialization info for the exception.</param>
  2352. <param name="context">The streaming context from which to deserialize.</param>
  2353. </member>
  2354. <member name="T:Ionic.Zip.BadReadException">
  2355. <summary>
  2356. Indicates that a read was attempted on a stream, and bad or incomplete data was
  2357. received.
  2358. </summary>
  2359. </member>
  2360. <member name="M:Ionic.Zip.BadReadException.#ctor">
  2361. <summary>
  2362. Default ctor.
  2363. </summary>
  2364. </member>
  2365. <member name="M:Ionic.Zip.BadReadException.#ctor(System.String)">
  2366. <summary>
  2367. Come on, you know how exceptions work. Why are you looking at this documentation?
  2368. </summary>
  2369. <param name="message">The message in the exception.</param>
  2370. </member>
  2371. <member name="M:Ionic.Zip.BadReadException.#ctor(System.String,System.Exception)">
  2372. <summary>
  2373. Come on, you know how exceptions work. Why are you looking at this documentation?
  2374. </summary>
  2375. <param name="message">The message in the exception.</param>
  2376. <param name="innerException">The innerException for this exception.</param>
  2377. </member>
  2378. <member name="M:Ionic.Zip.BadReadException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
  2379. <summary>
  2380. Come on, you know how exceptions work. Why are you looking at this documentation?
  2381. </summary>
  2382. <param name="info">The serialization info for the exception.</param>
  2383. <param name="context">The streaming context from which to deserialize.</param>
  2384. </member>
  2385. <member name="T:Ionic.Zip.BadCrcException">
  2386. <summary>
  2387. Issued when an CRC check fails upon extracting an entry from a zip archive.
  2388. </summary>
  2389. </member>
  2390. <member name="M:Ionic.Zip.BadCrcException.#ctor">
  2391. <summary>
  2392. Default ctor.
  2393. </summary>
  2394. </member>
  2395. <member name="M:Ionic.Zip.BadCrcException.#ctor(System.String)">
  2396. <summary>
  2397. Come on, you know how exceptions work. Why are you looking at this documentation?
  2398. </summary>
  2399. <param name="message">The message in the exception.</param>
  2400. </member>
  2401. <member name="M:Ionic.Zip.BadCrcException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
  2402. <summary>
  2403. Come on, you know how exceptions work. Why are you looking at this documentation?
  2404. </summary>
  2405. <param name="info">The serialization info for the exception.</param>
  2406. <param name="context">The streaming context from which to deserialize.</param>
  2407. </member>
  2408. <member name="T:Ionic.Zip.SfxGenerationException">
  2409. <summary>
  2410. Issued when errors occur saving a self-extracting archive.
  2411. </summary>
  2412. </member>
  2413. <member name="M:Ionic.Zip.SfxGenerationException.#ctor">
  2414. <summary>
  2415. Default ctor.
  2416. </summary>
  2417. </member>
  2418. <member name="M:Ionic.Zip.SfxGenerationException.#ctor(System.String)">
  2419. <summary>
  2420. Come on, you know how exceptions work. Why are you looking at this documentation?
  2421. </summary>
  2422. <param name="message">The message in the exception.</param>
  2423. </member>
  2424. <member name="M:Ionic.Zip.SfxGenerationException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
  2425. <summary>
  2426. Come on, you know how exceptions work. Why are you looking at this documentation?
  2427. </summary>
  2428. <param name="info">The serialization info for the exception.</param>
  2429. <param name="context">The streaming context from which to deserialize.</param>
  2430. </member>
  2431. <member name="T:Ionic.Zip.BadStateException">
  2432. <summary>
  2433. Indicates that an operation was attempted on a ZipFile which was not possible
  2434. given the state of the instance. For example, if you call <c>Save()</c> on a ZipFile
  2435. which has no filename set, you can get this exception.
  2436. </summary>
  2437. </member>
  2438. <member name="M:Ionic.Zip.BadStateException.#ctor">
  2439. <summary>
  2440. Default ctor.
  2441. </summary>
  2442. </member>
  2443. <member name="M:Ionic.Zip.BadStateException.#ctor(System.String)">
  2444. <summary>
  2445. Come on, you know how exceptions work. Why are you looking at this documentation?
  2446. </summary>
  2447. <param name="message">The message in the exception.</param>
  2448. </member>
  2449. <member name="M:Ionic.Zip.BadStateException.#ctor(System.String,System.Exception)">
  2450. <summary>
  2451. Come on, you know how exceptions work. Why are you looking at this documentation?
  2452. </summary>
  2453. <param name="message">The message in the exception.</param>
  2454. <param name="innerException">The innerException for this exception.</param>
  2455. </member>
  2456. <member name="M:Ionic.Zip.BadStateException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
  2457. <summary>
  2458. Come on, you know how exceptions work. Why are you looking at this documentation?
  2459. </summary>
  2460. <param name="info">The serialization info for the exception.</param>
  2461. <param name="context">The streaming context from which to deserialize.</param>
  2462. </member>
  2463. <member name="T:Ionic.Zip.SharedUtilities">
  2464. <summary>
  2465. Collects general purpose utility methods.
  2466. </summary>
  2467. </member>
  2468. <member name="M:Ionic.Zip.SharedUtilities.GetFileLength(System.String)">
  2469. private null constructor
  2470. </member>
  2471. <member name="M:Ionic.Zip.SharedUtilities.NormalizePathForUseInZipFile(System.String)">
  2472. <summary>
  2473. Utility routine for transforming path names from filesystem format (on Windows that means backslashes) to
  2474. a format suitable for use within zipfiles. This means trimming the volume letter and colon (if any) And
  2475. swapping backslashes for forward slashes.
  2476. </summary>
  2477. <param name="pathName">source path.</param>
  2478. <returns>transformed path</returns>
  2479. </member>
  2480. <member name="M:Ionic.Zip.SharedUtilities.FindSignature(System.IO.Stream,System.Int32)">
  2481. <summary>
  2482. Finds a signature in the zip stream. This is useful for finding
  2483. the end of a zip entry, for example, or the beginning of the next ZipEntry.
  2484. </summary>
  2485. <remarks>
  2486. <para>
  2487. Scans through 64k at a time.
  2488. </para>
  2489. <para>
  2490. If the method fails to find the requested signature, the stream Position
  2491. after completion of this method is unchanged. If the method succeeds in
  2492. finding the requested signature, the stream position after completion is
  2493. direct AFTER the signature found in the stream.
  2494. </para>
  2495. </remarks>
  2496. <param name="stream">The stream to search</param>
  2497. <param name="SignatureToFind">The 4-byte signature to find</param>
  2498. <returns>The number of bytes read</returns>
  2499. </member>
  2500. <member name="M:Ionic.Zip.SharedUtilities.CreateAndOpenUniqueTempFile(System.String,System.IO.Stream@,System.String@)">
  2501. <summary>
  2502. Create a pseudo-random filename, suitable for use as a temporary
  2503. file, and open it.
  2504. </summary>
  2505. <remarks>
  2506. <para>
  2507. The System.IO.Path.GetRandomFileName() method is not available on
  2508. the Compact Framework, so this library provides its own substitute
  2509. on NETCF.
  2510. </para>
  2511. <para>
  2512. This method produces a filename of the form
  2513. DotNetZip-xxxxxxxx.tmp, where xxxxxxxx is replaced by randomly
  2514. chosen characters, and creates that file.
  2515. </para>
  2516. </remarks>
  2517. </member>
  2518. <member name="M:Ionic.Zip.SharedUtilities.ReadWithRetry(System.IO.Stream,System.Byte[],System.Int32,System.Int32,System.String)">
  2519. <summary>
  2520. Workitem 7889: handle ERROR_LOCK_VIOLATION during read
  2521. </summary>
  2522. <remarks>
  2523. This could be gracefully handled with an extension attribute, but
  2524. This assembly is built for .NET 2.0, so I cannot use them.
  2525. </remarks>
  2526. </member>
  2527. <member name="T:Ionic.Zip.CountingStream">
  2528. <summary>
  2529. A decorator stream. It wraps another stream, and performs bookkeeping
  2530. to keep track of the stream Position.
  2531. </summary>
  2532. <remarks>
  2533. <para>
  2534. In some cases, it is not possible to get the Position of a stream, let's
  2535. say, on a write-only output stream like ASP.NET's
  2536. <c>Response.OutputStream</c>, or on a different write-only stream
  2537. provided as the destination for the zip by the application. In this
  2538. case, programmers can use this counting stream to count the bytes read
  2539. or written.
  2540. </para>
  2541. <para>
  2542. Consider the scenario of an application that saves a self-extracting
  2543. archive (SFX), that uses a custom SFX stub.
  2544. </para>
  2545. <para>
  2546. Saving to a filesystem file, the application would open the
  2547. filesystem file (getting a <c>FileStream</c>), save the custom sfx stub
  2548. into it, and then call <c>ZipFile.Save()</c>, specifying the same
  2549. FileStream. <c>ZipFile.Save()</c> does the right thing for the zipentry
  2550. offsets, by inquiring the Position of the <c>FileStream</c> before writing
  2551. any data, and then adding that initial offset into any ZipEntry
  2552. offsets in the zip directory. Everything works fine.
  2553. </para>
  2554. <para>
  2555. Now suppose the application is an ASPNET application and it saves
  2556. directly to <c>Response.OutputStream</c>. It's not possible for DotNetZip to
  2557. inquire the <c>Position</c>, so the offsets for the SFX will be wrong.
  2558. </para>
  2559. <para>
  2560. The workaround is for the application to use this class to wrap
  2561. <c>HttpResponse.OutputStream</c>, then write the SFX stub and the ZipFile
  2562. into that wrapper stream. Because <c>ZipFile.Save()</c> can inquire the
  2563. <c>Position</c>, it will then do the right thing with the offsets.
  2564. </para>
  2565. </remarks>
  2566. </member>
  2567. <member name="M:Ionic.Zip.CountingStream.#ctor(System.IO.Stream)">
  2568. <summary>
  2569. The constructor.
  2570. </summary>
  2571. <param name="stream">The underlying stream</param>
  2572. </member>
  2573. <member name="M:Ionic.Zip.CountingStream.Adjust(System.Int64)">
  2574. <summary>
  2575. Adjust the byte count on the stream.
  2576. </summary>
  2577. <param name='delta'>
  2578. the number of bytes to subtract from the count.
  2579. </param>
  2580. <remarks>
  2581. <para>
  2582. Subtract delta from the count of bytes written to the stream.
  2583. This is necessary when seeking back, and writing additional data,
  2584. as happens in some cases when saving Zip files.
  2585. </para>
  2586. </remarks>
  2587. </member>
  2588. <member name="M:Ionic.Zip.CountingStream.Read(System.Byte[],System.Int32,System.Int32)">
  2589. <summary>
  2590. The read method.
  2591. </summary>
  2592. <param name="buffer">The buffer to hold the data read from the stream.</param>
  2593. <param name="offset">the offset within the buffer to copy the first byte read.</param>
  2594. <param name="count">the number of bytes to read.</param>
  2595. <returns>the number of bytes read, after decryption and decompression.</returns>
  2596. </member>
  2597. <member name="M:Ionic.Zip.CountingStream.Write(System.Byte[],System.Int32,System.Int32)">
  2598. <summary>
  2599. Write data into the stream.
  2600. </summary>
  2601. <param name="buffer">The buffer holding data to write to the stream.</param>
  2602. <param name="offset">the offset within that data array to find the first byte to write.</param>
  2603. <param name="count">the number of bytes to write.</param>
  2604. </member>
  2605. <member name="M:Ionic.Zip.CountingStream.Flush">
  2606. <summary>
  2607. Flushes the underlying stream.
  2608. </summary>
  2609. </member>
  2610. <member name="M:Ionic.Zip.CountingStream.Seek(System.Int64,System.IO.SeekOrigin)">
  2611. <summary>
  2612. Seek in the stream.
  2613. </summary>
  2614. <param name="offset">the offset point to seek to</param>
  2615. <param name="origin">the reference point from which to seek</param>
  2616. <returns>The new position</returns>
  2617. </member>
  2618. <member name="M:Ionic.Zip.CountingStream.SetLength(System.Int64)">
  2619. <summary>
  2620. Set the length of the underlying stream. Be careful with this!
  2621. </summary>
  2622. <param name='value'>the length to set on the underlying stream.</param>
  2623. </member>
  2624. <member name="P:Ionic.Zip.CountingStream.WrappedStream">
  2625. <summary>
  2626. Gets the wrapped stream.
  2627. </summary>
  2628. </member>
  2629. <member name="P:Ionic.Zip.CountingStream.BytesWritten">
  2630. <summary>
  2631. The count of bytes written out to the stream.
  2632. </summary>
  2633. </member>
  2634. <member name="P:Ionic.Zip.CountingStream.BytesRead">
  2635. <summary>
  2636. the count of bytes that have been read from the stream.
  2637. </summary>
  2638. </member>
  2639. <member name="P:Ionic.Zip.CountingStream.CanRead">
  2640. <summary>
  2641. Whether the stream can be read.
  2642. </summary>
  2643. </member>
  2644. <member name="P:Ionic.Zip.CountingStream.CanSeek">
  2645. <summary>
  2646. Whether it is possible to call Seek() on the stream.
  2647. </summary>
  2648. </member>
  2649. <member name="P:Ionic.Zip.CountingStream.CanWrite">
  2650. <summary>
  2651. Whether it is possible to call Write() on the stream.
  2652. </summary>
  2653. </member>
  2654. <member name="P:Ionic.Zip.CountingStream.Length">
  2655. <summary>
  2656. The length of the underlying stream.
  2657. </summary>
  2658. </member>
  2659. <member name="P:Ionic.Zip.CountingStream.ComputedPosition">
  2660. <summary>
  2661. Returns the sum of number of bytes written, plus the initial
  2662. offset before writing.
  2663. </summary>
  2664. </member>
  2665. <member name="P:Ionic.Zip.CountingStream.Position">
  2666. <summary>
  2667. The Position of the stream.
  2668. </summary>
  2669. </member>
  2670. <member name="T:Ionic.Zip.ZipCrypto">
  2671. <summary>
  2672. This class implements the "traditional" or "classic" PKZip encryption,
  2673. which today is considered to be weak. On the other hand it is
  2674. ubiquitous. This class is intended for use only by the DotNetZip
  2675. library.
  2676. </summary>
  2677. <remarks>
  2678. Most uses of the DotNetZip library will not involve direct calls into
  2679. the ZipCrypto class. Instead, the ZipCrypto class is instantiated and
  2680. used by the ZipEntry() class when encryption or decryption on an entry
  2681. is employed. If for some reason you really wanted to use a weak
  2682. encryption algorithm in some other application, you might use this
  2683. library. But you would be much better off using one of the built-in
  2684. strong encryption libraries in the .NET Framework, like the AES
  2685. algorithm or SHA.
  2686. </remarks>
  2687. </member>
  2688. <member name="M:Ionic.Zip.ZipCrypto.#ctor">
  2689. <summary>
  2690. The default constructor for ZipCrypto.
  2691. </summary>
  2692. <remarks>
  2693. This class is intended for internal use by the library only. It's
  2694. probably not useful to you. Seriously. Stop reading this
  2695. documentation. It's a waste of your time. Go do something else.
  2696. Check the football scores. Go get an ice cream with a friend.
  2697. Seriously.
  2698. </remarks>
  2699. </member>
  2700. <member name="M:Ionic.Zip.ZipCrypto.DecryptMessage(System.Byte[],System.Int32)">
  2701. <summary>
  2702. Call this method on a cipher text to render the plaintext. You must
  2703. first initialize the cipher with a call to InitCipher.
  2704. </summary>
  2705. <example>
  2706. <code>
  2707. var cipher = new ZipCrypto();
  2708. cipher.InitCipher(Password);
  2709. // Decrypt the header. This has a side effect of "further initializing the
  2710. // encryption keys" in the traditional zip encryption.
  2711. byte[] DecryptedMessage = cipher.DecryptMessage(EncryptedMessage);
  2712. </code>
  2713. </example>
  2714. <param name="cipherText">The encrypted buffer.</param>
  2715. <param name="length">
  2716. The number of bytes to encrypt.
  2717. Should be less than or equal to CipherText.Length.
  2718. </param>
  2719. <returns>The plaintext.</returns>
  2720. </member>
  2721. <member name="M:Ionic.Zip.ZipCrypto.EncryptMessage(System.Byte[],System.Int32)">
  2722. <summary>
  2723. This is the converse of DecryptMessage. It encrypts the plaintext
  2724. and produces a ciphertext.
  2725. </summary>
  2726. <param name="plainText">The plain text buffer.</param>
  2727. <param name="length">
  2728. The number of bytes to encrypt.
  2729. Should be less than or equal to plainText.Length.
  2730. </param>
  2731. <returns>The ciphertext.</returns>
  2732. </member>
  2733. <member name="M:Ionic.Zip.ZipCrypto.InitCipher(System.String)">
  2734. <summary>
  2735. This initializes the cipher with the given password.
  2736. See AppNote.txt for details.
  2737. </summary>
  2738. <param name="passphrase">
  2739. The passphrase for encrypting or decrypting with this cipher.
  2740. </param>
  2741. <remarks>
  2742. <code>
  2743. Step 1 - Initializing the encryption keys
  2744. -----------------------------------------
  2745. Start with these keys:
  2746. Key(0) := 305419896 (0x12345678)
  2747. Key(1) := 591751049 (0x23456789)
  2748. Key(2) := 878082192 (0x34567890)
  2749. Then, initialize the keys with a password:
  2750. loop for i from 0 to length(password)-1
  2751. update_keys(password(i))
  2752. end loop
  2753. Where update_keys() is defined as:
  2754. update_keys(char):
  2755. Key(0) := crc32(key(0),char)
  2756. Key(1) := Key(1) + (Key(0) bitwiseAND 000000ffH)
  2757. Key(1) := Key(1) * 134775813 + 1
  2758. Key(2) := crc32(key(2),key(1) rightshift 24)
  2759. end update_keys
  2760. Where crc32(old_crc,char) is a routine that given a CRC value and a
  2761. character, returns an updated CRC value after applying the CRC-32
  2762. algorithm described elsewhere in this document.
  2763. </code>
  2764. <para>
  2765. After the keys are initialized, then you can use the cipher to
  2766. encrypt the plaintext.
  2767. </para>
  2768. <para>
  2769. Essentially we encrypt the password with the keys, then discard the
  2770. ciphertext for the password. This initializes the keys for later use.
  2771. </para>
  2772. </remarks>
  2773. </member>
  2774. <member name="P:Ionic.Zip.ZipCrypto.MagicByte">
  2775. <summary>
  2776. From AppNote.txt:
  2777. unsigned char decrypt_byte()
  2778. local unsigned short temp
  2779. temp :=- Key(2) | 2
  2780. decrypt_byte := (temp * (temp ^ 1)) bitshift-right 8
  2781. end decrypt_byte
  2782. </summary>
  2783. </member>
  2784. <member name="T:Ionic.Zip.ZipCipherStream">
  2785. <summary>
  2786. A Stream for reading and concurrently decrypting data from a zip file,
  2787. or for writing and concurrently encrypting data to a zip file.
  2788. </summary>
  2789. </member>
  2790. <member name="M:Ionic.Zip.ZipCipherStream.#ctor(System.IO.Stream,Ionic.Zip.ZipCrypto,Ionic.Zip.CryptoMode)">
  2791. <summary> The constructor. </summary>
  2792. <param name="s">The underlying stream</param>
  2793. <param name="mode">To either encrypt or decrypt.</param>
  2794. <param name="cipher">The pre-initialized ZipCrypto object.</param>
  2795. </member>
  2796. <member name="T:Ionic.Zip.WriteDelegate">
  2797. <summary>
  2798. Delegate in which the application writes the <c>ZipEntry</c> content for the named entry.
  2799. </summary>
  2800. <param name="entryName">The name of the entry that must be written.</param>
  2801. <param name="stream">The stream to which the entry data should be written.</param>
  2802. <remarks>
  2803. When you add an entry and specify a <c>WriteDelegate</c>, via <see cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,Ionic.Zip.WriteDelegate)"/>, the application
  2804. code provides the logic that writes the entry data directly into the zip file.
  2805. </remarks>
  2806. <example>
  2807. This example shows how to define a WriteDelegate that obtains a DataSet, and then
  2808. writes the XML for the DataSet into the zip archive. There's no need to
  2809. save the XML to a disk file first.
  2810. <code lang="C#">
  2811. private void WriteEntry (String filename, Stream output)
  2812. {
  2813. DataSet ds1 = ObtainDataSet();
  2814. ds1.WriteXml(output);
  2815. }
  2816. private void Run()
  2817. {
  2818. using (var zip = new ZipFile())
  2819. {
  2820. zip.AddEntry(zipEntryName, WriteEntry);
  2821. zip.Save(zipFileName);
  2822. }
  2823. }
  2824. </code>
  2825. <code lang="vb">
  2826. Private Sub WriteEntry (ByVal filename As String, ByVal output As Stream)
  2827. DataSet ds1 = ObtainDataSet()
  2828. ds1.WriteXml(stream)
  2829. End Sub
  2830. Public Sub Run()
  2831. Using zip = New ZipFile
  2832. zip.AddEntry(zipEntryName, New WriteDelegate(AddressOf WriteEntry))
  2833. zip.Save(zipFileName)
  2834. End Using
  2835. End Sub
  2836. </code>
  2837. </example>
  2838. <seealso cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,Ionic.Zip.WriteDelegate)"/>
  2839. </member>
  2840. <member name="T:Ionic.Zip.OpenDelegate">
  2841. <summary>
  2842. Delegate in which the application opens the stream, just-in-time, for the named entry.
  2843. </summary>
  2844. <param name="entryName">
  2845. The name of the ZipEntry that the application should open the stream for.
  2846. </param>
  2847. <remarks>
  2848. When you add an entry via <see cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,Ionic.Zip.OpenDelegate,Ionic.Zip.CloseDelegate)"/>, the application code provides the logic that
  2849. opens and closes the stream for the given ZipEntry.
  2850. </remarks>
  2851. <seealso cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,Ionic.Zip.OpenDelegate,Ionic.Zip.CloseDelegate)"/>
  2852. </member>
  2853. <member name="T:Ionic.Zip.CloseDelegate">
  2854. <summary>
  2855. Delegate in which the application closes the stream, just-in-time, for the named entry.
  2856. </summary>
  2857. <param name="entryName">
  2858. The name of the ZipEntry that the application should close the stream for.
  2859. </param>
  2860. <param name="stream">The stream to be closed.</param>
  2861. <remarks>
  2862. When you add an entry via <see cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,Ionic.Zip.OpenDelegate,Ionic.Zip.CloseDelegate)"/>, the application code provides the logic that
  2863. opens and closes the stream for the given ZipEntry.
  2864. </remarks>
  2865. <seealso cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,Ionic.Zip.OpenDelegate,Ionic.Zip.CloseDelegate)"/>
  2866. </member>
  2867. <member name="T:Ionic.Zip.SetCompressionCallback">
  2868. <summary>
  2869. Delegate for the callback by which the application tells the
  2870. library the CompressionLevel to use for a file.
  2871. </summary>
  2872. <remarks>
  2873. <para>
  2874. Using this callback, the application can, for example, specify that
  2875. previously-compressed files (.mp3, .png, .docx, etc) should use a
  2876. <c>CompressionLevel</c> of <c>None</c>, or can set the compression level based
  2877. on any other factor.
  2878. </para>
  2879. </remarks>
  2880. <seealso cref="P:Ionic.Zip.ZipFile.SetCompression"/>
  2881. </member>
  2882. <member name="T:Ionic.Zip.ZipProgressEventType">
  2883. <summary>
  2884. In an EventArgs type, indicates which sort of progress event is being
  2885. reported.
  2886. </summary>
  2887. <remarks>
  2888. There are events for reading, events for saving, and events for
  2889. extracting. This enumeration allows a single EventArgs type to be sued to
  2890. describe one of multiple subevents. For example, a SaveProgress event is
  2891. invoked before, after, and during the saving of a single entry. The value
  2892. of an enum with this type, specifies which event is being triggered. The
  2893. same applies to Extraction, Reading and Adding events.
  2894. </remarks>
  2895. </member>
  2896. <member name="F:Ionic.Zip.ZipProgressEventType.Adding_Started">
  2897. <summary>
  2898. Indicates that a Add() operation has started.
  2899. </summary>
  2900. </member>
  2901. <member name="F:Ionic.Zip.ZipProgressEventType.Adding_AfterAddEntry">
  2902. <summary>
  2903. Indicates that an individual entry in the archive has been added.
  2904. </summary>
  2905. </member>
  2906. <member name="F:Ionic.Zip.ZipProgressEventType.Adding_Completed">
  2907. <summary>
  2908. Indicates that a Add() operation has completed.
  2909. </summary>
  2910. </member>
  2911. <member name="F:Ionic.Zip.ZipProgressEventType.Reading_Started">
  2912. <summary>
  2913. Indicates that a Read() operation has started.
  2914. </summary>
  2915. </member>
  2916. <member name="F:Ionic.Zip.ZipProgressEventType.Reading_BeforeReadEntry">
  2917. <summary>
  2918. Indicates that an individual entry in the archive is about to be read.
  2919. </summary>
  2920. </member>
  2921. <member name="F:Ionic.Zip.ZipProgressEventType.Reading_AfterReadEntry">
  2922. <summary>
  2923. Indicates that an individual entry in the archive has just been read.
  2924. </summary>
  2925. </member>
  2926. <member name="F:Ionic.Zip.ZipProgressEventType.Reading_Completed">
  2927. <summary>
  2928. Indicates that a Read() operation has completed.
  2929. </summary>
  2930. </member>
  2931. <member name="F:Ionic.Zip.ZipProgressEventType.Reading_ArchiveBytesRead">
  2932. <summary>
  2933. The given event reports the number of bytes read so far
  2934. during a Read() operation.
  2935. </summary>
  2936. </member>
  2937. <member name="F:Ionic.Zip.ZipProgressEventType.Saving_Started">
  2938. <summary>
  2939. Indicates that a Save() operation has started.
  2940. </summary>
  2941. </member>
  2942. <member name="F:Ionic.Zip.ZipProgressEventType.Saving_BeforeWriteEntry">
  2943. <summary>
  2944. Indicates that an individual entry in the archive is about to be written.
  2945. </summary>
  2946. </member>
  2947. <member name="F:Ionic.Zip.ZipProgressEventType.Saving_AfterWriteEntry">
  2948. <summary>
  2949. Indicates that an individual entry in the archive has just been saved.
  2950. </summary>
  2951. </member>
  2952. <member name="F:Ionic.Zip.ZipProgressEventType.Saving_Completed">
  2953. <summary>
  2954. Indicates that a Save() operation has completed.
  2955. </summary>
  2956. </member>
  2957. <member name="F:Ionic.Zip.ZipProgressEventType.Saving_AfterSaveTempArchive">
  2958. <summary>
  2959. Indicates that the zip archive has been created in a
  2960. temporary location during a Save() operation.
  2961. </summary>
  2962. </member>
  2963. <member name="F:Ionic.Zip.ZipProgressEventType.Saving_BeforeRenameTempArchive">
  2964. <summary>
  2965. Indicates that the temporary file is about to be renamed to the final archive
  2966. name during a Save() operation.
  2967. </summary>
  2968. </member>
  2969. <member name="F:Ionic.Zip.ZipProgressEventType.Saving_AfterRenameTempArchive">
  2970. <summary>
  2971. Indicates that the temporary file is has just been renamed to the final archive
  2972. name during a Save() operation.
  2973. </summary>
  2974. </member>
  2975. <member name="F:Ionic.Zip.ZipProgressEventType.Saving_AfterCompileSelfExtractor">
  2976. <summary>
  2977. Indicates that the self-extracting archive has been compiled
  2978. during a Save() operation.
  2979. </summary>
  2980. </member>
  2981. <member name="F:Ionic.Zip.ZipProgressEventType.Saving_EntryBytesRead">
  2982. <summary>
  2983. The given event is reporting the number of source bytes that have run through the compressor so far
  2984. during a Save() operation.
  2985. </summary>
  2986. </member>
  2987. <member name="F:Ionic.Zip.ZipProgressEventType.Extracting_BeforeExtractEntry">
  2988. <summary>
  2989. Indicates that an entry is about to be extracted.
  2990. </summary>
  2991. </member>
  2992. <member name="F:Ionic.Zip.ZipProgressEventType.Extracting_AfterExtractEntry">
  2993. <summary>
  2994. Indicates that an entry has just been extracted.
  2995. </summary>
  2996. </member>
  2997. <member name="F:Ionic.Zip.ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite">
  2998. <summary>
  2999. Indicates that extraction of an entry would overwrite an existing
  3000. filesystem file. You must use
  3001. <see cref="F:Ionic.Zip.ExtractExistingFileAction.InvokeExtractProgressEvent">
  3002. ExtractExistingFileAction.InvokeExtractProgressEvent</see> in the call
  3003. to <c>ZipEntry.Extract()</c> in order to receive this event.
  3004. </summary>
  3005. </member>
  3006. <member name="F:Ionic.Zip.ZipProgressEventType.Extracting_EntryBytesWritten">
  3007. <summary>
  3008. The given event is reporting the number of bytes written so far for
  3009. the current entry during an Extract() operation.
  3010. </summary>
  3011. </member>
  3012. <member name="F:Ionic.Zip.ZipProgressEventType.Extracting_BeforeExtractAll">
  3013. <summary>
  3014. Indicates that an ExtractAll operation is about to begin.
  3015. </summary>
  3016. </member>
  3017. <member name="F:Ionic.Zip.ZipProgressEventType.Extracting_AfterExtractAll">
  3018. <summary>
  3019. Indicates that an ExtractAll operation has completed.
  3020. </summary>
  3021. </member>
  3022. <member name="F:Ionic.Zip.ZipProgressEventType.Error_Saving">
  3023. <summary>
  3024. Indicates that an error has occurred while saving a zip file.
  3025. This generally means the file cannot be opened, because it has been
  3026. removed, or because it is locked by another process. It can also
  3027. mean that the file cannot be Read, because of a range lock conflict.
  3028. </summary>
  3029. </member>
  3030. <member name="T:Ionic.Zip.ZipProgressEventArgs">
  3031. <summary>
  3032. Provides information about the progress of a save, read, or extract operation.
  3033. This is a base class; you will probably use one of the classes derived from this one.
  3034. </summary>
  3035. </member>
  3036. <member name="P:Ionic.Zip.ZipProgressEventArgs.EntriesTotal">
  3037. <summary>
  3038. The total number of entries to be saved or extracted.
  3039. </summary>
  3040. </member>
  3041. <member name="P:Ionic.Zip.ZipProgressEventArgs.CurrentEntry">
  3042. <summary>
  3043. The name of the last entry saved or extracted.
  3044. </summary>
  3045. </member>
  3046. <member name="P:Ionic.Zip.ZipProgressEventArgs.Cancel">
  3047. <summary>
  3048. In an event handler, set this to cancel the save or extract
  3049. operation that is in progress.
  3050. </summary>
  3051. </member>
  3052. <member name="P:Ionic.Zip.ZipProgressEventArgs.EventType">
  3053. <summary>
  3054. The type of event being reported.
  3055. </summary>
  3056. </member>
  3057. <member name="P:Ionic.Zip.ZipProgressEventArgs.ArchiveName">
  3058. <summary>
  3059. Returns the archive name associated to this event.
  3060. </summary>
  3061. </member>
  3062. <member name="P:Ionic.Zip.ZipProgressEventArgs.BytesTransferred">
  3063. <summary>
  3064. The number of bytes read or written so far for this entry.
  3065. </summary>
  3066. </member>
  3067. <member name="P:Ionic.Zip.ZipProgressEventArgs.TotalBytesToTransfer">
  3068. <summary>
  3069. Total number of bytes that will be read or written for this entry.
  3070. This number will be -1 if the value cannot be determined.
  3071. </summary>
  3072. </member>
  3073. <member name="T:Ionic.Zip.ReadProgressEventArgs">
  3074. <summary>
  3075. Provides information about the progress of a Read operation.
  3076. </summary>
  3077. </member>
  3078. <member name="T:Ionic.Zip.AddProgressEventArgs">
  3079. <summary>
  3080. Provides information about the progress of a Add operation.
  3081. </summary>
  3082. </member>
  3083. <member name="T:Ionic.Zip.SaveProgressEventArgs">
  3084. <summary>
  3085. Provides information about the progress of a save operation.
  3086. </summary>
  3087. </member>
  3088. <member name="M:Ionic.Zip.SaveProgressEventArgs.#ctor(System.String,System.Boolean,System.Int32,System.Int32,Ionic.Zip.ZipEntry)">
  3089. <summary>
  3090. Constructor for the SaveProgressEventArgs.
  3091. </summary>
  3092. <param name="archiveName">the name of the zip archive.</param>
  3093. <param name="before">whether this is before saving the entry, or after</param>
  3094. <param name="entriesTotal">The total number of entries in the zip archive.</param>
  3095. <param name="entriesSaved">Number of entries that have been saved.</param>
  3096. <param name="entry">The entry involved in the event.</param>
  3097. </member>
  3098. <member name="P:Ionic.Zip.SaveProgressEventArgs.EntriesSaved">
  3099. <summary>
  3100. Number of entries saved so far.
  3101. </summary>
  3102. </member>
  3103. <member name="T:Ionic.Zip.ExtractProgressEventArgs">
  3104. <summary>
  3105. Provides information about the progress of the extract operation.
  3106. </summary>
  3107. </member>
  3108. <member name="M:Ionic.Zip.ExtractProgressEventArgs.#ctor(System.String,System.Boolean,System.Int32,System.Int32,Ionic.Zip.ZipEntry,System.String)">
  3109. <summary>
  3110. Constructor for the ExtractProgressEventArgs.
  3111. </summary>
  3112. <param name="archiveName">the name of the zip archive.</param>
  3113. <param name="before">whether this is before saving the entry, or after</param>
  3114. <param name="entriesTotal">The total number of entries in the zip archive.</param>
  3115. <param name="entriesExtracted">Number of entries that have been extracted.</param>
  3116. <param name="entry">The entry involved in the event.</param>
  3117. <param name="extractLocation">The location to which entries are extracted.</param>
  3118. </member>
  3119. <member name="P:Ionic.Zip.ExtractProgressEventArgs.EntriesExtracted">
  3120. <summary>
  3121. Number of entries extracted so far. This is set only if the
  3122. EventType is Extracting_BeforeExtractEntry or Extracting_AfterExtractEntry, and
  3123. the Extract() is occurring witin the scope of a call to ExtractAll().
  3124. </summary>
  3125. </member>
  3126. <member name="P:Ionic.Zip.ExtractProgressEventArgs.ExtractLocation">
  3127. <summary>
  3128. Returns the extraction target location, a filesystem path.
  3129. </summary>
  3130. </member>
  3131. <member name="T:Ionic.Zip.ZipErrorEventArgs">
  3132. <summary>
  3133. Provides information about the an error that occurred while zipping.
  3134. </summary>
  3135. </member>
  3136. <member name="P:Ionic.Zip.ZipErrorEventArgs.Exception">
  3137. <summary>
  3138. Returns the exception that occurred, if any.
  3139. </summary>
  3140. </member>
  3141. <member name="P:Ionic.Zip.ZipErrorEventArgs.FileName">
  3142. <summary>
  3143. Returns the name of the file that caused the exception, if any.
  3144. </summary>
  3145. </member>
  3146. <member name="T:Ionic.Zip.ZipEntry">
  3147. <summary>
  3148. Represents a single entry in a ZipFile. Typically, applications get a ZipEntry
  3149. by enumerating the entries within a ZipFile, or by adding an entry to a ZipFile.
  3150. </summary>
  3151. </member>
  3152. <member name="M:Ionic.Zip.ZipEntry.ReadDirEntry(Ionic.Zip.ZipFile,System.Collections.Generic.Dictionary{System.String,System.Object})">
  3153. <summary>
  3154. Reads one entry from the zip directory structure in the zip file.
  3155. </summary>
  3156. <param name="zf">
  3157. The zipfile for which a directory entry will be read. From this param, the
  3158. method gets the ReadStream and the expected text encoding
  3159. (ProvisionalAlternateEncoding) which is used if the entry is not marked
  3160. UTF-8.
  3161. </param>
  3162. <param name="previouslySeen">
  3163. a list of previously seen entry names; used to prevent duplicates.
  3164. </param>
  3165. <returns>the entry read from the archive.</returns>
  3166. </member>
  3167. <member name="M:Ionic.Zip.ZipEntry.IsNotValidZipDirEntrySig(System.Int32)">
  3168. <summary>
  3169. Returns true if the passed-in value is a valid signature for a ZipDirEntry.
  3170. </summary>
  3171. <param name="signature">the candidate 4-byte signature value.</param>
  3172. <returns>true, if the signature is valid according to the PKWare spec.</returns>
  3173. </member>
  3174. <member name="M:Ionic.Zip.ZipEntry.#ctor">
  3175. <summary>
  3176. Default constructor.
  3177. </summary>
  3178. <remarks>
  3179. Applications should never need to call this directly. It is exposed to
  3180. support COM Automation environments.
  3181. </remarks>
  3182. </member>
  3183. <member name="M:Ionic.Zip.ZipEntry.SetEntryTimes(System.DateTime,System.DateTime,System.DateTime)">
  3184. <summary>
  3185. Sets the NTFS Creation, Access, and Modified times for the given entry.
  3186. </summary>
  3187. <remarks>
  3188. <para>
  3189. When adding an entry from a file or directory, the Creation, Access, and
  3190. Modified times for the given entry are automatically set from the
  3191. filesystem values. When adding an entry from a stream or string, the
  3192. values are implicitly set to DateTime.Now. The application may wish to
  3193. set these values to some arbitrary value, before saving the archive, and
  3194. can do so using the various setters. If you want to set all of the times,
  3195. this method is more efficient.
  3196. </para>
  3197. <para>
  3198. The values you set here will be retrievable with the <see cref="P:Ionic.Zip.ZipEntry.ModifiedTime"/>, <see cref="P:Ionic.Zip.ZipEntry.CreationTime"/> and <see cref="P:Ionic.Zip.ZipEntry.AccessedTime"/> properties.
  3199. </para>
  3200. <para>
  3201. When this method is called, if both <see cref="P:Ionic.Zip.ZipEntry.EmitTimesInWindowsFormatWhenSaving"/> and <see cref="P:Ionic.Zip.ZipEntry.EmitTimesInUnixFormatWhenSaving"/> are false, then the
  3202. <c>EmitTimesInWindowsFormatWhenSaving</c> flag is automatically set.
  3203. </para>
  3204. <para>
  3205. DateTime values provided here without a DateTimeKind are assumed to be Local Time.
  3206. </para>
  3207. </remarks>
  3208. <param name="created">the creation time of the entry.</param>
  3209. <param name="accessed">the last access time of the entry.</param>
  3210. <param name="modified">the last modified time of the entry.</param>
  3211. <seealso cref="P:Ionic.Zip.ZipEntry.EmitTimesInWindowsFormatWhenSaving"/>
  3212. <seealso cref="P:Ionic.Zip.ZipEntry.EmitTimesInUnixFormatWhenSaving"/>
  3213. <seealso cref="P:Ionic.Zip.ZipEntry.AccessedTime"/>
  3214. <seealso cref="P:Ionic.Zip.ZipEntry.CreationTime"/>
  3215. <seealso cref="P:Ionic.Zip.ZipEntry.ModifiedTime"/>
  3216. </member>
  3217. <member name="M:Ionic.Zip.ZipEntry.ToString">
  3218. <summary>Provides a string representation of the instance.</summary>
  3219. <returns>a string representation of the instance.</returns>
  3220. </member>
  3221. <member name="M:Ionic.Zip.ZipEntry.Extract">
  3222. <summary>
  3223. Extract the entry to the filesystem, starting at the current
  3224. working directory.
  3225. </summary>
  3226. <overloads>
  3227. This method has a bunch of overloads! One of them is sure to
  3228. be the right one for you... If you don't like these, check
  3229. out the <c>ExtractWithPassword()</c> methods.
  3230. </overloads>
  3231. <seealso cref="P:Ionic.Zip.ZipEntry.ExtractExistingFile"/>
  3232. <seealso cref="M:Ionic.Zip.ZipEntry.Extract(Ionic.Zip.ExtractExistingFileAction)"/>
  3233. <remarks>
  3234. <para>
  3235. This method extracts an entry from a zip file into the current
  3236. working directory. The path of the entry as extracted is the full
  3237. path as specified in the zip archive, relative to the current
  3238. working directory. After the file is extracted successfully, the
  3239. file attributes and timestamps are set.
  3240. </para>
  3241. <para>
  3242. The action taken when extraction an entry would overwrite an
  3243. existing file is determined by the <see cref="P:Ionic.Zip.ZipEntry.ExtractExistingFile"/> property.
  3244. </para>
  3245. <para>
  3246. Within the call to <c>Extract()</c>, the content for the entry is
  3247. written into a filesystem file, and then the last modified time of the
  3248. file is set according to the <see cref="P:Ionic.Zip.ZipEntry.LastModified"/> property on
  3249. the entry. See the remarks the <see cref="P:Ionic.Zip.ZipEntry.LastModified"/> property for
  3250. some details about the last modified time.
  3251. </para>
  3252. </remarks>
  3253. </member>
  3254. <member name="M:Ionic.Zip.ZipEntry.Extract(Ionic.Zip.ExtractExistingFileAction)">
  3255. <summary>
  3256. Extract the entry to a file in the filesystem, using the specified
  3257. behavior when extraction would overwrite an existing file.
  3258. </summary>
  3259. <remarks>
  3260. <para>
  3261. See the remarks on the <see cref="P:Ionic.Zip.ZipEntry.LastModified"/> property, for some
  3262. details about how the last modified time of the file is set after
  3263. extraction.
  3264. </para>
  3265. </remarks>
  3266. <param name="extractExistingFile">
  3267. The action to take if extraction would overwrite an existing file.
  3268. </param>
  3269. </member>
  3270. <member name="M:Ionic.Zip.ZipEntry.Extract(System.IO.Stream)">
  3271. <summary>
  3272. Extracts the entry to the specified stream.
  3273. </summary>
  3274. <remarks>
  3275. <para>
  3276. The caller can specify any write-able stream, for example a <see cref="T:System.IO.FileStream"/>, a <see cref="T:System.IO.MemoryStream"/>, or ASP.NET's
  3277. <c>Response.OutputStream</c>. The content will be decrypted and
  3278. decompressed as necessary. If the entry is encrypted and no password
  3279. is provided, this method will throw.
  3280. </para>
  3281. <para>
  3282. The position on the stream is not reset by this method before it extracts.
  3283. You may want to call stream.Seek() before calling ZipEntry.Extract().
  3284. </para>
  3285. </remarks>
  3286. <param name="stream">
  3287. the stream to which the entry should be extracted.
  3288. </param>
  3289. </member>
  3290. <member name="M:Ionic.Zip.ZipEntry.Extract(System.String)">
  3291. <summary>
  3292. Extract the entry to the filesystem, starting at the specified base
  3293. directory.
  3294. </summary>
  3295. <param name="baseDirectory">the pathname of the base directory</param>
  3296. <seealso cref="P:Ionic.Zip.ZipEntry.ExtractExistingFile"/>
  3297. <seealso cref="M:Ionic.Zip.ZipEntry.Extract(System.String,Ionic.Zip.ExtractExistingFileAction)"/>
  3298. <example>
  3299. This example extracts only the entries in a zip file that are .txt files,
  3300. into a directory called "textfiles".
  3301. <code lang="C#">
  3302. using (ZipFile zip = ZipFile.Read("PackedDocuments.zip"))
  3303. {
  3304. foreach (string s1 in zip.EntryFilenames)
  3305. {
  3306. if (s1.EndsWith(".txt"))
  3307. {
  3308. zip[s1].Extract("textfiles");
  3309. }
  3310. }
  3311. }
  3312. </code>
  3313. <code lang="VB">
  3314. Using zip As ZipFile = ZipFile.Read("PackedDocuments.zip")
  3315. Dim s1 As String
  3316. For Each s1 In zip.EntryFilenames
  3317. If s1.EndsWith(".txt") Then
  3318. zip(s1).Extract("textfiles")
  3319. End If
  3320. Next
  3321. End Using
  3322. </code>
  3323. </example>
  3324. <remarks>
  3325. <para>
  3326. Using this method, existing entries in the filesystem will not be
  3327. overwritten. If you would like to force the overwrite of existing
  3328. files, see the <see cref="P:Ionic.Zip.ZipEntry.ExtractExistingFile"/> property, or call
  3329. <see cref="M:Ionic.Zip.ZipEntry.Extract(System.String,Ionic.Zip.ExtractExistingFileAction)"/>.
  3330. </para>
  3331. <para>
  3332. See the remarks on the <see cref="P:Ionic.Zip.ZipEntry.LastModified"/> property, for some
  3333. details about how the last modified time of the created file is set.
  3334. </para>
  3335. </remarks>
  3336. </member>
  3337. <member name="M:Ionic.Zip.ZipEntry.Extract(System.String,Ionic.Zip.ExtractExistingFileAction)">
  3338. <summary>
  3339. Extract the entry to the filesystem, starting at the specified base
  3340. directory, and using the specified behavior when extraction would
  3341. overwrite an existing file.
  3342. </summary>
  3343. <remarks>
  3344. <para>
  3345. See the remarks on the <see cref="P:Ionic.Zip.ZipEntry.LastModified"/> property, for some
  3346. details about how the last modified time of the created file is set.
  3347. </para>
  3348. </remarks>
  3349. <example>
  3350. <code lang="C#">
  3351. String sZipPath = "Airborne.zip";
  3352. String sFilePath = "Readme.txt";
  3353. String sRootFolder = "Digado";
  3354. using (ZipFile zip = ZipFile.Read(sZipPath))
  3355. {
  3356. if (zip.EntryFileNames.Contains(sFilePath))
  3357. {
  3358. // use the string indexer on the zip file
  3359. zip[sFileName].Extract(sRootFolder,
  3360. ExtractExistingFileAction.OverwriteSilently);
  3361. }
  3362. }
  3363. </code>
  3364. <code lang="VB">
  3365. Dim sZipPath as String = "Airborne.zip"
  3366. Dim sFilePath As String = "Readme.txt"
  3367. Dim sRootFolder As String = "Digado"
  3368. Using zip As ZipFile = ZipFile.Read(sZipPath)
  3369. If zip.EntryFileNames.Contains(sFilePath)
  3370. ' use the string indexer on the zip file
  3371. zip(sFilePath).Extract(sRootFolder, _
  3372. ExtractExistingFileAction.OverwriteSilently)
  3373. End If
  3374. End Using
  3375. </code>
  3376. </example>
  3377. <param name="baseDirectory">the pathname of the base directory</param>
  3378. <param name="extractExistingFile">
  3379. The action to take if extraction would overwrite an existing file.
  3380. </param>
  3381. </member>
  3382. <member name="M:Ionic.Zip.ZipEntry.ExtractWithPassword(System.String)">
  3383. <summary>
  3384. Extract the entry to the filesystem, using the current working directory
  3385. and the specified password.
  3386. </summary>
  3387. <overloads>
  3388. This method has a bunch of overloads! One of them is sure to be
  3389. the right one for you...
  3390. </overloads>
  3391. <seealso cref="P:Ionic.Zip.ZipEntry.ExtractExistingFile"/>
  3392. <seealso cref="M:Ionic.Zip.ZipEntry.ExtractWithPassword(Ionic.Zip.ExtractExistingFileAction,System.String)"/>
  3393. <remarks>
  3394. <para>
  3395. Existing entries in the filesystem will not be overwritten. If you
  3396. would like to force the overwrite of existing files, see the <see cref="P:Ionic.Zip.ZipEntry.ExtractExistingFile"/>property, or call
  3397. <see cref="M:Ionic.Zip.ZipEntry.ExtractWithPassword(Ionic.Zip.ExtractExistingFileAction,System.String)"/>.
  3398. </para>
  3399. <para>
  3400. See the remarks on the <see cref="P:Ionic.Zip.ZipEntry.LastModified"/> property for some
  3401. details about how the "last modified" time of the created file is
  3402. set.
  3403. </para>
  3404. </remarks>
  3405. <example>
  3406. In this example, entries that use encryption are extracted using a
  3407. particular password.
  3408. <code>
  3409. using (var zip = ZipFile.Read(FilePath))
  3410. {
  3411. foreach (ZipEntry e in zip)
  3412. {
  3413. if (e.UsesEncryption)
  3414. e.ExtractWithPassword("Secret!");
  3415. else
  3416. e.Extract();
  3417. }
  3418. }
  3419. </code>
  3420. <code lang="VB">
  3421. Using zip As ZipFile = ZipFile.Read(FilePath)
  3422. Dim e As ZipEntry
  3423. For Each e In zip
  3424. If (e.UsesEncryption)
  3425. e.ExtractWithPassword("Secret!")
  3426. Else
  3427. e.Extract
  3428. End If
  3429. Next
  3430. End Using
  3431. </code>
  3432. </example>
  3433. <param name="password">The Password to use for decrypting the entry.</param>
  3434. </member>
  3435. <member name="M:Ionic.Zip.ZipEntry.ExtractWithPassword(System.String,System.String)">
  3436. <summary>
  3437. Extract the entry to the filesystem, starting at the specified base
  3438. directory, and using the specified password.
  3439. </summary>
  3440. <seealso cref="P:Ionic.Zip.ZipEntry.ExtractExistingFile"/>
  3441. <seealso cref="M:Ionic.Zip.ZipEntry.ExtractWithPassword(System.String,Ionic.Zip.ExtractExistingFileAction,System.String)"/>
  3442. <remarks>
  3443. <para>
  3444. Existing entries in the filesystem will not be overwritten. If you
  3445. would like to force the overwrite of existing files, see the <see cref="P:Ionic.Zip.ZipEntry.ExtractExistingFile"/>property, or call
  3446. <see cref="M:Ionic.Zip.ZipEntry.ExtractWithPassword(Ionic.Zip.ExtractExistingFileAction,System.String)"/>.
  3447. </para>
  3448. <para>
  3449. See the remarks on the <see cref="P:Ionic.Zip.ZipEntry.LastModified"/> property, for some
  3450. details about how the last modified time of the created file is set.
  3451. </para>
  3452. </remarks>
  3453. <param name="baseDirectory">The pathname of the base directory.</param>
  3454. <param name="password">The Password to use for decrypting the entry.</param>
  3455. </member>
  3456. <member name="M:Ionic.Zip.ZipEntry.ExtractWithPassword(Ionic.Zip.ExtractExistingFileAction,System.String)">
  3457. <summary>
  3458. Extract the entry to a file in the filesystem, relative to the
  3459. current directory, using the specified behavior when extraction
  3460. would overwrite an existing file.
  3461. </summary>
  3462. <remarks>
  3463. <para>
  3464. See the remarks on the <see cref="P:Ionic.Zip.ZipEntry.LastModified"/> property, for some
  3465. details about how the last modified time of the created file is set.
  3466. </para>
  3467. </remarks>
  3468. <param name="password">The Password to use for decrypting the entry.</param>
  3469. <param name="extractExistingFile">
  3470. The action to take if extraction would overwrite an existing file.
  3471. </param>
  3472. </member>
  3473. <member name="M:Ionic.Zip.ZipEntry.ExtractWithPassword(System.String,Ionic.Zip.ExtractExistingFileAction,System.String)">
  3474. <summary>
  3475. Extract the entry to the filesystem, starting at the specified base
  3476. directory, and using the specified behavior when extraction would
  3477. overwrite an existing file.
  3478. </summary>
  3479. <remarks>
  3480. See the remarks on the <see cref="P:Ionic.Zip.ZipEntry.LastModified"/> property, for some
  3481. details about how the last modified time of the created file is set.
  3482. </remarks>
  3483. <param name="baseDirectory">the pathname of the base directory</param>
  3484. <param name="extractExistingFile">The action to take if extraction would
  3485. overwrite an existing file.</param>
  3486. <param name="password">The Password to use for decrypting the entry.</param>
  3487. </member>
  3488. <member name="M:Ionic.Zip.ZipEntry.ExtractWithPassword(System.IO.Stream,System.String)">
  3489. <summary>
  3490. Extracts the entry to the specified stream, using the specified
  3491. Password. For example, the caller could extract to Console.Out, or
  3492. to a MemoryStream.
  3493. </summary>
  3494. <remarks>
  3495. <para>
  3496. The caller can specify any write-able stream, for example a <see cref="T:System.IO.FileStream"/>, a <see cref="T:System.IO.MemoryStream"/>, or ASP.NET's
  3497. <c>Response.OutputStream</c>. The content will be decrypted and
  3498. decompressed as necessary. If the entry is encrypted and no password
  3499. is provided, this method will throw.
  3500. </para>
  3501. <para>
  3502. The position on the stream is not reset by this method before it extracts.
  3503. You may want to call stream.Seek() before calling ZipEntry.Extract().
  3504. </para>
  3505. </remarks>
  3506. <param name="stream">
  3507. the stream to which the entry should be extracted.
  3508. </param>
  3509. <param name="password">
  3510. The password to use for decrypting the entry.
  3511. </param>
  3512. </member>
  3513. <member name="M:Ionic.Zip.ZipEntry.OpenReader">
  3514. <summary>
  3515. Opens a readable stream corresponding to the zip entry in the
  3516. archive. The stream decompresses and decrypts as necessary, as it
  3517. is read.
  3518. </summary>
  3519. <remarks>
  3520. <para>
  3521. DotNetZip offers a variety of ways to extract entries from a zip
  3522. file. This method allows an application to extract an entry by
  3523. reading a <see cref="T:System.IO.Stream"/>.
  3524. </para>
  3525. <para>
  3526. The return value is of type <see cref="T:Ionic.Crc.CrcCalculatorStream"/>. Use it as you would any
  3527. stream for reading. When an application calls <see cref="M:System.IO.Stream.Read(System.Byte[],System.Int32,System.Int32)"/> on that stream, it will
  3528. receive data from the zip entry that is decrypted and decompressed
  3529. as necessary.
  3530. </para>
  3531. <para>
  3532. <c>CrcCalculatorStream</c> adds one additional feature: it keeps a
  3533. CRC32 checksum on the bytes of the stream as it is read. The CRC
  3534. value is available in the <see cref="P:Ionic.Crc.CrcCalculatorStream.Crc"/> property on the
  3535. <c>CrcCalculatorStream</c>. When the read is complete, your
  3536. application
  3537. <em>should</em> check this CRC against the <see cref="P:Ionic.Zip.ZipEntry.Crc"/>
  3538. property on the <c>ZipEntry</c> to validate the content of the
  3539. ZipEntry. You don't have to validate the entry using the CRC, but
  3540. you should, to verify integrity. Check the example for how to do
  3541. this.
  3542. </para>
  3543. <para>
  3544. If the entry is protected with a password, then you need to provide
  3545. a password prior to calling <see cref="M:Ionic.Zip.ZipEntry.OpenReader"/>, either by
  3546. setting the <see cref="P:Ionic.Zip.ZipEntry.Password"/> property on the entry, or the
  3547. <see cref="P:Ionic.Zip.ZipFile.Password"/> property on the <c>ZipFile</c>
  3548. itself. Or, you can use <see cref="M:Ionic.Zip.ZipEntry.OpenReader(System.String)"/>, the
  3549. overload of OpenReader that accepts a password parameter.
  3550. </para>
  3551. <para>
  3552. If you want to extract entry data into a write-able stream that is
  3553. already opened, like a <see cref="T:System.IO.FileStream"/>, do not
  3554. use this method. Instead, use <see cref="M:Ionic.Zip.ZipEntry.Extract(System.IO.Stream)"/>.
  3555. </para>
  3556. <para>
  3557. Your application may use only one stream created by OpenReader() at
  3558. a time, and you should not call other Extract methods before
  3559. completing your reads on a stream obtained from OpenReader(). This
  3560. is because there is really only one source stream for the compressed
  3561. content. A call to OpenReader() seeks in the source stream, to the
  3562. beginning of the compressed content. A subsequent call to
  3563. OpenReader() on a different entry will seek to a different position
  3564. in the source stream, as will a call to Extract() or one of its
  3565. overloads. This will corrupt the state for the decompressing stream
  3566. from the original call to OpenReader().
  3567. </para>
  3568. <para>
  3569. The <c>OpenReader()</c> method works only when the ZipEntry is
  3570. obtained from an instance of <c>ZipFile</c>. This method will throw
  3571. an exception if the ZipEntry is obtained from a <see cref="T:Ionic.Zip.ZipInputStream"/>.
  3572. </para>
  3573. </remarks>
  3574. <example>
  3575. This example shows how to open a zip archive, then read in a named
  3576. entry via a stream. After the read loop is complete, the code
  3577. compares the calculated during the read loop with the expected CRC
  3578. on the <c>ZipEntry</c>, to verify the extraction.
  3579. <code>
  3580. using (ZipFile zip = new ZipFile(ZipFileToRead))
  3581. {
  3582. ZipEntry e1= zip["Elevation.mp3"];
  3583. using (Ionic.Zlib.CrcCalculatorStream s = e1.OpenReader())
  3584. {
  3585. byte[] buffer = new byte[4096];
  3586. int n, totalBytesRead= 0;
  3587. do {
  3588. n = s.Read(buffer,0, buffer.Length);
  3589. totalBytesRead+=n;
  3590. } while (n&gt;0);
  3591. if (s.Crc32 != e1.Crc32)
  3592. throw new Exception(string.Format("The Zip Entry failed the CRC Check. (0x{0:X8}!=0x{1:X8})", s.Crc32, e1.Crc32));
  3593. if (totalBytesRead != e1.UncompressedSize)
  3594. throw new Exception(string.Format("We read an unexpected number of bytes. ({0}!={1})", totalBytesRead, e1.UncompressedSize));
  3595. }
  3596. }
  3597. </code>
  3598. <code lang="VB">
  3599. Using zip As New ZipFile(ZipFileToRead)
  3600. Dim e1 As ZipEntry = zip.Item("Elevation.mp3")
  3601. Using s As Ionic.Zlib.CrcCalculatorStream = e1.OpenReader
  3602. Dim n As Integer
  3603. Dim buffer As Byte() = New Byte(4096) {}
  3604. Dim totalBytesRead As Integer = 0
  3605. Do
  3606. n = s.Read(buffer, 0, buffer.Length)
  3607. totalBytesRead = (totalBytesRead + n)
  3608. Loop While (n &gt; 0)
  3609. If (s.Crc32 &lt;&gt; e1.Crc32) Then
  3610. Throw New Exception(String.Format("The Zip Entry failed the CRC Check. (0x{0:X8}!=0x{1:X8})", s.Crc32, e1.Crc32))
  3611. End If
  3612. If (totalBytesRead &lt;&gt; e1.UncompressedSize) Then
  3613. Throw New Exception(String.Format("We read an unexpected number of bytes. ({0}!={1})", totalBytesRead, e1.UncompressedSize))
  3614. End If
  3615. End Using
  3616. End Using
  3617. </code>
  3618. </example>
  3619. <seealso cref="M:Ionic.Zip.ZipEntry.Extract(System.IO.Stream)"/>
  3620. <returns>The Stream for reading.</returns>
  3621. </member>
  3622. <member name="M:Ionic.Zip.ZipEntry.OpenReader(System.String)">
  3623. <summary>
  3624. Opens a readable stream for an encrypted zip entry in the archive.
  3625. The stream decompresses and decrypts as necessary, as it is read.
  3626. </summary>
  3627. <remarks>
  3628. <para>
  3629. See the documentation on the <see cref="M:Ionic.Zip.ZipEntry.OpenReader"/> method for
  3630. full details. This overload allows the application to specify a
  3631. password for the <c>ZipEntry</c> to be read.
  3632. </para>
  3633. </remarks>
  3634. <param name="password">The password to use for decrypting the entry.</param>
  3635. <returns>The Stream for reading.</returns>
  3636. </member>
  3637. <member name="M:Ionic.Zip.ZipEntry.ValidateOutput(System.String,System.IO.Stream,System.String@)">
  3638. <summary>
  3639. Validates that the args are consistent.
  3640. </summary>
  3641. <remarks>
  3642. Only one of {baseDir, outStream} can be non-null.
  3643. If baseDir is non-null, then the outputFile is created.
  3644. </remarks>
  3645. </member>
  3646. <member name="M:Ionic.Zip.ZipEntry.ReadEntry(Ionic.Zip.ZipContainer,System.Boolean)">
  3647. <summary>
  3648. Reads one <c>ZipEntry</c> from the given stream. The content for
  3649. the entry does not get decompressed or decrypted. This method
  3650. basically reads metadata, and seeks.
  3651. </summary>
  3652. <param name="zc">the ZipContainer this entry belongs to.</param>
  3653. <param name="first">
  3654. true of this is the first entry being read from the stream.
  3655. </param>
  3656. <returns>the <c>ZipEntry</c> read from the stream.</returns>
  3657. </member>
  3658. <member name="M:Ionic.Zip.ZipEntry.FindExtraFieldSegment(System.Byte[],System.Int32,System.UInt16)">
  3659. <summary>
  3660. Finds a particular segment in the given extra field.
  3661. This is used when modifying a previously-generated
  3662. extra field, in particular when removing the AES crypto
  3663. segment in the extra field.
  3664. </summary>
  3665. </member>
  3666. <member name="M:Ionic.Zip.ZipEntry.ProcessExtraField(System.IO.Stream,System.Int16)">
  3667. <summary>
  3668. At current cursor position in the stream, read the extra
  3669. field, and set the properties on the ZipEntry instance
  3670. appropriately. This can be called when processing the
  3671. Extra field in the Central Directory, or in the local
  3672. header.
  3673. </summary>
  3674. </member>
  3675. <member name="M:Ionic.Zip.ZipEntry.GetEncodedFileNameBytes">
  3676. <summary>
  3677. generate and return a byte array that encodes the filename
  3678. for the entry.
  3679. </summary>
  3680. <remarks>
  3681. <para>
  3682. side effects: generate and store into _CommentBytes the
  3683. byte array for any comment attached to the entry. Also
  3684. sets _actualEncoding to indicate the actual encoding
  3685. used. The same encoding is used for both filename and
  3686. comment.
  3687. </para>
  3688. </remarks>
  3689. </member>
  3690. <member name="M:Ionic.Zip.ZipEntry.PrepSourceStream">
  3691. <summary>
  3692. Stores the position of the entry source stream, or, if the position is
  3693. already stored, seeks to that position.
  3694. </summary>
  3695. <remarks>
  3696. <para>
  3697. This method is called in prep for reading the source stream. If PKZIP
  3698. encryption is used, then we need to calc the CRC32 before doing the
  3699. encryption, because the CRC is used in the 12th byte of the PKZIP
  3700. encryption header. So, we need to be able to seek backward in the source
  3701. when saving the ZipEntry. This method is called from the place that
  3702. calculates the CRC, and also from the method that does the encryption of
  3703. the file data.
  3704. </para>
  3705. <para>
  3706. The first time through, this method sets the _sourceStreamOriginalPosition
  3707. field. Subsequent calls to this method seek to that position.
  3708. </para>
  3709. </remarks>
  3710. </member>
  3711. <member name="M:Ionic.Zip.ZipEntry.CopyMetaData(Ionic.Zip.ZipEntry)">
  3712. <summary>
  3713. Copy metadata that may have been changed by the app. We do this when
  3714. resetting the zipFile instance. If the app calls Save() on a ZipFile, then
  3715. tries to party on that file some more, we may need to Reset() it , which
  3716. means re-reading the entries and then copying the metadata. I think.
  3717. </summary>
  3718. </member>
  3719. <member name="M:Ionic.Zip.ZipEntry.SetInputAndFigureFileLength(System.IO.Stream@)">
  3720. <summary>
  3721. Set the input stream and get its length, if possible. The length is
  3722. used for progress updates, AND, to allow an optimization in case of
  3723. a stream/file of zero length. In that case we skip the Encrypt and
  3724. compression Stream. (like DeflateStream or BZip2OutputStream)
  3725. </summary>
  3726. </member>
  3727. <member name="M:Ionic.Zip.ZipEntry.PrepOutputStream(System.IO.Stream,System.Int64,Ionic.Zip.CountingStream@,System.IO.Stream@,System.IO.Stream@,Ionic.Crc.CrcCalculatorStream@)">
  3728. <summary>
  3729. Prepare the given stream for output - wrap it in a CountingStream, and
  3730. then in a CRC stream, and an encryptor and deflator as appropriate.
  3731. </summary>
  3732. <remarks>
  3733. <para>
  3734. Previously this was used in ZipEntry.Write(), but in an effort to
  3735. introduce some efficiencies in that method I've refactored to put the
  3736. code inline. This method still gets called by ZipOutputStream.
  3737. </para>
  3738. </remarks>
  3739. </member>
  3740. <member name="P:Ionic.Zip.ZipEntry.AttributesIndicateDirectory">
  3741. <summary>
  3742. True if the referenced entry is a directory.
  3743. </summary>
  3744. </member>
  3745. <member name="P:Ionic.Zip.ZipEntry.Info">
  3746. <summary>
  3747. Provides a human-readable string with information about the ZipEntry.
  3748. </summary>
  3749. </member>
  3750. <member name="P:Ionic.Zip.ZipEntry.LastModified">
  3751. <summary>
  3752. The time and date at which the file indicated by the <c>ZipEntry</c> was
  3753. last modified.
  3754. </summary>
  3755. <remarks>
  3756. <para>
  3757. The DotNetZip library sets the LastModified value for an entry, equal to
  3758. the Last Modified time of the file in the filesystem. If an entry is
  3759. added from a stream, the library uses <c>System.DateTime.Now</c> for this
  3760. value, for the given entry.
  3761. </para>
  3762. <para>
  3763. This property allows the application to retrieve and possibly set the
  3764. LastModified value on an entry, to an arbitrary value. <see cref="T:System.DateTime"/> values with a <see cref="T:System.DateTimeKind"/>
  3765. setting of <c>DateTimeKind.Unspecified</c> are taken to be expressed as
  3766. <c>DateTimeKind.Local</c>.
  3767. </para>
  3768. <para>
  3769. Be aware that because of the way <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWare's
  3770. Zip specification</see> describes how times are stored in the zip file,
  3771. the full precision of the <c>System.DateTime</c> datatype is not stored
  3772. for the last modified time when saving zip files. For more information on
  3773. how times are formatted, see the PKZip specification.
  3774. </para>
  3775. <para>
  3776. The actual last modified time of a file can be stored in multiple ways in
  3777. the zip file, and they are not mutually exclusive:
  3778. </para>
  3779. <list type="bullet">
  3780. <item>
  3781. In the so-called "DOS" format, which has a 2-second precision. Values
  3782. are rounded to the nearest even second. For example, if the time on the
  3783. file is 12:34:43, then it will be stored as 12:34:44. This first value
  3784. is accessible via the <c>LastModified</c> property. This value is always
  3785. present in the metadata for each zip entry. In some cases the value is
  3786. invalid, or zero.
  3787. </item>
  3788. <item>
  3789. In the so-called "Windows" or "NTFS" format, as an 8-byte integer
  3790. quantity expressed as the number of 1/10 milliseconds (in other words
  3791. the number of 100 nanosecond units) since January 1, 1601 (UTC). This
  3792. format is how Windows represents file times. This time is accessible
  3793. via the <c>ModifiedTime</c> property.
  3794. </item>
  3795. <item>
  3796. In the "Unix" format, a 4-byte quantity specifying the number of seconds since
  3797. January 1, 1970 UTC.
  3798. </item>
  3799. <item>
  3800. In an older format, now deprecated but still used by some current
  3801. tools. This format is also a 4-byte quantity specifying the number of
  3802. seconds since January 1, 1970 UTC.
  3803. </item>
  3804. </list>
  3805. <para>
  3806. Zip tools and libraries will always at least handle (read or write) the
  3807. DOS time, and may also handle the other time formats. Keep in mind that
  3808. while the names refer to particular operating systems, there is nothing in
  3809. the time formats themselves that prevents their use on other operating
  3810. systems.
  3811. </para>
  3812. <para>
  3813. When reading ZIP files, the DotNetZip library reads the Windows-formatted
  3814. time, if it is stored in the entry, and sets both <c>LastModified</c> and
  3815. <c>ModifiedTime</c> to that value. When writing ZIP files, the DotNetZip
  3816. library by default will write both time quantities. It can also emit the
  3817. Unix-formatted time if desired (See <see cref="P:Ionic.Zip.ZipEntry.EmitTimesInUnixFormatWhenSaving"/>.)
  3818. </para>
  3819. <para>
  3820. The last modified time of the file created upon a call to
  3821. <c>ZipEntry.Extract()</c> may be adjusted during extraction to compensate
  3822. for differences in how the .NET Base Class Library deals with daylight
  3823. saving time (DST) versus how the Windows filesystem deals with daylight
  3824. saving time. Raymond Chen <see href="http://blogs.msdn.com/oldnewthing/archive/2003/10/24/55413.aspx">provides
  3825. some good context</see>.
  3826. </para>
  3827. <para>
  3828. In a nutshell: Daylight savings time rules change regularly. In 2007, for
  3829. example, the inception week of DST changed. In 1977, DST was in place all
  3830. year round. In 1945, likewise. And so on. Win32 does not attempt to
  3831. guess which time zone rules were in effect at the time in question. It
  3832. will render a time as "standard time" and allow the app to change to DST
  3833. as necessary. .NET makes a different choice.
  3834. </para>
  3835. <para>
  3836. Compare the output of FileInfo.LastWriteTime.ToString("f") with what you
  3837. see in the Windows Explorer property sheet for a file that was last
  3838. written to on the other side of the DST transition. For example, suppose
  3839. the file was last modified on October 17, 2003, during DST but DST is not
  3840. currently in effect. Explorer's file properties reports Thursday, October
  3841. 17, 2003, 8:45:38 AM, but .NETs FileInfo reports Thursday, October 17,
  3842. 2003, 9:45 AM.
  3843. </para>
  3844. <para>
  3845. Win32 says, "Thursday, October 17, 2002 8:45:38 AM PST". Note: Pacific
  3846. STANDARD Time. Even though October 17 of that year occurred during Pacific
  3847. Daylight Time, Win32 displays the time as standard time because that's
  3848. what time it is NOW.
  3849. </para>
  3850. <para>
  3851. .NET BCL assumes that the current DST rules were in place at the time in
  3852. question. So, .NET says, "Well, if the rules in effect now were also in
  3853. effect on October 17, 2003, then that would be daylight time" so it
  3854. displays "Thursday, October 17, 2003, 9:45 AM PDT" - daylight time.
  3855. </para>
  3856. <para>
  3857. So .NET gives a value which is more intuitively correct, but is also
  3858. potentially incorrect, and which is not invertible. Win32 gives a value
  3859. which is intuitively incorrect, but is strictly correct.
  3860. </para>
  3861. <para>
  3862. Because of this funkiness, this library adds one hour to the LastModified
  3863. time on the extracted file, if necessary. That is to say, if the time in
  3864. question had occurred in what the .NET Base Class Library assumed to be
  3865. DST. This assumption may be wrong given the constantly changing DST rules,
  3866. but it is the best we can do.
  3867. </para>
  3868. </remarks>
  3869. </member>
  3870. <member name="P:Ionic.Zip.ZipEntry.ModifiedTime">
  3871. <summary>
  3872. Last Modified time for the file represented by the entry.
  3873. </summary>
  3874. <remarks>
  3875. <para>
  3876. This value corresponds to the "last modified" time in the NTFS file times
  3877. as described in <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">the Zip
  3878. specification</see>. When getting this property, the value may be
  3879. different from <see cref="P:Ionic.Zip.ZipEntry.LastModified"/>. When setting the property,
  3880. the <see cref="P:Ionic.Zip.ZipEntry.LastModified"/> property also gets set, but with a lower
  3881. precision.
  3882. </para>
  3883. <para>
  3884. Let me explain. It's going to take a while, so get
  3885. comfortable. Originally, waaaaay back in 1989 when the ZIP specification
  3886. was originally described by the esteemed Mr. Phil Katz, the dominant
  3887. operating system of the time was MS-DOS. MSDOS stored file times with a
  3888. 2-second precision, because, c'mon, <em>who is ever going to need better
  3889. resolution than THAT?</em> And so ZIP files, regardless of the platform on
  3890. which the zip file was created, store file times in exactly <see href="http://www.vsft.com/hal/dostime.htm">the same format that DOS used
  3891. in 1989</see>.
  3892. </para>
  3893. <para>
  3894. Since then, the ZIP spec has evolved, but the internal format for file
  3895. timestamps remains the same. Despite the fact that the way times are
  3896. stored in a zip file is rooted in DOS heritage, any program on any
  3897. operating system can format a time in this way, and most zip tools and
  3898. libraries DO - they round file times to the nearest even second and store
  3899. it just like DOS did 25+ years ago.
  3900. </para>
  3901. <para>
  3902. PKWare extended the ZIP specification to allow a zip file to store what
  3903. are called "NTFS Times" and "Unix(tm) times" for a file. These are the
  3904. <em>last write</em>, <em>last access</em>, and <em>file creation</em>
  3905. times of a particular file. These metadata are not actually specific
  3906. to NTFS or Unix. They are tracked for each file by NTFS and by various
  3907. Unix filesystems, but they are also tracked by other filesystems, too.
  3908. The key point is that the times are <em>formatted in the zip file</em>
  3909. in the same way that NTFS formats the time (ticks since win32 epoch),
  3910. or in the same way that Unix formats the time (seconds since Unix
  3911. epoch). As with the DOS time, any tool or library running on any
  3912. operating system is capable of formatting a time in one of these ways
  3913. and embedding it into the zip file.
  3914. </para>
  3915. <para>
  3916. These extended times are higher precision quantities than the DOS time.
  3917. As described above, the (DOS) LastModified has a precision of 2 seconds.
  3918. The Unix time is stored with a precision of 1 second. The NTFS time is
  3919. stored with a precision of 0.0000001 seconds. The quantities are easily
  3920. convertible, except for the loss of precision you may incur.
  3921. </para>
  3922. <para>
  3923. A zip archive can store the {C,A,M} times in NTFS format, in Unix format,
  3924. or not at all. Often a tool running on Unix or Mac will embed the times
  3925. in Unix format (1 second precision), while WinZip running on Windows might
  3926. embed the times in NTFS format (precision of of 0.0000001 seconds). When
  3927. reading a zip file with these "extended" times, in either format,
  3928. DotNetZip represents the values with the
  3929. <c>ModifiedTime</c>, <c>AccessedTime</c> and <c>CreationTime</c>
  3930. properties on the <c>ZipEntry</c>.
  3931. </para>
  3932. <para>
  3933. While any zip application or library, regardless of the platform it
  3934. runs on, could use any of the time formats allowed by the ZIP
  3935. specification, not all zip tools or libraries do support all these
  3936. formats. Storing the higher-precision times for each entry is
  3937. optional for zip files, and many tools and libraries don't use the
  3938. higher precision quantities at all. The old DOS time, represented by
  3939. <see cref="P:Ionic.Zip.ZipEntry.LastModified"/>, is guaranteed to be present, though it
  3940. sometimes unset.
  3941. </para>
  3942. <para>
  3943. Ok, getting back to the question about how the <c>LastModified</c>
  3944. property relates to this <c>ModifiedTime</c>
  3945. property... <c>LastModified</c> is always set, while
  3946. <c>ModifiedTime</c> is not. (The other times stored in the <em>NTFS
  3947. times extension</em>, <c>CreationTime</c> and <c>AccessedTime</c> also
  3948. may not be set on an entry that is read from an existing zip file.)
  3949. When reading a zip file, then <c>LastModified</c> takes the DOS time
  3950. that is stored with the file. If the DOS time has been stored as zero
  3951. in the zipfile, then this library will use <c>DateTime.Now</c> for the
  3952. <c>LastModified</c> value. If the ZIP file was created by an evolved
  3953. tool, then there will also be higher precision NTFS or Unix times in
  3954. the zip file. In that case, this library will read those times, and
  3955. set <c>LastModified</c> and <c>ModifiedTime</c> to the same value, the
  3956. one corresponding to the last write time of the file. If there are no
  3957. higher precision times stored for the entry, then <c>ModifiedTime</c>
  3958. remains unset (likewise <c>AccessedTime</c> and <c>CreationTime</c>),
  3959. and <c>LastModified</c> keeps its DOS time.
  3960. </para>
  3961. <para>
  3962. When creating zip files with this library, by default the extended time
  3963. properties (<c>ModifiedTime</c>, <c>AccessedTime</c>, and
  3964. <c>CreationTime</c>) are set on the ZipEntry instance, and these data are
  3965. stored in the zip archive for each entry, in NTFS format. If you add an
  3966. entry from an actual filesystem file, then the entry gets the actual file
  3967. times for that file, to NTFS-level precision. If you add an entry from a
  3968. stream, or a string, then the times get the value <c>DateTime.Now</c>. In
  3969. this case <c>LastModified</c> and <c>ModifiedTime</c> will be identical,
  3970. to 2 seconds of precision. You can explicitly set the
  3971. <c>CreationTime</c>, <c>AccessedTime</c>, and <c>ModifiedTime</c> of an
  3972. entry using the property setters. If you want to set all of those
  3973. quantities, it's more efficient to use the <see cref="M:Ionic.Zip.ZipEntry.SetEntryTimes(System.DateTime,System.DateTime,System.DateTime)"/> method. Those
  3974. changes are not made permanent in the zip file until you call <see cref="M:Ionic.Zip.ZipFile.Save"/> or one of its cousins.
  3975. </para>
  3976. <para>
  3977. When creating a zip file, you can override the default behavior of
  3978. this library for formatting times in the zip file, disabling the
  3979. embedding of file times in NTFS format or enabling the storage of file
  3980. times in Unix format, or both. You may want to do this, for example,
  3981. when creating a zip file on Windows, that will be consumed on a Mac,
  3982. by an application that is not hip to the "NTFS times" format. To do
  3983. this, use the <see cref="P:Ionic.Zip.ZipEntry.EmitTimesInWindowsFormatWhenSaving"/> and
  3984. <see cref="P:Ionic.Zip.ZipEntry.EmitTimesInUnixFormatWhenSaving"/> properties. A valid zip
  3985. file may store the file times in both formats. But, there are no
  3986. guarantees that a program running on Mac or Linux will gracefully
  3987. handle the NTFS-formatted times when Unix times are present, or that a
  3988. non-DotNetZip-powered application running on Windows will be able to
  3989. handle file times in Unix format. DotNetZip will always do something
  3990. reasonable; other libraries or tools may not. When in doubt, test.
  3991. </para>
  3992. <para>
  3993. I'll bet you didn't think one person could type so much about time, eh?
  3994. And reading it was so enjoyable, too! Well, in appreciation, <see href="http://cheeso.members.winisp.net/DotNetZipDonate.aspx">maybe you
  3995. should donate</see>?
  3996. </para>
  3997. </remarks>
  3998. <seealso cref="P:Ionic.Zip.ZipEntry.AccessedTime"/>
  3999. <seealso cref="P:Ionic.Zip.ZipEntry.CreationTime"/>
  4000. <seealso cref="P:Ionic.Zip.ZipEntry.LastModified"/>
  4001. <seealso cref="M:Ionic.Zip.ZipEntry.SetEntryTimes(System.DateTime,System.DateTime,System.DateTime)"/>
  4002. </member>
  4003. <member name="P:Ionic.Zip.ZipEntry.AccessedTime">
  4004. <summary>
  4005. Last Access time for the file represented by the entry.
  4006. </summary>
  4007. <remarks>
  4008. This value may or may not be meaningful. If the <c>ZipEntry</c> was read from an existing
  4009. Zip archive, this information may not be available. For an explanation of why, see
  4010. <see cref="P:Ionic.Zip.ZipEntry.ModifiedTime"/>.
  4011. </remarks>
  4012. <seealso cref="P:Ionic.Zip.ZipEntry.ModifiedTime"/>
  4013. <seealso cref="P:Ionic.Zip.ZipEntry.CreationTime"/>
  4014. <seealso cref="M:Ionic.Zip.ZipEntry.SetEntryTimes(System.DateTime,System.DateTime,System.DateTime)"/>
  4015. </member>
  4016. <member name="P:Ionic.Zip.ZipEntry.CreationTime">
  4017. <summary>
  4018. The file creation time for the file represented by the entry.
  4019. </summary>
  4020. <remarks>
  4021. This value may or may not be meaningful. If the <c>ZipEntry</c> was read
  4022. from an existing zip archive, and the creation time was not set on the entry
  4023. when the zip file was created, then this property may be meaningless. For an
  4024. explanation of why, see <see cref="P:Ionic.Zip.ZipEntry.ModifiedTime"/>.
  4025. </remarks>
  4026. <seealso cref="P:Ionic.Zip.ZipEntry.ModifiedTime"/>
  4027. <seealso cref="P:Ionic.Zip.ZipEntry.AccessedTime"/>
  4028. <seealso cref="M:Ionic.Zip.ZipEntry.SetEntryTimes(System.DateTime,System.DateTime,System.DateTime)"/>
  4029. </member>
  4030. <member name="P:Ionic.Zip.ZipEntry.EmitTimesInWindowsFormatWhenSaving">
  4031. <summary>
  4032. Specifies whether the Creation, Access, and Modified times for the given
  4033. entry will be emitted in "Windows format" when the zip archive is saved.
  4034. </summary>
  4035. <remarks>
  4036. <para>
  4037. An application creating a zip archive can use this flag to explicitly
  4038. specify that the file times for the entry should or should not be stored
  4039. in the zip archive in the format used by Windows. The default value of
  4040. this property is <c>true</c>.
  4041. </para>
  4042. <para>
  4043. When adding an entry from a file or directory, the Creation (<see cref="P:Ionic.Zip.ZipEntry.CreationTime"/>), Access (<see cref="P:Ionic.Zip.ZipEntry.AccessedTime"/>), and Modified
  4044. (<see cref="P:Ionic.Zip.ZipEntry.ModifiedTime"/>) times for the given entry are automatically
  4045. set from the filesystem values. When adding an entry from a stream or
  4046. string, all three values are implicitly set to DateTime.Now. Applications
  4047. can also explicitly set those times by calling <see cref="M:Ionic.Zip.ZipEntry.SetEntryTimes(System.DateTime,System.DateTime,System.DateTime)"/>.
  4048. </para>
  4049. <para>
  4050. <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE's
  4051. zip specification</see> describes multiple ways to format these times in a
  4052. zip file. One is the format Windows applications normally use: 100ns ticks
  4053. since Jan 1, 1601 UTC. The other is a format Unix applications typically
  4054. use: seconds since January 1, 1970 UTC. Each format can be stored in an
  4055. "extra field" in the zip entry when saving the zip archive. The former
  4056. uses an extra field with a Header Id of 0x000A, while the latter uses a
  4057. header ID of 0x5455.
  4058. </para>
  4059. <para>
  4060. Not all zip tools and libraries can interpret these fields. Windows
  4061. compressed folders is one that can read the Windows Format timestamps,
  4062. while I believe the <see href="http://www.info-zip.org/">Infozip</see>
  4063. tools can read the Unix format timestamps. Although the time values are
  4064. easily convertible, subject to a loss of precision, some tools and
  4065. libraries may be able to read only one or the other. DotNetZip can read or
  4066. write times in either or both formats.
  4067. </para>
  4068. <para>
  4069. The times stored are taken from <see cref="P:Ionic.Zip.ZipEntry.ModifiedTime"/>, <see cref="P:Ionic.Zip.ZipEntry.AccessedTime"/>, and <see cref="P:Ionic.Zip.ZipEntry.CreationTime"/>.
  4070. </para>
  4071. <para>
  4072. This property is not mutually exclusive from the <see cref="P:Ionic.Zip.ZipEntry.EmitTimesInUnixFormatWhenSaving"/> property. It is
  4073. possible that a zip entry can embed the timestamps in both forms, one
  4074. form, or neither. But, there are no guarantees that a program running on
  4075. Mac or Linux will gracefully handle NTFS Formatted times, or that a
  4076. non-DotNetZip-powered application running on Windows will be able to
  4077. handle file times in Unix format. When in doubt, test.
  4078. </para>
  4079. <para>
  4080. Normally you will use the <see cref="P:Ionic.Zip.ZipFile.EmitTimesInWindowsFormatWhenSaving">ZipFile.EmitTimesInWindowsFormatWhenSaving</see>
  4081. property, to specify the behavior for all entries in a zip, rather than
  4082. the property on each individual entry.
  4083. </para>
  4084. </remarks>
  4085. <seealso cref="M:Ionic.Zip.ZipEntry.SetEntryTimes(System.DateTime,System.DateTime,System.DateTime)"/>
  4086. <seealso cref="P:Ionic.Zip.ZipEntry.EmitTimesInUnixFormatWhenSaving"/>
  4087. <seealso cref="P:Ionic.Zip.ZipEntry.CreationTime"/>
  4088. <seealso cref="P:Ionic.Zip.ZipEntry.AccessedTime"/>
  4089. <seealso cref="P:Ionic.Zip.ZipEntry.ModifiedTime"/>
  4090. </member>
  4091. <member name="P:Ionic.Zip.ZipEntry.EmitTimesInUnixFormatWhenSaving">
  4092. <summary>
  4093. Specifies whether the Creation, Access, and Modified times for the given
  4094. entry will be emitted in "Unix(tm) format" when the zip archive is saved.
  4095. </summary>
  4096. <remarks>
  4097. <para>
  4098. An application creating a zip archive can use this flag to explicitly
  4099. specify that the file times for the entry should or should not be stored
  4100. in the zip archive in the format used by Unix. By default this flag is
  4101. <c>false</c>, meaning the Unix-format times are not stored in the zip
  4102. archive.
  4103. </para>
  4104. <para>
  4105. When adding an entry from a file or directory, the Creation (<see cref="P:Ionic.Zip.ZipEntry.CreationTime"/>), Access (<see cref="P:Ionic.Zip.ZipEntry.AccessedTime"/>), and Modified
  4106. (<see cref="P:Ionic.Zip.ZipEntry.ModifiedTime"/>) times for the given entry are automatically
  4107. set from the filesystem values. When adding an entry from a stream or
  4108. string, all three values are implicitly set to DateTime.Now. Applications
  4109. can also explicitly set those times by calling <see cref="M:Ionic.Zip.ZipEntry.SetEntryTimes(System.DateTime,System.DateTime,System.DateTime)"/>.
  4110. </para>
  4111. <para>
  4112. <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE's
  4113. zip specification</see> describes multiple ways to format these times in a
  4114. zip file. One is the format Windows applications normally use: 100ns ticks
  4115. since Jan 1, 1601 UTC. The other is a format Unix applications typically
  4116. use: seconds since Jan 1, 1970 UTC. Each format can be stored in an
  4117. "extra field" in the zip entry when saving the zip archive. The former
  4118. uses an extra field with a Header Id of 0x000A, while the latter uses a
  4119. header ID of 0x5455.
  4120. </para>
  4121. <para>
  4122. Not all tools and libraries can interpret these fields. Windows
  4123. compressed folders is one that can read the Windows Format timestamps,
  4124. while I believe the <see href="http://www.info-zip.org/">Infozip</see>
  4125. tools can read the Unix format timestamps. Although the time values are
  4126. easily convertible, subject to a loss of precision, some tools and
  4127. libraries may be able to read only one or the other. DotNetZip can read or
  4128. write times in either or both formats.
  4129. </para>
  4130. <para>
  4131. The times stored are taken from <see cref="P:Ionic.Zip.ZipEntry.ModifiedTime"/>, <see cref="P:Ionic.Zip.ZipEntry.AccessedTime"/>, and <see cref="P:Ionic.Zip.ZipEntry.CreationTime"/>.
  4132. </para>
  4133. <para>
  4134. This property is not mutually exclusive from the <see cref="P:Ionic.Zip.ZipEntry.EmitTimesInWindowsFormatWhenSaving"/> property. It is
  4135. possible that a zip entry can embed the timestamps in both forms, one
  4136. form, or neither. But, there are no guarantees that a program running on
  4137. Mac or Linux will gracefully handle NTFS Formatted times, or that a
  4138. non-DotNetZip-powered application running on Windows will be able to
  4139. handle file times in Unix format. When in doubt, test.
  4140. </para>
  4141. <para>
  4142. Normally you will use the <see cref="P:Ionic.Zip.ZipFile.EmitTimesInUnixFormatWhenSaving">ZipFile.EmitTimesInUnixFormatWhenSaving</see>
  4143. property, to specify the behavior for all entries, rather than the
  4144. property on each individual entry.
  4145. </para>
  4146. </remarks>
  4147. <seealso cref="M:Ionic.Zip.ZipEntry.SetEntryTimes(System.DateTime,System.DateTime,System.DateTime)"/>
  4148. <seealso cref="P:Ionic.Zip.ZipEntry.EmitTimesInWindowsFormatWhenSaving"/>
  4149. <seealso cref="P:Ionic.Zip.ZipFile.EmitTimesInUnixFormatWhenSaving"/>
  4150. <seealso cref="P:Ionic.Zip.ZipEntry.CreationTime"/>
  4151. <seealso cref="P:Ionic.Zip.ZipEntry.AccessedTime"/>
  4152. <seealso cref="P:Ionic.Zip.ZipEntry.ModifiedTime"/>
  4153. </member>
  4154. <member name="P:Ionic.Zip.ZipEntry.Timestamp">
  4155. <summary>
  4156. The type of timestamp attached to the ZipEntry.
  4157. </summary>
  4158. <remarks>
  4159. This property is valid only for a ZipEntry that was read from a zip archive.
  4160. It indicates the type of timestamp attached to the entry.
  4161. </remarks>
  4162. <seealso cref="P:Ionic.Zip.ZipEntry.EmitTimesInWindowsFormatWhenSaving"/>
  4163. <seealso cref="P:Ionic.Zip.ZipEntry.EmitTimesInUnixFormatWhenSaving"/>
  4164. </member>
  4165. <member name="P:Ionic.Zip.ZipEntry.Attributes">
  4166. <summary>
  4167. The file attributes for the entry.
  4168. </summary>
  4169. <remarks>
  4170. <para>
  4171. The <see cref="T:System.IO.FileAttributes">attributes</see> in NTFS include
  4172. ReadOnly, Archive, Hidden, System, and Indexed. When adding a
  4173. <c>ZipEntry</c> to a ZipFile, these attributes are set implicitly when
  4174. adding an entry from the filesystem. When adding an entry from a stream
  4175. or string, the Attributes are not set implicitly. Regardless of the way
  4176. an entry was added to a <c>ZipFile</c>, you can set the attributes
  4177. explicitly if you like.
  4178. </para>
  4179. <para>
  4180. When reading a <c>ZipEntry</c> from a <c>ZipFile</c>, the attributes are
  4181. set according to the data stored in the <c>ZipFile</c>. If you extract the
  4182. entry from the archive to a filesystem file, DotNetZip will set the
  4183. attributes on the resulting file accordingly.
  4184. </para>
  4185. <para>
  4186. The attributes can be set explicitly by the application. For example the
  4187. application may wish to set the <c>FileAttributes.ReadOnly</c> bit for all
  4188. entries added to an archive, so that on unpack, this attribute will be set
  4189. on the extracted file. Any changes you make to this property are made
  4190. permanent only when you call a <c>Save()</c> method on the <c>ZipFile</c>
  4191. instance that contains the ZipEntry.
  4192. </para>
  4193. <para>
  4194. For example, an application may wish to zip up a directory and set the
  4195. ReadOnly bit on every file in the archive, so that upon later extraction,
  4196. the resulting files will be marked as ReadOnly. Not every extraction tool
  4197. respects these attributes, but if you unpack with DotNetZip, as for
  4198. example in a self-extracting archive, then the attributes will be set as
  4199. they are stored in the <c>ZipFile</c>.
  4200. </para>
  4201. <para>
  4202. These attributes may not be interesting or useful if the resulting archive
  4203. is extracted on a non-Windows platform. How these attributes get used
  4204. upon extraction depends on the platform and tool used.
  4205. </para>
  4206. <para>
  4207. This property is only partially supported in the Silverlight version
  4208. of the library: applications can read attributes on entries within
  4209. ZipFiles. But extracting entries within Silverlight will not set the
  4210. attributes on the extracted files.
  4211. </para>
  4212. </remarks>
  4213. </member>
  4214. <member name="P:Ionic.Zip.ZipEntry.LocalFileName">
  4215. <summary>
  4216. The name of the filesystem file, referred to by the ZipEntry.
  4217. </summary>
  4218. <remarks>
  4219. <para>
  4220. This property specifies the thing-to-be-zipped on disk, and is set only
  4221. when the <c>ZipEntry</c> is being created from a filesystem file. If the
  4222. <c>ZipFile</c> is instantiated by reading an existing .zip archive, then
  4223. the LocalFileName will be <c>null</c> (<c>Nothing</c> in VB).
  4224. </para>
  4225. <para>
  4226. When it is set, the value of this property may be different than <see cref="P:Ionic.Zip.ZipEntry.FileName"/>, which is the path used in the archive itself. If you
  4227. call <c>Zip.AddFile("foop.txt", AlternativeDirectory)</c>, then the path
  4228. used for the <c>ZipEntry</c> within the zip archive will be different
  4229. than this path.
  4230. </para>
  4231. <para>
  4232. If the entry is being added from a stream, then this is null (Nothing in VB).
  4233. </para>
  4234. </remarks>
  4235. <seealso cref="P:Ionic.Zip.ZipEntry.FileName"/>
  4236. </member>
  4237. <member name="P:Ionic.Zip.ZipEntry.FileName">
  4238. <summary>
  4239. The name of the file contained in the ZipEntry.
  4240. </summary>
  4241. <remarks>
  4242. <para>
  4243. This is the name of the entry in the <c>ZipFile</c> itself. When creating
  4244. a zip archive, if the <c>ZipEntry</c> has been created from a filesystem
  4245. file, via a call to <see cref="M:Ionic.Zip.ZipFile.AddFile(System.String,System.String)"/> or <see cref="M:Ionic.Zip.ZipFile.AddItem(System.String,System.String)"/>, or a related overload, the value
  4246. of this property is derived from the name of that file. The
  4247. <c>FileName</c> property does not include drive letters, and may include a
  4248. different directory path, depending on the value of the
  4249. <c>directoryPathInArchive</c> parameter used when adding the entry into
  4250. the <c>ZipFile</c>.
  4251. </para>
  4252. <para>
  4253. In some cases there is no related filesystem file - for example when a
  4254. <c>ZipEntry</c> is created using <see cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,System.String)"/> or one of the similar overloads. In this case, the value of
  4255. this property is derived from the fileName and the directory path passed
  4256. to that method.
  4257. </para>
  4258. <para>
  4259. When reading a zip file, this property takes the value of the entry name
  4260. as stored in the zip file. If you extract such an entry, the extracted
  4261. file will take the name given by this property.
  4262. </para>
  4263. <para>
  4264. Applications can set this property when creating new zip archives or when
  4265. reading existing archives. When setting this property, the actual value
  4266. that is set will replace backslashes with forward slashes, in accordance
  4267. with <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">the Zip
  4268. specification</see>, for compatibility with Unix(tm) and ... get
  4269. this.... Amiga!
  4270. </para>
  4271. <para>
  4272. If an application reads a <c>ZipFile</c> via <see cref="M:Ionic.Zip.ZipFile.Read(System.String)"/> or a related overload, and then explicitly
  4273. sets the FileName on an entry contained within the <c>ZipFile</c>, and
  4274. then calls <see cref="M:Ionic.Zip.ZipFile.Save"/>, the application will effectively
  4275. rename the entry within the zip archive.
  4276. </para>
  4277. <para>
  4278. If an application sets the value of <c>FileName</c>, then calls
  4279. <c>Extract()</c> on the entry, the entry is extracted to a file using the
  4280. newly set value as the filename. The <c>FileName</c> value is made
  4281. permanent in the zip archive only <em>after</em> a call to one of the
  4282. <c>ZipFile.Save()</c> methods on the <c>ZipFile</c> that contains the
  4283. ZipEntry.
  4284. </para>
  4285. <para>
  4286. If an application attempts to set the <c>FileName</c> to a value that
  4287. would result in a duplicate entry in the <c>ZipFile</c>, an exception is
  4288. thrown.
  4289. </para>
  4290. <para>
  4291. When a <c>ZipEntry</c> is contained within a <c>ZipFile</c>, applications
  4292. cannot rename the entry within the context of a <c>foreach</c> (<c>For
  4293. Each</c> in VB) loop, because of the way the <c>ZipFile</c> stores
  4294. entries. If you need to enumerate through all the entries and rename one
  4295. or more of them, use <see cref="P:Ionic.Zip.ZipFile.EntriesSorted">ZipFile.EntriesSorted</see> as the
  4296. collection. See also, <see cref="M:Ionic.Zip.ZipFile.GetEnumerator">ZipFile.GetEnumerator()</see>.
  4297. </para>
  4298. </remarks>
  4299. </member>
  4300. <member name="P:Ionic.Zip.ZipEntry.InputStream">
  4301. <summary>
  4302. The stream that provides content for the ZipEntry.
  4303. </summary>
  4304. <remarks>
  4305. <para>
  4306. The application can use this property to set the input stream for an
  4307. entry on a just-in-time basis. Imagine a scenario where the application
  4308. creates a <c>ZipFile</c> comprised of content obtained from hundreds of
  4309. files, via calls to <c>AddFile()</c>. The DotNetZip library opens streams
  4310. on these files on a just-in-time basis, only when writing the entry out to
  4311. an external store within the scope of a <c>ZipFile.Save()</c> call. Only
  4312. one input stream is opened at a time, as each entry is being written out.
  4313. </para>
  4314. <para>
  4315. Now imagine a different application that creates a <c>ZipFile</c>
  4316. with content obtained from hundreds of streams, added through <see cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,System.IO.Stream)"/>. Normally the
  4317. application would supply an open stream to that call. But when large
  4318. numbers of streams are being added, this can mean many open streams at one
  4319. time, unnecessarily.
  4320. </para>
  4321. <para>
  4322. To avoid this, call <see cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,Ionic.Zip.OpenDelegate,Ionic.Zip.CloseDelegate)"/> and specify delegates that open and close the stream at
  4323. the time of Save.
  4324. </para>
  4325. <para>
  4326. Setting the value of this property when the entry was not added from a
  4327. stream (for example, when the <c>ZipEntry</c> was added with <see cref="M:Ionic.Zip.ZipFile.AddFile(System.String)"/> or <see cref="M:Ionic.Zip.ZipFile.AddDirectory(System.String)"/>, or when the entry was added by
  4328. reading an existing zip archive) will throw an exception.
  4329. </para>
  4330. </remarks>
  4331. </member>
  4332. <member name="P:Ionic.Zip.ZipEntry.InputStreamWasJitProvided">
  4333. <summary>
  4334. A flag indicating whether the InputStream was provided Just-in-time.
  4335. </summary>
  4336. <remarks>
  4337. <para>
  4338. When creating a zip archive, an application can obtain content for one or
  4339. more of the <c>ZipEntry</c> instances from streams, using the <see cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,System.IO.Stream)"/> method. At the time
  4340. of calling that method, the application can supply null as the value of
  4341. the stream parameter. By doing so, the application indicates to the
  4342. library that it will provide a stream for the entry on a just-in-time
  4343. basis, at the time one of the <c>ZipFile.Save()</c> methods is called and
  4344. the data for the various entries are being compressed and written out.
  4345. </para>
  4346. <para>
  4347. In this case, the application can set the <see cref="P:Ionic.Zip.ZipEntry.InputStream"/>
  4348. property, typically within the SaveProgress event (event type: <see cref="F:Ionic.Zip.ZipProgressEventType.Saving_BeforeWriteEntry"/>) for that entry.
  4349. </para>
  4350. <para>
  4351. The application will later want to call Close() and Dispose() on that
  4352. stream. In the SaveProgress event, when the event type is <see cref="F:Ionic.Zip.ZipProgressEventType.Saving_AfterWriteEntry"/>, the application can
  4353. do so. This flag indicates that the stream has been provided by the
  4354. application on a just-in-time basis and that it is the application's
  4355. responsibility to call Close/Dispose on that stream.
  4356. </para>
  4357. </remarks>
  4358. <seealso cref="P:Ionic.Zip.ZipEntry.InputStream"/>
  4359. </member>
  4360. <member name="P:Ionic.Zip.ZipEntry.Source">
  4361. <summary>
  4362. An enum indicating the source of the ZipEntry.
  4363. </summary>
  4364. </member>
  4365. <member name="P:Ionic.Zip.ZipEntry.VersionNeeded">
  4366. <summary>
  4367. The version of the zip engine needed to read the ZipEntry.
  4368. </summary>
  4369. <remarks>
  4370. <para>
  4371. This is a readonly property, indicating the version of <a
  4372. href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">the Zip
  4373. specification</a> that the extracting tool or library must support to
  4374. extract the given entry. Generally higher versions indicate newer
  4375. features. Older zip engines obviously won't know about new features, and
  4376. won't be able to extract entries that depend on those newer features.
  4377. </para>
  4378. <list type="table">
  4379. <listheader>
  4380. <term>value</term>
  4381. <description>Features</description>
  4382. </listheader>
  4383. <item>
  4384. <term>20</term>
  4385. <description>a basic Zip Entry, potentially using PKZIP encryption.
  4386. </description>
  4387. </item>
  4388. <item>
  4389. <term>45</term>
  4390. <description>The ZIP64 extension is used on the entry.
  4391. </description>
  4392. </item>
  4393. <item>
  4394. <term>46</term>
  4395. <description> File is compressed using BZIP2 compression*</description>
  4396. </item>
  4397. <item>
  4398. <term>50</term>
  4399. <description> File is encrypted using PkWare's DES, 3DES, (broken) RC2 or RC4</description>
  4400. </item>
  4401. <item>
  4402. <term>51</term>
  4403. <description> File is encrypted using PKWare's AES encryption or corrected RC2 encryption.</description>
  4404. </item>
  4405. <item>
  4406. <term>52</term>
  4407. <description> File is encrypted using corrected RC2-64 encryption**</description>
  4408. </item>
  4409. <item>
  4410. <term>61</term>
  4411. <description> File is encrypted using non-OAEP key wrapping***</description>
  4412. </item>
  4413. <item>
  4414. <term>63</term>
  4415. <description> File is compressed using LZMA, PPMd+, Blowfish, or Twofish</description>
  4416. </item>
  4417. </list>
  4418. <para>
  4419. There are other values possible, not listed here. DotNetZip supports
  4420. regular PKZip encryption, and ZIP64 extensions. DotNetZip cannot extract
  4421. entries that require a zip engine higher than 45.
  4422. </para>
  4423. <para>
  4424. This value is set upon reading an existing zip file, or after saving a zip
  4425. archive.
  4426. </para>
  4427. </remarks>
  4428. </member>
  4429. <member name="P:Ionic.Zip.ZipEntry.Comment">
  4430. <summary>
  4431. The comment attached to the ZipEntry.
  4432. </summary>
  4433. <remarks>
  4434. <para>
  4435. Each entry in a zip file can optionally have a comment associated to
  4436. it. The comment might be displayed by a zip tool during extraction, for
  4437. example.
  4438. </para>
  4439. <para>
  4440. By default, the <c>Comment</c> is encoded in IBM437 code page. You can
  4441. specify an alternative with <see cref="P:Ionic.Zip.ZipEntry.AlternateEncoding"/> and
  4442. <see cref="P:Ionic.Zip.ZipEntry.AlternateEncodingUsage"/>.
  4443. </para>
  4444. </remarks>
  4445. <seealso cref="P:Ionic.Zip.ZipEntry.AlternateEncoding"/>
  4446. <seealso cref="P:Ionic.Zip.ZipEntry.AlternateEncodingUsage"/>
  4447. </member>
  4448. <member name="P:Ionic.Zip.ZipEntry.RequiresZip64">
  4449. <summary>
  4450. Indicates whether the entry requires ZIP64 extensions.
  4451. </summary>
  4452. <remarks>
  4453. <para>
  4454. This property is null (Nothing in VB) until a <c>Save()</c> method on the
  4455. containing <see cref="T:Ionic.Zip.ZipFile"/> instance has been called. The property is
  4456. non-null (<c>HasValue</c> is true) only after a <c>Save()</c> method has
  4457. been called.
  4458. </para>
  4459. <para>
  4460. After the containing <c>ZipFile</c> has been saved, the Value of this
  4461. property is true if any of the following three conditions holds: the
  4462. uncompressed size of the entry is larger than 0xFFFFFFFF; the compressed
  4463. size of the entry is larger than 0xFFFFFFFF; the relative offset of the
  4464. entry within the zip archive is larger than 0xFFFFFFFF. These quantities
  4465. are not known until a <c>Save()</c> is attempted on the zip archive and
  4466. the compression is applied.
  4467. </para>
  4468. <para>
  4469. If none of the three conditions holds, then the <c>Value</c> is false.
  4470. </para>
  4471. <para>
  4472. A <c>Value</c> of false does not indicate that the entry, as saved in the
  4473. zip archive, does not use ZIP64. It merely indicates that ZIP64 is
  4474. <em>not required</em>. An entry may use ZIP64 even when not required if
  4475. the <see cref="P:Ionic.Zip.ZipFile.UseZip64WhenSaving"/> property on the containing
  4476. <c>ZipFile</c> instance is set to <see cref="F:Ionic.Zip.Zip64Option.Always"/>, or if
  4477. the <see cref="P:Ionic.Zip.ZipFile.UseZip64WhenSaving"/> property on the containing
  4478. <c>ZipFile</c> instance is set to <see cref="F:Ionic.Zip.Zip64Option.AsNecessary"/>
  4479. and the output stream was not seekable.
  4480. </para>
  4481. </remarks>
  4482. <seealso cref="P:Ionic.Zip.ZipEntry.OutputUsedZip64"/>
  4483. </member>
  4484. <member name="P:Ionic.Zip.ZipEntry.OutputUsedZip64">
  4485. <summary>
  4486. Indicates whether the entry actually used ZIP64 extensions, as it was most
  4487. recently written to the output file or stream.
  4488. </summary>
  4489. <remarks>
  4490. <para>
  4491. This Nullable property is null (Nothing in VB) until a <c>Save()</c>
  4492. method on the containing <see cref="T:Ionic.Zip.ZipFile"/> instance has been
  4493. called. <c>HasValue</c> is true only after a <c>Save()</c> method has been
  4494. called.
  4495. </para>
  4496. <para>
  4497. The value of this property for a particular <c>ZipEntry</c> may change
  4498. over successive calls to <c>Save()</c> methods on the containing ZipFile,
  4499. even if the file that corresponds to the <c>ZipEntry</c> does not. This
  4500. may happen if other entries contained in the <c>ZipFile</c> expand,
  4501. causing the offset for this particular entry to exceed 0xFFFFFFFF.
  4502. </para>
  4503. </remarks>
  4504. <seealso cref="P:Ionic.Zip.ZipEntry.RequiresZip64"/>
  4505. </member>
  4506. <member name="P:Ionic.Zip.ZipEntry.BitField">
  4507. <summary>
  4508. The bitfield for the entry as defined in the zip spec. You probably
  4509. never need to look at this.
  4510. </summary>
  4511. <remarks>
  4512. <para>
  4513. You probably do not need to concern yourself with the contents of this
  4514. property, but in case you do:
  4515. </para>
  4516. <list type="table">
  4517. <listheader>
  4518. <term>bit</term>
  4519. <description>meaning</description>
  4520. </listheader>
  4521. <item>
  4522. <term>0</term>
  4523. <description>set if encryption is used.</description>
  4524. </item>
  4525. <item>
  4526. <term>1-2</term>
  4527. <description>
  4528. set to determine whether normal, max, fast deflation. DotNetZip library
  4529. always leaves these bits unset when writing (indicating "normal"
  4530. deflation"), but can read an entry with any value here.
  4531. </description>
  4532. </item>
  4533. <item>
  4534. <term>3</term>
  4535. <description>
  4536. Indicates that the Crc32, Compressed and Uncompressed sizes are zero in the
  4537. local header. This bit gets set on an entry during writing a zip file, when
  4538. it is saved to a non-seekable output stream.
  4539. </description>
  4540. </item>
  4541. <item>
  4542. <term>4</term>
  4543. <description>reserved for "enhanced deflating". This library doesn't do enhanced deflating.</description>
  4544. </item>
  4545. <item>
  4546. <term>5</term>
  4547. <description>set to indicate the zip is compressed patched data. This library doesn't do that.</description>
  4548. </item>
  4549. <item>
  4550. <term>6</term>
  4551. <description>
  4552. set if PKWare's strong encryption is used (must also set bit 1 if bit 6 is
  4553. set). This bit is not set if WinZip's AES encryption is set.</description>
  4554. </item>
  4555. <item>
  4556. <term>7</term>
  4557. <description>not used</description>
  4558. </item>
  4559. <item>
  4560. <term>8</term>
  4561. <description>not used</description>
  4562. </item>
  4563. <item>
  4564. <term>9</term>
  4565. <description>not used</description>
  4566. </item>
  4567. <item>
  4568. <term>10</term>
  4569. <description>not used</description>
  4570. </item>
  4571. <item>
  4572. <term>11</term>
  4573. <description>
  4574. Language encoding flag (EFS). If this bit is set, the filename and comment
  4575. fields for this file must be encoded using UTF-8. This library currently
  4576. does not support UTF-8.
  4577. </description>
  4578. </item>
  4579. <item>
  4580. <term>12</term>
  4581. <description>Reserved by PKWARE for enhanced compression.</description>
  4582. </item>
  4583. <item>
  4584. <term>13</term>
  4585. <description>
  4586. Used when encrypting the Central Directory to indicate selected data
  4587. values in the Local Header are masked to hide their actual values. See
  4588. the section in <a
  4589. href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">the Zip
  4590. specification</a> describing the Strong Encryption Specification for
  4591. details.
  4592. </description>
  4593. </item>
  4594. <item>
  4595. <term>14</term>
  4596. <description>Reserved by PKWARE.</description>
  4597. </item>
  4598. <item>
  4599. <term>15</term>
  4600. <description>Reserved by PKWARE.</description>
  4601. </item>
  4602. </list>
  4603. </remarks>
  4604. </member>
  4605. <member name="P:Ionic.Zip.ZipEntry.CompressionMethod">
  4606. <summary>
  4607. The compression method employed for this ZipEntry.
  4608. </summary>
  4609. <remarks>
  4610. <para>
  4611. <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">The
  4612. Zip specification</see> allows a variety of compression methods. This
  4613. library supports just two: 0x08 = Deflate. 0x00 = Store (no compression),
  4614. for reading or writing.
  4615. </para>
  4616. <para>
  4617. When reading an entry from an existing zipfile, the value you retrieve
  4618. here indicates the compression method used on the entry by the original
  4619. creator of the zip. When writing a zipfile, you can specify either 0x08
  4620. (Deflate) or 0x00 (None). If you try setting something else, you will get
  4621. an exception.
  4622. </para>
  4623. <para>
  4624. You may wish to set <c>CompressionMethod</c> to <c>CompressionMethod.None</c> (0)
  4625. when zipping already-compressed data like a jpg, png, or mp3 file.
  4626. This can save time and cpu cycles.
  4627. </para>
  4628. <para>
  4629. When setting this property on a <c>ZipEntry</c> that is read from an
  4630. existing zip file, calling <c>ZipFile.Save()</c> will cause the new
  4631. CompressionMethod to be used on the entry in the newly saved zip file.
  4632. </para>
  4633. <para>
  4634. Setting this property may have the side effect of modifying the
  4635. <c>CompressionLevel</c> property. If you set the <c>CompressionMethod</c> to a
  4636. value other than <c>None</c>, and <c>CompressionLevel</c> is previously
  4637. set to <c>None</c>, then <c>CompressionLevel</c> will be set to
  4638. <c>Default</c>.
  4639. </para>
  4640. </remarks>
  4641. <seealso cref="P:Ionic.Zip.ZipEntry.CompressionMethod"/>
  4642. <example>
  4643. In this example, the first entry added to the zip archive uses the default
  4644. behavior - compression is used where it makes sense. The second entry,
  4645. the MP3 file, is added to the archive without being compressed.
  4646. <code>
  4647. using (ZipFile zip = new ZipFile(ZipFileToCreate))
  4648. {
  4649. ZipEntry e1= zip.AddFile(@"notes\Readme.txt");
  4650. ZipEntry e2= zip.AddFile(@"music\StopThisTrain.mp3");
  4651. e2.CompressionMethod = CompressionMethod.None;
  4652. zip.Save();
  4653. }
  4654. </code>
  4655. <code lang="VB">
  4656. Using zip As New ZipFile(ZipFileToCreate)
  4657. zip.AddFile("notes\Readme.txt")
  4658. Dim e2 as ZipEntry = zip.AddFile("music\StopThisTrain.mp3")
  4659. e2.CompressionMethod = CompressionMethod.None
  4660. zip.Save
  4661. End Using
  4662. </code>
  4663. </example>
  4664. </member>
  4665. <member name="P:Ionic.Zip.ZipEntry.CompressionLevel">
  4666. <summary>
  4667. Sets the compression level to be used for the entry when saving the zip
  4668. archive. This applies only for CompressionMethod = DEFLATE.
  4669. </summary>
  4670. <remarks>
  4671. <para>
  4672. When using the DEFLATE compression method, Varying the compression
  4673. level used on entries can affect the size-vs-speed tradeoff when
  4674. compression and decompressing data streams or files.
  4675. </para>
  4676. <para>
  4677. If you do not set this property, the default compression level is used,
  4678. which normally gives a good balance of compression efficiency and
  4679. compression speed. In some tests, using <c>BestCompression</c> can
  4680. double the time it takes to compress, while delivering just a small
  4681. increase in compression efficiency. This behavior will vary with the
  4682. type of data you compress. If you are in doubt, just leave this setting
  4683. alone, and accept the default.
  4684. </para>
  4685. <para>
  4686. When setting this property on a <c>ZipEntry</c> that is read from an
  4687. existing zip file, calling <c>ZipFile.Save()</c> will cause the new
  4688. <c>CompressionLevel</c> to be used on the entry in the newly saved zip file.
  4689. </para>
  4690. <para>
  4691. Setting this property may have the side effect of modifying the
  4692. <c>CompressionMethod</c> property. If you set the <c>CompressionLevel</c>
  4693. to a value other than <c>None</c>, <c>CompressionMethod</c> will be set
  4694. to <c>Deflate</c>, if it was previously <c>None</c>.
  4695. </para>
  4696. <para>
  4697. Setting this property has no effect if the <c>CompressionMethod</c> is something
  4698. other than <c>Deflate</c> or <c>None</c>.
  4699. </para>
  4700. </remarks>
  4701. <seealso cref="P:Ionic.Zip.ZipEntry.CompressionMethod"/>
  4702. </member>
  4703. <member name="P:Ionic.Zip.ZipEntry.CompressedSize">
  4704. <summary>
  4705. The compressed size of the file, in bytes, within the zip archive.
  4706. </summary>
  4707. <remarks>
  4708. When reading a <c>ZipFile</c>, this value is read in from the existing
  4709. zip file. When creating or updating a <c>ZipFile</c>, the compressed
  4710. size is computed during compression. Therefore the value on a
  4711. <c>ZipEntry</c> is valid after a call to <c>Save()</c> (or one of its
  4712. overloads) in that case.
  4713. </remarks>
  4714. <seealso cref="P:Ionic.Zip.ZipEntry.UncompressedSize"/>
  4715. </member>
  4716. <member name="P:Ionic.Zip.ZipEntry.UncompressedSize">
  4717. <summary>
  4718. The size of the file, in bytes, before compression, or after extraction.
  4719. </summary>
  4720. <remarks>
  4721. When reading a <c>ZipFile</c>, this value is read in from the existing
  4722. zip file. When creating or updating a <c>ZipFile</c>, the uncompressed
  4723. size is computed during compression. Therefore the value on a
  4724. <c>ZipEntry</c> is valid after a call to <c>Save()</c> (or one of its
  4725. overloads) in that case.
  4726. </remarks>
  4727. <seealso cref="P:Ionic.Zip.ZipEntry.CompressedSize"/>
  4728. </member>
  4729. <member name="P:Ionic.Zip.ZipEntry.CompressionRatio">
  4730. <summary>
  4731. The ratio of compressed size to uncompressed size of the ZipEntry.
  4732. </summary>
  4733. <remarks>
  4734. <para>
  4735. This is a ratio of the compressed size to the uncompressed size of the
  4736. entry, expressed as a double in the range of 0 to 100+. A value of 100
  4737. indicates no compression at all. It could be higher than 100 when the
  4738. compression algorithm actually inflates the data, as may occur for small
  4739. files, or uncompressible data that is encrypted.
  4740. </para>
  4741. <para>
  4742. You could format it for presentation to a user via a format string of
  4743. "{3,5:F0}%" to see it as a percentage.
  4744. </para>
  4745. <para>
  4746. If the size of the original uncompressed file is 0, implying a
  4747. denominator of 0, the return value will be zero.
  4748. </para>
  4749. <para>
  4750. This property is valid after reading in an existing zip file, or after
  4751. saving the <c>ZipFile</c> that contains the ZipEntry. You cannot know the
  4752. effect of a compression transform until you try it.
  4753. </para>
  4754. </remarks>
  4755. </member>
  4756. <member name="P:Ionic.Zip.ZipEntry.Crc">
  4757. <summary>
  4758. The 32-bit CRC (Cyclic Redundancy Check) on the contents of the ZipEntry.
  4759. </summary>
  4760. <remarks>
  4761. <para> You probably don't need to concern yourself with this. It is used
  4762. internally by DotNetZip to verify files or streams upon extraction. </para>
  4763. <para> The value is a <see href="http://en.wikipedia.org/wiki/CRC32">32-bit
  4764. CRC</see> using 0xEDB88320 for the polynomial. This is the same CRC-32 used in
  4765. PNG, MPEG-2, and other protocols and formats. It is a read-only property; when
  4766. creating a Zip archive, the CRC for each entry is set only after a call to
  4767. <c>Save()</c> on the containing ZipFile. When reading an existing zip file, the value
  4768. of this property reflects the stored CRC for the entry. </para>
  4769. </remarks>
  4770. </member>
  4771. <member name="P:Ionic.Zip.ZipEntry.IsDirectory">
  4772. <summary>
  4773. True if the entry is a directory (not a file).
  4774. This is a readonly property on the entry.
  4775. </summary>
  4776. </member>
  4777. <member name="P:Ionic.Zip.ZipEntry.UsesEncryption">
  4778. <summary>
  4779. A derived property that is <c>true</c> if the entry uses encryption.
  4780. </summary>
  4781. <remarks>
  4782. <para>
  4783. This is a readonly property on the entry. When reading a zip file,
  4784. the value for the <c>ZipEntry</c> is determined by the data read
  4785. from the zip file. After saving a ZipFile, the value of this
  4786. property for each <c>ZipEntry</c> indicates whether encryption was
  4787. actually used (which will have been true if the <see cref="P:Ionic.Zip.ZipEntry.Password"/> was set and the <see cref="P:Ionic.Zip.ZipEntry.Encryption"/> property
  4788. was something other than <see cref="F:Ionic.Zip.EncryptionAlgorithm.None"/>.
  4789. </para>
  4790. </remarks>
  4791. </member>
  4792. <member name="P:Ionic.Zip.ZipEntry.Encryption">
  4793. <summary>
  4794. Set this to specify which encryption algorithm to use for the entry when
  4795. saving it to a zip archive.
  4796. </summary>
  4797. <remarks>
  4798. <para>
  4799. Set this property in order to encrypt the entry when the <c>ZipFile</c> is
  4800. saved. When setting this property, you must also set a <see cref="P:Ionic.Zip.ZipEntry.Password"/> on the entry. If you set a value other than <see cref="F:Ionic.Zip.EncryptionAlgorithm.None"/> on this property and do not set a
  4801. <c>Password</c> then the entry will not be encrypted. The <c>ZipEntry</c>
  4802. data is encrypted as the <c>ZipFile</c> is saved, when you call <see cref="M:Ionic.Zip.ZipFile.Save"/> or one of its cousins on the containing
  4803. <c>ZipFile</c> instance. You do not need to specify the <c>Encryption</c>
  4804. when extracting entries from an archive.
  4805. </para>
  4806. <para>
  4807. The Zip specification from PKWare defines a set of encryption algorithms,
  4808. and the data formats for the zip archive that support them, and PKWare
  4809. supports those algorithms in the tools it produces. Other vendors of tools
  4810. and libraries, such as WinZip or Xceed, typically support <em>a
  4811. subset</em> of the algorithms specified by PKWare. These tools can
  4812. sometimes support additional different encryption algorithms and data
  4813. formats, not specified by PKWare. The AES Encryption specified and
  4814. supported by WinZip is the most popular example. This library supports a
  4815. subset of the complete set of algorithms specified by PKWare and other
  4816. vendors.
  4817. </para>
  4818. <para>
  4819. There is no common, ubiquitous multi-vendor standard for strong encryption
  4820. within zip files. There is broad support for so-called "traditional" Zip
  4821. encryption, sometimes called Zip 2.0 encryption, as <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">specified
  4822. by PKWare</see>, but this encryption is considered weak and
  4823. breakable. This library currently supports the Zip 2.0 "weak" encryption,
  4824. and also a stronger WinZip-compatible AES encryption, using either 128-bit
  4825. or 256-bit key strength. If you want DotNetZip to support an algorithm
  4826. that is not currently supported, call the author of this library and maybe
  4827. we can talk business.
  4828. </para>
  4829. <para>
  4830. The <see cref="T:Ionic.Zip.ZipFile"/> class also has a <see cref="P:Ionic.Zip.ZipFile.Encryption"/> property. In most cases you will use
  4831. <em>that</em> property when setting encryption. This property takes
  4832. precedence over any <c>Encryption</c> set on the <c>ZipFile</c> itself.
  4833. Typically, you would use the per-entry Encryption when most entries in the
  4834. zip archive use one encryption algorithm, and a few entries use a
  4835. different one. If all entries in the zip file use the same Encryption,
  4836. then it is simpler to just set this property on the ZipFile itself, when
  4837. creating a zip archive.
  4838. </para>
  4839. <para>
  4840. Some comments on updating archives: If you read a <c>ZipFile</c>, you can
  4841. modify the Encryption on an encrypted entry: you can remove encryption
  4842. from an entry that was encrypted; you can encrypt an entry that was not
  4843. encrypted previously; or, you can change the encryption algorithm. The
  4844. changes in encryption are not made permanent until you call Save() on the
  4845. <c>ZipFile</c>. To effect changes in encryption, the entry content is
  4846. streamed through several transformations, depending on the modification
  4847. the application has requested. For example if the entry is not encrypted
  4848. and the application sets <c>Encryption</c> to <c>PkzipWeak</c>, then at
  4849. the time of <c>Save()</c>, the original entry is read and decompressed,
  4850. then re-compressed and encrypted. Conversely, if the original entry is
  4851. encrypted with <c>PkzipWeak</c> encryption, and the application sets the
  4852. <c>Encryption</c> property to <c>WinZipAes128</c>, then at the time of
  4853. <c>Save()</c>, the original entry is decrypted via PKZIP encryption and
  4854. decompressed, then re-compressed and re-encrypted with AES. This all
  4855. happens automatically within the library, but it can be time-consuming for
  4856. large entries.
  4857. </para>
  4858. <para>
  4859. Additionally, when updating archives, it is not possible to change the
  4860. password when changing the encryption algorithm. To change both the
  4861. algorithm and the password, you need to Save() the zipfile twice. First
  4862. set the <c>Encryption</c> to None, then call <c>Save()</c>. Then set the
  4863. <c>Encryption</c> to the new value (not "None"), then call <c>Save()</c>
  4864. once again.
  4865. </para>
  4866. <para>
  4867. The WinZip AES encryption algorithms are not supported on the .NET Compact
  4868. Framework.
  4869. </para>
  4870. </remarks>
  4871. <example>
  4872. <para>
  4873. This example creates a zip archive that uses encryption, and then extracts
  4874. entries from the archive. When creating the zip archive, the ReadMe.txt
  4875. file is zipped without using a password or encryption. The other file
  4876. uses encryption.
  4877. </para>
  4878. <code>
  4879. // Create a zip archive with AES Encryption.
  4880. using (ZipFile zip = new ZipFile())
  4881. {
  4882. zip.AddFile("ReadMe.txt")
  4883. ZipEntry e1= zip.AddFile("2008-Regional-Sales-Report.pdf");
  4884. e1.Encryption= EncryptionAlgorithm.WinZipAes256;
  4885. e1.Password= "Top.Secret.No.Peeking!";
  4886. zip.Save("EncryptedArchive.zip");
  4887. }
  4888. // Extract a zip archive that uses AES Encryption.
  4889. // You do not need to specify the algorithm during extraction.
  4890. using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip"))
  4891. {
  4892. // Specify the password that is used during extraction, for
  4893. // all entries that require a password:
  4894. zip.Password= "Top.Secret.No.Peeking!";
  4895. zip.ExtractAll("extractDirectory");
  4896. }
  4897. </code>
  4898. <code lang="VB">
  4899. ' Create a zip that uses Encryption.
  4900. Using zip As New ZipFile()
  4901. zip.AddFile("ReadMe.txt")
  4902. Dim e1 as ZipEntry
  4903. e1= zip.AddFile("2008-Regional-Sales-Report.pdf")
  4904. e1.Encryption= EncryptionAlgorithm.WinZipAes256
  4905. e1.Password= "Top.Secret.No.Peeking!"
  4906. zip.Save("EncryptedArchive.zip")
  4907. End Using
  4908. ' Extract a zip archive that uses AES Encryption.
  4909. ' You do not need to specify the algorithm during extraction.
  4910. Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip"))
  4911. ' Specify the password that is used during extraction, for
  4912. ' all entries that require a password:
  4913. zip.Password= "Top.Secret.No.Peeking!"
  4914. zip.ExtractAll("extractDirectory")
  4915. End Using
  4916. </code>
  4917. </example>
  4918. <exception cref="T:System.InvalidOperationException">
  4919. Thrown in the setter if EncryptionAlgorithm.Unsupported is specified.
  4920. </exception>
  4921. <seealso cref="P:Ionic.Zip.ZipEntry.Password">ZipEntry.Password</seealso>
  4922. <seealso cref="P:Ionic.Zip.ZipFile.Encryption">ZipFile.Encryption</seealso>
  4923. </member>
  4924. <member name="P:Ionic.Zip.ZipEntry.Password">
  4925. <summary>
  4926. The Password to be used when encrypting a <c>ZipEntry</c> upon
  4927. <c>ZipFile.Save()</c>, or when decrypting an entry upon Extract().
  4928. </summary>
  4929. <remarks>
  4930. <para>
  4931. This is a write-only property on the entry. Set this to request that the
  4932. entry be encrypted when writing the zip archive, or set it to specify the
  4933. password to be used when extracting an existing entry that is encrypted.
  4934. </para>
  4935. <para>
  4936. The password set here is implicitly used to encrypt the entry during the
  4937. <see cref="M:Ionic.Zip.ZipFile.Save"/> operation, or to decrypt during the <see cref="M:Ionic.Zip.ZipEntry.Extract"/> or <see cref="M:Ionic.Zip.ZipEntry.OpenReader"/> operation. If you set
  4938. the Password on a <c>ZipEntry</c> after calling <c>Save()</c>, there is no
  4939. effect.
  4940. </para>
  4941. <para>
  4942. Consider setting the <see cref="P:Ionic.Zip.ZipEntry.Encryption"/> property when using a
  4943. password. Answering concerns that the standard password protection
  4944. supported by all zip tools is weak, WinZip has extended the ZIP
  4945. specification with a way to use AES Encryption to protect entries in the
  4946. Zip file. Unlike the "PKZIP 2.0" encryption specified in the PKZIP
  4947. specification, <see href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard">AES
  4948. Encryption</see> uses a standard, strong, tested, encryption
  4949. algorithm. DotNetZip can create zip archives that use WinZip-compatible
  4950. AES encryption, if you set the <see cref="P:Ionic.Zip.ZipEntry.Encryption"/> property. But,
  4951. archives created that use AES encryption may not be readable by all other
  4952. tools and libraries. For example, Windows Explorer cannot read a
  4953. "compressed folder" (a zip file) that uses AES encryption, though it can
  4954. read a zip file that uses "PKZIP encryption."
  4955. </para>
  4956. <para>
  4957. The <see cref="T:Ionic.Zip.ZipFile"/> class also has a <see cref="P:Ionic.Zip.ZipFile.Password"/>
  4958. property. This property takes precedence over any password set on the
  4959. ZipFile itself. Typically, you would use the per-entry Password when most
  4960. entries in the zip archive use one password, and a few entries use a
  4961. different password. If all entries in the zip file use the same password,
  4962. then it is simpler to just set this property on the ZipFile itself,
  4963. whether creating a zip archive or extracting a zip archive.
  4964. </para>
  4965. <para>
  4966. Some comments on updating archives: If you read a <c>ZipFile</c>, you
  4967. cannot modify the password on any encrypted entry, except by extracting
  4968. the entry with the original password (if any), removing the original entry
  4969. via <see cref="M:Ionic.Zip.ZipFile.RemoveEntry(Ionic.Zip.ZipEntry)"/>, and then adding a new
  4970. entry with a new Password.
  4971. </para>
  4972. <para>
  4973. For example, suppose you read a <c>ZipFile</c>, and there is an encrypted
  4974. entry. Setting the Password property on that <c>ZipEntry</c> and then
  4975. calling <c>Save()</c> on the <c>ZipFile</c> does not update the password
  4976. on that entry in the archive. Neither is an exception thrown. Instead,
  4977. what happens during the <c>Save()</c> is the existing entry is copied
  4978. through to the new zip archive, in its original encrypted form. Upon
  4979. re-reading that archive, the entry can be decrypted with its original
  4980. password.
  4981. </para>
  4982. <para>
  4983. If you read a ZipFile, and there is an un-encrypted entry, you can set the
  4984. <c>Password</c> on the entry and then call Save() on the ZipFile, and get
  4985. encryption on that entry.
  4986. </para>
  4987. </remarks>
  4988. <example>
  4989. <para>
  4990. This example creates a zip file with two entries, and then extracts the
  4991. entries from the zip file. When creating the zip file, the two files are
  4992. added to the zip file using password protection. Each entry uses a
  4993. different password. During extraction, each file is extracted with the
  4994. appropriate password.
  4995. </para>
  4996. <code>
  4997. // create a file with encryption
  4998. using (ZipFile zip = new ZipFile())
  4999. {
  5000. ZipEntry entry;
  5001. entry= zip.AddFile("Declaration.txt");
  5002. entry.Password= "123456!";
  5003. entry = zip.AddFile("Report.xls");
  5004. entry.Password= "1Secret!";
  5005. zip.Save("EncryptedArchive.zip");
  5006. }
  5007. // extract entries that use encryption
  5008. using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip"))
  5009. {
  5010. ZipEntry entry;
  5011. entry = zip["Declaration.txt"];
  5012. entry.Password = "123456!";
  5013. entry.Extract("extractDir");
  5014. entry = zip["Report.xls"];
  5015. entry.Password = "1Secret!";
  5016. entry.Extract("extractDir");
  5017. }
  5018. </code>
  5019. <code lang="VB">
  5020. Using zip As New ZipFile
  5021. Dim entry as ZipEntry
  5022. entry= zip.AddFile("Declaration.txt")
  5023. entry.Password= "123456!"
  5024. entry = zip.AddFile("Report.xls")
  5025. entry.Password= "1Secret!"
  5026. zip.Save("EncryptedArchive.zip")
  5027. End Using
  5028. ' extract entries that use encryption
  5029. Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip"))
  5030. Dim entry as ZipEntry
  5031. entry = zip("Declaration.txt")
  5032. entry.Password = "123456!"
  5033. entry.Extract("extractDir")
  5034. entry = zip("Report.xls")
  5035. entry.Password = "1Secret!"
  5036. entry.Extract("extractDir")
  5037. End Using
  5038. </code>
  5039. </example>
  5040. <seealso cref="P:Ionic.Zip.ZipEntry.Encryption"/>
  5041. <seealso cref="P:Ionic.Zip.ZipFile.Password">ZipFile.Password</seealso>
  5042. </member>
  5043. <member name="P:Ionic.Zip.ZipEntry.ExtractExistingFile">
  5044. <summary>
  5045. The action the library should take when extracting a file that already exists.
  5046. </summary>
  5047. <remarks>
  5048. <para>
  5049. This property affects the behavior of the Extract methods (one of the
  5050. <c>Extract()</c> or <c>ExtractWithPassword()</c> overloads), when
  5051. extraction would would overwrite an existing filesystem file. If you do
  5052. not set this property, the library throws an exception when extracting
  5053. an entry would overwrite an existing file.
  5054. </para>
  5055. <para>
  5056. This property has no effect when extracting to a stream, or when the file to be
  5057. extracted does not already exist.
  5058. </para>
  5059. </remarks>
  5060. <seealso cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>
  5061. <example>
  5062. This example shows how to set the <c>ExtractExistingFile</c> property in
  5063. an <c>ExtractProgress</c> event, in response to user input. The
  5064. <c>ExtractProgress</c> event is invoked if and only if the
  5065. <c>ExtractExistingFile</c> property was previously set to
  5066. <c>ExtractExistingFileAction.InvokeExtractProgressEvent</c>.
  5067. <code lang="C#">
  5068. public static void ExtractProgress(object sender, ExtractProgressEventArgs e)
  5069. {
  5070. if (e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry)
  5071. Console.WriteLine("extract {0} ", e.CurrentEntry.FileName);
  5072. else if (e.EventType == ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite)
  5073. {
  5074. ZipEntry entry = e.CurrentEntry;
  5075. string response = null;
  5076. // Ask the user if he wants overwrite the file
  5077. do
  5078. {
  5079. Console.Write("Overwrite {0} in {1} ? (y/n/C) ", entry.FileName, e.ExtractLocation);
  5080. response = Console.ReadLine();
  5081. Console.WriteLine();
  5082. } while (response != null &amp;&amp; response[0]!='Y' &amp;&amp;
  5083. response[0]!='N' &amp;&amp; response[0]!='C');
  5084. if (response[0]=='C')
  5085. e.Cancel = true;
  5086. else if (response[0]=='Y')
  5087. entry.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
  5088. else
  5089. entry.ExtractExistingFile= ExtractExistingFileAction.DoNotOverwrite;
  5090. }
  5091. }
  5092. </code>
  5093. </example>
  5094. </member>
  5095. <member name="P:Ionic.Zip.ZipEntry.ZipErrorAction">
  5096. <summary>
  5097. The action to take when an error is encountered while
  5098. opening or reading files as they are saved into a zip archive.
  5099. </summary>
  5100. <remarks>
  5101. <para>
  5102. Errors can occur within a call to <see cref="M:Ionic.Zip.ZipFile.Save">ZipFile.Save</see>, as the various files contained
  5103. in a ZipFile are being saved into the zip archive. During the
  5104. <c>Save</c>, DotNetZip will perform a <c>File.Open</c> on the file
  5105. associated to the ZipEntry, and then will read the entire contents of
  5106. the file as it is zipped. Either the open or the Read may fail, because
  5107. of lock conflicts or other reasons. Using this property, you can
  5108. specify the action to take when such errors occur.
  5109. </para>
  5110. <para>
  5111. Typically you will NOT set this property on individual ZipEntry
  5112. instances. Instead, you will set the <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction">ZipFile.ZipErrorAction</see> property on
  5113. the ZipFile instance, before adding any entries to the
  5114. <c>ZipFile</c>. If you do this, errors encountered on behalf of any of
  5115. the entries in the ZipFile will be handled the same way.
  5116. </para>
  5117. <para>
  5118. But, if you use a <see cref="E:Ionic.Zip.ZipFile.ZipError"/> handler, you will want
  5119. to set this property on the <c>ZipEntry</c> within the handler, to
  5120. communicate back to DotNetZip what you would like to do with the
  5121. particular error.
  5122. </para>
  5123. </remarks>
  5124. <seealso cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>
  5125. <seealso cref="E:Ionic.Zip.ZipFile.ZipError"/>
  5126. </member>
  5127. <member name="P:Ionic.Zip.ZipEntry.IncludedInMostRecentSave">
  5128. <summary>
  5129. Indicates whether the entry was included in the most recent save.
  5130. </summary>
  5131. <remarks>
  5132. An entry can be excluded or skipped from a save if there is an error
  5133. opening or reading the entry.
  5134. </remarks>
  5135. <seealso cref="P:Ionic.Zip.ZipEntry.ZipErrorAction"/>
  5136. </member>
  5137. <member name="P:Ionic.Zip.ZipEntry.SetCompression">
  5138. <summary>
  5139. A callback that allows the application to specify the compression to use
  5140. for a given entry that is about to be added to the zip archive.
  5141. </summary>
  5142. <remarks>
  5143. <para>
  5144. See <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>
  5145. </para>
  5146. </remarks>
  5147. </member>
  5148. <member name="P:Ionic.Zip.ZipEntry.UseUnicodeAsNecessary">
  5149. <summary>
  5150. Set to indicate whether to use UTF-8 encoding for filenames and comments.
  5151. </summary>
  5152. <remarks>
  5153. <para>
  5154. If this flag is set, the comment and filename for the entry will be
  5155. encoded with UTF-8, as described in <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">the Zip
  5156. specification</see>, if necessary. "Necessary" means, the filename or
  5157. entry comment (if any) cannot be reflexively encoded and decoded using the
  5158. default code page, IBM437.
  5159. </para>
  5160. <para>
  5161. Setting this flag to true is equivalent to setting <see cref="P:Ionic.Zip.ZipEntry.ProvisionalAlternateEncoding"/> to <c>System.Text.Encoding.UTF8</c>.
  5162. </para>
  5163. <para>
  5164. This flag has no effect or relation to the text encoding used within the
  5165. file itself.
  5166. </para>
  5167. </remarks>
  5168. </member>
  5169. <member name="P:Ionic.Zip.ZipEntry.ProvisionalAlternateEncoding">
  5170. <summary>
  5171. The text encoding to use for the FileName and Comment on this ZipEntry,
  5172. when the default encoding is insufficient.
  5173. </summary>
  5174. <remarks>
  5175. <para>
  5176. Don't use this property. See <see cref="P:Ionic.Zip.ZipEntry.AlternateEncoding"/>.
  5177. </para>
  5178. </remarks>
  5179. </member>
  5180. <member name="P:Ionic.Zip.ZipEntry.AlternateEncoding">
  5181. <summary>
  5182. Specifies the alternate text encoding used by this ZipEntry
  5183. </summary>
  5184. <remarks>
  5185. <para>
  5186. The default text encoding used in Zip files for encoding filenames and
  5187. comments is IBM437, which is something like a superset of ASCII. In
  5188. cases where this is insufficient, applications can specify an
  5189. alternate encoding.
  5190. </para>
  5191. <para>
  5192. When creating a zip file, the usage of the alternate encoding is
  5193. governed by the <see cref="P:Ionic.Zip.ZipEntry.AlternateEncodingUsage"/> property.
  5194. Typically you would set both properties to tell DotNetZip to employ an
  5195. encoding that is not IBM437 in the zipfile you are creating.
  5196. </para>
  5197. <para>
  5198. Keep in mind that because the ZIP specification states that the only
  5199. valid encodings to use are IBM437 and UTF-8, if you use something
  5200. other than that, then zip tools and libraries may not be able to
  5201. successfully read the zip archive you generate.
  5202. </para>
  5203. <para>
  5204. The zip specification states that applications should presume that
  5205. IBM437 is in use, except when a special bit is set, which indicates
  5206. UTF-8. There is no way to specify an arbitrary code page, within the
  5207. zip file itself. When you create a zip file encoded with gb2312 or
  5208. ibm861 or anything other than IBM437 or UTF-8, then the application
  5209. that reads the zip file needs to "know" which code page to use. In
  5210. some cases, the code page used when reading is chosen implicitly. For
  5211. example, WinRar uses the ambient code page for the host desktop
  5212. operating system. The pitfall here is that if you create a zip in
  5213. Copenhagen and send it to Tokyo, the reader of the zipfile may not be
  5214. able to decode successfully.
  5215. </para>
  5216. </remarks>
  5217. <example>
  5218. This example shows how to create a zipfile encoded with a
  5219. language-specific encoding:
  5220. <code>
  5221. using (var zip = new ZipFile())
  5222. {
  5223. zip.AlternateEnoding = System.Text.Encoding.GetEncoding("ibm861");
  5224. zip.AlternateEnodingUsage = ZipOption.Always;
  5225. zip.AddFileS(arrayOfFiles);
  5226. zip.Save("Myarchive-Encoded-in-IBM861.zip");
  5227. }
  5228. </code>
  5229. </example>
  5230. <seealso cref="P:Ionic.Zip.ZipFile.AlternateEncodingUsage"/>
  5231. </member>
  5232. <member name="P:Ionic.Zip.ZipEntry.AlternateEncodingUsage">
  5233. <summary>
  5234. Describes if and when this instance should apply
  5235. AlternateEncoding to encode the FileName and Comment, when
  5236. saving.
  5237. </summary>
  5238. <seealso cref="P:Ionic.Zip.ZipFile.AlternateEncoding"/>
  5239. </member>
  5240. <member name="P:Ionic.Zip.ZipEntry.IsText">
  5241. <summary>
  5242. Indicates whether an entry is marked as a text file. Be careful when
  5243. using on this property. Unless you have a good reason, you should
  5244. probably ignore this property.
  5245. </summary>
  5246. <remarks>
  5247. <para>
  5248. The ZIP format includes a provision for specifying whether an entry in
  5249. the zip archive is a text or binary file. This property exposes that
  5250. metadata item. Be careful when using this property: It's not clear
  5251. that this property as a firm meaning, across tools and libraries.
  5252. </para>
  5253. <para>
  5254. To be clear, when reading a zip file, the property value may or may
  5255. not be set, and its value may or may not be valid. Not all entries
  5256. that you may think of as "text" entries will be so marked, and entries
  5257. marked as "text" are not guaranteed in any way to be text entries.
  5258. Whether the value is set and set correctly depends entirely on the
  5259. application that produced the zip file.
  5260. </para>
  5261. <para>
  5262. There are many zip tools available, and when creating zip files, some
  5263. of them "respect" the IsText metadata field, and some of them do not.
  5264. Unfortunately, even when an application tries to do "the right thing",
  5265. it's not always clear what "the right thing" is.
  5266. </para>
  5267. <para>
  5268. There's no firm definition of just what it means to be "a text file",
  5269. and the zip specification does not help in this regard. Twenty years
  5270. ago, text was ASCII, each byte was less than 127. IsText meant, all
  5271. bytes in the file were less than 127. These days, it is not the case
  5272. that all text files have all bytes less than 127. Any unicode file
  5273. may have bytes that are above 0x7f. The zip specification has nothing
  5274. to say on this topic. Therefore, it's not clear what IsText really
  5275. means.
  5276. </para>
  5277. <para>
  5278. This property merely tells a reading application what is stored in the
  5279. metadata for an entry, without guaranteeing its validity or its
  5280. meaning.
  5281. </para>
  5282. <para>
  5283. When DotNetZip is used to create a zipfile, it attempts to set this
  5284. field "correctly." For example, if a file ends in ".txt", this field
  5285. will be set. Your application may override that default setting. When
  5286. writing a zip file, you must set the property before calling
  5287. <c>Save()</c> on the ZipFile.
  5288. </para>
  5289. <para>
  5290. When reading a zip file, a more general way to decide just what kind
  5291. of file is contained in a particular entry is to use the file type
  5292. database stored in the operating system. The operating system stores
  5293. a table that says, a file with .jpg extension is a JPG image file, a
  5294. file with a .xml extension is an XML document, a file with a .txt is a
  5295. pure ASCII text document, and so on. To get this information on
  5296. Windows, <see
  5297. href="http://www.codeproject.com/KB/cs/GetFileTypeAndIcon.aspx"> you
  5298. need to read and parse the registry.</see> </para>
  5299. </remarks>
  5300. <example>
  5301. <code>
  5302. using (var zip = new ZipFile())
  5303. {
  5304. var e = zip.UpdateFile("Descriptions.mme", "");
  5305. e.IsText = true;
  5306. zip.Save(zipPath);
  5307. }
  5308. </code>
  5309. <code lang="VB">
  5310. Using zip As New ZipFile
  5311. Dim e2 as ZipEntry = zip.AddFile("Descriptions.mme", "")
  5312. e.IsText= True
  5313. zip.Save(zipPath)
  5314. End Using
  5315. </code>
  5316. </example>
  5317. </member>
  5318. <member name="T:Ionic.Zip.ZipEntryTimestamp">
  5319. <summary>
  5320. An enum that specifies the type of timestamp available on the ZipEntry.
  5321. </summary>
  5322. <remarks>
  5323. <para>
  5324. The last modified time of a file can be stored in multiple ways in
  5325. a zip file, and they are not mutually exclusive:
  5326. </para>
  5327. <list type="bullet">
  5328. <item>
  5329. In the so-called "DOS" format, which has a 2-second precision. Values
  5330. are rounded to the nearest even second. For example, if the time on the
  5331. file is 12:34:43, then it will be stored as 12:34:44. This first value
  5332. is accessible via the <c>LastModified</c> property. This value is always
  5333. present in the metadata for each zip entry. In some cases the value is
  5334. invalid, or zero.
  5335. </item>
  5336. <item>
  5337. In the so-called "Windows" or "NTFS" format, as an 8-byte integer
  5338. quantity expressed as the number of 1/10 milliseconds (in other words
  5339. the number of 100 nanosecond units) since January 1, 1601 (UTC). This
  5340. format is how Windows represents file times. This time is accessible
  5341. via the <c>ModifiedTime</c> property.
  5342. </item>
  5343. <item>
  5344. In the "Unix" format, a 4-byte quantity specifying the number of seconds since
  5345. January 1, 1970 UTC.
  5346. </item>
  5347. <item>
  5348. In an older format, now deprecated but still used by some current
  5349. tools. This format is also a 4-byte quantity specifying the number of
  5350. seconds since January 1, 1970 UTC.
  5351. </item>
  5352. </list>
  5353. <para>
  5354. This bit field describes which of the formats were found in a <c>ZipEntry</c> that was read.
  5355. </para>
  5356. </remarks>
  5357. </member>
  5358. <member name="F:Ionic.Zip.ZipEntryTimestamp.None">
  5359. <summary>
  5360. Default value.
  5361. </summary>
  5362. </member>
  5363. <member name="F:Ionic.Zip.ZipEntryTimestamp.DOS">
  5364. <summary>
  5365. A DOS timestamp with 2-second precision.
  5366. </summary>
  5367. </member>
  5368. <member name="F:Ionic.Zip.ZipEntryTimestamp.Windows">
  5369. <summary>
  5370. A Windows timestamp with 100-ns precision.
  5371. </summary>
  5372. </member>
  5373. <member name="F:Ionic.Zip.ZipEntryTimestamp.Unix">
  5374. <summary>
  5375. A Unix timestamp with 1-second precision.
  5376. </summary>
  5377. </member>
  5378. <member name="F:Ionic.Zip.ZipEntryTimestamp.InfoZip1">
  5379. <summary>
  5380. A Unix timestamp with 1-second precision, stored in InfoZip v1 format. This
  5381. format is outdated and is supported for reading archives only.
  5382. </summary>
  5383. </member>
  5384. <member name="T:Ionic.Zip.CompressionMethod">
  5385. <summary>
  5386. The method of compression to use for a particular ZipEntry.
  5387. </summary>
  5388. <remarks>
  5389. <see
  5390. href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWare's
  5391. ZIP Specification</see> describes a number of distinct
  5392. cmopression methods that can be used within a zip
  5393. file. DotNetZip supports a subset of them.
  5394. </remarks>
  5395. </member>
  5396. <member name="F:Ionic.Zip.CompressionMethod.None">
  5397. <summary>
  5398. No compression at all. For COM environments, the value is 0 (zero).
  5399. </summary>
  5400. </member>
  5401. <member name="F:Ionic.Zip.CompressionMethod.Deflate">
  5402. <summary>
  5403. DEFLATE compression, as described in <see
  5404. href="http://www.ietf.org/rfc/rfc1951.txt">IETF RFC
  5405. 1951</see>. This is the "normal" compression used in zip
  5406. files. For COM environments, the value is 8.
  5407. </summary>
  5408. </member>
  5409. <member name="F:Ionic.Zip.CompressionMethod.BZip2">
  5410. <summary>
  5411. BZip2 compression, a compression algorithm developed by Julian Seward.
  5412. For COM environments, the value is 12.
  5413. </summary>
  5414. </member>
  5415. <member name="T:Ionic.Zip.ZipFile">
  5416. <summary>
  5417. The ZipFile type represents a zip archive file.
  5418. </summary>
  5419. <remarks>
  5420. <para>
  5421. This is the main type in the DotNetZip class library. This class reads and
  5422. writes zip files, as defined in the <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">specification
  5423. for zip files described by PKWare</see>. The compression for this
  5424. implementation is provided by a managed-code version of Zlib, included with
  5425. DotNetZip in the classes in the Ionic.Zlib namespace.
  5426. </para>
  5427. <para>
  5428. This class provides a general purpose zip file capability. Use it to read,
  5429. create, or update zip files. When you want to create zip files using a
  5430. <c>Stream</c> type to write the zip file, you may want to consider the <see cref="T:Ionic.Zip.ZipOutputStream"/> class.
  5431. </para>
  5432. <para>
  5433. Both the <c>ZipOutputStream</c> class and the <c>ZipFile</c> class can
  5434. be used to create zip files. Both of them support many of the common zip
  5435. features, including Unicode, different compression methods and levels,
  5436. and ZIP64. They provide very similar performance when creating zip
  5437. files.
  5438. </para>
  5439. <para>
  5440. The <c>ZipFile</c> class is generally easier to use than
  5441. <c>ZipOutputStream</c> and should be considered a higher-level interface. For
  5442. example, when creating a zip file via calls to the <c>PutNextEntry()</c> and
  5443. <c>Write()</c> methods on the <c>ZipOutputStream</c> class, the caller is
  5444. responsible for opening the file, reading the bytes from the file, writing
  5445. those bytes into the <c>ZipOutputStream</c>, setting the attributes on the
  5446. <c>ZipEntry</c>, and setting the created, last modified, and last accessed
  5447. timestamps on the zip entry. All of these things are done automatically by a
  5448. call to <see cref="M:Ionic.Zip.ZipFile.AddFile(System.String,System.String)">ZipFile.AddFile()</see>.
  5449. For this reason, the <c>ZipOutputStream</c> is generally recommended for use
  5450. only when your application emits arbitrary data, not necessarily data from a
  5451. filesystem file, directly into a zip file, and does so using a <c>Stream</c>
  5452. metaphor.
  5453. </para>
  5454. <para>
  5455. Aside from the differences in programming model, there are other
  5456. differences in capability between the two classes.
  5457. </para>
  5458. <list type="bullet">
  5459. <item>
  5460. <c>ZipFile</c> can be used to read and extract zip files, in addition to
  5461. creating zip files. <c>ZipOutputStream</c> cannot read zip files. If you want
  5462. to use a stream to read zip files, check out the <see cref="T:Ionic.Zip.ZipInputStream"/> class.
  5463. </item>
  5464. <item>
  5465. <c>ZipOutputStream</c> does not support the creation of segmented or spanned
  5466. zip files.
  5467. </item>
  5468. <item>
  5469. <c>ZipOutputStream</c> cannot produce a self-extracting archive.
  5470. </item>
  5471. </list>
  5472. <para>
  5473. Be aware that the <c>ZipFile</c> class implements the <see cref="T:System.IDisposable"/> interface. In order for <c>ZipFile</c> to
  5474. produce a valid zip file, you use use it within a using clause (<c>Using</c>
  5475. in VB), or call the <c>Dispose()</c> method explicitly. See the examples
  5476. for how to employ a using clause.
  5477. </para>
  5478. </remarks>
  5479. </member>
  5480. <member name="M:Ionic.Zip.ZipFile.AddItem(System.String)">
  5481. <summary>
  5482. Adds an item, either a file or a directory, to a zip file archive.
  5483. </summary>
  5484. <remarks>
  5485. <para>
  5486. This method is handy if you are adding things to zip archive and don't
  5487. want to bother distinguishing between directories or files. Any files are
  5488. added as single entries. A directory added through this method is added
  5489. recursively: all files and subdirectories contained within the directory
  5490. are added to the <c>ZipFile</c>.
  5491. </para>
  5492. <para>
  5493. The name of the item may be a relative path or a fully-qualified
  5494. path. Remember, the items contained in <c>ZipFile</c> instance get written
  5495. to the disk only when you call <see cref="M:Ionic.Zip.ZipFile.Save"/> or a similar
  5496. save method.
  5497. </para>
  5498. <para>
  5499. The directory name used for the file within the archive is the same
  5500. as the directory name (potentially a relative path) specified in the
  5501. <paramref name="fileOrDirectoryName"/>.
  5502. </para>
  5503. <para>
  5504. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  5505. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  5506. respective values at the time of this call will be applied to the
  5507. <c>ZipEntry</c> added.
  5508. </para>
  5509. </remarks>
  5510. <seealso cref="M:Ionic.Zip.ZipFile.AddFile(System.String)"/>
  5511. <seealso cref="M:Ionic.Zip.ZipFile.AddDirectory(System.String)"/>
  5512. <seealso cref="M:Ionic.Zip.ZipFile.UpdateItem(System.String)"/>
  5513. <overloads>This method has two overloads.</overloads>
  5514. <param name="fileOrDirectoryName">
  5515. the name of the file or directory to add.</param>
  5516. <returns>The <c>ZipEntry</c> added.</returns>
  5517. </member>
  5518. <member name="M:Ionic.Zip.ZipFile.AddItem(System.String,System.String)">
  5519. <summary>
  5520. Adds an item, either a file or a directory, to a zip file archive,
  5521. explicitly specifying the directory path to be used in the archive.
  5522. </summary>
  5523. <remarks>
  5524. <para>
  5525. If adding a directory, the add is recursive on all files and
  5526. subdirectories contained within it.
  5527. </para>
  5528. <para>
  5529. The name of the item may be a relative path or a fully-qualified path.
  5530. The item added by this call to the <c>ZipFile</c> is not read from the
  5531. disk nor written to the zip file archive until the application calls
  5532. Save() on the <c>ZipFile</c>.
  5533. </para>
  5534. <para>
  5535. This version of the method allows the caller to explicitly specify the
  5536. directory path to be used in the archive, which would override the
  5537. "natural" path of the filesystem file.
  5538. </para>
  5539. <para>
  5540. Encryption will be used on the file data if the <c>Password</c> has
  5541. been set on the <c>ZipFile</c> object, prior to calling this method.
  5542. </para>
  5543. <para>
  5544. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  5545. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  5546. respective values at the time of this call will be applied to the
  5547. <c>ZipEntry</c> added.
  5548. </para>
  5549. </remarks>
  5550. <exception cref="T:System.IO.FileNotFoundException">
  5551. Thrown if the file or directory passed in does not exist.
  5552. </exception>
  5553. <param name="fileOrDirectoryName">the name of the file or directory to add.
  5554. </param>
  5555. <param name="directoryPathInArchive">
  5556. The name of the directory path to use within the zip archive. This path
  5557. need not refer to an extant directory in the current filesystem. If the
  5558. files within the zip are later extracted, this is the path used for the
  5559. extracted file. Passing <c>null</c> (<c>Nothing</c> in VB) will use the
  5560. path on the fileOrDirectoryName. Passing the empty string ("") will
  5561. insert the item at the root path within the archive.
  5562. </param>
  5563. <seealso cref="M:Ionic.Zip.ZipFile.AddFile(System.String,System.String)"/>
  5564. <seealso cref="M:Ionic.Zip.ZipFile.AddDirectory(System.String,System.String)"/>
  5565. <seealso cref="M:Ionic.Zip.ZipFile.UpdateItem(System.String,System.String)"/>
  5566. <example>
  5567. This example shows how to zip up a set of files into a flat hierarchy,
  5568. regardless of where in the filesystem the files originated. The resulting
  5569. zip archive will contain a toplevel directory named "flat", which itself
  5570. will contain files Readme.txt, MyProposal.docx, and Image1.jpg. A
  5571. subdirectory under "flat" called SupportFiles will contain all the files
  5572. in the "c:\SupportFiles" directory on disk.
  5573. <code>
  5574. String[] itemnames= {
  5575. "c:\\fixedContent\\Readme.txt",
  5576. "MyProposal.docx",
  5577. "c:\\SupportFiles", // a directory
  5578. "images\\Image1.jpg"
  5579. };
  5580. try
  5581. {
  5582. using (ZipFile zip = new ZipFile())
  5583. {
  5584. for (int i = 1; i &lt; itemnames.Length; i++)
  5585. {
  5586. // will add Files or Dirs, recurses and flattens subdirectories
  5587. zip.AddItem(itemnames[i],"flat");
  5588. }
  5589. zip.Save(ZipToCreate);
  5590. }
  5591. }
  5592. catch (System.Exception ex1)
  5593. {
  5594. System.Console.Error.WriteLine("exception: {0}", ex1);
  5595. }
  5596. </code>
  5597. <code lang="VB">
  5598. Dim itemnames As String() = _
  5599. New String() { "c:\fixedContent\Readme.txt", _
  5600. "MyProposal.docx", _
  5601. "SupportFiles", _
  5602. "images\Image1.jpg" }
  5603. Try
  5604. Using zip As New ZipFile
  5605. Dim i As Integer
  5606. For i = 1 To itemnames.Length - 1
  5607. ' will add Files or Dirs, recursing and flattening subdirectories.
  5608. zip.AddItem(itemnames(i), "flat")
  5609. Next i
  5610. zip.Save(ZipToCreate)
  5611. End Using
  5612. Catch ex1 As Exception
  5613. Console.Error.WriteLine("exception: {0}", ex1.ToString())
  5614. End Try
  5615. </code>
  5616. </example>
  5617. <returns>The <c>ZipEntry</c> added.</returns>
  5618. </member>
  5619. <member name="M:Ionic.Zip.ZipFile.AddFile(System.String)">
  5620. <summary>
  5621. Adds a File to a Zip file archive.
  5622. </summary>
  5623. <remarks>
  5624. <para>
  5625. This call collects metadata for the named file in the filesystem,
  5626. including the file attributes and the timestamp, and inserts that metadata
  5627. into the resulting ZipEntry. Only when the application calls Save() on
  5628. the <c>ZipFile</c>, does DotNetZip read the file from the filesystem and
  5629. then write the content to the zip file archive.
  5630. </para>
  5631. <para>
  5632. This method will throw an exception if an entry with the same name already
  5633. exists in the <c>ZipFile</c>.
  5634. </para>
  5635. <para>
  5636. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  5637. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  5638. respective values at the time of this call will be applied to the
  5639. <c>ZipEntry</c> added.
  5640. </para>
  5641. </remarks>
  5642. <example>
  5643. <para>
  5644. In this example, three files are added to a Zip archive. The ReadMe.txt
  5645. file will be placed in the root of the archive. The .png file will be
  5646. placed in a folder within the zip called photos\personal. The pdf file
  5647. will be included into a folder within the zip called Desktop.
  5648. </para>
  5649. <code>
  5650. try
  5651. {
  5652. using (ZipFile zip = new ZipFile())
  5653. {
  5654. zip.AddFile("c:\\photos\\personal\\7440-N49th.png");
  5655. zip.AddFile("c:\\Desktop\\2008-Regional-Sales-Report.pdf");
  5656. zip.AddFile("ReadMe.txt");
  5657. zip.Save("Package.zip");
  5658. }
  5659. }
  5660. catch (System.Exception ex1)
  5661. {
  5662. System.Console.Error.WriteLine("exception: " + ex1);
  5663. }
  5664. </code>
  5665. <code lang="VB">
  5666. Try
  5667. Using zip As ZipFile = New ZipFile
  5668. zip.AddFile("c:\photos\personal\7440-N49th.png")
  5669. zip.AddFile("c:\Desktop\2008-Regional-Sales-Report.pdf")
  5670. zip.AddFile("ReadMe.txt")
  5671. zip.Save("Package.zip")
  5672. End Using
  5673. Catch ex1 As Exception
  5674. Console.Error.WriteLine("exception: {0}", ex1.ToString)
  5675. End Try
  5676. </code>
  5677. </example>
  5678. <overloads>This method has two overloads.</overloads>
  5679. <seealso cref="M:Ionic.Zip.ZipFile.AddItem(System.String)"/>
  5680. <seealso cref="M:Ionic.Zip.ZipFile.AddDirectory(System.String)"/>
  5681. <seealso cref="M:Ionic.Zip.ZipFile.UpdateFile(System.String)"/>
  5682. <param name="fileName">
  5683. The name of the file to add. It should refer to a file in the filesystem.
  5684. The name of the file may be a relative path or a fully-qualified path.
  5685. </param>
  5686. <returns>The <c>ZipEntry</c> corresponding to the File added.</returns>
  5687. </member>
  5688. <member name="M:Ionic.Zip.ZipFile.AddFile(System.String,System.String)">
  5689. <summary>
  5690. Adds a File to a Zip file archive, potentially overriding the path to be
  5691. used within the zip archive.
  5692. </summary>
  5693. <remarks>
  5694. <para>
  5695. The file added by this call to the <c>ZipFile</c> is not written to the
  5696. zip file archive until the application calls Save() on the <c>ZipFile</c>.
  5697. </para>
  5698. <para>
  5699. This method will throw an exception if an entry with the same name already
  5700. exists in the <c>ZipFile</c>.
  5701. </para>
  5702. <para>
  5703. This version of the method allows the caller to explicitly specify the
  5704. directory path to be used in the archive.
  5705. </para>
  5706. <para>
  5707. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  5708. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  5709. respective values at the time of this call will be applied to the
  5710. <c>ZipEntry</c> added.
  5711. </para>
  5712. </remarks>
  5713. <example>
  5714. <para>
  5715. In this example, three files are added to a Zip archive. The ReadMe.txt
  5716. file will be placed in the root of the archive. The .png file will be
  5717. placed in a folder within the zip called images. The pdf file will be
  5718. included into a folder within the zip called files\docs, and will be
  5719. encrypted with the given password.
  5720. </para>
  5721. <code>
  5722. try
  5723. {
  5724. using (ZipFile zip = new ZipFile())
  5725. {
  5726. // the following entry will be inserted at the root in the archive.
  5727. zip.AddFile("c:\\datafiles\\ReadMe.txt", "");
  5728. // this image file will be inserted into the "images" directory in the archive.
  5729. zip.AddFile("c:\\photos\\personal\\7440-N49th.png", "images");
  5730. // the following will result in a password-protected file called
  5731. // files\\docs\\2008-Regional-Sales-Report.pdf in the archive.
  5732. zip.Password = "EncryptMe!";
  5733. zip.AddFile("c:\\Desktop\\2008-Regional-Sales-Report.pdf", "files\\docs");
  5734. zip.Save("Archive.zip");
  5735. }
  5736. }
  5737. catch (System.Exception ex1)
  5738. {
  5739. System.Console.Error.WriteLine("exception: {0}", ex1);
  5740. }
  5741. </code>
  5742. <code lang="VB">
  5743. Try
  5744. Using zip As ZipFile = New ZipFile
  5745. ' the following entry will be inserted at the root in the archive.
  5746. zip.AddFile("c:\datafiles\ReadMe.txt", "")
  5747. ' this image file will be inserted into the "images" directory in the archive.
  5748. zip.AddFile("c:\photos\personal\7440-N49th.png", "images")
  5749. ' the following will result in a password-protected file called
  5750. ' files\\docs\\2008-Regional-Sales-Report.pdf in the archive.
  5751. zip.Password = "EncryptMe!"
  5752. zip.AddFile("c:\Desktop\2008-Regional-Sales-Report.pdf", "files\documents")
  5753. zip.Save("Archive.zip")
  5754. End Using
  5755. Catch ex1 As Exception
  5756. Console.Error.WriteLine("exception: {0}", ex1)
  5757. End Try
  5758. </code>
  5759. </example>
  5760. <seealso cref="M:Ionic.Zip.ZipFile.AddItem(System.String,System.String)"/>
  5761. <seealso cref="M:Ionic.Zip.ZipFile.AddDirectory(System.String,System.String)"/>
  5762. <seealso cref="M:Ionic.Zip.ZipFile.UpdateFile(System.String,System.String)"/>
  5763. <param name="fileName">
  5764. The name of the file to add. The name of the file may be a relative path
  5765. or a fully-qualified path.
  5766. </param>
  5767. <param name="directoryPathInArchive">
  5768. Specifies a directory path to use to override any path in the fileName.
  5769. This path may, or may not, correspond to a real directory in the current
  5770. filesystem. If the files within the zip are later extracted, this is the
  5771. path used for the extracted file. Passing <c>null</c> (<c>Nothing</c> in
  5772. VB) will use the path on the fileName, if any. Passing the empty string
  5773. ("") will insert the item at the root path within the archive.
  5774. </param>
  5775. <returns>The <c>ZipEntry</c> corresponding to the file added.</returns>
  5776. </member>
  5777. <member name="M:Ionic.Zip.ZipFile.RemoveEntries(System.Collections.Generic.ICollection{Ionic.Zip.ZipEntry})">
  5778. <summary>
  5779. This method removes a collection of entries from the <c>ZipFile</c>.
  5780. </summary>
  5781. <param name="entriesToRemove">
  5782. A collection of ZipEntry instances from this zip file to be removed. For
  5783. example, you can pass in an array of ZipEntry instances; or you can call
  5784. SelectEntries(), and then add or remove entries from that
  5785. ICollection&lt;ZipEntry&gt; (ICollection(Of ZipEntry) in VB), and pass
  5786. that ICollection to this method.
  5787. </param>
  5788. <seealso cref="M:Ionic.Zip.ZipFile.SelectEntries(System.String)"/>
  5789. <seealso cref="M:Ionic.Zip.ZipFile.RemoveSelectedEntries(System.String)"/>
  5790. </member>
  5791. <member name="M:Ionic.Zip.ZipFile.RemoveEntries(System.Collections.Generic.ICollection{System.String})">
  5792. <summary>
  5793. This method removes a collection of entries from the <c>ZipFile</c>, by name.
  5794. </summary>
  5795. <param name="entriesToRemove">
  5796. A collection of strings that refer to names of entries to be removed
  5797. from the <c>ZipFile</c>. For example, you can pass in an array or a
  5798. List of Strings that provide the names of entries to be removed.
  5799. </param>
  5800. <seealso cref="M:Ionic.Zip.ZipFile.SelectEntries(System.String)"/>
  5801. <seealso cref="M:Ionic.Zip.ZipFile.RemoveSelectedEntries(System.String)"/>
  5802. </member>
  5803. <member name="M:Ionic.Zip.ZipFile.AddFiles(System.Collections.Generic.IEnumerable{System.String})">
  5804. <summary>
  5805. This method adds a set of files to the <c>ZipFile</c>.
  5806. </summary>
  5807. <remarks>
  5808. <para>
  5809. Use this method to add a set of files to the zip archive, in one call.
  5810. For example, a list of files received from
  5811. <c>System.IO.Directory.GetFiles()</c> can be added to a zip archive in one
  5812. call.
  5813. </para>
  5814. <para>
  5815. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  5816. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  5817. respective values at the time of this call will be applied to each
  5818. ZipEntry added.
  5819. </para>
  5820. </remarks>
  5821. <param name="fileNames">
  5822. The collection of names of the files to add. Each string should refer to a
  5823. file in the filesystem. The name of the file may be a relative path or a
  5824. fully-qualified path.
  5825. </param>
  5826. <example>
  5827. This example shows how to create a zip file, and add a few files into it.
  5828. <code>
  5829. String ZipFileToCreate = "archive1.zip";
  5830. String DirectoryToZip = "c:\\reports";
  5831. using (ZipFile zip = new ZipFile())
  5832. {
  5833. // Store all files found in the top level directory, into the zip archive.
  5834. String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip);
  5835. zip.AddFiles(filenames);
  5836. zip.Save(ZipFileToCreate);
  5837. }
  5838. </code>
  5839. <code lang="VB">
  5840. Dim ZipFileToCreate As String = "archive1.zip"
  5841. Dim DirectoryToZip As String = "c:\reports"
  5842. Using zip As ZipFile = New ZipFile
  5843. ' Store all files found in the top level directory, into the zip archive.
  5844. Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip)
  5845. zip.AddFiles(filenames)
  5846. zip.Save(ZipFileToCreate)
  5847. End Using
  5848. </code>
  5849. </example>
  5850. <seealso cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String,System.String)"/>
  5851. </member>
  5852. <member name="M:Ionic.Zip.ZipFile.UpdateFiles(System.Collections.Generic.IEnumerable{System.String})">
  5853. <summary>
  5854. Adds or updates a set of files in the <c>ZipFile</c>.
  5855. </summary>
  5856. <remarks>
  5857. <para>
  5858. Any files that already exist in the archive are updated. Any files that
  5859. don't yet exist in the archive are added.
  5860. </para>
  5861. <para>
  5862. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  5863. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  5864. respective values at the time of this call will be applied to each
  5865. ZipEntry added.
  5866. </para>
  5867. </remarks>
  5868. <param name="fileNames">
  5869. The collection of names of the files to update. Each string should refer to a file in
  5870. the filesystem. The name of the file may be a relative path or a fully-qualified path.
  5871. </param>
  5872. </member>
  5873. <member name="M:Ionic.Zip.ZipFile.AddFiles(System.Collections.Generic.IEnumerable{System.String},System.String)">
  5874. <summary>
  5875. Adds a set of files to the <c>ZipFile</c>, using the
  5876. specified directory path in the archive.
  5877. </summary>
  5878. <remarks>
  5879. <para>
  5880. Any directory structure that may be present in the
  5881. filenames contained in the list is "flattened" in the
  5882. archive. Each file in the list is added to the archive in
  5883. the specified top-level directory.
  5884. </para>
  5885. <para>
  5886. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>, <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their respective values at the
  5887. time of this call will be applied to each ZipEntry added.
  5888. </para>
  5889. </remarks>
  5890. <param name="fileNames">
  5891. The names of the files to add. Each string should refer to
  5892. a file in the filesystem. The name of the file may be a
  5893. relative path or a fully-qualified path.
  5894. </param>
  5895. <param name="directoryPathInArchive">
  5896. Specifies a directory path to use to override any path in the file name.
  5897. Th is path may, or may not, correspond to a real directory in the current
  5898. filesystem. If the files within the zip are later extracted, this is the
  5899. path used for the extracted file. Passing <c>null</c> (<c>Nothing</c> in
  5900. VB) will use the path on each of the <c>fileNames</c>, if any. Passing
  5901. the empty string ("") will insert the item at the root path within the
  5902. archive.
  5903. </param>
  5904. <seealso cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String,System.String)"/>
  5905. </member>
  5906. <member name="M:Ionic.Zip.ZipFile.AddFiles(System.Collections.Generic.IEnumerable{System.String},System.Boolean,System.String)">
  5907. <summary>
  5908. Adds a set of files to the <c>ZipFile</c>, using the specified directory
  5909. path in the archive, and preserving the full directory structure in the
  5910. filenames.
  5911. </summary>
  5912. <remarks>
  5913. <para>
  5914. If preserveDirHierarchy is true, any directory structure present in the
  5915. filenames contained in the list is preserved in the archive. On the other
  5916. hand, if preserveDirHierarchy is false, any directory structure that may
  5917. be present in the filenames contained in the list is "flattened" in the
  5918. archive; Each file in the list is added to the archive in the specified
  5919. top-level directory.
  5920. </para>
  5921. <para>
  5922. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  5923. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  5924. respective values at the time of this call will be applied to each
  5925. ZipEntry added.
  5926. </para>
  5927. </remarks>
  5928. <param name="fileNames">
  5929. The names of the files to add. Each string should refer to a file in the
  5930. filesystem. The name of the file may be a relative path or a
  5931. fully-qualified path.
  5932. </param>
  5933. <param name="directoryPathInArchive">
  5934. Specifies a directory path to use to override any path in the file name.
  5935. This path may, or may not, correspond to a real directory in the current
  5936. filesystem. If the files within the zip are later extracted, this is the
  5937. path used for the extracted file. Passing <c>null</c> (<c>Nothing</c> in
  5938. VB) will use the path on each of the <c>fileNames</c>, if any. Passing
  5939. the empty string ("") will insert the item at the root path within the
  5940. archive.
  5941. </param>
  5942. <param name="preserveDirHierarchy">
  5943. whether the entries in the zip archive will reflect the directory
  5944. hierarchy that is present in the various filenames. For example, if <paramref name="fileNames"/>
  5945. includes two paths, \Animalia\Chordata\Mammalia\Info.txt and
  5946. \Plantae\Magnoliophyta\Dicotyledon\Info.txt, then calling this method with
  5947. <paramref name="preserveDirHierarchy"/> = <c>false</c> will result in an
  5948. exception because of a duplicate entry name, while calling this method
  5949. with <paramref name="preserveDirHierarchy"/> = <c>true</c> will result in the
  5950. full direcory paths being included in the entries added to the ZipFile.
  5951. </param>
  5952. <seealso cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String,System.String)"/>
  5953. </member>
  5954. <member name="M:Ionic.Zip.ZipFile.UpdateFiles(System.Collections.Generic.IEnumerable{System.String},System.String)">
  5955. <summary>
  5956. Adds or updates a set of files to the <c>ZipFile</c>, using the specified
  5957. directory path in the archive.
  5958. </summary>
  5959. <remarks>
  5960. <para>
  5961. Any files that already exist in the archive are updated. Any files that
  5962. don't yet exist in the archive are added.
  5963. </para>
  5964. <para>
  5965. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  5966. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  5967. respective values at the time of this call will be applied to each
  5968. ZipEntry added.
  5969. </para>
  5970. </remarks>
  5971. <param name="fileNames">
  5972. The names of the files to add or update. Each string should refer to a
  5973. file in the filesystem. The name of the file may be a relative path or a
  5974. fully-qualified path.
  5975. </param>
  5976. <param name="directoryPathInArchive">
  5977. Specifies a directory path to use to override any path in the file name.
  5978. This path may, or may not, correspond to a real directory in the current
  5979. filesystem. If the files within the zip are later extracted, this is the
  5980. path used for the extracted file. Passing <c>null</c> (<c>Nothing</c> in
  5981. VB) will use the path on each of the <c>fileNames</c>, if any. Passing
  5982. the empty string ("") will insert the item at the root path within the
  5983. archive.
  5984. </param>
  5985. <seealso cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String,System.String)"/>
  5986. </member>
  5987. <member name="M:Ionic.Zip.ZipFile.UpdateFile(System.String)">
  5988. <summary>
  5989. Adds or Updates a File in a Zip file archive.
  5990. </summary>
  5991. <remarks>
  5992. <para>
  5993. This method adds a file to a zip archive, or, if the file already exists
  5994. in the zip archive, this method Updates the content of that given filename
  5995. in the zip archive. The <c>UpdateFile</c> method might more accurately be
  5996. called "AddOrUpdateFile".
  5997. </para>
  5998. <para>
  5999. Upon success, there is no way for the application to learn whether the file
  6000. was added versus updated.
  6001. </para>
  6002. <para>
  6003. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  6004. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  6005. respective values at the time of this call will be applied to the
  6006. <c>ZipEntry</c> added.
  6007. </para>
  6008. </remarks>
  6009. <example>
  6010. This example shows how to Update an existing entry in a zipfile. The first
  6011. call to UpdateFile adds the file to the newly-created zip archive. The
  6012. second call to UpdateFile updates the content for that file in the zip
  6013. archive.
  6014. <code>
  6015. using (ZipFile zip1 = new ZipFile())
  6016. {
  6017. // UpdateFile might more accurately be called "AddOrUpdateFile"
  6018. zip1.UpdateFile("MyDocuments\\Readme.txt");
  6019. zip1.UpdateFile("CustomerList.csv");
  6020. zip1.Comment = "This zip archive has been created.";
  6021. zip1.Save("Content.zip");
  6022. }
  6023. using (ZipFile zip2 = ZipFile.Read("Content.zip"))
  6024. {
  6025. zip2.UpdateFile("Updates\\Readme.txt");
  6026. zip2.Comment = "This zip archive has been updated: The Readme.txt file has been changed.";
  6027. zip2.Save();
  6028. }
  6029. </code>
  6030. <code lang="VB">
  6031. Using zip1 As New ZipFile
  6032. ' UpdateFile might more accurately be called "AddOrUpdateFile"
  6033. zip1.UpdateFile("MyDocuments\Readme.txt")
  6034. zip1.UpdateFile("CustomerList.csv")
  6035. zip1.Comment = "This zip archive has been created."
  6036. zip1.Save("Content.zip")
  6037. End Using
  6038. Using zip2 As ZipFile = ZipFile.Read("Content.zip")
  6039. zip2.UpdateFile("Updates\Readme.txt")
  6040. zip2.Comment = "This zip archive has been updated: The Readme.txt file has been changed."
  6041. zip2.Save
  6042. End Using
  6043. </code>
  6044. </example>
  6045. <seealso cref="M:Ionic.Zip.ZipFile.AddFile(System.String)"/>
  6046. <seealso cref="M:Ionic.Zip.ZipFile.UpdateDirectory(System.String)"/>
  6047. <seealso cref="M:Ionic.Zip.ZipFile.UpdateItem(System.String)"/>
  6048. <param name="fileName">
  6049. The name of the file to add or update. It should refer to a file in the
  6050. filesystem. The name of the file may be a relative path or a
  6051. fully-qualified path.
  6052. </param>
  6053. <returns>
  6054. The <c>ZipEntry</c> corresponding to the File that was added or updated.
  6055. </returns>
  6056. </member>
  6057. <member name="M:Ionic.Zip.ZipFile.UpdateFile(System.String,System.String)">
  6058. <summary>
  6059. Adds or Updates a File in a Zip file archive.
  6060. </summary>
  6061. <remarks>
  6062. <para>
  6063. This method adds a file to a zip archive, or, if the file already exists
  6064. in the zip archive, this method Updates the content of that given filename
  6065. in the zip archive.
  6066. </para>
  6067. <para>
  6068. This version of the method allows the caller to explicitly specify the
  6069. directory path to be used in the archive. The entry to be added or
  6070. updated is found by using the specified directory path, combined with the
  6071. basename of the specified filename.
  6072. </para>
  6073. <para>
  6074. Upon success, there is no way for the application to learn if the file was
  6075. added versus updated.
  6076. </para>
  6077. <para>
  6078. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  6079. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  6080. respective values at the time of this call will be applied to the
  6081. <c>ZipEntry</c> added.
  6082. </para>
  6083. </remarks>
  6084. <seealso cref="M:Ionic.Zip.ZipFile.AddFile(System.String,System.String)"/>
  6085. <seealso cref="M:Ionic.Zip.ZipFile.UpdateDirectory(System.String,System.String)"/>
  6086. <seealso cref="M:Ionic.Zip.ZipFile.UpdateItem(System.String,System.String)"/>
  6087. <param name="fileName">
  6088. The name of the file to add or update. It should refer to a file in the
  6089. filesystem. The name of the file may be a relative path or a
  6090. fully-qualified path.
  6091. </param>
  6092. <param name="directoryPathInArchive">
  6093. Specifies a directory path to use to override any path in the
  6094. <c>fileName</c>. This path may, or may not, correspond to a real
  6095. directory in the current filesystem. If the files within the zip are
  6096. later extracted, this is the path used for the extracted file. Passing
  6097. <c>null</c> (<c>Nothing</c> in VB) will use the path on the
  6098. <c>fileName</c>, if any. Passing the empty string ("") will insert the
  6099. item at the root path within the archive.
  6100. </param>
  6101. <returns>
  6102. The <c>ZipEntry</c> corresponding to the File that was added or updated.
  6103. </returns>
  6104. </member>
  6105. <member name="M:Ionic.Zip.ZipFile.UpdateDirectory(System.String)">
  6106. <summary>
  6107. Add or update a directory in a zip archive.
  6108. </summary>
  6109. <remarks>
  6110. If the specified directory does not exist in the archive, then this method
  6111. is equivalent to calling <c>AddDirectory()</c>. If the specified
  6112. directory already exists in the archive, then this method updates any
  6113. existing entries, and adds any new entries. Any entries that are in the
  6114. zip archive but not in the specified directory, are left alone. In other
  6115. words, the contents of the zip file will be a union of the previous
  6116. contents and the new files.
  6117. </remarks>
  6118. <seealso cref="M:Ionic.Zip.ZipFile.UpdateFile(System.String)"/>
  6119. <seealso cref="M:Ionic.Zip.ZipFile.AddDirectory(System.String)"/>
  6120. <seealso cref="M:Ionic.Zip.ZipFile.UpdateItem(System.String)"/>
  6121. <param name="directoryName">
  6122. The path to the directory to be added to the zip archive, or updated in
  6123. the zip archive.
  6124. </param>
  6125. <returns>
  6126. The <c>ZipEntry</c> corresponding to the Directory that was added or updated.
  6127. </returns>
  6128. </member>
  6129. <member name="M:Ionic.Zip.ZipFile.UpdateDirectory(System.String,System.String)">
  6130. <summary>
  6131. Add or update a directory in the zip archive at the specified root
  6132. directory in the archive.
  6133. </summary>
  6134. <remarks>
  6135. If the specified directory does not exist in the archive, then this method
  6136. is equivalent to calling <c>AddDirectory()</c>. If the specified
  6137. directory already exists in the archive, then this method updates any
  6138. existing entries, and adds any new entries. Any entries that are in the
  6139. zip archive but not in the specified directory, are left alone. In other
  6140. words, the contents of the zip file will be a union of the previous
  6141. contents and the new files.
  6142. </remarks>
  6143. <seealso cref="M:Ionic.Zip.ZipFile.UpdateFile(System.String,System.String)"/>
  6144. <seealso cref="M:Ionic.Zip.ZipFile.AddDirectory(System.String,System.String)"/>
  6145. <seealso cref="M:Ionic.Zip.ZipFile.UpdateItem(System.String,System.String)"/>
  6146. <param name="directoryName">
  6147. The path to the directory to be added to the zip archive, or updated
  6148. in the zip archive.
  6149. </param>
  6150. <param name="directoryPathInArchive">
  6151. Specifies a directory path to use to override any path in the
  6152. <c>directoryName</c>. This path may, or may not, correspond to a real
  6153. directory in the current filesystem. If the files within the zip are
  6154. later extracted, this is the path used for the extracted file. Passing
  6155. <c>null</c> (<c>Nothing</c> in VB) will use the path on the
  6156. <c>directoryName</c>, if any. Passing the empty string ("") will insert
  6157. the item at the root path within the archive.
  6158. </param>
  6159. <returns>
  6160. The <c>ZipEntry</c> corresponding to the Directory that was added or updated.
  6161. </returns>
  6162. </member>
  6163. <member name="M:Ionic.Zip.ZipFile.UpdateItem(System.String)">
  6164. <summary>
  6165. Add or update a file or directory in the zip archive.
  6166. </summary>
  6167. <remarks>
  6168. <para>
  6169. This is useful when the application is not sure or does not care if the
  6170. item to be added is a file or directory, and does not know or does not
  6171. care if the item already exists in the <c>ZipFile</c>. Calling this method
  6172. is equivalent to calling <c>RemoveEntry()</c> if an entry by the same name
  6173. already exists, followed calling by <c>AddItem()</c>.
  6174. </para>
  6175. <para>
  6176. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  6177. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  6178. respective values at the time of this call will be applied to the
  6179. <c>ZipEntry</c> added.
  6180. </para>
  6181. </remarks>
  6182. <seealso cref="M:Ionic.Zip.ZipFile.AddItem(System.String)"/>
  6183. <seealso cref="M:Ionic.Zip.ZipFile.UpdateFile(System.String)"/>
  6184. <seealso cref="M:Ionic.Zip.ZipFile.UpdateDirectory(System.String)"/>
  6185. <param name="itemName">
  6186. the path to the file or directory to be added or updated.
  6187. </param>
  6188. </member>
  6189. <member name="M:Ionic.Zip.ZipFile.UpdateItem(System.String,System.String)">
  6190. <summary>
  6191. Add or update a file or directory.
  6192. </summary>
  6193. <remarks>
  6194. <para>
  6195. This method is useful when the application is not sure or does not care if
  6196. the item to be added is a file or directory, and does not know or does not
  6197. care if the item already exists in the <c>ZipFile</c>. Calling this method
  6198. is equivalent to calling <c>RemoveEntry()</c>, if an entry by that name
  6199. exists, and then calling <c>AddItem()</c>.
  6200. </para>
  6201. <para>
  6202. This version of the method allows the caller to explicitly specify the
  6203. directory path to be used for the item being added to the archive. The
  6204. entry or entries that are added or updated will use the specified
  6205. <c>DirectoryPathInArchive</c>. Extracting the entry from the archive will
  6206. result in a file stored in that directory path.
  6207. </para>
  6208. <para>
  6209. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  6210. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  6211. respective values at the time of this call will be applied to the
  6212. <c>ZipEntry</c> added.
  6213. </para>
  6214. </remarks>
  6215. <seealso cref="M:Ionic.Zip.ZipFile.AddItem(System.String,System.String)"/>
  6216. <seealso cref="M:Ionic.Zip.ZipFile.UpdateFile(System.String,System.String)"/>
  6217. <seealso cref="M:Ionic.Zip.ZipFile.UpdateDirectory(System.String,System.String)"/>
  6218. <param name="itemName">
  6219. The path for the File or Directory to be added or updated.
  6220. </param>
  6221. <param name="directoryPathInArchive">
  6222. Specifies a directory path to use to override any path in the
  6223. <c>itemName</c>. This path may, or may not, correspond to a real
  6224. directory in the current filesystem. If the files within the zip are
  6225. later extracted, this is the path used for the extracted file. Passing
  6226. <c>null</c> (<c>Nothing</c> in VB) will use the path on the
  6227. <c>itemName</c>, if any. Passing the empty string ("") will insert the
  6228. item at the root path within the archive.
  6229. </param>
  6230. </member>
  6231. <member name="M:Ionic.Zip.ZipFile.AddEntry(System.String,System.String)">
  6232. <summary>
  6233. Adds a named entry into the zip archive, taking content for the entry
  6234. from a string.
  6235. </summary>
  6236. <remarks>
  6237. Calling this method creates an entry using the given fileName and
  6238. directory path within the archive. There is no need for a file by the
  6239. given name to exist in the filesystem; the name is used within the zip
  6240. archive only. The content for the entry is encoded using the default text
  6241. encoding for the machine, or on Silverlight, using UTF-8.
  6242. </remarks>
  6243. <param name="content">
  6244. The content of the file, should it be extracted from the zip.
  6245. </param>
  6246. <param name="entryName">
  6247. The name, including any path, to use for the entry within the archive.
  6248. </param>
  6249. <returns>The <c>ZipEntry</c> added.</returns>
  6250. <example>
  6251. This example shows how to add an entry to the zipfile, using a string as
  6252. content for that entry.
  6253. <code lang="C#">
  6254. string Content = "This string will be the content of the Readme.txt file in the zip archive.";
  6255. using (ZipFile zip1 = new ZipFile())
  6256. {
  6257. zip1.AddFile("MyDocuments\\Resume.doc", "files");
  6258. zip1.AddEntry("Readme.txt", Content);
  6259. zip1.Comment = "This zip file was created at " + System.DateTime.Now.ToString("G");
  6260. zip1.Save("Content.zip");
  6261. }
  6262. </code>
  6263. <code lang="VB">
  6264. Public Sub Run()
  6265. Dim Content As String = "This string will be the content of the Readme.txt file in the zip archive."
  6266. Using zip1 As ZipFile = New ZipFile
  6267. zip1.AddEntry("Readme.txt", Content)
  6268. zip1.AddFile("MyDocuments\Resume.doc", "files")
  6269. zip1.Comment = ("This zip file was created at " &amp; DateTime.Now.ToString("G"))
  6270. zip1.Save("Content.zip")
  6271. End Using
  6272. End Sub
  6273. </code>
  6274. </example>
  6275. </member>
  6276. <member name="M:Ionic.Zip.ZipFile.AddEntry(System.String,System.String,System.Text.Encoding)">
  6277. <summary>
  6278. Adds a named entry into the zip archive, taking content for the entry
  6279. from a string, and using the specified text encoding.
  6280. </summary>
  6281. <remarks>
  6282. <para>
  6283. Calling this method creates an entry using the given fileName and
  6284. directory path within the archive. There is no need for a file by the
  6285. given name to exist in the filesystem; the name is used within the zip
  6286. archive only.
  6287. </para>
  6288. <para>
  6289. The content for the entry, a string value, is encoded using the given
  6290. text encoding. A BOM (byte-order-mark) is emitted into the file, if the
  6291. Encoding parameter is set for that.
  6292. </para>
  6293. <para>
  6294. Most Encoding classes support a constructor that accepts a boolean,
  6295. indicating whether to emit a BOM or not. For example see <see cref="M:System.Text.UTF8Encoding.#ctor(System.Boolean)"/>.
  6296. </para>
  6297. </remarks>
  6298. <param name="entryName">
  6299. The name, including any path, to use within the archive for the entry.
  6300. </param>
  6301. <param name="content">
  6302. The content of the file, should it be extracted from the zip.
  6303. </param>
  6304. <param name="encoding">
  6305. The text encoding to use when encoding the string. Be aware: This is
  6306. distinct from the text encoding used to encode the fileName, as specified
  6307. in <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>.
  6308. </param>
  6309. <returns>The <c>ZipEntry</c> added.</returns>
  6310. </member>
  6311. <member name="M:Ionic.Zip.ZipFile.AddEntry(System.String,System.IO.Stream)">
  6312. <summary>
  6313. Create an entry in the <c>ZipFile</c> using the given <c>Stream</c>
  6314. as input. The entry will have the given filename.
  6315. </summary>
  6316. <remarks>
  6317. <para>
  6318. The application should provide an open, readable stream; in this case it
  6319. will be read during the call to <see cref="M:Ionic.Zip.ZipFile.Save"/> or one of
  6320. its overloads.
  6321. </para>
  6322. <para>
  6323. The passed stream will be read from its current position. If
  6324. necessary, callers should set the position in the stream before
  6325. calling AddEntry(). This might be appropriate when using this method
  6326. with a MemoryStream, for example.
  6327. </para>
  6328. <para>
  6329. In cases where a large number of streams will be added to the
  6330. <c>ZipFile</c>, the application may wish to avoid maintaining all of the
  6331. streams open simultaneously. To handle this situation, the application
  6332. should use the <see cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,Ionic.Zip.OpenDelegate,Ionic.Zip.CloseDelegate)"/>
  6333. overload.
  6334. </para>
  6335. <para>
  6336. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  6337. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  6338. respective values at the time of this call will be applied to the
  6339. <c>ZipEntry</c> added.
  6340. </para>
  6341. </remarks>
  6342. <example>
  6343. <para>
  6344. This example adds a single entry to a <c>ZipFile</c> via a <c>Stream</c>.
  6345. </para>
  6346. <code lang="C#">
  6347. String zipToCreate = "Content.zip";
  6348. String fileNameInArchive = "Content-From-Stream.bin";
  6349. using (System.IO.Stream streamToRead = MyStreamOpener())
  6350. {
  6351. using (ZipFile zip = new ZipFile())
  6352. {
  6353. ZipEntry entry= zip.AddEntry(fileNameInArchive, streamToRead);
  6354. zip.AddFile("Readme.txt");
  6355. zip.Save(zipToCreate); // the stream is read implicitly here
  6356. }
  6357. }
  6358. </code>
  6359. <code lang="VB">
  6360. Dim zipToCreate As String = "Content.zip"
  6361. Dim fileNameInArchive As String = "Content-From-Stream.bin"
  6362. Using streamToRead as System.IO.Stream = MyStreamOpener()
  6363. Using zip As ZipFile = New ZipFile()
  6364. Dim entry as ZipEntry = zip.AddEntry(fileNameInArchive, streamToRead)
  6365. zip.AddFile("Readme.txt")
  6366. zip.Save(zipToCreate) '' the stream is read implicitly, here
  6367. End Using
  6368. End Using
  6369. </code>
  6370. </example>
  6371. <seealso cref="M:Ionic.Zip.ZipFile.UpdateEntry(System.String,System.IO.Stream)"/>
  6372. <param name="entryName">
  6373. The name, including any path, which is shown in the zip file for the added
  6374. entry.
  6375. </param>
  6376. <param name="stream">
  6377. The input stream from which to grab content for the file
  6378. </param>
  6379. <returns>The <c>ZipEntry</c> added.</returns>
  6380. </member>
  6381. <member name="M:Ionic.Zip.ZipFile.AddEntry(System.String,Ionic.Zip.WriteDelegate)">
  6382. <summary>
  6383. Add a ZipEntry for which content is written directly by the application.
  6384. </summary>
  6385. <remarks>
  6386. <para>
  6387. When the application needs to write the zip entry data, use this
  6388. method to add the ZipEntry. For example, in the case that the
  6389. application wishes to write the XML representation of a DataSet into
  6390. a ZipEntry, the application can use this method to do so.
  6391. </para>
  6392. <para>
  6393. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  6394. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  6395. respective values at the time of this call will be applied to the
  6396. <c>ZipEntry</c> added.
  6397. </para>
  6398. <para>
  6399. About progress events: When using the WriteDelegate, DotNetZip does
  6400. not issue any SaveProgress events with <c>EventType</c> = <see cref="F:Ionic.Zip.ZipProgressEventType.Saving_EntryBytesRead">
  6401. Saving_EntryBytesRead</see>. (This is because it is the
  6402. application's code that runs in WriteDelegate - there's no way for
  6403. DotNetZip to know when to issue a EntryBytesRead event.)
  6404. Applications that want to update a progress bar or similar status
  6405. indicator should do so from within the WriteDelegate
  6406. itself. DotNetZip will issue the other SaveProgress events,
  6407. including <see cref="F:Ionic.Zip.ZipProgressEventType.Saving_Started">
  6408. Saving_Started</see>,
  6409. <see cref="F:Ionic.Zip.ZipProgressEventType.Saving_BeforeWriteEntry">
  6410. Saving_BeforeWriteEntry</see>, and <see cref="F:Ionic.Zip.ZipProgressEventType.Saving_AfterWriteEntry">
  6411. Saving_AfterWriteEntry</see>.
  6412. </para>
  6413. <para>
  6414. Note: When you use PKZip encryption, it's normally necessary to
  6415. compute the CRC of the content to be encrypted, before compressing or
  6416. encrypting it. Therefore, when using PKZip encryption with a
  6417. WriteDelegate, the WriteDelegate CAN BE called twice: once to compute
  6418. the CRC, and the second time to potentially compress and
  6419. encrypt. Surprising, but true. This is because PKWARE specified that
  6420. the encryption initialization data depends on the CRC.
  6421. If this happens, for each call of the delegate, your
  6422. application must stream the same entry data in its entirety. If your
  6423. application writes different data during the second call, it will
  6424. result in a corrupt zip file.
  6425. </para>
  6426. <para>
  6427. The double-read behavior happens with all types of entries, not only
  6428. those that use WriteDelegate. It happens if you add an entry from a
  6429. filesystem file, or using a string, or a stream, or an opener/closer
  6430. pair. But in those cases, DotNetZip takes care of reading twice; in
  6431. the case of the WriteDelegate, the application code gets invoked
  6432. twice. Be aware.
  6433. </para>
  6434. <para>
  6435. As you can imagine, this can cause performance problems for large
  6436. streams, and it can lead to correctness problems when you use a
  6437. <c>WriteDelegate</c>. This is a pretty big pitfall. There are two
  6438. ways to avoid it. First, and most preferred: don't use PKZIP
  6439. encryption. If you use the WinZip AES encryption, this problem
  6440. doesn't occur, because the encryption protocol doesn't require the CRC
  6441. up front. Second: if you do choose to use PKZIP encryption, write out
  6442. to a non-seekable stream (like standard output, or the
  6443. Response.OutputStream in an ASP.NET application). In this case,
  6444. DotNetZip will use an alternative encryption protocol that does not
  6445. rely on the CRC of the content. This also implies setting bit 3 in
  6446. the zip entry, which still presents problems for some zip tools.
  6447. </para>
  6448. <para>
  6449. In the future I may modify DotNetZip to *always* use bit 3 when PKZIP
  6450. encryption is in use. This seems like a win overall, but there will
  6451. be some work involved. If you feel strongly about it, visit the
  6452. DotNetZip forums and vote up <see href="http://dotnetzip.codeplex.com/workitem/13686">the Workitem
  6453. tracking this issue</see>.
  6454. </para>
  6455. </remarks>
  6456. <param name="entryName">the name of the entry to add</param>
  6457. <param name="writer">the delegate which will write the entry content</param>
  6458. <returns>the ZipEntry added</returns>
  6459. <example>
  6460. This example shows an application filling a DataSet, then saving the
  6461. contents of that DataSet as XML, into a ZipEntry in a ZipFile, using an
  6462. anonymous delegate in C#. The DataSet XML is never saved to a disk file.
  6463. <code lang="C#">
  6464. var c1= new System.Data.SqlClient.SqlConnection(connstring1);
  6465. var da = new System.Data.SqlClient.SqlDataAdapter()
  6466. {
  6467. SelectCommand= new System.Data.SqlClient.SqlCommand(strSelect, c1)
  6468. };
  6469. DataSet ds1 = new DataSet();
  6470. da.Fill(ds1, "Invoices");
  6471. using(Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile())
  6472. {
  6473. zip.AddEntry(zipEntryName, (name,stream) =&gt; ds1.WriteXml(stream) );
  6474. zip.Save(zipFileName);
  6475. }
  6476. </code>
  6477. </example>
  6478. <example>
  6479. This example uses an anonymous method in C# as the WriteDelegate to provide
  6480. the data for the ZipEntry. The example is a bit contrived - the
  6481. <c>AddFile()</c> method is a simpler way to insert the contents of a file
  6482. into an entry in a zip file. On the other hand, if there is some sort of
  6483. processing or transformation of the file contents required before writing,
  6484. the application could use the <c>WriteDelegate</c> to do it, in this way.
  6485. <code lang="C#">
  6486. using (var input = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ))
  6487. {
  6488. using(Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile())
  6489. {
  6490. zip.AddEntry(zipEntryName, (name,output) =&gt;
  6491. {
  6492. byte[] buffer = new byte[BufferSize];
  6493. int n;
  6494. while ((n = input.Read(buffer, 0, buffer.Length)) != 0)
  6495. {
  6496. // could transform the data here...
  6497. output.Write(buffer, 0, n);
  6498. // could update a progress bar here
  6499. }
  6500. });
  6501. zip.Save(zipFileName);
  6502. }
  6503. }
  6504. </code>
  6505. </example>
  6506. <example>
  6507. This example uses a named delegate in VB to write data for the given
  6508. ZipEntry (VB9 does not have anonymous delegates). The example here is a bit
  6509. contrived - a simpler way to add the contents of a file to a ZipEntry is to
  6510. simply use the appropriate <c>AddFile()</c> method. The key scenario for
  6511. which the <c>WriteDelegate</c> makes sense is saving a DataSet, in XML
  6512. format, to the zip file. The DataSet can write XML to a stream, and the
  6513. WriteDelegate is the perfect place to write into the zip file. There may be
  6514. other data structures that can write to a stream, but cannot be read as a
  6515. stream. The <c>WriteDelegate</c> would be appropriate for those cases as
  6516. well.
  6517. <code lang="VB">
  6518. Private Sub WriteEntry (ByVal name As String, ByVal output As Stream)
  6519. Using input As FileStream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
  6520. Dim n As Integer = -1
  6521. Dim buffer As Byte() = New Byte(BufferSize){}
  6522. Do While n &lt;&gt; 0
  6523. n = input.Read(buffer, 0, buffer.Length)
  6524. output.Write(buffer, 0, n)
  6525. Loop
  6526. End Using
  6527. End Sub
  6528. Public Sub Run()
  6529. Using zip = New ZipFile
  6530. zip.AddEntry(zipEntryName, New WriteDelegate(AddressOf WriteEntry))
  6531. zip.Save(zipFileName)
  6532. End Using
  6533. End Sub
  6534. </code>
  6535. </example>
  6536. </member>
  6537. <member name="M:Ionic.Zip.ZipFile.AddEntry(System.String,Ionic.Zip.OpenDelegate,Ionic.Zip.CloseDelegate)">
  6538. <summary>
  6539. Add an entry, for which the application will provide a stream,
  6540. just-in-time.
  6541. </summary>
  6542. <remarks>
  6543. <para>
  6544. In cases where the application wishes to open the stream that holds
  6545. the content for the ZipEntry, on a just-in-time basis, the application
  6546. can use this method and provide delegates to open and close the
  6547. stream.
  6548. </para>
  6549. <para>
  6550. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  6551. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  6552. respective values at the time of this call will be applied to the
  6553. <c>ZipEntry</c> added.
  6554. </para>
  6555. </remarks>
  6556. <example>
  6557. This example uses anonymous methods in C# to open and close the
  6558. source stream for the content for a zip entry. In a real
  6559. application, the logic for the OpenDelegate would probably be more
  6560. involved.
  6561. <code lang="C#">
  6562. using(Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile())
  6563. {
  6564. zip.AddEntry(zipEntryName,
  6565. (name) =&gt; File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ),
  6566. (name, stream) =&gt; stream.Close()
  6567. );
  6568. zip.Save(zipFileName);
  6569. }
  6570. </code>
  6571. </example>
  6572. <example>
  6573. This example uses delegates in VB.NET to open and close the
  6574. the source stream for the content for a zip entry. VB 9.0 lacks
  6575. support for "Sub" lambda expressions, and so the CloseDelegate must
  6576. be an actual, named Sub.
  6577. <code lang="VB">
  6578. Function MyStreamOpener(ByVal entryName As String) As Stream
  6579. '' This simply opens a file. You probably want to do somethinig
  6580. '' more involved here: open a stream to read from a database,
  6581. '' open a stream on an HTTP connection, and so on.
  6582. Return File.OpenRead(entryName)
  6583. End Function
  6584. Sub MyStreamCloser(entryName As String, stream As Stream)
  6585. stream.Close()
  6586. End Sub
  6587. Public Sub Run()
  6588. Dim dirToZip As String = "fodder"
  6589. Dim zipFileToCreate As String = "Archive.zip"
  6590. Dim opener As OpenDelegate = AddressOf MyStreamOpener
  6591. Dim closer As CloseDelegate = AddressOf MyStreamCloser
  6592. Dim numFilestoAdd As Int32 = 4
  6593. Using zip As ZipFile = New ZipFile
  6594. Dim i As Integer
  6595. For i = 0 To numFilesToAdd - 1
  6596. zip.AddEntry(String.Format("content-{0:000}.txt"), opener, closer)
  6597. Next i
  6598. zip.Save(zipFileToCreate)
  6599. End Using
  6600. End Sub
  6601. </code>
  6602. </example>
  6603. <param name="entryName">the name of the entry to add</param>
  6604. <param name="opener">
  6605. the delegate that will be invoked to open the stream
  6606. </param>
  6607. <param name="closer">
  6608. the delegate that will be invoked to close the stream
  6609. </param>
  6610. <returns>the ZipEntry added</returns>
  6611. </member>
  6612. <member name="M:Ionic.Zip.ZipFile.UpdateEntry(System.String,System.String)">
  6613. <summary>
  6614. Updates the given entry in the <c>ZipFile</c>, using the given
  6615. string as content for the <c>ZipEntry</c>.
  6616. </summary>
  6617. <remarks>
  6618. <para>
  6619. Calling this method is equivalent to removing the <c>ZipEntry</c> for
  6620. the given file name and directory path, if it exists, and then calling
  6621. <see cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,System.String)"/>. See the documentation for
  6622. that method for further explanation. The string content is encoded
  6623. using the default encoding for the machine, or on Silverlight, using
  6624. UTF-8. This encoding is distinct from the encoding used for the
  6625. filename itself. See <see cref="P:Ionic.Zip.ZipFile.AlternateEncoding"/>.
  6626. </para>
  6627. </remarks>
  6628. <param name="entryName">
  6629. The name, including any path, to use within the archive for the entry.
  6630. </param>
  6631. <param name="content">
  6632. The content of the file, should it be extracted from the zip.
  6633. </param>
  6634. <returns>The <c>ZipEntry</c> added.</returns>
  6635. </member>
  6636. <member name="M:Ionic.Zip.ZipFile.UpdateEntry(System.String,System.String,System.Text.Encoding)">
  6637. <summary>
  6638. Updates the given entry in the <c>ZipFile</c>, using the given string as
  6639. content for the <c>ZipEntry</c>.
  6640. </summary>
  6641. <remarks>
  6642. Calling this method is equivalent to removing the <c>ZipEntry</c> for the
  6643. given file name and directory path, if it exists, and then calling <see cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,System.String,System.Text.Encoding)"/>. See the
  6644. documentation for that method for further explanation.
  6645. </remarks>
  6646. <param name="entryName">
  6647. The name, including any path, to use within the archive for the entry.
  6648. </param>
  6649. <param name="content">
  6650. The content of the file, should it be extracted from the zip.
  6651. </param>
  6652. <param name="encoding">
  6653. The text encoding to use when encoding the string. Be aware: This is
  6654. distinct from the text encoding used to encode the filename. See <see cref="P:Ionic.Zip.ZipFile.AlternateEncoding"/>.
  6655. </param>
  6656. <returns>The <c>ZipEntry</c> added.</returns>
  6657. </member>
  6658. <member name="M:Ionic.Zip.ZipFile.UpdateEntry(System.String,Ionic.Zip.WriteDelegate)">
  6659. <summary>
  6660. Updates the given entry in the <c>ZipFile</c>, using the given delegate
  6661. as the source for content for the <c>ZipEntry</c>.
  6662. </summary>
  6663. <remarks>
  6664. Calling this method is equivalent to removing the <c>ZipEntry</c> for the
  6665. given file name and directory path, if it exists, and then calling <see cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,Ionic.Zip.WriteDelegate)"/>. See the
  6666. documentation for that method for further explanation.
  6667. </remarks>
  6668. <param name="entryName">
  6669. The name, including any path, to use within the archive for the entry.
  6670. </param>
  6671. <param name="writer">the delegate which will write the entry content.</param>
  6672. <returns>The <c>ZipEntry</c> added.</returns>
  6673. </member>
  6674. <member name="M:Ionic.Zip.ZipFile.UpdateEntry(System.String,Ionic.Zip.OpenDelegate,Ionic.Zip.CloseDelegate)">
  6675. <summary>
  6676. Updates the given entry in the <c>ZipFile</c>, using the given delegates
  6677. to open and close the stream that provides the content for the <c>ZipEntry</c>.
  6678. </summary>
  6679. <remarks>
  6680. Calling this method is equivalent to removing the <c>ZipEntry</c> for the
  6681. given file name and directory path, if it exists, and then calling <see cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,Ionic.Zip.OpenDelegate,Ionic.Zip.CloseDelegate)"/>. See the
  6682. documentation for that method for further explanation.
  6683. </remarks>
  6684. <param name="entryName">
  6685. The name, including any path, to use within the archive for the entry.
  6686. </param>
  6687. <param name="opener">
  6688. the delegate that will be invoked to open the stream
  6689. </param>
  6690. <param name="closer">
  6691. the delegate that will be invoked to close the stream
  6692. </param>
  6693. <returns>The <c>ZipEntry</c> added or updated.</returns>
  6694. </member>
  6695. <member name="M:Ionic.Zip.ZipFile.UpdateEntry(System.String,System.IO.Stream)">
  6696. <summary>
  6697. Updates the given entry in the <c>ZipFile</c>, using the given stream as
  6698. input, and the given filename and given directory Path.
  6699. </summary>
  6700. <remarks>
  6701. <para>
  6702. Calling the method is equivalent to calling <c>RemoveEntry()</c> if an
  6703. entry by the same name already exists, and then calling <c>AddEntry()</c>
  6704. with the given <c>fileName</c> and stream.
  6705. </para>
  6706. <para>
  6707. The stream must be open and readable during the call to
  6708. <c>ZipFile.Save</c>. You can dispense the stream on a just-in-time basis
  6709. using the <see cref="P:Ionic.Zip.ZipEntry.InputStream"/> property. Check the
  6710. documentation of that property for more information.
  6711. </para>
  6712. <para>
  6713. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  6714. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  6715. respective values at the time of this call will be applied to the
  6716. <c>ZipEntry</c> added.
  6717. </para>
  6718. </remarks>
  6719. <seealso cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,System.IO.Stream)"/>
  6720. <seealso cref="P:Ionic.Zip.ZipEntry.InputStream"/>
  6721. <param name="entryName">
  6722. The name, including any path, to use within the archive for the entry.
  6723. </param>
  6724. <param name="stream">The input stream from which to read file data.</param>
  6725. <returns>The <c>ZipEntry</c> added.</returns>
  6726. </member>
  6727. <member name="M:Ionic.Zip.ZipFile.AddEntry(System.String,System.Byte[])">
  6728. <summary>
  6729. Add an entry into the zip archive using the given filename and
  6730. directory path within the archive, and the given content for the
  6731. file. No file is created in the filesystem.
  6732. </summary>
  6733. <param name="byteContent">The data to use for the entry.</param>
  6734. <param name="entryName">
  6735. The name, including any path, to use within the archive for the entry.
  6736. </param>
  6737. <returns>The <c>ZipEntry</c> added.</returns>
  6738. </member>
  6739. <member name="M:Ionic.Zip.ZipFile.UpdateEntry(System.String,System.Byte[])">
  6740. <summary>
  6741. Updates the given entry in the <c>ZipFile</c>, using the given byte
  6742. array as content for the entry.
  6743. </summary>
  6744. <remarks>
  6745. Calling this method is equivalent to removing the <c>ZipEntry</c>
  6746. for the given filename and directory path, if it exists, and then
  6747. calling <see cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,System.Byte[])"/>. See the
  6748. documentation for that method for further explanation.
  6749. </remarks>
  6750. <param name="entryName">
  6751. The name, including any path, to use within the archive for the entry.
  6752. </param>
  6753. <param name="byteContent">The content to use for the <c>ZipEntry</c>.</param>
  6754. <returns>The <c>ZipEntry</c> added.</returns>
  6755. </member>
  6756. <member name="M:Ionic.Zip.ZipFile.AddDirectory(System.String)">
  6757. <summary>
  6758. Adds the contents of a filesystem directory to a Zip file archive.
  6759. </summary>
  6760. <remarks>
  6761. <para>
  6762. The name of the directory may be a relative path or a fully-qualified
  6763. path. Any files within the named directory are added to the archive. Any
  6764. subdirectories within the named directory are also added to the archive,
  6765. recursively.
  6766. </para>
  6767. <para>
  6768. Top-level entries in the named directory will appear as top-level entries
  6769. in the zip archive. Entries in subdirectories in the named directory will
  6770. result in entries in subdirectories in the zip archive.
  6771. </para>
  6772. <para>
  6773. If you want the entries to appear in a containing directory in the zip
  6774. archive itself, then you should call the AddDirectory() overload that
  6775. allows you to explicitly specify a directory path for use in the archive.
  6776. </para>
  6777. <para>
  6778. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  6779. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  6780. respective values at the time of this call will be applied to each
  6781. ZipEntry added.
  6782. </para>
  6783. </remarks>
  6784. <seealso cref="M:Ionic.Zip.ZipFile.AddItem(System.String)"/>
  6785. <seealso cref="M:Ionic.Zip.ZipFile.AddFile(System.String)"/>
  6786. <seealso cref="M:Ionic.Zip.ZipFile.UpdateDirectory(System.String)"/>
  6787. <seealso cref="M:Ionic.Zip.ZipFile.AddDirectory(System.String,System.String)"/>
  6788. <overloads>This method has 2 overloads.</overloads>
  6789. <param name="directoryName">The name of the directory to add.</param>
  6790. <returns>The <c>ZipEntry</c> added.</returns>
  6791. </member>
  6792. <member name="M:Ionic.Zip.ZipFile.AddDirectory(System.String,System.String)">
  6793. <summary>
  6794. Adds the contents of a filesystem directory to a Zip file archive,
  6795. overriding the path to be used for entries in the archive.
  6796. </summary>
  6797. <remarks>
  6798. <para>
  6799. The name of the directory may be a relative path or a fully-qualified
  6800. path. The add operation is recursive, so that any files or subdirectories
  6801. within the name directory are also added to the archive.
  6802. </para>
  6803. <para>
  6804. Top-level entries in the named directory will appear as top-level entries
  6805. in the zip archive. Entries in subdirectories in the named directory will
  6806. result in entries in subdirectories in the zip archive.
  6807. </para>
  6808. <para>
  6809. For <c>ZipFile</c> properties including <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.SetCompression"/>, <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>, <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>,
  6810. <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, their
  6811. respective values at the time of this call will be applied to each
  6812. ZipEntry added.
  6813. </para>
  6814. </remarks>
  6815. <example>
  6816. <para>
  6817. In this code, calling the ZipUp() method with a value of "c:\reports" for
  6818. the directory parameter will result in a zip file structure in which all
  6819. entries are contained in a toplevel "reports" directory.
  6820. </para>
  6821. <code lang="C#">
  6822. public void ZipUp(string targetZip, string directory)
  6823. {
  6824. using (var zip = new ZipFile())
  6825. {
  6826. zip.AddDirectory(directory, System.IO.Path.GetFileName(directory));
  6827. zip.Save(targetZip);
  6828. }
  6829. }
  6830. </code>
  6831. </example>
  6832. <seealso cref="M:Ionic.Zip.ZipFile.AddItem(System.String,System.String)"/>
  6833. <seealso cref="M:Ionic.Zip.ZipFile.AddFile(System.String,System.String)"/>
  6834. <seealso cref="M:Ionic.Zip.ZipFile.UpdateDirectory(System.String,System.String)"/>
  6835. <param name="directoryName">The name of the directory to add.</param>
  6836. <param name="directoryPathInArchive">
  6837. Specifies a directory path to use to override any path in the
  6838. DirectoryName. This path may, or may not, correspond to a real directory
  6839. in the current filesystem. If the zip is later extracted, this is the
  6840. path used for the extracted file or directory. Passing <c>null</c>
  6841. (<c>Nothing</c> in VB) or the empty string ("") will insert the items at
  6842. the root path within the archive.
  6843. </param>
  6844. <returns>The <c>ZipEntry</c> added.</returns>
  6845. </member>
  6846. <member name="M:Ionic.Zip.ZipFile.AddDirectoryByName(System.String)">
  6847. <summary>
  6848. Creates a directory in the zip archive.
  6849. </summary>
  6850. <remarks>
  6851. <para>
  6852. Use this when you want to create a directory in the archive but there is
  6853. no corresponding filesystem representation for that directory.
  6854. </para>
  6855. <para>
  6856. You will probably not need to do this in your code. One of the only times
  6857. you will want to do this is if you want an empty directory in the zip
  6858. archive. The reason: if you add a file to a zip archive that is stored
  6859. within a multi-level directory, all of the directory tree is implicitly
  6860. created in the zip archive.
  6861. </para>
  6862. </remarks>
  6863. <param name="directoryNameInArchive">
  6864. The name of the directory to create in the archive.
  6865. </param>
  6866. <returns>The <c>ZipEntry</c> added.</returns>
  6867. </member>
  6868. <member name="M:Ionic.Zip.ZipFile.CheckZip(System.String)">
  6869. <summary>
  6870. Checks a zip file to see if its directory is consistent.
  6871. </summary>
  6872. <remarks>
  6873. <para>
  6874. In cases of data error, the directory within a zip file can get out
  6875. of synch with the entries in the zip file. This method checks the
  6876. given zip file and returns true if this has occurred.
  6877. </para>
  6878. <para> This method may take a long time to run for large zip files. </para>
  6879. <para>
  6880. This method is not supported in the Reduced or Compact Framework
  6881. versions of DotNetZip.
  6882. </para>
  6883. <para>
  6884. Developers using COM can use the <see cref="M:Ionic.Zip.ComHelper.CheckZip(System.String)">ComHelper.CheckZip(String)</see>
  6885. method.
  6886. </para>
  6887. </remarks>
  6888. <param name="zipFileName">The filename to of the zip file to check.</param>
  6889. <returns>true if the named zip file checks OK. Otherwise, false. </returns>
  6890. <seealso cref="M:Ionic.Zip.ZipFile.FixZipDirectory(System.String)"/>
  6891. <seealso cref="M:Ionic.Zip.ZipFile.CheckZip(System.String,System.Boolean,System.IO.TextWriter)"/>
  6892. </member>
  6893. <member name="M:Ionic.Zip.ZipFile.CheckZip(System.String,System.Boolean,System.IO.TextWriter)">
  6894. <summary>
  6895. Checks a zip file to see if its directory is consistent,
  6896. and optionally fixes the directory if necessary.
  6897. </summary>
  6898. <remarks>
  6899. <para>
  6900. In cases of data error, the directory within a zip file can get out of
  6901. synch with the entries in the zip file. This method checks the given
  6902. zip file, and returns true if this has occurred. It also optionally
  6903. fixes the zipfile, saving the fixed copy in <em>Name</em>_Fixed.zip.
  6904. </para>
  6905. <para>
  6906. This method may take a long time to run for large zip files. It
  6907. will take even longer if the file actually needs to be fixed, and if
  6908. <c>fixIfNecessary</c> is true.
  6909. </para>
  6910. <para>
  6911. This method is not supported in the Reduced or Compact
  6912. Framework versions of DotNetZip.
  6913. </para>
  6914. </remarks>
  6915. <param name="zipFileName">The filename to of the zip file to check.</param>
  6916. <param name="fixIfNecessary">If true, the method will fix the zip file if
  6917. necessary.</param>
  6918. <param name="writer">
  6919. a TextWriter in which messages generated while checking will be written.
  6920. </param>
  6921. <returns>true if the named zip is OK; false if the file needs to be fixed.</returns>
  6922. <seealso cref="M:Ionic.Zip.ZipFile.CheckZip(System.String)"/>
  6923. <seealso cref="M:Ionic.Zip.ZipFile.FixZipDirectory(System.String)"/>
  6924. </member>
  6925. <member name="M:Ionic.Zip.ZipFile.FixZipDirectory(System.String)">
  6926. <summary>
  6927. Rewrite the directory within a zipfile.
  6928. </summary>
  6929. <remarks>
  6930. <para>
  6931. In cases of data error, the directory in a zip file can get out of
  6932. synch with the entries in the zip file. This method attempts to fix
  6933. the zip file if this has occurred.
  6934. </para>
  6935. <para> This can take a long time for large zip files. </para>
  6936. <para> This won't work if the zip file uses a non-standard
  6937. code page - neither IBM437 nor UTF-8. </para>
  6938. <para>
  6939. This method is not supported in the Reduced or Compact Framework
  6940. versions of DotNetZip.
  6941. </para>
  6942. <para>
  6943. Developers using COM can use the <see cref="M:Ionic.Zip.ComHelper.FixZipDirectory(System.String)">ComHelper.FixZipDirectory(String)</see>
  6944. method.
  6945. </para>
  6946. </remarks>
  6947. <param name="zipFileName">The filename to of the zip file to fix.</param>
  6948. <seealso cref="M:Ionic.Zip.ZipFile.CheckZip(System.String)"/>
  6949. <seealso cref="M:Ionic.Zip.ZipFile.CheckZip(System.String,System.Boolean,System.IO.TextWriter)"/>
  6950. </member>
  6951. <member name="M:Ionic.Zip.ZipFile.CheckZipPassword(System.String,System.String)">
  6952. <summary>
  6953. Verify the password on a zip file.
  6954. </summary>
  6955. <remarks>
  6956. <para>
  6957. Keep in mind that passwords in zipfiles are applied to
  6958. zip entries, not to the entire zip file. So testing a
  6959. zipfile for a particular password doesn't work in the
  6960. general case. On the other hand, it's often the case
  6961. that a single password will be used on all entries in a
  6962. zip file. This method works for that case.
  6963. </para>
  6964. <para>
  6965. There is no way to check a password without doing the
  6966. decryption. So this code decrypts and extracts the given
  6967. zipfile into <see cref="F:System.IO.Stream.Null"/>
  6968. </para>
  6969. </remarks>
  6970. <param name="zipFileName">The filename to of the zip file to fix.</param>
  6971. <param name="password">The password to check.</param>
  6972. <returns>a bool indicating whether the password matches.</returns>
  6973. </member>
  6974. <member name="M:Ionic.Zip.ZipFile.ContainsEntry(System.String)">
  6975. <summary>
  6976. Returns true if an entry by the given name exists in the ZipFile.
  6977. </summary>
  6978. <param name='name'>the name of the entry to find</param>
  6979. <returns>true if an entry with the given name exists; otherwise false.
  6980. </returns>
  6981. </member>
  6982. <member name="M:Ionic.Zip.ZipFile.ToString">
  6983. <summary>Provides a string representation of the instance.</summary>
  6984. <returns>a string representation of the instance.</returns>
  6985. </member>
  6986. <member name="M:Ionic.Zip.ZipFile.#ctor(System.String)">
  6987. <summary>
  6988. Creates a new <c>ZipFile</c> instance, using the specified filename.
  6989. </summary>
  6990. <remarks>
  6991. <para>
  6992. Applications can use this constructor to create a new ZipFile for writing,
  6993. or to slurp in an existing zip archive for read and update purposes.
  6994. </para>
  6995. <para>
  6996. To create a new zip archive, an application can call this constructor,
  6997. passing the name of a file that does not exist. The name may be a fully
  6998. qualified path. Then the application can add directories or files to the
  6999. <c>ZipFile</c> via <c>AddDirectory()</c>, <c>AddFile()</c>, <c>AddItem()</c>
  7000. and then write the zip archive to the disk by calling <c>Save()</c>. The
  7001. zip file is not actually opened and written to the disk until the
  7002. application calls <c>ZipFile.Save()</c>. At that point the new zip file
  7003. with the given name is created.
  7004. </para>
  7005. <para>
  7006. If you won't know the name of the <c>Zipfile</c> until the time you call
  7007. <c>ZipFile.Save()</c>, or if you plan to save to a stream (which has no
  7008. name), then you should use the no-argument constructor.
  7009. </para>
  7010. <para>
  7011. The application can also call this constructor to read an existing zip
  7012. archive. passing the name of a valid zip file that does exist. But, it's
  7013. better form to use the static <see cref="M:Ionic.Zip.ZipFile.Read(System.String)"/> method,
  7014. passing the name of the zip file, because using <c>ZipFile.Read()</c> in
  7015. your code communicates very clearly what you are doing. In either case,
  7016. the file is then read into the <c>ZipFile</c> instance. The app can then
  7017. enumerate the entries or can modify the zip file, for example adding
  7018. entries, removing entries, changing comments, and so on.
  7019. </para>
  7020. <para>
  7021. One advantage to this parameterized constructor: it allows applications to
  7022. use the same code to add items to a zip archive, regardless of whether the
  7023. zip file exists.
  7024. </para>
  7025. <para>
  7026. Instances of the <c>ZipFile</c> class are not multi-thread safe. You may
  7027. not party on a single instance with multiple threads. You may have
  7028. multiple threads that each use a distinct <c>ZipFile</c> instance, or you
  7029. can synchronize multi-thread access to a single instance.
  7030. </para>
  7031. <para>
  7032. By the way, since DotNetZip is so easy to use, don't you think <see href="http://cheeso.members.winisp.net/DotNetZipDonate.aspx">you should
  7033. donate $5 or $10</see>?
  7034. </para>
  7035. </remarks>
  7036. <exception cref="T:Ionic.Zip.ZipException">
  7037. Thrown if name refers to an existing file that is not a valid zip file.
  7038. </exception>
  7039. <example>
  7040. This example shows how to create a zipfile, and add a few files into it.
  7041. <code>
  7042. String ZipFileToCreate = "archive1.zip";
  7043. String DirectoryToZip = "c:\\reports";
  7044. using (ZipFile zip = new ZipFile())
  7045. {
  7046. // Store all files found in the top level directory, into the zip archive.
  7047. String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip);
  7048. zip.AddFiles(filenames, "files");
  7049. zip.Save(ZipFileToCreate);
  7050. }
  7051. </code>
  7052. <code lang="VB">
  7053. Dim ZipFileToCreate As String = "archive1.zip"
  7054. Dim DirectoryToZip As String = "c:\reports"
  7055. Using zip As ZipFile = New ZipFile()
  7056. Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip)
  7057. zip.AddFiles(filenames, "files")
  7058. zip.Save(ZipFileToCreate)
  7059. End Using
  7060. </code>
  7061. </example>
  7062. <param name="fileName">The filename to use for the new zip archive.</param>
  7063. </member>
  7064. <member name="M:Ionic.Zip.ZipFile.#ctor(System.String,System.Text.Encoding)">
  7065. <summary>
  7066. Creates a new <c>ZipFile</c> instance, using the specified name for the
  7067. filename, and the specified Encoding.
  7068. </summary>
  7069. <remarks>
  7070. <para>
  7071. See the documentation on the <see cref="M:Ionic.Zip.ZipFile.#ctor(System.String)">ZipFile
  7072. constructor that accepts a single string argument</see> for basic
  7073. information on all the <c>ZipFile</c> constructors.
  7074. </para>
  7075. <para>
  7076. The Encoding is used as the default alternate encoding for entries with
  7077. filenames or comments that cannot be encoded with the IBM437 code page.
  7078. This is equivalent to setting the <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/> property on the <c>ZipFile</c>
  7079. instance after construction.
  7080. </para>
  7081. <para>
  7082. Instances of the <c>ZipFile</c> class are not multi-thread safe. You may
  7083. not party on a single instance with multiple threads. You may have
  7084. multiple threads that each use a distinct <c>ZipFile</c> instance, or you
  7085. can synchronize multi-thread access to a single instance.
  7086. </para>
  7087. </remarks>
  7088. <exception cref="T:Ionic.Zip.ZipException">
  7089. Thrown if name refers to an existing file that is not a valid zip file.
  7090. </exception>
  7091. <param name="fileName">The filename to use for the new zip archive.</param>
  7092. <param name="encoding">The Encoding is used as the default alternate
  7093. encoding for entries with filenames or comments that cannot be encoded
  7094. with the IBM437 code page. </param>
  7095. </member>
  7096. <member name="M:Ionic.Zip.ZipFile.#ctor">
  7097. <summary>
  7098. Create a zip file, without specifying a target filename or stream to save to.
  7099. </summary>
  7100. <remarks>
  7101. <para>
  7102. See the documentation on the <see cref="M:Ionic.Zip.ZipFile.#ctor(System.String)">ZipFile
  7103. constructor that accepts a single string argument</see> for basic
  7104. information on all the <c>ZipFile</c> constructors.
  7105. </para>
  7106. <para>
  7107. After instantiating with this constructor and adding entries to the
  7108. archive, the application should call <see cref="M:Ionic.Zip.ZipFile.Save(System.String)"/> or
  7109. <see cref="M:Ionic.Zip.ZipFile.Save(System.IO.Stream)"/> to save to a file or a
  7110. stream, respectively. The application can also set the <see cref="P:Ionic.Zip.ZipFile.Name"/>
  7111. property and then call the no-argument <see cref="M:Ionic.Zip.ZipFile.Save"/> method. (This
  7112. is the preferred approach for applications that use the library through
  7113. COM interop.) If you call the no-argument <see cref="M:Ionic.Zip.ZipFile.Save"/> method
  7114. without having set the <c>Name</c> of the <c>ZipFile</c>, either through
  7115. the parameterized constructor or through the explicit property , the
  7116. Save() will throw, because there is no place to save the file. </para>
  7117. <para>
  7118. Instances of the <c>ZipFile</c> class are not multi-thread safe. You may
  7119. have multiple threads that each use a distinct <c>ZipFile</c> instance, or
  7120. you can synchronize multi-thread access to a single instance. </para>
  7121. </remarks>
  7122. <example>
  7123. This example creates a Zip archive called Backup.zip, containing all the files
  7124. in the directory DirectoryToZip. Files within subdirectories are not zipped up.
  7125. <code>
  7126. using (ZipFile zip = new ZipFile())
  7127. {
  7128. // Store all files found in the top level directory, into the zip archive.
  7129. // note: this code does not recurse subdirectories!
  7130. String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip);
  7131. zip.AddFiles(filenames, "files");
  7132. zip.Save("Backup.zip");
  7133. }
  7134. </code>
  7135. <code lang="VB">
  7136. Using zip As New ZipFile
  7137. ' Store all files found in the top level directory, into the zip archive.
  7138. ' note: this code does not recurse subdirectories!
  7139. Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip)
  7140. zip.AddFiles(filenames, "files")
  7141. zip.Save("Backup.zip")
  7142. End Using
  7143. </code>
  7144. </example>
  7145. </member>
  7146. <member name="M:Ionic.Zip.ZipFile.#ctor(System.Text.Encoding)">
  7147. <summary>
  7148. Create a zip file, specifying a text Encoding, but without specifying a
  7149. target filename or stream to save to.
  7150. </summary>
  7151. <remarks>
  7152. <para>
  7153. See the documentation on the <see cref="M:Ionic.Zip.ZipFile.#ctor(System.String)">ZipFile
  7154. constructor that accepts a single string argument</see> for basic
  7155. information on all the <c>ZipFile</c> constructors.
  7156. </para>
  7157. </remarks>
  7158. <param name="encoding">
  7159. The Encoding is used as the default alternate encoding for entries with
  7160. filenames or comments that cannot be encoded with the IBM437 code page.
  7161. </param>
  7162. </member>
  7163. <member name="M:Ionic.Zip.ZipFile.#ctor(System.String,System.IO.TextWriter)">
  7164. <summary>
  7165. Creates a new <c>ZipFile</c> instance, using the specified name for the
  7166. filename, and the specified status message writer.
  7167. </summary>
  7168. <remarks>
  7169. <para>
  7170. See the documentation on the <see cref="M:Ionic.Zip.ZipFile.#ctor(System.String)">ZipFile
  7171. constructor that accepts a single string argument</see> for basic
  7172. information on all the <c>ZipFile</c> constructors.
  7173. </para>
  7174. <para>
  7175. This version of the constructor allows the caller to pass in a TextWriter,
  7176. to which verbose messages will be written during extraction or creation of
  7177. the zip archive. A console application may wish to pass
  7178. System.Console.Out to get messages on the Console. A graphical or headless
  7179. application may wish to capture the messages in a different
  7180. <c>TextWriter</c>, for example, a <c>StringWriter</c>, and then display
  7181. the messages in a TextBox, or generate an audit log of ZipFile operations.
  7182. </para>
  7183. <para>
  7184. To encrypt the data for the files added to the <c>ZipFile</c> instance,
  7185. set the Password property after creating the <c>ZipFile</c> instance.
  7186. </para>
  7187. <para>
  7188. Instances of the <c>ZipFile</c> class are not multi-thread safe. You may
  7189. not party on a single instance with multiple threads. You may have
  7190. multiple threads that each use a distinct <c>ZipFile</c> instance, or you
  7191. can synchronize multi-thread access to a single instance.
  7192. </para>
  7193. </remarks>
  7194. <exception cref="T:Ionic.Zip.ZipException">
  7195. Thrown if name refers to an existing file that is not a valid zip file.
  7196. </exception>
  7197. <example>
  7198. <code>
  7199. using (ZipFile zip = new ZipFile("Backup.zip", Console.Out))
  7200. {
  7201. // Store all files found in the top level directory, into the zip archive.
  7202. // note: this code does not recurse subdirectories!
  7203. // Status messages will be written to Console.Out
  7204. String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip);
  7205. zip.AddFiles(filenames);
  7206. zip.Save();
  7207. }
  7208. </code>
  7209. <code lang="VB">
  7210. Using zip As New ZipFile("Backup.zip", Console.Out)
  7211. ' Store all files found in the top level directory, into the zip archive.
  7212. ' note: this code does not recurse subdirectories!
  7213. ' Status messages will be written to Console.Out
  7214. Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip)
  7215. zip.AddFiles(filenames)
  7216. zip.Save()
  7217. End Using
  7218. </code>
  7219. </example>
  7220. <param name="fileName">The filename to use for the new zip archive.</param>
  7221. <param name="statusMessageWriter">A TextWriter to use for writing
  7222. verbose status messages.</param>
  7223. </member>
  7224. <member name="M:Ionic.Zip.ZipFile.#ctor(System.String,System.IO.TextWriter,System.Text.Encoding)">
  7225. <summary>
  7226. Creates a new <c>ZipFile</c> instance, using the specified name for the
  7227. filename, the specified status message writer, and the specified Encoding.
  7228. </summary>
  7229. <remarks>
  7230. <para>
  7231. This constructor works like the <see cref="M:Ionic.Zip.ZipFile.#ctor(System.String)">ZipFile
  7232. constructor that accepts a single string argument.</see> See that
  7233. reference for detail on what this constructor does.
  7234. </para>
  7235. <para>
  7236. This version of the constructor allows the caller to pass in a
  7237. <c>TextWriter</c>, and an Encoding. The <c>TextWriter</c> will collect
  7238. verbose messages that are generated by the library during extraction or
  7239. creation of the zip archive. A console application may wish to pass
  7240. <c>System.Console.Out</c> to get messages on the Console. A graphical or
  7241. headless application may wish to capture the messages in a different
  7242. <c>TextWriter</c>, for example, a <c>StringWriter</c>, and then display
  7243. the messages in a <c>TextBox</c>, or generate an audit log of
  7244. <c>ZipFile</c> operations.
  7245. </para>
  7246. <para>
  7247. The <c>Encoding</c> is used as the default alternate encoding for entries
  7248. with filenames or comments that cannot be encoded with the IBM437 code
  7249. page. This is a equivalent to setting the <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/> property on the <c>ZipFile</c>
  7250. instance after construction.
  7251. </para>
  7252. <para>
  7253. To encrypt the data for the files added to the <c>ZipFile</c> instance,
  7254. set the <c>Password</c> property after creating the <c>ZipFile</c>
  7255. instance.
  7256. </para>
  7257. <para>
  7258. Instances of the <c>ZipFile</c> class are not multi-thread safe. You may
  7259. not party on a single instance with multiple threads. You may have
  7260. multiple threads that each use a distinct <c>ZipFile</c> instance, or you
  7261. can synchronize multi-thread access to a single instance.
  7262. </para>
  7263. </remarks>
  7264. <exception cref="T:Ionic.Zip.ZipException">
  7265. Thrown if <c>fileName</c> refers to an existing file that is not a valid zip file.
  7266. </exception>
  7267. <param name="fileName">The filename to use for the new zip archive.</param>
  7268. <param name="statusMessageWriter">A TextWriter to use for writing verbose
  7269. status messages.</param>
  7270. <param name="encoding">
  7271. The Encoding is used as the default alternate encoding for entries with
  7272. filenames or comments that cannot be encoded with the IBM437 code page.
  7273. </param>
  7274. </member>
  7275. <member name="M:Ionic.Zip.ZipFile.Initialize(System.String)">
  7276. <summary>
  7277. Initialize a <c>ZipFile</c> instance by reading in a zip file.
  7278. </summary>
  7279. <remarks>
  7280. <para>
  7281. This method is primarily useful from COM Automation environments, when
  7282. reading or extracting zip files. In COM, it is not possible to invoke
  7283. parameterized constructors for a class. A COM Automation application can
  7284. update a zip file by using the <see cref="M:Ionic.Zip.ZipFile.#ctor">default (no argument)
  7285. constructor</see>, then calling <c>Initialize()</c> to read the contents
  7286. of an on-disk zip archive into the <c>ZipFile</c> instance.
  7287. </para>
  7288. <para>
  7289. .NET applications are encouraged to use the <c>ZipFile.Read()</c> methods
  7290. for better clarity.
  7291. </para>
  7292. </remarks>
  7293. <param name="fileName">the name of the existing zip file to read in.</param>
  7294. </member>
  7295. <member name="M:Ionic.Zip.ZipFile.RemoveEntry(Ionic.Zip.ZipEntry)">
  7296. <summary>
  7297. Removes the given <c>ZipEntry</c> from the zip archive.
  7298. </summary>
  7299. <remarks>
  7300. <para>
  7301. After calling <c>RemoveEntry</c>, the application must call <c>Save</c> to
  7302. make the changes permanent.
  7303. </para>
  7304. </remarks>
  7305. <exception cref="T:System.ArgumentException">
  7306. Thrown if the specified <c>ZipEntry</c> does not exist in the <c>ZipFile</c>.
  7307. </exception>
  7308. <example>
  7309. In this example, all entries in the zip archive dating from before
  7310. December 31st, 2007, are removed from the archive. This is actually much
  7311. easier if you use the RemoveSelectedEntries method. But I needed an
  7312. example for RemoveEntry, so here it is.
  7313. <code>
  7314. String ZipFileToRead = "ArchiveToModify.zip";
  7315. System.DateTime Threshold = new System.DateTime(2007,12,31);
  7316. using (ZipFile zip = ZipFile.Read(ZipFileToRead))
  7317. {
  7318. var EntriesToRemove = new System.Collections.Generic.List&lt;ZipEntry&gt;();
  7319. foreach (ZipEntry e in zip)
  7320. {
  7321. if (e.LastModified &lt; Threshold)
  7322. {
  7323. // We cannot remove the entry from the list, within the context of
  7324. // an enumeration of said list.
  7325. // So we add the doomed entry to a list to be removed later.
  7326. EntriesToRemove.Add(e);
  7327. }
  7328. }
  7329. // actually remove the doomed entries.
  7330. foreach (ZipEntry zombie in EntriesToRemove)
  7331. zip.RemoveEntry(zombie);
  7332. zip.Comment= String.Format("This zip archive was updated at {0}.",
  7333. System.DateTime.Now.ToString("G"));
  7334. // save with a different name
  7335. zip.Save("Archive-Updated.zip");
  7336. }
  7337. </code>
  7338. <code lang="VB">
  7339. Dim ZipFileToRead As String = "ArchiveToModify.zip"
  7340. Dim Threshold As New DateTime(2007, 12, 31)
  7341. Using zip As ZipFile = ZipFile.Read(ZipFileToRead)
  7342. Dim EntriesToRemove As New System.Collections.Generic.List(Of ZipEntry)
  7343. Dim e As ZipEntry
  7344. For Each e In zip
  7345. If (e.LastModified &lt; Threshold) Then
  7346. ' We cannot remove the entry from the list, within the context of
  7347. ' an enumeration of said list.
  7348. ' So we add the doomed entry to a list to be removed later.
  7349. EntriesToRemove.Add(e)
  7350. End If
  7351. Next
  7352. ' actually remove the doomed entries.
  7353. Dim zombie As ZipEntry
  7354. For Each zombie In EntriesToRemove
  7355. zip.RemoveEntry(zombie)
  7356. Next
  7357. zip.Comment = String.Format("This zip archive was updated at {0}.", DateTime.Now.ToString("G"))
  7358. 'save as a different name
  7359. zip.Save("Archive-Updated.zip")
  7360. End Using
  7361. </code>
  7362. </example>
  7363. <param name="entry">
  7364. The <c>ZipEntry</c> to remove from the zip.
  7365. </param>
  7366. <seealso cref="M:Ionic.Zip.ZipFile.RemoveSelectedEntries(System.String)"/>
  7367. </member>
  7368. <member name="M:Ionic.Zip.ZipFile.RemoveEntry(System.String)">
  7369. <summary>
  7370. Removes the <c>ZipEntry</c> with the given filename from the zip archive.
  7371. </summary>
  7372. <remarks>
  7373. <para>
  7374. After calling <c>RemoveEntry</c>, the application must call <c>Save</c> to
  7375. make the changes permanent.
  7376. </para>
  7377. </remarks>
  7378. <exception cref="T:System.InvalidOperationException">
  7379. Thrown if the <c>ZipFile</c> is not updatable.
  7380. </exception>
  7381. <exception cref="T:System.ArgumentException">
  7382. Thrown if a <c>ZipEntry</c> with the specified filename does not exist in
  7383. the <c>ZipFile</c>.
  7384. </exception>
  7385. <example>
  7386. This example shows one way to remove an entry with a given filename from
  7387. an existing zip archive.
  7388. <code>
  7389. String zipFileToRead= "PackedDocuments.zip";
  7390. string candidate = "DatedMaterial.xps";
  7391. using (ZipFile zip = ZipFile.Read(zipFileToRead))
  7392. {
  7393. if (zip.EntryFilenames.Contains(candidate))
  7394. {
  7395. zip.RemoveEntry(candidate);
  7396. zip.Comment= String.Format("The file '{0}' has been removed from this archive.",
  7397. Candidate);
  7398. zip.Save();
  7399. }
  7400. }
  7401. </code>
  7402. <code lang="VB">
  7403. Dim zipFileToRead As String = "PackedDocuments.zip"
  7404. Dim candidate As String = "DatedMaterial.xps"
  7405. Using zip As ZipFile = ZipFile.Read(zipFileToRead)
  7406. If zip.EntryFilenames.Contains(candidate) Then
  7407. zip.RemoveEntry(candidate)
  7408. zip.Comment = String.Format("The file '{0}' has been removed from this archive.", Candidate)
  7409. zip.Save
  7410. End If
  7411. End Using
  7412. </code>
  7413. </example>
  7414. <param name="fileName">
  7415. The name of the file, including any directory path, to remove from the zip.
  7416. The filename match is not case-sensitive by default; you can use the
  7417. <c>CaseSensitiveRetrieval</c> property to change this behavior. The
  7418. pathname can use forward-slashes or backward slashes.
  7419. </param>
  7420. </member>
  7421. <member name="M:Ionic.Zip.ZipFile.Dispose">
  7422. <summary>
  7423. Closes the read and write streams associated
  7424. to the <c>ZipFile</c>, if necessary.
  7425. </summary>
  7426. <remarks>
  7427. The Dispose() method is generally employed implicitly, via a <c>using(..) {..}</c>
  7428. statement. (<c>Using...End Using</c> in VB) If you do not employ a using
  7429. statement, insure that your application calls Dispose() explicitly. For
  7430. example, in a Powershell application, or an application that uses the COM
  7431. interop interface, you must call Dispose() explicitly.
  7432. </remarks>
  7433. <example>
  7434. This example extracts an entry selected by name, from the Zip file to the
  7435. Console.
  7436. <code>
  7437. using (ZipFile zip = ZipFile.Read(zipfile))
  7438. {
  7439. foreach (ZipEntry e in zip)
  7440. {
  7441. if (WantThisEntry(e.FileName))
  7442. zip.Extract(e.FileName, Console.OpenStandardOutput());
  7443. }
  7444. } // Dispose() is called implicitly here.
  7445. </code>
  7446. <code lang="VB">
  7447. Using zip As ZipFile = ZipFile.Read(zipfile)
  7448. Dim e As ZipEntry
  7449. For Each e In zip
  7450. If WantThisEntry(e.FileName) Then
  7451. zip.Extract(e.FileName, Console.OpenStandardOutput())
  7452. End If
  7453. Next
  7454. End Using ' Dispose is implicity called here
  7455. </code>
  7456. </example>
  7457. </member>
  7458. <member name="M:Ionic.Zip.ZipFile.Dispose(System.Boolean)">
  7459. <summary>
  7460. Disposes any managed resources, if the flag is set, then marks the
  7461. instance disposed. This method is typically not called explicitly from
  7462. application code.
  7463. </summary>
  7464. <remarks>
  7465. Applications should call <see cref="M:Ionic.Zip.ZipFile.Dispose">the no-arg Dispose method</see>.
  7466. </remarks>
  7467. <param name="disposeManagedResources">
  7468. indicates whether the method should dispose streams or not.
  7469. </param>
  7470. </member>
  7471. <member name="F:Ionic.Zip.ZipFile.BufferSizeDefault">
  7472. <summary>
  7473. Default size of the buffer used for IO.
  7474. </summary>
  7475. </member>
  7476. <member name="M:Ionic.Zip.ZipFile.ExtractAll(System.String)">
  7477. <summary>
  7478. Extracts all of the items in the zip archive, to the specified path in the
  7479. filesystem. The path can be relative or fully-qualified.
  7480. </summary>
  7481. <remarks>
  7482. <para>
  7483. This method will extract all entries in the <c>ZipFile</c> to the
  7484. specified path.
  7485. </para>
  7486. <para>
  7487. If an extraction of a file from the zip archive would overwrite an
  7488. existing file in the filesystem, the action taken is dictated by the
  7489. ExtractExistingFile property, which overrides any setting you may have
  7490. made on individual ZipEntry instances. By default, if you have not
  7491. set that property on the <c>ZipFile</c> instance, the entry will not
  7492. be extracted, the existing file will not be overwritten and an
  7493. exception will be thrown. To change this, set the property, or use the
  7494. <see cref="M:Ionic.Zip.ZipFile.ExtractAll(System.String,Ionic.Zip.ExtractExistingFileAction)"/> overload that allows you to
  7495. specify an ExtractExistingFileAction parameter.
  7496. </para>
  7497. <para>
  7498. The action to take when an extract would overwrite an existing file
  7499. applies to all entries. If you want to set this on a per-entry basis,
  7500. then you must use one of the <see cref="M:Ionic.Zip.ZipEntry.Extract">ZipEntry.Extract</see> methods.
  7501. </para>
  7502. <para>
  7503. This method will send verbose output messages to the <see cref="P:Ionic.Zip.ZipFile.StatusMessageTextWriter"/>, if it is set on the <c>ZipFile</c>
  7504. instance.
  7505. </para>
  7506. <para>
  7507. You may wish to take advantage of the <c>ExtractProgress</c> event.
  7508. </para>
  7509. <para>
  7510. About timestamps: When extracting a file entry from a zip archive, the
  7511. extracted file gets the last modified time of the entry as stored in
  7512. the archive. The archive may also store extended file timestamp
  7513. information, including last accessed and created times. If these are
  7514. present in the <c>ZipEntry</c>, then the extracted file will also get
  7515. these times.
  7516. </para>
  7517. <para>
  7518. A Directory entry is somewhat different. It will get the times as
  7519. described for a file entry, but, if there are file entries in the zip
  7520. archive that, when extracted, appear in the just-created directory,
  7521. then when those file entries are extracted, the last modified and last
  7522. accessed times of the directory will change, as a side effect. The
  7523. result is that after an extraction of a directory and a number of
  7524. files within the directory, the last modified and last accessed
  7525. timestamps on the directory will reflect the time that the last file
  7526. was extracted into the directory, rather than the time stored in the
  7527. zip archive for the directory.
  7528. </para>
  7529. <para>
  7530. To compensate, when extracting an archive with <c>ExtractAll</c>,
  7531. DotNetZip will extract all the file and directory entries as described
  7532. above, but it will then make a second pass on the directories, and
  7533. reset the times on the directories to reflect what is stored in the
  7534. zip archive.
  7535. </para>
  7536. <para>
  7537. This compensation is performed only within the context of an
  7538. <c>ExtractAll</c>. If you call <c>ZipEntry.Extract</c> on a directory
  7539. entry, the timestamps on directory in the filesystem will reflect the
  7540. times stored in the zip. If you then call <c>ZipEntry.Extract</c> on
  7541. a file entry, which is extracted into the directory, the timestamps on
  7542. the directory will be updated to the current time.
  7543. </para>
  7544. </remarks>
  7545. <example>
  7546. This example extracts all the entries in a zip archive file, to the
  7547. specified target directory. The extraction will overwrite any
  7548. existing files silently.
  7549. <code>
  7550. String TargetDirectory= "unpack";
  7551. using(ZipFile zip= ZipFile.Read(ZipFileToExtract))
  7552. {
  7553. zip.ExtractExistingFile= ExtractExistingFileAction.OverwriteSilently;
  7554. zip.ExtractAll(TargetDirectory);
  7555. }
  7556. </code>
  7557. <code lang="VB">
  7558. Dim TargetDirectory As String = "unpack"
  7559. Using zip As ZipFile = ZipFile.Read(ZipFileToExtract)
  7560. zip.ExtractExistingFile= ExtractExistingFileAction.OverwriteSilently
  7561. zip.ExtractAll(TargetDirectory)
  7562. End Using
  7563. </code>
  7564. </example>
  7565. <seealso cref="E:Ionic.Zip.ZipFile.ExtractProgress"/>
  7566. <seealso cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/>
  7567. <param name="path">
  7568. The path to which the contents of the zipfile will be extracted.
  7569. The path can be relative or fully-qualified.
  7570. </param>
  7571. </member>
  7572. <member name="M:Ionic.Zip.ZipFile.ExtractAll(System.String,Ionic.Zip.ExtractExistingFileAction)">
  7573. <summary>
  7574. Extracts all of the items in the zip archive, to the specified path in the
  7575. filesystem, using the specified behavior when extraction would overwrite an
  7576. existing file.
  7577. </summary>
  7578. <remarks>
  7579. <para>
  7580. This method will extract all entries in the <c>ZipFile</c> to the specified
  7581. path. For an extraction that would overwrite an existing file, the behavior
  7582. is dictated by <paramref name="extractExistingFile"/>, which overrides any
  7583. setting you may have made on individual ZipEntry instances.
  7584. </para>
  7585. <para>
  7586. The action to take when an extract would overwrite an existing file
  7587. applies to all entries. If you want to set this on a per-entry basis,
  7588. then you must use <see cref="M:Ionic.Zip.ZipEntry.Extract(System.String,Ionic.Zip.ExtractExistingFileAction)"/> or one of the similar methods.
  7589. </para>
  7590. <para>
  7591. Calling this method is equivalent to setting the <see cref="P:Ionic.Zip.ZipFile.ExtractExistingFile"/> property and then calling <see cref="M:Ionic.Zip.ZipFile.ExtractAll(System.String)"/>.
  7592. </para>
  7593. <para>
  7594. This method will send verbose output messages to the
  7595. <see cref="P:Ionic.Zip.ZipFile.StatusMessageTextWriter"/>, if it is set on the <c>ZipFile</c> instance.
  7596. </para>
  7597. </remarks>
  7598. <example>
  7599. This example extracts all the entries in a zip archive file, to the
  7600. specified target directory. It does not overwrite any existing files.
  7601. <code>
  7602. String TargetDirectory= "c:\\unpack";
  7603. using(ZipFile zip= ZipFile.Read(ZipFileToExtract))
  7604. {
  7605. zip.ExtractAll(TargetDirectory, ExtractExistingFileAction.DontOverwrite);
  7606. }
  7607. </code>
  7608. <code lang="VB">
  7609. Dim TargetDirectory As String = "c:\unpack"
  7610. Using zip As ZipFile = ZipFile.Read(ZipFileToExtract)
  7611. zip.ExtractAll(TargetDirectory, ExtractExistingFileAction.DontOverwrite)
  7612. End Using
  7613. </code>
  7614. </example>
  7615. <param name="path">
  7616. The path to which the contents of the zipfile will be extracted.
  7617. The path can be relative or fully-qualified.
  7618. </param>
  7619. <param name="extractExistingFile">
  7620. The action to take if extraction would overwrite an existing file.
  7621. </param>
  7622. <seealso cref="M:Ionic.Zip.ZipFile.ExtractSelectedEntries(System.String,Ionic.Zip.ExtractExistingFileAction)"/>
  7623. </member>
  7624. <member name="M:Ionic.Zip.ZipFile.Read(System.String)">
  7625. <summary>
  7626. Reads a zip file archive and returns the instance.
  7627. </summary>
  7628. <remarks>
  7629. <para>
  7630. The stream is read using the default <c>System.Text.Encoding</c>, which is the
  7631. <c>IBM437</c> codepage.
  7632. </para>
  7633. </remarks>
  7634. <exception cref="T:System.Exception">
  7635. Thrown if the <c>ZipFile</c> cannot be read. The implementation of this method
  7636. relies on <c>System.IO.File.OpenRead</c>, which can throw a variety of exceptions,
  7637. including specific exceptions if a file is not found, an unauthorized access
  7638. exception, exceptions for poorly formatted filenames, and so on.
  7639. </exception>
  7640. <param name="fileName">
  7641. The name of the zip archive to open. This can be a fully-qualified or relative
  7642. pathname.
  7643. </param>
  7644. <seealso cref="M:Ionic.Zip.ZipFile.Read(System.String,Ionic.Zip.ReadOptions)"/>.
  7645. <returns>The instance read from the zip archive.</returns>
  7646. </member>
  7647. <member name="M:Ionic.Zip.ZipFile.Read(System.String,Ionic.Zip.ReadOptions)">
  7648. <summary>
  7649. Reads a zip file archive from the named filesystem file using the
  7650. specified options.
  7651. </summary>
  7652. <remarks>
  7653. <para>
  7654. This version of the <c>Read()</c> method allows the caller to pass
  7655. in a <c>TextWriter</c> an <c>Encoding</c>, via an instance of the
  7656. <c>ReadOptions</c> class. The <c>ZipFile</c> is read in using the
  7657. specified encoding for entries where UTF-8 encoding is not
  7658. explicitly specified.
  7659. </para>
  7660. </remarks>
  7661. <example>
  7662. <para>
  7663. This example shows how to read a zip file using the Big-5 Chinese
  7664. code page (950), and extract each entry in the zip file, while
  7665. sending status messages out to the Console.
  7666. </para>
  7667. <para>
  7668. For this code to work as intended, the zipfile must have been
  7669. created using the big5 code page (CP950). This is typical, for
  7670. example, when using WinRar on a machine with CP950 set as the
  7671. default code page. In that case, the names of entries within the
  7672. Zip archive will be stored in that code page, and reading the zip
  7673. archive must be done using that code page. If the application did
  7674. not use the correct code page in ZipFile.Read(), then names of
  7675. entries within the zip archive would not be correctly retrieved.
  7676. </para>
  7677. <code lang="C#">
  7678. string zipToExtract = "MyArchive.zip";
  7679. string extractDirectory = "extract";
  7680. var options = new ReadOptions
  7681. {
  7682. StatusMessageWriter = System.Console.Out,
  7683. Encoding = System.Text.Encoding.GetEncoding(950)
  7684. };
  7685. using (ZipFile zip = ZipFile.Read(zipToExtract, options))
  7686. {
  7687. foreach (ZipEntry e in zip)
  7688. {
  7689. e.Extract(extractDirectory);
  7690. }
  7691. }
  7692. </code>
  7693. <code lang="VB">
  7694. Dim zipToExtract as String = "MyArchive.zip"
  7695. Dim extractDirectory as String = "extract"
  7696. Dim options as New ReadOptions
  7697. options.Encoding = System.Text.Encoding.GetEncoding(950)
  7698. options.StatusMessageWriter = System.Console.Out
  7699. Using zip As ZipFile = ZipFile.Read(zipToExtract, options)
  7700. Dim e As ZipEntry
  7701. For Each e In zip
  7702. e.Extract(extractDirectory)
  7703. Next
  7704. End Using
  7705. </code>
  7706. </example>
  7707. <example>
  7708. <para>
  7709. This example shows how to read a zip file using the default
  7710. code page, to remove entries that have a modified date before a given threshold,
  7711. sending status messages out to a <c>StringWriter</c>.
  7712. </para>
  7713. <code lang="C#">
  7714. var options = new ReadOptions
  7715. {
  7716. StatusMessageWriter = new System.IO.StringWriter()
  7717. };
  7718. using (ZipFile zip = ZipFile.Read("PackedDocuments.zip", options))
  7719. {
  7720. var Threshold = new DateTime(2007,7,4);
  7721. // We cannot remove the entry from the list, within the context of
  7722. // an enumeration of said list.
  7723. // So we add the doomed entry to a list to be removed later.
  7724. // pass 1: mark the entries for removal
  7725. var MarkedEntries = new System.Collections.Generic.List&lt;ZipEntry&gt;();
  7726. foreach (ZipEntry e in zip)
  7727. {
  7728. if (e.LastModified &lt; Threshold)
  7729. MarkedEntries.Add(e);
  7730. }
  7731. // pass 2: actually remove the entry.
  7732. foreach (ZipEntry zombie in MarkedEntries)
  7733. zip.RemoveEntry(zombie);
  7734. zip.Comment = "This archive has been updated.";
  7735. zip.Save();
  7736. }
  7737. // can now use contents of sw, eg store in an audit log
  7738. </code>
  7739. <code lang="VB">
  7740. Dim options as New ReadOptions
  7741. options.StatusMessageWriter = New System.IO.StringWriter
  7742. Using zip As ZipFile = ZipFile.Read("PackedDocuments.zip", options)
  7743. Dim Threshold As New DateTime(2007, 7, 4)
  7744. ' We cannot remove the entry from the list, within the context of
  7745. ' an enumeration of said list.
  7746. ' So we add the doomed entry to a list to be removed later.
  7747. ' pass 1: mark the entries for removal
  7748. Dim MarkedEntries As New System.Collections.Generic.List(Of ZipEntry)
  7749. Dim e As ZipEntry
  7750. For Each e In zip
  7751. If (e.LastModified &lt; Threshold) Then
  7752. MarkedEntries.Add(e)
  7753. End If
  7754. Next
  7755. ' pass 2: actually remove the entry.
  7756. Dim zombie As ZipEntry
  7757. For Each zombie In MarkedEntries
  7758. zip.RemoveEntry(zombie)
  7759. Next
  7760. zip.Comment = "This archive has been updated."
  7761. zip.Save
  7762. End Using
  7763. ' can now use contents of sw, eg store in an audit log
  7764. </code>
  7765. </example>
  7766. <exception cref="T:System.Exception">
  7767. Thrown if the zipfile cannot be read. The implementation of
  7768. this method relies on <c>System.IO.File.OpenRead</c>, which
  7769. can throw a variety of exceptions, including specific
  7770. exceptions if a file is not found, an unauthorized access
  7771. exception, exceptions for poorly formatted filenames, and so
  7772. on.
  7773. </exception>
  7774. <param name="fileName">
  7775. The name of the zip archive to open.
  7776. This can be a fully-qualified or relative pathname.
  7777. </param>
  7778. <param name="options">
  7779. The set of options to use when reading the zip file.
  7780. </param>
  7781. <returns>The ZipFile instance read from the zip archive.</returns>
  7782. <seealso cref="M:Ionic.Zip.ZipFile.Read(System.IO.Stream,Ionic.Zip.ReadOptions)"/>
  7783. </member>
  7784. <member name="M:Ionic.Zip.ZipFile.Read(System.String,System.IO.TextWriter,System.Text.Encoding,System.EventHandler{Ionic.Zip.ReadProgressEventArgs})">
  7785. <summary>
  7786. Reads a zip file archive using the specified text encoding, the specified
  7787. TextWriter for status messages, and the specified ReadProgress event handler,
  7788. and returns the instance.
  7789. </summary>
  7790. <param name="fileName">
  7791. The name of the zip archive to open.
  7792. This can be a fully-qualified or relative pathname.
  7793. </param>
  7794. <param name="readProgress">
  7795. An event handler for Read operations.
  7796. </param>
  7797. <param name="statusMessageWriter">
  7798. The <c>System.IO.TextWriter</c> to use for writing verbose status messages
  7799. during operations on the zip archive. A console application may wish to
  7800. pass <c>System.Console.Out</c> to get messages on the Console. A graphical
  7801. or headless application may wish to capture the messages in a different
  7802. <c>TextWriter</c>, such as a <c>System.IO.StringWriter</c>.
  7803. </param>
  7804. <param name="encoding">
  7805. The <c>System.Text.Encoding</c> to use when reading in the zip archive. Be
  7806. careful specifying the encoding. If the value you use here is not the same
  7807. as the Encoding used when the zip archive was created (possibly by a
  7808. different archiver) you will get unexpected results and possibly exceptions.
  7809. </param>
  7810. <returns>The instance read from the zip archive.</returns>
  7811. </member>
  7812. <member name="M:Ionic.Zip.ZipFile.Read(System.IO.Stream)">
  7813. <summary>
  7814. Reads a zip archive from a stream.
  7815. </summary>
  7816. <remarks>
  7817. <para>
  7818. When reading from a file, it's probably easier to just use
  7819. <see cref="M:Ionic.Zip.ZipFile.Read(System.String,Ionic.Zip.ReadOptions)">ZipFile.Read(String, ReadOptions)</see>. This
  7820. overload is useful when when the zip archive content is
  7821. available from an already-open stream. The stream must be
  7822. open and readable and seekable when calling this method. The
  7823. stream is left open when the reading is completed.
  7824. </para>
  7825. <para>
  7826. Using this overload, the stream is read using the default
  7827. <c>System.Text.Encoding</c>, which is the <c>IBM437</c>
  7828. codepage. If you want to specify the encoding to use when
  7829. reading the zipfile content, see
  7830. <see cref="M:Ionic.Zip.ZipFile.Read(System.IO.Stream,Ionic.Zip.ReadOptions)">ZipFile.Read(Stream, ReadOptions)</see>. This
  7831. </para>
  7832. <para>
  7833. Reading of zip content begins at the current position in the
  7834. stream. This means if you have a stream that concatenates
  7835. regular data and zip data, if you position the open, readable
  7836. stream at the start of the zip data, you will be able to read
  7837. the zip archive using this constructor, or any of the ZipFile
  7838. constructors that accept a <see cref="T:System.IO.Stream"/> as
  7839. input. Some examples of where this might be useful: the zip
  7840. content is concatenated at the end of a regular EXE file, as
  7841. some self-extracting archives do. (Note: SFX files produced
  7842. by DotNetZip do not work this way; they can be read as normal
  7843. ZIP files). Another example might be a stream being read from
  7844. a database, where the zip content is embedded within an
  7845. aggregate stream of data.
  7846. </para>
  7847. </remarks>
  7848. <example>
  7849. <para>
  7850. This example shows how to Read zip content from a stream, and
  7851. extract one entry into a different stream. In this example,
  7852. the filename "NameOfEntryInArchive.doc", refers only to the
  7853. name of the entry within the zip archive. A file by that
  7854. name is not created in the filesystem. The I/O is done
  7855. strictly with the given streams.
  7856. </para>
  7857. <code>
  7858. using (ZipFile zip = ZipFile.Read(InputStream))
  7859. {
  7860. zip.Extract("NameOfEntryInArchive.doc", OutputStream);
  7861. }
  7862. </code>
  7863. <code lang="VB">
  7864. Using zip as ZipFile = ZipFile.Read(InputStream)
  7865. zip.Extract("NameOfEntryInArchive.doc", OutputStream)
  7866. End Using
  7867. </code>
  7868. </example>
  7869. <param name="zipStream">the stream containing the zip data.</param>
  7870. <returns>The ZipFile instance read from the stream</returns>
  7871. </member>
  7872. <member name="M:Ionic.Zip.ZipFile.Read(System.IO.Stream,Ionic.Zip.ReadOptions)">
  7873. <summary>
  7874. Reads a zip file archive from the given stream using the
  7875. specified options.
  7876. </summary>
  7877. <remarks>
  7878. <para>
  7879. When reading from a file, it's probably easier to just use
  7880. <see cref="M:Ionic.Zip.ZipFile.Read(System.String,Ionic.Zip.ReadOptions)">ZipFile.Read(String, ReadOptions)</see>. This
  7881. overload is useful when when the zip archive content is
  7882. available from an already-open stream. The stream must be
  7883. open and readable and seekable when calling this method. The
  7884. stream is left open when the reading is completed.
  7885. </para>
  7886. <para>
  7887. Reading of zip content begins at the current position in the
  7888. stream. This means if you have a stream that concatenates
  7889. regular data and zip data, if you position the open, readable
  7890. stream at the start of the zip data, you will be able to read
  7891. the zip archive using this constructor, or any of the ZipFile
  7892. constructors that accept a <see cref="T:System.IO.Stream"/> as
  7893. input. Some examples of where this might be useful: the zip
  7894. content is concatenated at the end of a regular EXE file, as
  7895. some self-extracting archives do. (Note: SFX files produced
  7896. by DotNetZip do not work this way; they can be read as normal
  7897. ZIP files). Another example might be a stream being read from
  7898. a database, where the zip content is embedded within an
  7899. aggregate stream of data.
  7900. </para>
  7901. </remarks>
  7902. <param name="zipStream">the stream containing the zip data.</param>
  7903. <param name="options">
  7904. The set of options to use when reading the zip file.
  7905. </param>
  7906. <exception cref="T:System.Exception">
  7907. Thrown if the zip archive cannot be read.
  7908. </exception>
  7909. <returns>The ZipFile instance read from the stream.</returns>
  7910. <seealso cref="M:Ionic.Zip.ZipFile.Read(System.String,Ionic.Zip.ReadOptions)"/>
  7911. </member>
  7912. <member name="M:Ionic.Zip.ZipFile.Read(System.IO.Stream,System.IO.TextWriter,System.Text.Encoding,System.EventHandler{Ionic.Zip.ReadProgressEventArgs})">
  7913. <summary>
  7914. Reads a zip archive from a stream, using the specified text Encoding, the
  7915. specified TextWriter for status messages,
  7916. and the specified ReadProgress event handler.
  7917. </summary>
  7918. <remarks>
  7919. <para>
  7920. Reading of zip content begins at the current position in the stream. This
  7921. means if you have a stream that concatenates regular data and zip data, if
  7922. you position the open, readable stream at the start of the zip data, you
  7923. will be able to read the zip archive using this constructor, or any of the
  7924. ZipFile constructors that accept a <see cref="T:System.IO.Stream"/> as
  7925. input. Some examples of where this might be useful: the zip content is
  7926. concatenated at the end of a regular EXE file, as some self-extracting
  7927. archives do. (Note: SFX files produced by DotNetZip do not work this
  7928. way). Another example might be a stream being read from a database, where
  7929. the zip content is embedded within an aggregate stream of data.
  7930. </para>
  7931. </remarks>
  7932. <param name="zipStream">the stream containing the zip data.</param>
  7933. <param name="statusMessageWriter">
  7934. The <c>System.IO.TextWriter</c> to which verbose status messages are written
  7935. during operations on the <c>ZipFile</c>. For example, in a console
  7936. application, System.Console.Out works, and will get a message for each entry
  7937. added to the ZipFile. If the TextWriter is <c>null</c>, no verbose messages
  7938. are written.
  7939. </param>
  7940. <param name="encoding">
  7941. The text encoding to use when reading entries that do not have the UTF-8
  7942. encoding bit set. Be careful specifying the encoding. If the value you use
  7943. here is not the same as the Encoding used when the zip archive was created
  7944. (possibly by a different archiver) you will get unexpected results and
  7945. possibly exceptions. See the <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>
  7946. property for more information.
  7947. </param>
  7948. <param name="readProgress">
  7949. An event handler for Read operations.
  7950. </param>
  7951. <returns>an instance of ZipFile</returns>
  7952. </member>
  7953. <member name="M:Ionic.Zip.ZipFile.IsZipFile(System.String)">
  7954. <summary>
  7955. Checks the given file to see if it appears to be a valid zip file.
  7956. </summary>
  7957. <remarks>
  7958. <para>
  7959. Calling this method is equivalent to calling <see cref="M:Ionic.Zip.ZipFile.IsZipFile(System.String,System.Boolean)"/> with the testExtract parameter set to false.
  7960. </para>
  7961. </remarks>
  7962. <param name="fileName">The file to check.</param>
  7963. <returns>true if the file appears to be a zip file.</returns>
  7964. </member>
  7965. <member name="M:Ionic.Zip.ZipFile.IsZipFile(System.String,System.Boolean)">
  7966. <summary>
  7967. Checks a file to see if it is a valid zip file.
  7968. </summary>
  7969. <remarks>
  7970. <para>
  7971. This method opens the specified zip file, reads in the zip archive,
  7972. verifying the ZIP metadata as it reads.
  7973. </para>
  7974. <para>
  7975. If everything succeeds, then the method returns true. If anything fails -
  7976. for example if an incorrect signature or CRC is found, indicating a
  7977. corrupt file, the the method returns false. This method also returns
  7978. false for a file that does not exist.
  7979. </para>
  7980. <para>
  7981. If <paramref name="testExtract"/> is true, as part of its check, this
  7982. method reads in the content for each entry, expands it, and checks CRCs.
  7983. This provides an additional check beyond verifying the zip header and
  7984. directory data.
  7985. </para>
  7986. <para>
  7987. If <paramref name="testExtract"/> is true, and if any of the zip entries
  7988. are protected with a password, this method will return false. If you want
  7989. to verify a <c>ZipFile</c> that has entries which are protected with a
  7990. password, you will need to do that manually.
  7991. </para>
  7992. </remarks>
  7993. <param name="fileName">The zip file to check.</param>
  7994. <param name="testExtract">true if the caller wants to extract each entry.</param>
  7995. <returns>true if the file contains a valid zip file.</returns>
  7996. </member>
  7997. <member name="M:Ionic.Zip.ZipFile.IsZipFile(System.IO.Stream,System.Boolean)">
  7998. <summary>
  7999. Checks a stream to see if it contains a valid zip archive.
  8000. </summary>
  8001. <remarks>
  8002. <para>
  8003. This method reads the zip archive contained in the specified stream, verifying
  8004. the ZIP metadata as it reads. If testExtract is true, this method also extracts
  8005. each entry in the archive, dumping all the bits into <see cref="F:System.IO.Stream.Null"/>.
  8006. </para>
  8007. <para>
  8008. If everything succeeds, then the method returns true. If anything fails -
  8009. for example if an incorrect signature or CRC is found, indicating a corrupt
  8010. file, the the method returns false. This method also returns false for a
  8011. file that does not exist.
  8012. </para>
  8013. <para>
  8014. If <c>testExtract</c> is true, this method reads in the content for each
  8015. entry, expands it, and checks CRCs. This provides an additional check
  8016. beyond verifying the zip header data.
  8017. </para>
  8018. <para>
  8019. If <c>testExtract</c> is true, and if any of the zip entries are protected
  8020. with a password, this method will return false. If you want to verify a
  8021. ZipFile that has entries which are protected with a password, you will need
  8022. to do that manually.
  8023. </para>
  8024. </remarks>
  8025. <seealso cref="M:Ionic.Zip.ZipFile.IsZipFile(System.String,System.Boolean)"/>
  8026. <param name="stream">The stream to check.</param>
  8027. <param name="testExtract">true if the caller wants to extract each entry.</param>
  8028. <returns>true if the stream contains a valid zip archive.</returns>
  8029. </member>
  8030. <member name="M:Ionic.Zip.ZipFile.DeleteFileWithRetry(System.String)">
  8031. <summary>
  8032. Delete file with retry on UnauthorizedAccessException.
  8033. </summary>
  8034. <remarks>
  8035. <para>
  8036. When calling File.Delete() on a file that has been "recently"
  8037. created, the call sometimes fails with
  8038. UnauthorizedAccessException. This method simply retries the Delete 3
  8039. times with a sleep between tries.
  8040. </para>
  8041. </remarks>
  8042. <param name='filename'>the name of the file to be deleted</param>
  8043. </member>
  8044. <member name="M:Ionic.Zip.ZipFile.Save">
  8045. <summary>
  8046. Saves the Zip archive to a file, specified by the Name property of the
  8047. <c>ZipFile</c>.
  8048. </summary>
  8049. <remarks>
  8050. <para>
  8051. The <c>ZipFile</c> instance is written to storage, typically a zip file
  8052. in a filesystem, only when the caller calls <c>Save</c>. In the typical
  8053. case, the Save operation writes the zip content to a temporary file, and
  8054. then renames the temporary file to the desired name. If necessary, this
  8055. method will delete a pre-existing file before the rename.
  8056. </para>
  8057. <para>
  8058. The <see cref="P:Ionic.Zip.ZipFile.Name"/> property is specified either explicitly,
  8059. or implicitly using one of the parameterized ZipFile constructors. For
  8060. COM Automation clients, the <c>Name</c> property must be set explicitly,
  8061. because COM Automation clients cannot call parameterized constructors.
  8062. </para>
  8063. <para>
  8064. When using a filesystem file for the Zip output, it is possible to call
  8065. <c>Save</c> multiple times on the <c>ZipFile</c> instance. With each
  8066. call the zip content is re-written to the same output file.
  8067. </para>
  8068. <para>
  8069. Data for entries that have been added to the <c>ZipFile</c> instance is
  8070. written to the output when the <c>Save</c> method is called. This means
  8071. that the input streams for those entries must be available at the time
  8072. the application calls <c>Save</c>. If, for example, the application
  8073. adds entries with <c>AddEntry</c> using a dynamically-allocated
  8074. <c>MemoryStream</c>, the memory stream must not have been disposed
  8075. before the call to <c>Save</c>. See the <see cref="P:Ionic.Zip.ZipEntry.InputStream"/> property for more discussion of the
  8076. availability requirements of the input stream for an entry, and an
  8077. approach for providing just-in-time stream lifecycle management.
  8078. </para>
  8079. </remarks>
  8080. <seealso cref="M:Ionic.Zip.ZipFile.AddEntry(System.String,System.IO.Stream)"/>
  8081. <exception cref="T:Ionic.Zip.BadStateException">
  8082. Thrown if you haven't specified a location or stream for saving the zip,
  8083. either in the constructor or by setting the Name property, or if you try
  8084. to save a regular zip archive to a filename with a .exe extension.
  8085. </exception>
  8086. <exception cref="T:System.OverflowException">
  8087. Thrown if <see cref="P:Ionic.Zip.ZipFile.MaxOutputSegmentSize"/> is non-zero, and the number
  8088. of segments that would be generated for the spanned zip file during the
  8089. save operation exceeds 99. If this happens, you need to increase the
  8090. segment size.
  8091. </exception>
  8092. </member>
  8093. <member name="M:Ionic.Zip.ZipFile.Save(System.String)">
  8094. <summary>
  8095. Save the file to a new zipfile, with the given name.
  8096. </summary>
  8097. <remarks>
  8098. <para>
  8099. This method allows the application to explicitly specify the name of the zip
  8100. file when saving. Use this when creating a new zip file, or when
  8101. updating a zip archive.
  8102. </para>
  8103. <para>
  8104. An application can also save a zip archive in several places by calling this
  8105. method multiple times in succession, with different filenames.
  8106. </para>
  8107. <para>
  8108. The <c>ZipFile</c> instance is written to storage, typically a zip file in a
  8109. filesystem, only when the caller calls <c>Save</c>. The Save operation writes
  8110. the zip content to a temporary file, and then renames the temporary file
  8111. to the desired name. If necessary, this method will delete a pre-existing file
  8112. before the rename.
  8113. </para>
  8114. </remarks>
  8115. <exception cref="T:System.ArgumentException">
  8116. Thrown if you specify a directory for the filename.
  8117. </exception>
  8118. <param name="fileName">
  8119. The name of the zip archive to save to. Existing files will
  8120. be overwritten with great prejudice.
  8121. </param>
  8122. <example>
  8123. This example shows how to create and Save a zip file.
  8124. <code>
  8125. using (ZipFile zip = new ZipFile())
  8126. {
  8127. zip.AddDirectory(@"c:\reports\January");
  8128. zip.Save("January.zip");
  8129. }
  8130. </code>
  8131. <code lang="VB">
  8132. Using zip As New ZipFile()
  8133. zip.AddDirectory("c:\reports\January")
  8134. zip.Save("January.zip")
  8135. End Using
  8136. </code>
  8137. </example>
  8138. <example>
  8139. This example shows how to update a zip file.
  8140. <code>
  8141. using (ZipFile zip = ZipFile.Read("ExistingArchive.zip"))
  8142. {
  8143. zip.AddFile("NewData.csv");
  8144. zip.Save("UpdatedArchive.zip");
  8145. }
  8146. </code>
  8147. <code lang="VB">
  8148. Using zip As ZipFile = ZipFile.Read("ExistingArchive.zip")
  8149. zip.AddFile("NewData.csv")
  8150. zip.Save("UpdatedArchive.zip")
  8151. End Using
  8152. </code>
  8153. </example>
  8154. </member>
  8155. <member name="M:Ionic.Zip.ZipFile.Save(System.IO.Stream)">
  8156. <summary>
  8157. Save the zip archive to the specified stream.
  8158. </summary>
  8159. <remarks>
  8160. <para>
  8161. The <c>ZipFile</c> instance is written to storage - typically a zip file
  8162. in a filesystem, but using this overload, the storage can be anything
  8163. accessible via a writable stream - only when the caller calls <c>Save</c>.
  8164. </para>
  8165. <para>
  8166. Use this method to save the zip content to a stream directly. A common
  8167. scenario is an ASP.NET application that dynamically generates a zip file
  8168. and allows the browser to download it. The application can call
  8169. <c>Save(Response.OutputStream)</c> to write a zipfile directly to the
  8170. output stream, without creating a zip file on the disk on the ASP.NET
  8171. server.
  8172. </para>
  8173. <para>
  8174. Be careful when saving a file to a non-seekable stream, including
  8175. <c>Response.OutputStream</c>. When DotNetZip writes to a non-seekable
  8176. stream, the zip archive is formatted in such a way that may not be
  8177. compatible with all zip tools on all platforms. It's a perfectly legal
  8178. and compliant zip file, but some people have reported problems opening
  8179. files produced this way using the Mac OS archive utility.
  8180. </para>
  8181. </remarks>
  8182. <example>
  8183. This example saves the zipfile content into a MemoryStream, and
  8184. then gets the array of bytes from that MemoryStream.
  8185. <code lang="C#">
  8186. using (var zip = new Ionic.Zip.ZipFile())
  8187. {
  8188. zip.CompressionLevel= Ionic.Zlib.CompressionLevel.BestCompression;
  8189. zip.Password = "VerySecret.";
  8190. zip.Encryption = EncryptionAlgorithm.WinZipAes128;
  8191. zip.AddFile(sourceFileName);
  8192. MemoryStream output = new MemoryStream();
  8193. zip.Save(output);
  8194. byte[] zipbytes = output.ToArray();
  8195. }
  8196. </code>
  8197. </example>
  8198. <example>
  8199. <para>
  8200. This example shows a pitfall you should avoid. DO NOT read
  8201. from a stream, then try to save to the same stream. DO
  8202. NOT DO THIS:
  8203. </para>
  8204. <code lang="C#">
  8205. using (var fs = new FileSteeam(filename, FileMode.Open))
  8206. {
  8207. using (var zip = Ionic.Zip.ZipFile.Read(inputStream))
  8208. {
  8209. zip.AddEntry("Name1.txt", "this is the content");
  8210. zip.Save(inputStream); // NO NO NO!!
  8211. }
  8212. }
  8213. </code>
  8214. <para>
  8215. Better like this:
  8216. </para>
  8217. <code lang="C#">
  8218. using (var zip = Ionic.Zip.ZipFile.Read(filename))
  8219. {
  8220. zip.AddEntry("Name1.txt", "this is the content");
  8221. zip.Save(); // YES!
  8222. }
  8223. </code>
  8224. </example>
  8225. <param name="outputStream">
  8226. The <c>System.IO.Stream</c> to write to. It must be
  8227. writable. If you created the ZipFile instanct by calling
  8228. ZipFile.Read(), this stream must not be the same stream
  8229. you passed to ZipFile.Read().
  8230. </param>
  8231. </member>
  8232. <member name="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String)">
  8233. <summary>
  8234. Adds to the ZipFile a set of files from the current working directory on
  8235. disk, that conform to the specified criteria.
  8236. </summary>
  8237. <remarks>
  8238. <para>
  8239. This method selects files from the the current working directory matching
  8240. the specified criteria, and adds them to the ZipFile.
  8241. </para>
  8242. <para>
  8243. Specify the criteria in statements of 3 elements: a noun, an operator, and
  8244. a value. Consider the string "name != *.doc" . The noun is "name". The
  8245. operator is "!=", implying "Not Equal". The value is "*.doc". That
  8246. criterion, in English, says "all files with a name that does not end in
  8247. the .doc extension."
  8248. </para>
  8249. <para>
  8250. Supported nouns include "name" (or "filename") for the filename; "atime",
  8251. "mtime", and "ctime" for last access time, last modfied time, and created
  8252. time of the file, respectively; "attributes" (or "attrs") for the file
  8253. attributes; "size" (or "length") for the file length (uncompressed), and
  8254. "type" for the type of object, either a file or a directory. The
  8255. "attributes", "name" and "type" nouns both support = and != as operators.
  8256. The "size", "atime", "mtime", and "ctime" nouns support = and !=, and
  8257. &gt;, &gt;=, &lt;, &lt;= as well. The times are taken to be expressed in
  8258. local time.
  8259. </para>
  8260. <para>
  8261. Specify values for the file attributes as a string with one or more of the
  8262. characters H,R,S,A,I,L in any order, implying file attributes of Hidden,
  8263. ReadOnly, System, Archive, NotContextIndexed, and ReparsePoint (symbolic
  8264. link) respectively.
  8265. </para>
  8266. <para>
  8267. To specify a time, use YYYY-MM-DD-HH:mm:ss or YYYY/MM/DD-HH:mm:ss as the
  8268. format. If you omit the HH:mm:ss portion, it is assumed to be 00:00:00
  8269. (midnight).
  8270. </para>
  8271. <para>
  8272. The value for a size criterion is expressed in integer quantities of bytes,
  8273. kilobytes (use k or kb after the number), megabytes (m or mb), or gigabytes
  8274. (g or gb).
  8275. </para>
  8276. <para>
  8277. The value for a name is a pattern to match against the filename, potentially
  8278. including wildcards. The pattern follows CMD.exe glob rules: * implies one
  8279. or more of any character, while ? implies one character. If the name
  8280. pattern contains any slashes, it is matched to the entire filename,
  8281. including the path; otherwise, it is matched against only the filename
  8282. without the path. This means a pattern of "*\*.*" matches all files one
  8283. directory level deep, while a pattern of "*.*" matches all files in all
  8284. directories.
  8285. </para>
  8286. <para>
  8287. To specify a name pattern that includes spaces, use single quotes around the
  8288. pattern. A pattern of "'* *.*'" will match all files that have spaces in
  8289. the filename. The full criteria string for that would be "name = '* *.*'" .
  8290. </para>
  8291. <para>
  8292. The value for a type criterion is either F (implying a file) or D (implying
  8293. a directory).
  8294. </para>
  8295. <para>
  8296. Some examples:
  8297. </para>
  8298. <list type="table">
  8299. <listheader>
  8300. <term>criteria</term>
  8301. <description>Files retrieved</description>
  8302. </listheader>
  8303. <item>
  8304. <term>name != *.xls </term>
  8305. <description>any file with an extension that is not .xls
  8306. </description>
  8307. </item>
  8308. <item>
  8309. <term>name = *.mp3 </term>
  8310. <description>any file with a .mp3 extension.
  8311. </description>
  8312. </item>
  8313. <item>
  8314. <term>*.mp3</term>
  8315. <description>(same as above) any file with a .mp3 extension.
  8316. </description>
  8317. </item>
  8318. <item>
  8319. <term>attributes = A </term>
  8320. <description>all files whose attributes include the Archive bit.
  8321. </description>
  8322. </item>
  8323. <item>
  8324. <term>attributes != H </term>
  8325. <description>all files whose attributes do not include the Hidden bit.
  8326. </description>
  8327. </item>
  8328. <item>
  8329. <term>mtime > 2009-01-01</term>
  8330. <description>all files with a last modified time after January 1st, 2009.
  8331. </description>
  8332. </item>
  8333. <item>
  8334. <term>size > 2gb</term>
  8335. <description>all files whose uncompressed size is greater than 2gb.
  8336. </description>
  8337. </item>
  8338. <item>
  8339. <term>type = D</term>
  8340. <description>all directories in the filesystem. </description>
  8341. </item>
  8342. </list>
  8343. <para>
  8344. You can combine criteria with the conjunctions AND or OR. Using a string
  8345. like "name = *.txt AND size &gt;= 100k" for the selectionCriteria retrieves
  8346. entries whose names end in .txt, and whose uncompressed size is greater than
  8347. or equal to 100 kilobytes.
  8348. </para>
  8349. <para>
  8350. For more complex combinations of criteria, you can use parenthesis to group
  8351. clauses in the boolean logic. Without parenthesis, the precedence of the
  8352. criterion atoms is determined by order of appearance. Unlike the C#
  8353. language, the AND conjunction does not take precendence over the logical OR.
  8354. This is important only in strings that contain 3 or more criterion atoms.
  8355. In other words, "name = *.txt and size &gt; 1000 or attributes = H" implies
  8356. "((name = *.txt AND size &gt; 1000) OR attributes = H)" while "attributes =
  8357. H OR name = *.txt and size &gt; 1000" evaluates to "((attributes = H OR name
  8358. = *.txt) AND size &gt; 1000)". When in doubt, use parenthesis.
  8359. </para>
  8360. <para>
  8361. Using time properties requires some extra care. If you want to retrieve all
  8362. entries that were last updated on 2009 February 14, specify a time range
  8363. like so:"mtime &gt;= 2009-02-14 AND mtime &lt; 2009-02-15". Read this to
  8364. say: all files updated after 12:00am on February 14th, until 12:00am on
  8365. February 15th. You can use the same bracketing approach to specify any time
  8366. period - a year, a month, a week, and so on.
  8367. </para>
  8368. <para>
  8369. The syntax allows one special case: if you provide a string with no spaces, it is
  8370. treated as a pattern to match for the filename. Therefore a string like "*.xls"
  8371. will be equivalent to specifying "name = *.xls".
  8372. </para>
  8373. <para>
  8374. There is no logic in this method that insures that the file inclusion
  8375. criteria are internally consistent. For example, it's possible to specify
  8376. criteria that says the file must have a size of less than 100 bytes, as well
  8377. as a size that is greater than 1000 bytes. Obviously no file will ever
  8378. satisfy such criteria, but this method does not detect such logical
  8379. inconsistencies. The caller is responsible for insuring the criteria are
  8380. sensible.
  8381. </para>
  8382. <para>
  8383. Using this method, the file selection does not recurse into
  8384. subdirectories, and the full path of the selected files is included in the
  8385. entries added into the zip archive. If you don't like these behaviors,
  8386. see the other overloads of this method.
  8387. </para>
  8388. </remarks>
  8389. <example>
  8390. This example zips up all *.csv files in the current working directory.
  8391. <code>
  8392. using (ZipFile zip = new ZipFile())
  8393. {
  8394. // To just match on filename wildcards,
  8395. // use the shorthand form of the selectionCriteria string.
  8396. zip.AddSelectedFiles("*.csv");
  8397. zip.Save(PathToZipArchive);
  8398. }
  8399. </code>
  8400. <code lang="VB">
  8401. Using zip As ZipFile = New ZipFile()
  8402. zip.AddSelectedFiles("*.csv")
  8403. zip.Save(PathToZipArchive)
  8404. End Using
  8405. </code>
  8406. </example>
  8407. <param name="selectionCriteria">The criteria for file selection</param>
  8408. </member>
  8409. <member name="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String,System.Boolean)">
  8410. <summary>
  8411. Adds to the ZipFile a set of files from the disk that conform to the
  8412. specified criteria, optionally recursing into subdirectories.
  8413. </summary>
  8414. <remarks>
  8415. <para>
  8416. This method selects files from the the current working directory matching
  8417. the specified criteria, and adds them to the ZipFile. If
  8418. <c>recurseDirectories</c> is true, files are also selected from
  8419. subdirectories, and the directory structure in the filesystem is
  8420. reproduced in the zip archive, rooted at the current working directory.
  8421. </para>
  8422. <para>
  8423. Using this method, the full path of the selected files is included in the
  8424. entries added into the zip archive. If you don't want this behavior, use
  8425. one of the overloads of this method that allows the specification of a
  8426. <c>directoryInArchive</c>.
  8427. </para>
  8428. <para>
  8429. For details on the syntax for the selectionCriteria parameter, see <see cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String)"/>.
  8430. </para>
  8431. </remarks>
  8432. <example>
  8433. This example zips up all *.xml files in the current working directory, or any
  8434. subdirectory, that are larger than 1mb.
  8435. <code>
  8436. using (ZipFile zip = new ZipFile())
  8437. {
  8438. // Use a compound expression in the selectionCriteria string.
  8439. zip.AddSelectedFiles("name = *.xml and size &gt; 1024kb", true);
  8440. zip.Save(PathToZipArchive);
  8441. }
  8442. </code>
  8443. <code lang="VB">
  8444. Using zip As ZipFile = New ZipFile()
  8445. ' Use a compound expression in the selectionCriteria string.
  8446. zip.AddSelectedFiles("name = *.xml and size &gt; 1024kb", true)
  8447. zip.Save(PathToZipArchive)
  8448. End Using
  8449. </code>
  8450. </example>
  8451. <param name="selectionCriteria">The criteria for file selection</param>
  8452. <param name="recurseDirectories">
  8453. If true, the file selection will recurse into subdirectories.
  8454. </param>
  8455. </member>
  8456. <member name="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String,System.String)">
  8457. <summary>
  8458. Adds to the ZipFile a set of files from a specified directory in the
  8459. filesystem, that conform to the specified criteria.
  8460. </summary>
  8461. <remarks>
  8462. <para>
  8463. This method selects files that conform to the specified criteria, from the
  8464. the specified directory on disk, and adds them to the ZipFile. The search
  8465. does not recurse into subdirectores.
  8466. </para>
  8467. <para>
  8468. Using this method, the full filesystem path of the files on disk is
  8469. reproduced on the entries added to the zip file. If you don't want this
  8470. behavior, use one of the other overloads of this method.
  8471. </para>
  8472. <para>
  8473. For details on the syntax for the selectionCriteria parameter, see <see cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String)"/>.
  8474. </para>
  8475. </remarks>
  8476. <example>
  8477. This example zips up all *.xml files larger than 1mb in the directory
  8478. given by "d:\rawdata".
  8479. <code>
  8480. using (ZipFile zip = new ZipFile())
  8481. {
  8482. // Use a compound expression in the selectionCriteria string.
  8483. zip.AddSelectedFiles("name = *.xml and size &gt; 1024kb", "d:\\rawdata");
  8484. zip.Save(PathToZipArchive);
  8485. }
  8486. </code>
  8487. <code lang="VB">
  8488. Using zip As ZipFile = New ZipFile()
  8489. ' Use a compound expression in the selectionCriteria string.
  8490. zip.AddSelectedFiles("name = *.xml and size &gt; 1024kb", "d:\rawdata)
  8491. zip.Save(PathToZipArchive)
  8492. End Using
  8493. </code>
  8494. </example>
  8495. <param name="selectionCriteria">The criteria for file selection</param>
  8496. <param name="directoryOnDisk">
  8497. The name of the directory on the disk from which to select files.
  8498. </param>
  8499. </member>
  8500. <member name="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String,System.String,System.Boolean)">
  8501. <summary>
  8502. Adds to the ZipFile a set of files from the specified directory on disk,
  8503. that conform to the specified criteria.
  8504. </summary>
  8505. <remarks>
  8506. <para>
  8507. This method selects files from the the specified disk directory matching
  8508. the specified selection criteria, and adds them to the ZipFile. If
  8509. <c>recurseDirectories</c> is true, files are also selected from
  8510. subdirectories.
  8511. </para>
  8512. <para>
  8513. The full directory structure in the filesystem is reproduced on the
  8514. entries added to the zip archive. If you don't want this behavior, use
  8515. one of the overloads of this method that allows the specification of a
  8516. <c>directoryInArchive</c>.
  8517. </para>
  8518. <para>
  8519. For details on the syntax for the selectionCriteria parameter, see <see cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String)"/>.
  8520. </para>
  8521. </remarks>
  8522. <example>
  8523. This example zips up all *.csv files in the "files" directory, or any
  8524. subdirectory, that have been saved since 2009 February 14th.
  8525. <code>
  8526. using (ZipFile zip = new ZipFile())
  8527. {
  8528. // Use a compound expression in the selectionCriteria string.
  8529. zip.AddSelectedFiles("name = *.csv and mtime &gt; 2009-02-14", "files", true);
  8530. zip.Save(PathToZipArchive);
  8531. }
  8532. </code>
  8533. <code lang="VB">
  8534. Using zip As ZipFile = New ZipFile()
  8535. ' Use a compound expression in the selectionCriteria string.
  8536. zip.AddSelectedFiles("name = *.csv and mtime &gt; 2009-02-14", "files", true)
  8537. zip.Save(PathToZipArchive)
  8538. End Using
  8539. </code>
  8540. </example>
  8541. <example>
  8542. This example zips up all files in the current working
  8543. directory, and all its child directories, except those in
  8544. the <c>excludethis</c> subdirectory.
  8545. <code lang="VB">
  8546. Using Zip As ZipFile = New ZipFile(zipfile)
  8547. Zip.AddSelectedFfiles("name != 'excludethis\*.*'", datapath, True)
  8548. Zip.Save()
  8549. End Using
  8550. </code>
  8551. </example>
  8552. <param name="selectionCriteria">The criteria for file selection</param>
  8553. <param name="directoryOnDisk">
  8554. The filesystem path from which to select files.
  8555. </param>
  8556. <param name="recurseDirectories">
  8557. If true, the file selection will recurse into subdirectories.
  8558. </param>
  8559. </member>
  8560. <member name="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String,System.String,System.String)">
  8561. <summary>
  8562. Adds to the ZipFile a selection of files from the specified directory on
  8563. disk, that conform to the specified criteria, and using a specified root
  8564. path for entries added to the zip archive.
  8565. </summary>
  8566. <remarks>
  8567. <para>
  8568. This method selects files from the specified disk directory matching the
  8569. specified selection criteria, and adds those files to the ZipFile, using
  8570. the specified directory path in the archive. The search does not recurse
  8571. into subdirectories. For details on the syntax for the selectionCriteria
  8572. parameter, see <see cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String)"/>.
  8573. </para>
  8574. </remarks>
  8575. <example>
  8576. This example zips up all *.psd files in the "photos" directory that have
  8577. been saved since 2009 February 14th, and puts them all in a zip file,
  8578. using the directory name of "content" in the zip archive itself. When the
  8579. zip archive is unzipped, the folder containing the .psd files will be
  8580. named "content".
  8581. <code>
  8582. using (ZipFile zip = new ZipFile())
  8583. {
  8584. // Use a compound expression in the selectionCriteria string.
  8585. zip.AddSelectedFiles("name = *.psd and mtime &gt; 2009-02-14", "photos", "content");
  8586. zip.Save(PathToZipArchive);
  8587. }
  8588. </code>
  8589. <code lang="VB">
  8590. Using zip As ZipFile = New ZipFile
  8591. zip.AddSelectedFiles("name = *.psd and mtime &gt; 2009-02-14", "photos", "content")
  8592. zip.Save(PathToZipArchive)
  8593. End Using
  8594. </code>
  8595. </example>
  8596. <param name="selectionCriteria">
  8597. The criteria for selection of files to add to the <c>ZipFile</c>.
  8598. </param>
  8599. <param name="directoryOnDisk">
  8600. The path to the directory in the filesystem from which to select files.
  8601. </param>
  8602. <param name="directoryPathInArchive">
  8603. Specifies a directory path to use to in place of the
  8604. <c>directoryOnDisk</c>. This path may, or may not, correspond to a real
  8605. directory in the current filesystem. If the files within the zip are
  8606. later extracted, this is the path used for the extracted file. Passing
  8607. null (nothing in VB) will use the path on the file name, if any; in other
  8608. words it would use <c>directoryOnDisk</c>, plus any subdirectory. Passing
  8609. the empty string ("") will insert the item at the root path within the
  8610. archive.
  8611. </param>
  8612. </member>
  8613. <member name="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String,System.String,System.String,System.Boolean)">
  8614. <summary>
  8615. Adds to the ZipFile a selection of files from the specified directory on
  8616. disk, that conform to the specified criteria, optionally recursing through
  8617. subdirectories, and using a specified root path for entries added to the
  8618. zip archive.
  8619. </summary>
  8620. <remarks>
  8621. This method selects files from the specified disk directory that match the
  8622. specified selection criteria, and adds those files to the ZipFile, using
  8623. the specified directory path in the archive. If <c>recurseDirectories</c>
  8624. is true, files are also selected from subdirectories, and the directory
  8625. structure in the filesystem is reproduced in the zip archive, rooted at
  8626. the directory specified by <c>directoryOnDisk</c>. For details on the
  8627. syntax for the selectionCriteria parameter, see <see cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String)"/>.
  8628. </remarks>
  8629. <example>
  8630. This example zips up all files that are NOT *.pst files, in the current
  8631. working directory and any subdirectories.
  8632. <code>
  8633. using (ZipFile zip = new ZipFile())
  8634. {
  8635. zip.AddSelectedFiles("name != *.pst", SourceDirectory, "backup", true);
  8636. zip.Save(PathToZipArchive);
  8637. }
  8638. </code>
  8639. <code lang="VB">
  8640. Using zip As ZipFile = New ZipFile
  8641. zip.AddSelectedFiles("name != *.pst", SourceDirectory, "backup", true)
  8642. zip.Save(PathToZipArchive)
  8643. End Using
  8644. </code>
  8645. </example>
  8646. <param name="selectionCriteria">
  8647. The criteria for selection of files to add to the <c>ZipFile</c>.
  8648. </param>
  8649. <param name="directoryOnDisk">
  8650. The path to the directory in the filesystem from which to select files.
  8651. </param>
  8652. <param name="directoryPathInArchive">
  8653. Specifies a directory path to use to in place of the
  8654. <c>directoryOnDisk</c>. This path may, or may not, correspond to a real
  8655. directory in the current filesystem. If the files within the zip are
  8656. later extracted, this is the path used for the extracted file. Passing
  8657. null (nothing in VB) will use the path on the file name, if any; in other
  8658. words it would use <c>directoryOnDisk</c>, plus any subdirectory. Passing
  8659. the empty string ("") will insert the item at the root path within the
  8660. archive.
  8661. </param>
  8662. <param name="recurseDirectories">
  8663. If true, the method also scans subdirectories for files matching the
  8664. criteria.
  8665. </param>
  8666. </member>
  8667. <member name="M:Ionic.Zip.ZipFile.UpdateSelectedFiles(System.String,System.String,System.String,System.Boolean)">
  8668. <summary>
  8669. Updates the ZipFile with a selection of files from the disk that conform
  8670. to the specified criteria.
  8671. </summary>
  8672. <remarks>
  8673. This method selects files from the specified disk directory that match the
  8674. specified selection criteria, and Updates the <c>ZipFile</c> with those
  8675. files, using the specified directory path in the archive. If
  8676. <c>recurseDirectories</c> is true, files are also selected from
  8677. subdirectories, and the directory structure in the filesystem is
  8678. reproduced in the zip archive, rooted at the directory specified by
  8679. <c>directoryOnDisk</c>. For details on the syntax for the
  8680. selectionCriteria parameter, see <see cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String)"/>.
  8681. </remarks>
  8682. <param name="selectionCriteria">
  8683. The criteria for selection of files to add to the <c>ZipFile</c>.
  8684. </param>
  8685. <param name="directoryOnDisk">
  8686. The path to the directory in the filesystem from which to select files.
  8687. </param>
  8688. <param name="directoryPathInArchive">
  8689. Specifies a directory path to use to in place of the
  8690. <c>directoryOnDisk</c>. This path may, or may not, correspond to a
  8691. real directory in the current filesystem. If the files within the zip
  8692. are later extracted, this is the path used for the extracted file.
  8693. Passing null (nothing in VB) will use the path on the file name, if
  8694. any; in other words it would use <c>directoryOnDisk</c>, plus any
  8695. subdirectory. Passing the empty string ("") will insert the item at
  8696. the root path within the archive.
  8697. </param>
  8698. <param name="recurseDirectories">
  8699. If true, the method also scans subdirectories for files matching the criteria.
  8700. </param>
  8701. <seealso cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String,System.String,System.String,System.Boolean)"/>
  8702. </member>
  8703. <member name="M:Ionic.Zip.ZipFile.SelectEntries(System.String)">
  8704. <summary>
  8705. Retrieve entries from the zipfile by specified criteria.
  8706. </summary>
  8707. <remarks>
  8708. <para>
  8709. This method allows callers to retrieve the collection of entries from the zipfile
  8710. that fit the specified criteria. The criteria are described in a string format, and
  8711. can include patterns for the filename; constraints on the size of the entry;
  8712. constraints on the last modified, created, or last accessed time for the file
  8713. described by the entry; or the attributes of the entry.
  8714. </para>
  8715. <para>
  8716. For details on the syntax for the selectionCriteria parameter, see <see cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String)"/>.
  8717. </para>
  8718. <para>
  8719. This method is intended for use with a ZipFile that has been read from storage.
  8720. When creating a new ZipFile, this method will work only after the ZipArchive has
  8721. been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip
  8722. archive from storage.) Calling SelectEntries on a ZipFile that has not yet been
  8723. saved will deliver undefined results.
  8724. </para>
  8725. </remarks>
  8726. <exception cref="T:System.Exception">
  8727. Thrown if selectionCriteria has an invalid syntax.
  8728. </exception>
  8729. <example>
  8730. This example selects all the PhotoShop files from within an archive, and extracts them
  8731. to the current working directory.
  8732. <code>
  8733. using (ZipFile zip1 = ZipFile.Read(ZipFileName))
  8734. {
  8735. var PhotoShopFiles = zip1.SelectEntries("*.psd");
  8736. foreach (ZipEntry psd in PhotoShopFiles)
  8737. {
  8738. psd.Extract();
  8739. }
  8740. }
  8741. </code>
  8742. <code lang="VB">
  8743. Using zip1 As ZipFile = ZipFile.Read(ZipFileName)
  8744. Dim PhotoShopFiles as ICollection(Of ZipEntry)
  8745. PhotoShopFiles = zip1.SelectEntries("*.psd")
  8746. Dim psd As ZipEntry
  8747. For Each psd In PhotoShopFiles
  8748. psd.Extract
  8749. Next
  8750. End Using
  8751. </code>
  8752. </example>
  8753. <param name="selectionCriteria">the string that specifies which entries to select</param>
  8754. <returns>a collection of ZipEntry objects that conform to the inclusion spec</returns>
  8755. </member>
  8756. <member name="M:Ionic.Zip.ZipFile.SelectEntries(System.String,System.String)">
  8757. <summary>
  8758. Retrieve entries from the zipfile by specified criteria.
  8759. </summary>
  8760. <remarks>
  8761. <para>
  8762. This method allows callers to retrieve the collection of entries from the zipfile
  8763. that fit the specified criteria. The criteria are described in a string format, and
  8764. can include patterns for the filename; constraints on the size of the entry;
  8765. constraints on the last modified, created, or last accessed time for the file
  8766. described by the entry; or the attributes of the entry.
  8767. </para>
  8768. <para>
  8769. For details on the syntax for the selectionCriteria parameter, see <see cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String)"/>.
  8770. </para>
  8771. <para>
  8772. This method is intended for use with a ZipFile that has been read from storage.
  8773. When creating a new ZipFile, this method will work only after the ZipArchive has
  8774. been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip
  8775. archive from storage.) Calling SelectEntries on a ZipFile that has not yet been
  8776. saved will deliver undefined results.
  8777. </para>
  8778. </remarks>
  8779. <exception cref="T:System.Exception">
  8780. Thrown if selectionCriteria has an invalid syntax.
  8781. </exception>
  8782. <example>
  8783. <code>
  8784. using (ZipFile zip1 = ZipFile.Read(ZipFileName))
  8785. {
  8786. var UpdatedPhotoShopFiles = zip1.SelectEntries("*.psd", "UpdatedFiles");
  8787. foreach (ZipEntry e in UpdatedPhotoShopFiles)
  8788. {
  8789. // prompt for extract here
  8790. if (WantExtract(e.FileName))
  8791. e.Extract();
  8792. }
  8793. }
  8794. </code>
  8795. <code lang="VB">
  8796. Using zip1 As ZipFile = ZipFile.Read(ZipFileName)
  8797. Dim UpdatedPhotoShopFiles As ICollection(Of ZipEntry) = zip1.SelectEntries("*.psd", "UpdatedFiles")
  8798. Dim e As ZipEntry
  8799. For Each e In UpdatedPhotoShopFiles
  8800. ' prompt for extract here
  8801. If Me.WantExtract(e.FileName) Then
  8802. e.Extract
  8803. End If
  8804. Next
  8805. End Using
  8806. </code>
  8807. </example>
  8808. <param name="selectionCriteria">the string that specifies which entries to select</param>
  8809. <param name="directoryPathInArchive">
  8810. the directory in the archive from which to select entries. If null, then
  8811. all directories in the archive are used.
  8812. </param>
  8813. <returns>a collection of ZipEntry objects that conform to the inclusion spec</returns>
  8814. </member>
  8815. <member name="M:Ionic.Zip.ZipFile.RemoveSelectedEntries(System.String)">
  8816. <summary>
  8817. Remove entries from the zipfile by specified criteria.
  8818. </summary>
  8819. <remarks>
  8820. <para>
  8821. This method allows callers to remove the collection of entries from the zipfile
  8822. that fit the specified criteria. The criteria are described in a string format, and
  8823. can include patterns for the filename; constraints on the size of the entry;
  8824. constraints on the last modified, created, or last accessed time for the file
  8825. described by the entry; or the attributes of the entry.
  8826. </para>
  8827. <para>
  8828. For details on the syntax for the selectionCriteria parameter, see <see cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String)"/>.
  8829. </para>
  8830. <para>
  8831. This method is intended for use with a ZipFile that has been read from storage.
  8832. When creating a new ZipFile, this method will work only after the ZipArchive has
  8833. been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip
  8834. archive from storage.) Calling SelectEntries on a ZipFile that has not yet been
  8835. saved will deliver undefined results.
  8836. </para>
  8837. </remarks>
  8838. <exception cref="T:System.Exception">
  8839. Thrown if selectionCriteria has an invalid syntax.
  8840. </exception>
  8841. <example>
  8842. This example removes all entries in a zip file that were modified prior to January 1st, 2008.
  8843. <code>
  8844. using (ZipFile zip1 = ZipFile.Read(ZipFileName))
  8845. {
  8846. // remove all entries from prior to Jan 1, 2008
  8847. zip1.RemoveEntries("mtime &lt; 2008-01-01");
  8848. // don't forget to save the archive!
  8849. zip1.Save();
  8850. }
  8851. </code>
  8852. <code lang="VB">
  8853. Using zip As ZipFile = ZipFile.Read(ZipFileName)
  8854. ' remove all entries from prior to Jan 1, 2008
  8855. zip1.RemoveEntries("mtime &lt; 2008-01-01")
  8856. ' do not forget to save the archive!
  8857. zip1.Save
  8858. End Using
  8859. </code>
  8860. </example>
  8861. <param name="selectionCriteria">the string that specifies which entries to select</param>
  8862. <returns>the number of entries removed</returns>
  8863. </member>
  8864. <member name="M:Ionic.Zip.ZipFile.RemoveSelectedEntries(System.String,System.String)">
  8865. <summary>
  8866. Remove entries from the zipfile by specified criteria, and within the specified
  8867. path in the archive.
  8868. </summary>
  8869. <remarks>
  8870. <para>
  8871. This method allows callers to remove the collection of entries from the zipfile
  8872. that fit the specified criteria. The criteria are described in a string format, and
  8873. can include patterns for the filename; constraints on the size of the entry;
  8874. constraints on the last modified, created, or last accessed time for the file
  8875. described by the entry; or the attributes of the entry.
  8876. </para>
  8877. <para>
  8878. For details on the syntax for the selectionCriteria parameter, see <see cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String)"/>.
  8879. </para>
  8880. <para>
  8881. This method is intended for use with a ZipFile that has been read from storage.
  8882. When creating a new ZipFile, this method will work only after the ZipArchive has
  8883. been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip
  8884. archive from storage.) Calling SelectEntries on a ZipFile that has not yet been
  8885. saved will deliver undefined results.
  8886. </para>
  8887. </remarks>
  8888. <exception cref="T:System.Exception">
  8889. Thrown if selectionCriteria has an invalid syntax.
  8890. </exception>
  8891. <example>
  8892. <code>
  8893. using (ZipFile zip1 = ZipFile.Read(ZipFileName))
  8894. {
  8895. // remove all entries from prior to Jan 1, 2008
  8896. zip1.RemoveEntries("mtime &lt; 2008-01-01", "documents");
  8897. // a call to ZipFile.Save will make the modifications permanent
  8898. zip1.Save();
  8899. }
  8900. </code>
  8901. <code lang="VB">
  8902. Using zip As ZipFile = ZipFile.Read(ZipFileName)
  8903. ' remove all entries from prior to Jan 1, 2008
  8904. zip1.RemoveEntries("mtime &lt; 2008-01-01", "documents")
  8905. ' a call to ZipFile.Save will make the modifications permanent
  8906. zip1.Save
  8907. End Using
  8908. </code>
  8909. </example>
  8910. <param name="selectionCriteria">the string that specifies which entries to select</param>
  8911. <param name="directoryPathInArchive">
  8912. the directory in the archive from which to select entries. If null, then
  8913. all directories in the archive are used.
  8914. </param>
  8915. <returns>the number of entries removed</returns>
  8916. </member>
  8917. <member name="M:Ionic.Zip.ZipFile.ExtractSelectedEntries(System.String)">
  8918. <summary>
  8919. Selects and Extracts a set of Entries from the ZipFile.
  8920. </summary>
  8921. <remarks>
  8922. <para>
  8923. The entries are extracted into the current working directory.
  8924. </para>
  8925. <para>
  8926. If any of the files to be extracted already exist, then the action taken is as
  8927. specified in the <see cref="P:Ionic.Zip.ZipEntry.ExtractExistingFile"/> property on the
  8928. corresponding ZipEntry instance. By default, the action taken in this case is to
  8929. throw an exception.
  8930. </para>
  8931. <para>
  8932. For information on the syntax of the selectionCriteria string,
  8933. see <see cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String)"/>.
  8934. </para>
  8935. </remarks>
  8936. <example>
  8937. This example shows how extract all XML files modified after 15 January 2009.
  8938. <code>
  8939. using (ZipFile zip = ZipFile.Read(zipArchiveName))
  8940. {
  8941. zip.ExtractSelectedEntries("name = *.xml and mtime &gt; 2009-01-15");
  8942. }
  8943. </code>
  8944. </example>
  8945. <param name="selectionCriteria">the selection criteria for entries to extract.</param>
  8946. <seealso cref="M:Ionic.Zip.ZipFile.ExtractSelectedEntries(System.String,Ionic.Zip.ExtractExistingFileAction)"/>
  8947. </member>
  8948. <member name="M:Ionic.Zip.ZipFile.ExtractSelectedEntries(System.String,Ionic.Zip.ExtractExistingFileAction)">
  8949. <summary>
  8950. Selects and Extracts a set of Entries from the ZipFile.
  8951. </summary>
  8952. <remarks>
  8953. <para>
  8954. The entries are extracted into the current working directory. When extraction would would
  8955. overwrite an existing filesystem file, the action taken is as specified in the
  8956. <paramref name="extractExistingFile"/> parameter.
  8957. </para>
  8958. <para>
  8959. For information on the syntax of the string describing the entry selection criteria,
  8960. see <see cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String)"/>.
  8961. </para>
  8962. </remarks>
  8963. <example>
  8964. This example shows how extract all XML files modified after 15 January 2009,
  8965. overwriting any existing files.
  8966. <code>
  8967. using (ZipFile zip = ZipFile.Read(zipArchiveName))
  8968. {
  8969. zip.ExtractSelectedEntries("name = *.xml and mtime &gt; 2009-01-15",
  8970. ExtractExistingFileAction.OverwriteSilently);
  8971. }
  8972. </code>
  8973. </example>
  8974. <param name="selectionCriteria">the selection criteria for entries to extract.</param>
  8975. <param name="extractExistingFile">
  8976. The action to take if extraction would overwrite an existing file.
  8977. </param>
  8978. </member>
  8979. <member name="M:Ionic.Zip.ZipFile.ExtractSelectedEntries(System.String,System.String)">
  8980. <summary>
  8981. Selects and Extracts a set of Entries from the ZipFile.
  8982. </summary>
  8983. <remarks>
  8984. <para>
  8985. The entries are selected from the specified directory within the archive, and then
  8986. extracted into the current working directory.
  8987. </para>
  8988. <para>
  8989. If any of the files to be extracted already exist, then the action taken is as
  8990. specified in the <see cref="P:Ionic.Zip.ZipEntry.ExtractExistingFile"/> property on the
  8991. corresponding ZipEntry instance. By default, the action taken in this case is to
  8992. throw an exception.
  8993. </para>
  8994. <para>
  8995. For information on the syntax of the string describing the entry selection criteria,
  8996. see <see cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String)"/>.
  8997. </para>
  8998. </remarks>
  8999. <example>
  9000. This example shows how extract all XML files modified after 15 January 2009,
  9001. and writes them to the "unpack" directory.
  9002. <code>
  9003. using (ZipFile zip = ZipFile.Read(zipArchiveName))
  9004. {
  9005. zip.ExtractSelectedEntries("name = *.xml and mtime &gt; 2009-01-15","unpack");
  9006. }
  9007. </code>
  9008. </example>
  9009. <param name="selectionCriteria">the selection criteria for entries to extract.</param>
  9010. <param name="directoryPathInArchive">
  9011. the directory in the archive from which to select entries. If null, then
  9012. all directories in the archive are used.
  9013. </param>
  9014. <seealso cref="M:Ionic.Zip.ZipFile.ExtractSelectedEntries(System.String,System.String,System.String,Ionic.Zip.ExtractExistingFileAction)"/>
  9015. </member>
  9016. <member name="M:Ionic.Zip.ZipFile.ExtractSelectedEntries(System.String,System.String,System.String)">
  9017. <summary>
  9018. Selects and Extracts a set of Entries from the ZipFile.
  9019. </summary>
  9020. <remarks>
  9021. <para>
  9022. The entries are extracted into the specified directory. If any of the files to be
  9023. extracted already exist, an exception will be thrown.
  9024. </para>
  9025. <para>
  9026. For information on the syntax of the string describing the entry selection criteria,
  9027. see <see cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String)"/>.
  9028. </para>
  9029. </remarks>
  9030. <param name="selectionCriteria">the selection criteria for entries to extract.</param>
  9031. <param name="directoryInArchive">
  9032. the directory in the archive from which to select entries. If null, then
  9033. all directories in the archive are used.
  9034. </param>
  9035. <param name="extractDirectory">
  9036. the directory on the disk into which to extract. It will be created
  9037. if it does not exist.
  9038. </param>
  9039. </member>
  9040. <member name="M:Ionic.Zip.ZipFile.ExtractSelectedEntries(System.String,System.String,System.String,Ionic.Zip.ExtractExistingFileAction)">
  9041. <summary>
  9042. Selects and Extracts a set of Entries from the ZipFile.
  9043. </summary>
  9044. <remarks>
  9045. <para>
  9046. The entries are extracted into the specified directory. When extraction would would
  9047. overwrite an existing filesystem file, the action taken is as specified in the
  9048. <paramref name="extractExistingFile"/> parameter.
  9049. </para>
  9050. <para>
  9051. For information on the syntax of the string describing the entry selection criteria,
  9052. see <see cref="M:Ionic.Zip.ZipFile.AddSelectedFiles(System.String)"/>.
  9053. </para>
  9054. </remarks>
  9055. <example>
  9056. This example shows how extract all files with an XML extension or with a size larger than 100,000 bytes,
  9057. and puts them in the unpack directory. For any files that already exist in
  9058. that destination directory, they will not be overwritten.
  9059. <code>
  9060. using (ZipFile zip = ZipFile.Read(zipArchiveName))
  9061. {
  9062. zip.ExtractSelectedEntries("name = *.xml or size &gt; 100000",
  9063. null,
  9064. "unpack",
  9065. ExtractExistingFileAction.DontOverwrite);
  9066. }
  9067. </code>
  9068. </example>
  9069. <param name="selectionCriteria">the selection criteria for entries to extract.</param>
  9070. <param name="extractDirectory">
  9071. The directory on the disk into which to extract. It will be created if it does not exist.
  9072. </param>
  9073. <param name="directoryPathInArchive">
  9074. The directory in the archive from which to select entries. If null, then
  9075. all directories in the archive are used.
  9076. </param>
  9077. <param name="extractExistingFile">
  9078. The action to take if extraction would overwrite an existing file.
  9079. </param>
  9080. </member>
  9081. <member name="M:Ionic.Zip.ZipFile.SaveSelfExtractor(System.String,Ionic.Zip.SelfExtractorFlavor)">
  9082. <summary>
  9083. Saves the ZipFile instance to a self-extracting zip archive.
  9084. </summary>
  9085. <remarks>
  9086. <para>
  9087. The generated exe image will execute on any machine that has the .NET
  9088. Framework 2.0 installed on it. The generated exe image is also a
  9089. valid ZIP file, readable with DotNetZip or another Zip library or tool
  9090. such as WinZip.
  9091. </para>
  9092. <para>
  9093. There are two "flavors" of self-extracting archive. The
  9094. <c>WinFormsApplication</c> version will pop up a GUI and allow the
  9095. user to select a target directory into which to extract. There's also
  9096. a checkbox allowing the user to specify to overwrite existing files,
  9097. and another checkbox to allow the user to request that Explorer be
  9098. opened to see the extracted files after extraction. The other flavor
  9099. is <c>ConsoleApplication</c>. A self-extractor generated with that
  9100. flavor setting will run from the command line. It accepts command-line
  9101. options to set the overwrite behavior, and to specify the target
  9102. extraction directory.
  9103. </para>
  9104. <para>
  9105. There are a few temporary files created during the saving to a
  9106. self-extracting zip. These files are created in the directory pointed
  9107. to by <see cref="P:Ionic.Zip.ZipFile.TempFileFolder"/>, which defaults to <see cref="M:System.IO.Path.GetTempPath"/>. These temporary files are
  9108. removed upon successful completion of this method.
  9109. </para>
  9110. <para>
  9111. When a user runs the WinForms SFX, the user's personal directory (<see cref="F:System.Environment.SpecialFolder.Personal">Environment.SpecialFolder.Personal</see>)
  9112. will be used as the default extract location. If you want to set the
  9113. default extract location, you should use the other overload of
  9114. <c>SaveSelfExtractor()</c>/ The user who runs the SFX will have the
  9115. opportunity to change the extract directory before extracting. When
  9116. the user runs the Command-Line SFX, the user must explicitly specify
  9117. the directory to which to extract. The .NET Framework 2.0 is required
  9118. on the computer when the self-extracting archive is run.
  9119. </para>
  9120. <para>
  9121. NB: This method is not available in the version of DotNetZip build for
  9122. the .NET Compact Framework, nor in the "Reduced" DotNetZip library.
  9123. </para>
  9124. </remarks>
  9125. <example>
  9126. <code>
  9127. string DirectoryPath = "c:\\Documents\\Project7";
  9128. using (ZipFile zip = new ZipFile())
  9129. {
  9130. zip.AddDirectory(DirectoryPath, System.IO.Path.GetFileName(DirectoryPath));
  9131. zip.Comment = "This will be embedded into a self-extracting console-based exe";
  9132. zip.SaveSelfExtractor("archive.exe", SelfExtractorFlavor.ConsoleApplication);
  9133. }
  9134. </code>
  9135. <code lang="VB">
  9136. Dim DirectoryPath As String = "c:\Documents\Project7"
  9137. Using zip As New ZipFile()
  9138. zip.AddDirectory(DirectoryPath, System.IO.Path.GetFileName(DirectoryPath))
  9139. zip.Comment = "This will be embedded into a self-extracting console-based exe"
  9140. zip.SaveSelfExtractor("archive.exe", SelfExtractorFlavor.ConsoleApplication)
  9141. End Using
  9142. </code>
  9143. </example>
  9144. <param name="exeToGenerate">
  9145. a pathname, possibly fully qualified, to be created. Typically it
  9146. will end in an .exe extension.</param>
  9147. <param name="flavor">
  9148. Indicates whether a Winforms or Console self-extractor is
  9149. desired. </param>
  9150. </member>
  9151. <member name="M:Ionic.Zip.ZipFile.SaveSelfExtractor(System.String,Ionic.Zip.SelfExtractorSaveOptions)">
  9152. <summary>
  9153. Saves the ZipFile instance to a self-extracting zip archive, using
  9154. the specified save options.
  9155. </summary>
  9156. <remarks>
  9157. <para>
  9158. This method saves a self extracting archive, using the specified save
  9159. options. These options include the flavor of the SFX, the default extract
  9160. directory, the icon file, and so on. See the documentation
  9161. for <see cref="M:Ionic.Zip.ZipFile.SaveSelfExtractor(System.String,Ionic.Zip.SelfExtractorFlavor)"/> for more
  9162. details.
  9163. </para>
  9164. <para>
  9165. The user who runs the SFX will have the opportunity to change the extract
  9166. directory before extracting. If at the time of extraction, the specified
  9167. directory does not exist, the SFX will create the directory before
  9168. extracting the files.
  9169. </para>
  9170. </remarks>
  9171. <example>
  9172. This example saves a WinForms-based self-extracting archive EXE that
  9173. will use c:\ExtractHere as the default extract location. The C# code
  9174. shows syntax for .NET 3.0, which uses an object initializer for
  9175. the SelfExtractorOptions object.
  9176. <code>
  9177. string DirectoryPath = "c:\\Documents\\Project7";
  9178. using (ZipFile zip = new ZipFile())
  9179. {
  9180. zip.AddDirectory(DirectoryPath, System.IO.Path.GetFileName(DirectoryPath));
  9181. zip.Comment = "This will be embedded into a self-extracting WinForms-based exe";
  9182. var options = new SelfExtractorOptions
  9183. {
  9184. Flavor = SelfExtractorFlavor.WinFormsApplication,
  9185. DefaultExtractDirectory = "%USERPROFILE%\\ExtractHere",
  9186. PostExtractCommandLine = ExeToRunAfterExtract,
  9187. SfxExeWindowTitle = "My Custom Window Title",
  9188. RemoveUnpackedFilesAfterExecute = true
  9189. };
  9190. zip.SaveSelfExtractor("archive.exe", options);
  9191. }
  9192. </code>
  9193. <code lang="VB">
  9194. Dim DirectoryPath As String = "c:\Documents\Project7"
  9195. Using zip As New ZipFile()
  9196. zip.AddDirectory(DirectoryPath, System.IO.Path.GetFileName(DirectoryPath))
  9197. zip.Comment = "This will be embedded into a self-extracting console-based exe"
  9198. Dim options As New SelfExtractorOptions()
  9199. options.Flavor = SelfExtractorFlavor.WinFormsApplication
  9200. options.DefaultExtractDirectory = "%USERPROFILE%\\ExtractHere"
  9201. options.PostExtractCommandLine = ExeToRunAfterExtract
  9202. options.SfxExeWindowTitle = "My Custom Window Title"
  9203. options.RemoveUnpackedFilesAfterExecute = True
  9204. zip.SaveSelfExtractor("archive.exe", options)
  9205. End Using
  9206. </code>
  9207. </example>
  9208. <param name="exeToGenerate">The name of the EXE to generate.</param>
  9209. <param name="options">provides the options for creating the
  9210. Self-extracting archive.</param>
  9211. </member>
  9212. <member name="M:Ionic.Zip.ZipFile.GetEnumerator">
  9213. <summary>
  9214. Generic IEnumerator support, for use of a ZipFile in an enumeration.
  9215. </summary>
  9216. <remarks>
  9217. You probably do not want to call <c>GetEnumerator</c> explicitly. Instead
  9218. it is implicitly called when you use a <see langword="foreach"/> loop in C#, or a
  9219. <c>For Each</c> loop in VB.NET.
  9220. </remarks>
  9221. <example>
  9222. This example reads a zipfile of a given name, then enumerates the
  9223. entries in that zip file, and displays the information about each
  9224. entry on the Console.
  9225. <code>
  9226. using (ZipFile zip = ZipFile.Read(zipfile))
  9227. {
  9228. bool header = true;
  9229. foreach (ZipEntry e in zip)
  9230. {
  9231. if (header)
  9232. {
  9233. System.Console.WriteLine("Zipfile: {0}", zip.Name);
  9234. System.Console.WriteLine("Version Needed: 0x{0:X2}", e.VersionNeeded);
  9235. System.Console.WriteLine("BitField: 0x{0:X2}", e.BitField);
  9236. System.Console.WriteLine("Compression Method: 0x{0:X2}", e.CompressionMethod);
  9237. System.Console.WriteLine("\n{1,-22} {2,-6} {3,4} {4,-8} {0}",
  9238. "Filename", "Modified", "Size", "Ratio", "Packed");
  9239. System.Console.WriteLine(new System.String('-', 72));
  9240. header = false;
  9241. }
  9242. System.Console.WriteLine("{1,-22} {2,-6} {3,4:F0}% {4,-8} {0}",
  9243. e.FileName,
  9244. e.LastModified.ToString("yyyy-MM-dd HH:mm:ss"),
  9245. e.UncompressedSize,
  9246. e.CompressionRatio,
  9247. e.CompressedSize);
  9248. e.Extract();
  9249. }
  9250. }
  9251. </code>
  9252. <code lang="VB">
  9253. Dim ZipFileToExtract As String = "c:\foo.zip"
  9254. Using zip As ZipFile = ZipFile.Read(ZipFileToExtract)
  9255. Dim header As Boolean = True
  9256. Dim e As ZipEntry
  9257. For Each e In zip
  9258. If header Then
  9259. Console.WriteLine("Zipfile: {0}", zip.Name)
  9260. Console.WriteLine("Version Needed: 0x{0:X2}", e.VersionNeeded)
  9261. Console.WriteLine("BitField: 0x{0:X2}", e.BitField)
  9262. Console.WriteLine("Compression Method: 0x{0:X2}", e.CompressionMethod)
  9263. Console.WriteLine(ChrW(10) &amp; "{1,-22} {2,-6} {3,4} {4,-8} {0}", _
  9264. "Filename", "Modified", "Size", "Ratio", "Packed" )
  9265. Console.WriteLine(New String("-"c, 72))
  9266. header = False
  9267. End If
  9268. Console.WriteLine("{1,-22} {2,-6} {3,4:F0}% {4,-8} {0}", _
  9269. e.FileName, _
  9270. e.LastModified.ToString("yyyy-MM-dd HH:mm:ss"), _
  9271. e.UncompressedSize, _
  9272. e.CompressionRatio, _
  9273. e.CompressedSize )
  9274. e.Extract
  9275. Next
  9276. End Using
  9277. </code>
  9278. </example>
  9279. <returns>A generic enumerator suitable for use within a foreach loop.</returns>
  9280. </member>
  9281. <member name="M:Ionic.Zip.ZipFile.GetNewEnum">
  9282. <summary>
  9283. An IEnumerator, for use of a ZipFile in a foreach construct.
  9284. </summary>
  9285. <remarks>
  9286. This method is included for COM support. An application generally does not call
  9287. this method directly. It is called implicitly by COM clients when enumerating
  9288. the entries in the ZipFile instance. In VBScript, this is done with a <c>For Each</c>
  9289. statement. In Javascript, this is done with <c>new Enumerator(zipfile)</c>.
  9290. </remarks>
  9291. <returns>
  9292. The IEnumerator over the entries in the ZipFile.
  9293. </returns>
  9294. </member>
  9295. <member name="P:Ionic.Zip.ZipFile.Info">
  9296. <summary>
  9297. Provides a human-readable string with information about the ZipFile.
  9298. </summary>
  9299. <remarks>
  9300. <para>
  9301. The information string contains 10 lines or so, about each ZipEntry,
  9302. describing whether encryption is in use, the compressed and uncompressed
  9303. length of the entry, the offset of the entry, and so on. As a result the
  9304. information string can be very long for zip files that contain many
  9305. entries.
  9306. </para>
  9307. <para>
  9308. This information is mostly useful for diagnostic purposes.
  9309. </para>
  9310. </remarks>
  9311. </member>
  9312. <member name="P:Ionic.Zip.ZipFile.FullScan">
  9313. <summary>
  9314. Indicates whether to perform a full scan of the zip file when reading it.
  9315. </summary>
  9316. <remarks>
  9317. <para>
  9318. You almost never want to use this property.
  9319. </para>
  9320. <para>
  9321. When reading a zip file, if this flag is <c>true</c> (<c>True</c> in
  9322. VB), the entire zip archive will be scanned and searched for entries.
  9323. For large archives, this can take a very, long time. The much more
  9324. efficient default behavior is to read the zip directory, which is
  9325. stored at the end of the zip file. But, in some cases the directory is
  9326. corrupted and you need to perform a full scan of the zip file to
  9327. determine the contents of the zip file. This property lets you do
  9328. that, when necessary.
  9329. </para>
  9330. <para>
  9331. This flag is effective only when calling <see cref="M:Ionic.Zip.ZipFile.Initialize(System.String)"/>. Normally you would read a ZipFile with the
  9332. static <see cref="M:Ionic.Zip.ZipFile.Read(System.String)">ZipFile.Read</see>
  9333. method. But you can't set the <c>FullScan</c> property on the
  9334. <c>ZipFile</c> instance when you use a static factory method like
  9335. <c>ZipFile.Read</c>.
  9336. </para>
  9337. </remarks>
  9338. <example>
  9339. This example shows how to read a zip file using the full scan approach,
  9340. and then save it, thereby producing a corrected zip file.
  9341. <code lang="C#">
  9342. using (var zip = new ZipFile())
  9343. {
  9344. zip.FullScan = true;
  9345. zip.Initialize(zipFileName);
  9346. zip.Save(newName);
  9347. }
  9348. </code>
  9349. <code lang="VB">
  9350. Using zip As New ZipFile
  9351. zip.FullScan = True
  9352. zip.Initialize(zipFileName)
  9353. zip.Save(newName)
  9354. End Using
  9355. </code>
  9356. </example>
  9357. </member>
  9358. <member name="P:Ionic.Zip.ZipFile.SortEntriesBeforeSaving">
  9359. <summary>
  9360. Whether to sort the ZipEntries before saving the file.
  9361. </summary>
  9362. <remarks>
  9363. The default is false. If you have a large number of zip entries, the sort
  9364. alone can consume significant time.
  9365. </remarks>
  9366. <example>
  9367. <code lang="C#">
  9368. using (var zip = new ZipFile())
  9369. {
  9370. zip.AddFiles(filesToAdd);
  9371. zip.SortEntriesBeforeSaving = true;
  9372. zip.Save(name);
  9373. }
  9374. </code>
  9375. <code lang="VB">
  9376. Using zip As New ZipFile
  9377. zip.AddFiles(filesToAdd)
  9378. zip.SortEntriesBeforeSaving = True
  9379. zip.Save(name)
  9380. End Using
  9381. </code>
  9382. </example>
  9383. </member>
  9384. <member name="P:Ionic.Zip.ZipFile.AddDirectoryWillTraverseReparsePoints">
  9385. <summary>
  9386. Indicates whether NTFS Reparse Points, like junctions, should be
  9387. traversed during calls to <c>AddDirectory()</c>.
  9388. </summary>
  9389. <remarks>
  9390. By default, calls to AddDirectory() will traverse NTFS reparse
  9391. points, like mounted volumes, and directory junctions. An example
  9392. of a junction is the "My Music" directory in Windows Vista. In some
  9393. cases you may not want DotNetZip to traverse those directories. In
  9394. that case, set this property to false.
  9395. </remarks>
  9396. <example>
  9397. <code lang="C#">
  9398. using (var zip = new ZipFile())
  9399. {
  9400. zip.AddDirectoryWillTraverseReparsePoints = false;
  9401. zip.AddDirectory(dirToZip,"fodder");
  9402. zip.Save(zipFileToCreate);
  9403. }
  9404. </code>
  9405. </example>
  9406. </member>
  9407. <member name="P:Ionic.Zip.ZipFile.BufferSize">
  9408. <summary>
  9409. Size of the IO buffer used while saving.
  9410. </summary>
  9411. <remarks>
  9412. <para>
  9413. First, let me say that you really don't need to bother with this. It is
  9414. here to allow for optimizations that you probably won't make! It will work
  9415. fine if you don't set or get this property at all. Ok?
  9416. </para>
  9417. <para>
  9418. Now that we have <em>that</em> out of the way, the fine print: This
  9419. property affects the size of the buffer that is used for I/O for each
  9420. entry contained in the zip file. When a file is read in to be compressed,
  9421. it uses a buffer given by the size here. When you update a zip file, the
  9422. data for unmodified entries is copied from the first zip file to the
  9423. other, through a buffer given by the size here.
  9424. </para>
  9425. <para>
  9426. Changing the buffer size affects a few things: first, for larger buffer
  9427. sizes, the memory used by the <c>ZipFile</c>, obviously, will be larger
  9428. during I/O operations. This may make operations faster for very much
  9429. larger files. Last, for any given entry, when you use a larger buffer
  9430. there will be fewer progress events during I/O operations, because there's
  9431. one progress event generated for each time the buffer is filled and then
  9432. emptied.
  9433. </para>
  9434. <para>
  9435. The default buffer size is 8k. Increasing the buffer size may speed
  9436. things up as you compress larger files. But there are no hard-and-fast
  9437. rules here, eh? You won't know til you test it. And there will be a
  9438. limit where ever larger buffers actually slow things down. So as I said
  9439. in the beginning, it's probably best if you don't set or get this property
  9440. at all.
  9441. </para>
  9442. </remarks>
  9443. <example>
  9444. This example shows how you might set a large buffer size for efficiency when
  9445. dealing with zip entries that are larger than 1gb.
  9446. <code lang="C#">
  9447. using (ZipFile zip = new ZipFile())
  9448. {
  9449. zip.SaveProgress += this.zip1_SaveProgress;
  9450. zip.AddDirectory(directoryToZip, "");
  9451. zip.UseZip64WhenSaving = Zip64Option.Always;
  9452. zip.BufferSize = 65536*8; // 65536 * 8 = 512k
  9453. zip.Save(ZipFileToCreate);
  9454. }
  9455. </code>
  9456. </example>
  9457. </member>
  9458. <member name="P:Ionic.Zip.ZipFile.CodecBufferSize">
  9459. <summary>
  9460. Size of the work buffer to use for the ZLIB codec during compression.
  9461. </summary>
  9462. <remarks>
  9463. <para>
  9464. When doing ZLIB or Deflate compression, the library fills a buffer,
  9465. then passes it to the compressor for compression. Then the library
  9466. reads out the compressed bytes. This happens repeatedly until there
  9467. is no more uncompressed data to compress. This property sets the
  9468. size of the buffer that will be used for chunk-wise compression. In
  9469. order for the setting to take effect, your application needs to set
  9470. this property before calling one of the <c>ZipFile.Save()</c>
  9471. overloads.
  9472. </para>
  9473. <para>
  9474. Setting this affects the performance and memory efficiency of
  9475. compression and decompression. For larger files, setting this to a
  9476. larger size may improve compression performance, but the exact
  9477. numbers vary depending on available memory, the size of the streams
  9478. you are compressing, and a bunch of other variables. I don't have
  9479. good firm recommendations on how to set it. You'll have to test it
  9480. yourself. Or just leave it alone and accept the default.
  9481. </para>
  9482. </remarks>
  9483. </member>
  9484. <member name="P:Ionic.Zip.ZipFile.FlattenFoldersOnExtract">
  9485. <summary>
  9486. Indicates whether extracted files should keep their paths as
  9487. stored in the zip archive.
  9488. </summary>
  9489. <remarks>
  9490. <para>
  9491. This property affects Extraction. It is not used when creating zip
  9492. archives.
  9493. </para>
  9494. <para>
  9495. With this property set to <c>false</c>, the default, extracting entries
  9496. from a zip file will create files in the filesystem that have the full
  9497. path associated to the entry within the zip file. With this property set
  9498. to <c>true</c>, extracting entries from the zip file results in files
  9499. with no path: the folders are "flattened."
  9500. </para>
  9501. <para>
  9502. An example: suppose the zip file contains entries /directory1/file1.txt and
  9503. /directory2/file2.txt. With <c>FlattenFoldersOnExtract</c> set to false,
  9504. the files created will be \directory1\file1.txt and \directory2\file2.txt.
  9505. With the property set to true, the files created are file1.txt and file2.txt.
  9506. </para>
  9507. </remarks>
  9508. </member>
  9509. <member name="P:Ionic.Zip.ZipFile.Strategy">
  9510. <summary>
  9511. The compression strategy to use for all entries.
  9512. </summary>
  9513. <remarks>
  9514. Set the Strategy used by the ZLIB-compatible compressor, when
  9515. compressing entries using the DEFLATE method. Different compression
  9516. strategies work better on different sorts of data. The strategy
  9517. parameter can affect the compression ratio and the speed of
  9518. compression but not the correctness of the compresssion. For more
  9519. information see <see cref="T:Ionic.Zlib.CompressionStrategy">Ionic.Zlib.CompressionStrategy</see>.
  9520. </remarks>
  9521. </member>
  9522. <member name="P:Ionic.Zip.ZipFile.Name">
  9523. <summary>
  9524. The name of the <c>ZipFile</c>, on disk.
  9525. </summary>
  9526. <remarks>
  9527. <para>
  9528. When the <c>ZipFile</c> instance was created by reading an archive using
  9529. one of the <c>ZipFile.Read</c> methods, this property represents the name
  9530. of the zip file that was read. When the <c>ZipFile</c> instance was
  9531. created by using the no-argument constructor, this value is <c>null</c>
  9532. (<c>Nothing</c> in VB).
  9533. </para>
  9534. <para>
  9535. If you use the no-argument constructor, and you then explicitly set this
  9536. property, when you call <see cref="M:Ionic.Zip.ZipFile.Save"/>, this name will
  9537. specify the name of the zip file created. Doing so is equivalent to
  9538. calling <see cref="M:Ionic.Zip.ZipFile.Save(System.String)"/>. When instantiating a
  9539. <c>ZipFile</c> by reading from a stream or byte array, the <c>Name</c>
  9540. property remains <c>null</c>. When saving to a stream, the <c>Name</c>
  9541. property is implicitly set to <c>null</c>.
  9542. </para>
  9543. </remarks>
  9544. </member>
  9545. <member name="P:Ionic.Zip.ZipFile.CompressionLevel">
  9546. <summary>
  9547. Sets the compression level to be used for entries subsequently added to
  9548. the zip archive.
  9549. </summary>
  9550. <remarks>
  9551. <para>
  9552. Varying the compression level used on entries can affect the
  9553. size-vs-speed tradeoff when compression and decompressing data streams
  9554. or files.
  9555. </para>
  9556. <para>
  9557. As with some other properties on the <c>ZipFile</c> class, like <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, and <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>, setting this property on a <c>ZipFile</c>
  9558. instance will cause the specified <c>CompressionLevel</c> to be used on all
  9559. <see cref="T:Ionic.Zip.ZipEntry"/> items that are subsequently added to the
  9560. <c>ZipFile</c> instance. If you set this property after you have added
  9561. items to the <c>ZipFile</c>, but before you have called <c>Save()</c>,
  9562. those items will not use the specified compression level.
  9563. </para>
  9564. <para>
  9565. If you do not set this property, the default compression level is used,
  9566. which normally gives a good balance of compression efficiency and
  9567. compression speed. In some tests, using <c>BestCompression</c> can
  9568. double the time it takes to compress, while delivering just a small
  9569. increase in compression efficiency. This behavior will vary with the
  9570. type of data you compress. If you are in doubt, just leave this setting
  9571. alone, and accept the default.
  9572. </para>
  9573. </remarks>
  9574. </member>
  9575. <member name="P:Ionic.Zip.ZipFile.CompressionMethod">
  9576. <summary>
  9577. The compression method for the zipfile.
  9578. </summary>
  9579. <remarks>
  9580. <para>
  9581. By default, the compression method is <c>CompressionMethod.Deflate.</c>
  9582. </para>
  9583. </remarks>
  9584. <seealso cref="T:Ionic.Zip.CompressionMethod"/>
  9585. </member>
  9586. <member name="P:Ionic.Zip.ZipFile.Comment">
  9587. <summary>
  9588. A comment attached to the zip archive.
  9589. </summary>
  9590. <remarks>
  9591. <para>
  9592. This property is read/write. It allows the application to specify a
  9593. comment for the <c>ZipFile</c>, or read the comment for the
  9594. <c>ZipFile</c>. After setting this property, changes are only made
  9595. permanent when you call a <c>Save()</c> method.
  9596. </para>
  9597. <para>
  9598. According to <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE's
  9599. zip specification</see>, the comment is not encrypted, even if there is a
  9600. password set on the zip file.
  9601. </para>
  9602. <para>
  9603. The specification does not describe how to indicate the encoding used
  9604. on a comment string. Many "compliant" zip tools and libraries use
  9605. IBM437 as the code page for comments; DotNetZip, too, follows that
  9606. practice. On the other hand, there are situations where you want a
  9607. Comment to be encoded with something else, for example using code page
  9608. 950 "Big-5 Chinese". To fill that need, DotNetZip will encode the
  9609. comment following the same procedure it follows for encoding
  9610. filenames: (a) if <see cref="P:Ionic.Zip.ZipFile.AlternateEncodingUsage"/> is
  9611. <c>Never</c>, it uses the default encoding (IBM437). (b) if <see cref="P:Ionic.Zip.ZipFile.AlternateEncodingUsage"/> is <c>Always</c>, it always uses the
  9612. alternate encoding (<see cref="P:Ionic.Zip.ZipFile.AlternateEncoding"/>). (c) if <see cref="P:Ionic.Zip.ZipFile.AlternateEncodingUsage"/> is <c>AsNecessary</c>, it uses the
  9613. alternate encoding only if the default encoding is not sufficient for
  9614. encoding the comment - in other words if decoding the result does not
  9615. produce the original string. This decision is taken at the time of
  9616. the call to <c>ZipFile.Save()</c>.
  9617. </para>
  9618. <para>
  9619. When creating a zip archive using this library, it is possible to change
  9620. the value of <see cref="P:Ionic.Zip.ZipFile.AlternateEncoding"/> between each
  9621. entry you add, and between adding entries and the call to
  9622. <c>Save()</c>. Don't do this. It will likely result in a zip file that is
  9623. not readable by any tool or application. For best interoperability, leave
  9624. <see cref="P:Ionic.Zip.ZipFile.AlternateEncoding"/> alone, or specify it only
  9625. once, before adding any entries to the <c>ZipFile</c> instance.
  9626. </para>
  9627. </remarks>
  9628. </member>
  9629. <member name="P:Ionic.Zip.ZipFile.EmitTimesInWindowsFormatWhenSaving">
  9630. <summary>
  9631. Specifies whether the Creation, Access, and Modified times for entries
  9632. added to the zip file will be emitted in “Windows format”
  9633. when the zip archive is saved.
  9634. </summary>
  9635. <remarks>
  9636. <para>
  9637. An application creating a zip archive can use this flag to explicitly
  9638. specify that the file times for the entries should or should not be stored
  9639. in the zip archive in the format used by Windows. By default this flag is
  9640. <c>true</c>, meaning the Windows-format times are stored in the zip
  9641. archive.
  9642. </para>
  9643. <para>
  9644. When adding an entry from a file or directory, the Creation (<see cref="P:Ionic.Zip.ZipEntry.CreationTime"/>), Access (<see cref="P:Ionic.Zip.ZipEntry.AccessedTime"/>), and Modified (<see cref="P:Ionic.Zip.ZipEntry.ModifiedTime"/>) times for the given entry are
  9645. automatically set from the filesystem values. When adding an entry from a
  9646. stream or string, all three values are implicitly set to
  9647. <c>DateTime.Now</c>. Applications can also explicitly set those times by
  9648. calling <see cref="M:Ionic.Zip.ZipEntry.SetEntryTimes(System.DateTime,System.DateTime,System.DateTime)"/>.
  9649. </para>
  9650. <para>
  9651. <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE's
  9652. zip specification</see> describes multiple ways to format these times in a
  9653. zip file. One is the format Windows applications normally use: 100ns ticks
  9654. since January 1, 1601 UTC. The other is a format Unix applications typically
  9655. use: seconds since January 1, 1970 UTC. Each format can be stored in an
  9656. "extra field" in the zip entry when saving the zip archive. The former
  9657. uses an extra field with a Header Id of 0x000A, while the latter uses a
  9658. header ID of 0x5455, although you probably don't need to know that.
  9659. </para>
  9660. <para>
  9661. Not all tools and libraries can interpret these fields. Windows
  9662. compressed folders is one that can read the Windows Format timestamps,
  9663. while I believe <see href="http://www.info-zip.org/">the Infozip
  9664. tools</see> can read the Unix format timestamps. Some tools and libraries
  9665. may be able to read only one or the other. DotNetZip can read or write
  9666. times in either or both formats.
  9667. </para>
  9668. <para>
  9669. The times stored are taken from <see cref="P:Ionic.Zip.ZipEntry.ModifiedTime"/>, <see cref="P:Ionic.Zip.ZipEntry.AccessedTime"/>, and <see cref="P:Ionic.Zip.ZipEntry.CreationTime"/>.
  9670. </para>
  9671. <para>
  9672. The value set here applies to all entries subsequently added to the
  9673. <c>ZipFile</c>.
  9674. </para>
  9675. <para>
  9676. This property is not mutually exclusive of the <see cref="P:Ionic.Zip.ZipFile.EmitTimesInUnixFormatWhenSaving"/> property. It is possible and
  9677. legal and valid to produce a zip file that contains timestamps encoded in
  9678. the Unix format as well as in the Windows format, in addition to the <see cref="P:Ionic.Zip.ZipEntry.LastModified">LastModified</see> time attached to each
  9679. entry in the archive, a time that is always stored in "DOS format". And,
  9680. notwithstanding the names PKWare uses for these time formats, any of them
  9681. can be read and written by any computer, on any operating system. But,
  9682. there are no guarantees that a program running on Mac or Linux will
  9683. gracefully handle a zip file with "Windows" formatted times, or that an
  9684. application that does not use DotNetZip but runs on Windows will be able to
  9685. handle file times in Unix format.
  9686. </para>
  9687. <para>
  9688. When in doubt, test. Sorry, I haven't got a complete list of tools and
  9689. which sort of timestamps they can use and will tolerate. If you get any
  9690. good information and would like to pass it on, please do so and I will
  9691. include that information in this documentation.
  9692. </para>
  9693. </remarks>
  9694. <example>
  9695. This example shows how to save a zip file that contains file timestamps
  9696. in a format normally used by Unix.
  9697. <code lang="C#">
  9698. using (var zip = new ZipFile())
  9699. {
  9700. // produce a zip file the Mac will like
  9701. zip.EmitTimesInWindowsFormatWhenSaving = false;
  9702. zip.EmitTimesInUnixFormatWhenSaving = true;
  9703. zip.AddDirectory(directoryToZip, "files");
  9704. zip.Save(outputFile);
  9705. }
  9706. </code>
  9707. <code lang="VB">
  9708. Using zip As New ZipFile
  9709. '' produce a zip file the Mac will like
  9710. zip.EmitTimesInWindowsFormatWhenSaving = False
  9711. zip.EmitTimesInUnixFormatWhenSaving = True
  9712. zip.AddDirectory(directoryToZip, "files")
  9713. zip.Save(outputFile)
  9714. End Using
  9715. </code>
  9716. </example>
  9717. <seealso cref="P:Ionic.Zip.ZipEntry.EmitTimesInWindowsFormatWhenSaving"/>
  9718. <seealso cref="P:Ionic.Zip.ZipFile.EmitTimesInUnixFormatWhenSaving"/>
  9719. </member>
  9720. <member name="P:Ionic.Zip.ZipFile.EmitTimesInUnixFormatWhenSaving">
  9721. <summary>
  9722. Specifies whether the Creation, Access, and Modified times
  9723. for entries added to the zip file will be emitted in "Unix(tm)
  9724. format" when the zip archive is saved.
  9725. </summary>
  9726. <remarks>
  9727. <para>
  9728. An application creating a zip archive can use this flag to explicitly
  9729. specify that the file times for the entries should or should not be stored
  9730. in the zip archive in the format used by Unix. By default this flag is
  9731. <c>false</c>, meaning the Unix-format times are not stored in the zip
  9732. archive.
  9733. </para>
  9734. <para>
  9735. When adding an entry from a file or directory, the Creation (<see cref="P:Ionic.Zip.ZipEntry.CreationTime"/>), Access (<see cref="P:Ionic.Zip.ZipEntry.AccessedTime"/>), and Modified (<see cref="P:Ionic.Zip.ZipEntry.ModifiedTime"/>) times for the given entry are
  9736. automatically set from the filesystem values. When adding an entry from a
  9737. stream or string, all three values are implicitly set to DateTime.Now.
  9738. Applications can also explicitly set those times by calling <see cref="M:Ionic.Zip.ZipEntry.SetEntryTimes(System.DateTime,System.DateTime,System.DateTime)"/>.
  9739. </para>
  9740. <para>
  9741. <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE's
  9742. zip specification</see> describes multiple ways to format these times in a
  9743. zip file. One is the format Windows applications normally use: 100ns ticks
  9744. since January 1, 1601 UTC. The other is a format Unix applications
  9745. typically use: seconds since January 1, 1970 UTC. Each format can be
  9746. stored in an "extra field" in the zip entry when saving the zip
  9747. archive. The former uses an extra field with a Header Id of 0x000A, while
  9748. the latter uses a header ID of 0x5455, although you probably don't need to
  9749. know that.
  9750. </para>
  9751. <para>
  9752. Not all tools and libraries can interpret these fields. Windows
  9753. compressed folders is one that can read the Windows Format timestamps,
  9754. while I believe the <see href="http://www.info-zip.org/">Infozip</see>
  9755. tools can read the Unix format timestamps. Some tools and libraries may be
  9756. able to read only one or the other. DotNetZip can read or write times in
  9757. either or both formats.
  9758. </para>
  9759. <para>
  9760. The times stored are taken from <see cref="P:Ionic.Zip.ZipEntry.ModifiedTime"/>, <see cref="P:Ionic.Zip.ZipEntry.AccessedTime"/>, and <see cref="P:Ionic.Zip.ZipEntry.CreationTime"/>.
  9761. </para>
  9762. <para>
  9763. This property is not mutually exclusive of the <see cref="P:Ionic.Zip.ZipFile.EmitTimesInWindowsFormatWhenSaving"/> property. It is possible and
  9764. legal and valid to produce a zip file that contains timestamps encoded in
  9765. the Unix format as well as in the Windows format, in addition to the <see cref="P:Ionic.Zip.ZipEntry.LastModified">LastModified</see> time attached to each
  9766. entry in the zip archive, a time that is always stored in "DOS
  9767. format". And, notwithstanding the names PKWare uses for these time
  9768. formats, any of them can be read and written by any computer, on any
  9769. operating system. But, there are no guarantees that a program running on
  9770. Mac or Linux will gracefully handle a zip file with "Windows" formatted
  9771. times, or that an application that does not use DotNetZip but runs on
  9772. Windows will be able to handle file times in Unix format.
  9773. </para>
  9774. <para>
  9775. When in doubt, test. Sorry, I haven't got a complete list of tools and
  9776. which sort of timestamps they can use and will tolerate. If you get any
  9777. good information and would like to pass it on, please do so and I will
  9778. include that information in this documentation.
  9779. </para>
  9780. </remarks>
  9781. <seealso cref="P:Ionic.Zip.ZipEntry.EmitTimesInUnixFormatWhenSaving"/>
  9782. <seealso cref="P:Ionic.Zip.ZipFile.EmitTimesInWindowsFormatWhenSaving"/>
  9783. </member>
  9784. <member name="P:Ionic.Zip.ZipFile.Verbose">
  9785. <summary>
  9786. Indicates whether verbose output is sent to the <see cref="P:Ionic.Zip.ZipFile.StatusMessageTextWriter"/> during <c>AddXxx()</c> and
  9787. <c>ReadXxx()</c> operations.
  9788. </summary>
  9789. <remarks>
  9790. This is a <em>synthetic</em> property. It returns true if the <see cref="P:Ionic.Zip.ZipFile.StatusMessageTextWriter"/> is non-null.
  9791. </remarks>
  9792. </member>
  9793. <member name="P:Ionic.Zip.ZipFile.CaseSensitiveRetrieval">
  9794. <summary>
  9795. Indicates whether to perform case-sensitive matching on the filename when
  9796. retrieving entries in the zipfile via the string-based indexer.
  9797. </summary>
  9798. <remarks>
  9799. The default value is <c>false</c>, which means don't do case-sensitive
  9800. matching. In other words, retrieving zip["ReadMe.Txt"] is the same as
  9801. zip["readme.txt"]. It really makes sense to set this to <c>true</c> only
  9802. if you are not running on Windows, which has case-insensitive
  9803. filenames. But since this library is not built for non-Windows platforms,
  9804. in most cases you should just leave this property alone.
  9805. </remarks>
  9806. </member>
  9807. <member name="P:Ionic.Zip.ZipFile.UseUnicodeAsNecessary">
  9808. <summary>
  9809. Indicates whether to encode entry filenames and entry comments using Unicode
  9810. (UTF-8).
  9811. </summary>
  9812. <remarks>
  9813. <para>
  9814. <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">The
  9815. PKWare zip specification</see> provides for encoding file names and file
  9816. comments in either the IBM437 code page, or in UTF-8. This flag selects
  9817. the encoding according to that specification. By default, this flag is
  9818. false, and filenames and comments are encoded into the zip file in the
  9819. IBM437 codepage. Setting this flag to true will specify that filenames
  9820. and comments that cannot be encoded with IBM437 will be encoded with
  9821. UTF-8.
  9822. </para>
  9823. <para>
  9824. Zip files created with strict adherence to the PKWare specification with
  9825. respect to UTF-8 encoding can contain entries with filenames containing
  9826. any combination of Unicode characters, including the full range of
  9827. characters from Chinese, Latin, Hebrew, Greek, Cyrillic, and many other
  9828. alphabets. However, because at this time, the UTF-8 portion of the PKWare
  9829. specification is not broadly supported by other zip libraries and
  9830. utilities, such zip files may not be readable by your favorite zip tool or
  9831. archiver. In other words, interoperability will decrease if you set this
  9832. flag to true.
  9833. </para>
  9834. <para>
  9835. In particular, Zip files created with strict adherence to the PKWare
  9836. specification with respect to UTF-8 encoding will not work well with
  9837. Explorer in Windows XP or Windows Vista, because Windows compressed
  9838. folders, as far as I know, do not support UTF-8 in zip files. Vista can
  9839. read the zip files, but shows the filenames incorrectly. Unpacking from
  9840. Windows Vista Explorer will result in filenames that have rubbish
  9841. characters in place of the high-order UTF-8 bytes.
  9842. </para>
  9843. <para>
  9844. Also, zip files that use UTF-8 encoding will not work well with Java
  9845. applications that use the java.util.zip classes, as of v5.0 of the Java
  9846. runtime. The Java runtime does not correctly implement the PKWare
  9847. specification in this regard.
  9848. </para>
  9849. <para>
  9850. As a result, we have the unfortunate situation that "correct" behavior by
  9851. the DotNetZip library with regard to Unicode encoding of filenames during
  9852. zip creation will result in zip files that are readable by strictly
  9853. compliant and current tools (for example the most recent release of the
  9854. commercial WinZip tool); but these zip files will not be readable by
  9855. various other tools or libraries, including Windows Explorer.
  9856. </para>
  9857. <para>
  9858. The DotNetZip library can read and write zip files with UTF8-encoded
  9859. entries, according to the PKware spec. If you use DotNetZip for both
  9860. creating and reading the zip file, and you use UTF-8, there will be no
  9861. loss of information in the filenames. For example, using a self-extractor
  9862. created by this library will allow you to unpack files correctly with no
  9863. loss of information in the filenames.
  9864. </para>
  9865. <para>
  9866. If you do not set this flag, it will remain false. If this flag is false,
  9867. your <c>ZipFile</c> will encode all filenames and comments using the
  9868. IBM437 codepage. This can cause "loss of information" on some filenames,
  9869. but the resulting zipfile will be more interoperable with other
  9870. utilities. As an example of the loss of information, diacritics can be
  9871. lost. The o-tilde character will be down-coded to plain o. The c with a
  9872. cedilla (Unicode 0xE7) used in Portugese will be downcoded to a c.
  9873. Likewise, the O-stroke character (Unicode 248), used in Danish and
  9874. Norwegian, will be down-coded to plain o. Chinese characters cannot be
  9875. represented in codepage IBM437; when using the default encoding, Chinese
  9876. characters in filenames will be represented as ?. These are all examples
  9877. of "information loss".
  9878. </para>
  9879. <para>
  9880. The loss of information associated to the use of the IBM437 encoding is
  9881. inconvenient, and can also lead to runtime errors. For example, using
  9882. IBM437, any sequence of 4 Chinese characters will be encoded as ????. If
  9883. your application creates a <c>ZipFile</c>, then adds two files, each with
  9884. names of four Chinese characters each, this will result in a duplicate
  9885. filename exception. In the case where you add a single file with a name
  9886. containing four Chinese characters, calling Extract() on the entry that
  9887. has question marks in the filename will result in an exception, because
  9888. the question mark is not legal for use within filenames on Windows. These
  9889. are just a few examples of the problems associated to loss of information.
  9890. </para>
  9891. <para>
  9892. This flag is independent of the encoding of the content within the entries
  9893. in the zip file. Think of the zip file as a container - it supports an
  9894. encoding. Within the container are other "containers" - the file entries
  9895. themselves. The encoding within those entries is independent of the
  9896. encoding of the zip archive container for those entries.
  9897. </para>
  9898. <para>
  9899. Rather than specify the encoding in a binary fashion using this flag, an
  9900. application can specify an arbitrary encoding via the <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/> property. Setting the encoding
  9901. explicitly when creating zip archives will result in non-compliant zip
  9902. files that, curiously, are fairly interoperable. The challenge is, the
  9903. PKWare specification does not provide for a way to specify that an entry
  9904. in a zip archive uses a code page that is neither IBM437 nor UTF-8.
  9905. Therefore if you set the encoding explicitly when creating a zip archive,
  9906. you must take care upon reading the zip archive to use the same code page.
  9907. If you get it wrong, the behavior is undefined and may result in incorrect
  9908. filenames, exceptions, stomach upset, hair loss, and acne.
  9909. </para>
  9910. </remarks>
  9911. <seealso cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>
  9912. </member>
  9913. <member name="P:Ionic.Zip.ZipFile.UseZip64WhenSaving">
  9914. <summary>
  9915. Specify whether to use ZIP64 extensions when saving a zip archive.
  9916. </summary>
  9917. <remarks>
  9918. <para>
  9919. When creating a zip file, the default value for the property is <see cref="F:Ionic.Zip.Zip64Option.Never"/>. <see cref="F:Ionic.Zip.Zip64Option.AsNecessary"/> is
  9920. safest, in the sense that you will not get an Exception if a pre-ZIP64
  9921. limit is exceeded.
  9922. </para>
  9923. <para>
  9924. You may set the property at any time before calling Save().
  9925. </para>
  9926. <para>
  9927. When reading a zip file via the <c>Zipfile.Read()</c> method, DotNetZip
  9928. will properly read ZIP64-endowed zip archives, regardless of the value of
  9929. this property. DotNetZip will always read ZIP64 archives. This property
  9930. governs only whether DotNetZip will write them. Therefore, when updating
  9931. archives, be careful about setting this property after reading an archive
  9932. that may use ZIP64 extensions.
  9933. </para>
  9934. <para>
  9935. An interesting question is, if you have set this property to
  9936. <c>AsNecessary</c>, and then successfully saved, does the resulting
  9937. archive use ZIP64 extensions or not? To learn this, check the <see cref="P:Ionic.Zip.ZipFile.OutputUsedZip64"/> property, after calling <c>Save()</c>.
  9938. </para>
  9939. <para>
  9940. Have you thought about
  9941. <see href="http://cheeso.members.winisp.net/DotNetZipDonate.aspx">donating</see>?
  9942. </para>
  9943. </remarks>
  9944. <seealso cref="P:Ionic.Zip.ZipFile.RequiresZip64"/>
  9945. </member>
  9946. <member name="P:Ionic.Zip.ZipFile.RequiresZip64">
  9947. <summary>
  9948. Indicates whether the archive requires ZIP64 extensions.
  9949. </summary>
  9950. <remarks>
  9951. <para>
  9952. This property is <c>null</c> (or <c>Nothing</c> in VB) if the archive has
  9953. not been saved, and there are fewer than 65334 <c>ZipEntry</c> items
  9954. contained in the archive.
  9955. </para>
  9956. <para>
  9957. The <c>Value</c> is true if any of the following four conditions holds:
  9958. the uncompressed size of any entry is larger than 0xFFFFFFFF; the
  9959. compressed size of any entry is larger than 0xFFFFFFFF; the relative
  9960. offset of any entry within the zip archive is larger than 0xFFFFFFFF; or
  9961. there are more than 65534 entries in the archive. (0xFFFFFFFF =
  9962. 4,294,967,295). The result may not be known until a <c>Save()</c> is attempted
  9963. on the zip archive. The Value of this <see cref="T:System.Nullable"/>
  9964. property may be set only AFTER one of the Save() methods has been called.
  9965. </para>
  9966. <para>
  9967. If none of the four conditions holds, and the archive has been saved, then
  9968. the <c>Value</c> is false.
  9969. </para>
  9970. <para>
  9971. A <c>Value</c> of false does not indicate that the zip archive, as saved,
  9972. does not use ZIP64. It merely indicates that ZIP64 is not required. An
  9973. archive may use ZIP64 even when not required if the <see cref="P:Ionic.Zip.ZipFile.UseZip64WhenSaving"/> property is set to <see cref="F:Ionic.Zip.Zip64Option.Always"/>, or if the <see cref="P:Ionic.Zip.ZipFile.UseZip64WhenSaving"/> property is set to <see cref="F:Ionic.Zip.Zip64Option.AsNecessary"/> and the output stream was not
  9974. seekable. Use the <see cref="P:Ionic.Zip.ZipFile.OutputUsedZip64"/> property to determine if
  9975. the most recent <c>Save()</c> method resulted in an archive that utilized
  9976. the ZIP64 extensions.
  9977. </para>
  9978. </remarks>
  9979. <seealso cref="P:Ionic.Zip.ZipFile.UseZip64WhenSaving"/>
  9980. <seealso cref="P:Ionic.Zip.ZipFile.OutputUsedZip64"/>
  9981. </member>
  9982. <member name="P:Ionic.Zip.ZipFile.OutputUsedZip64">
  9983. <summary>
  9984. Indicates whether the most recent <c>Save()</c> operation used ZIP64 extensions.
  9985. </summary>
  9986. <remarks>
  9987. <para>
  9988. The use of ZIP64 extensions within an archive is not always necessary, and
  9989. for interoperability concerns, it may be desired to NOT use ZIP64 if
  9990. possible. The <see cref="P:Ionic.Zip.ZipFile.UseZip64WhenSaving"/> property can be
  9991. set to use ZIP64 extensions only when necessary. In those cases,
  9992. Sometimes applications want to know whether a Save() actually used ZIP64
  9993. extensions. Applications can query this read-only property to learn
  9994. whether ZIP64 has been used in a just-saved <c>ZipFile</c>.
  9995. </para>
  9996. <para>
  9997. The value is <c>null</c> (or <c>Nothing</c> in VB) if the archive has not
  9998. been saved.
  9999. </para>
  10000. <para>
  10001. Non-null values (<c>HasValue</c> is true) indicate whether ZIP64
  10002. extensions were used during the most recent <c>Save()</c> operation. The
  10003. ZIP64 extensions may have been used as required by any particular entry
  10004. because of its uncompressed or compressed size, or because the archive is
  10005. larger than 4294967295 bytes, or because there are more than 65534 entries
  10006. in the archive, or because the <c>UseZip64WhenSaving</c> property was set
  10007. to <see cref="F:Ionic.Zip.Zip64Option.Always"/>, or because the
  10008. <c>UseZip64WhenSaving</c> property was set to <see cref="F:Ionic.Zip.Zip64Option.AsNecessary"/> and the output stream was not seekable.
  10009. The value of this property does not indicate the reason the ZIP64
  10010. extensions were used.
  10011. </para>
  10012. </remarks>
  10013. <seealso cref="P:Ionic.Zip.ZipFile.UseZip64WhenSaving"/>
  10014. <seealso cref="P:Ionic.Zip.ZipFile.RequiresZip64"/>
  10015. </member>
  10016. <member name="P:Ionic.Zip.ZipFile.InputUsesZip64">
  10017. <summary>
  10018. Indicates whether the most recent <c>Read()</c> operation read a zip file that uses
  10019. ZIP64 extensions.
  10020. </summary>
  10021. <remarks>
  10022. This property will return null (Nothing in VB) if you've added an entry after reading
  10023. the zip file.
  10024. </remarks>
  10025. </member>
  10026. <member name="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding">
  10027. <summary>
  10028. The text encoding to use when writing new entries to the <c>ZipFile</c>,
  10029. for those entries that cannot be encoded with the default (IBM437)
  10030. encoding; or, the text encoding that was used when reading the entries
  10031. from the <c>ZipFile</c>.
  10032. </summary>
  10033. <remarks>
  10034. <para>
  10035. In <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">its
  10036. zip specification</see>, PKWare describes two options for encoding
  10037. filenames and comments: using IBM437 or UTF-8. But, some archiving tools
  10038. or libraries do not follow the specification, and instead encode
  10039. characters using the system default code page. For example, WinRAR when
  10040. run on a machine in Shanghai may encode filenames with the Big-5 Chinese
  10041. (950) code page. This behavior is contrary to the Zip specification, but
  10042. it occurs anyway.
  10043. </para>
  10044. <para>
  10045. When using DotNetZip to write zip archives that will be read by one of
  10046. these other archivers, set this property to specify the code page to use
  10047. when encoding the <see cref="P:Ionic.Zip.ZipEntry.FileName"/> and <see cref="P:Ionic.Zip.ZipEntry.Comment"/> for each <c>ZipEntry</c> in the zip file, for
  10048. values that cannot be encoded with the default codepage for zip files,
  10049. IBM437. This is why this property is "provisional". In all cases, IBM437
  10050. is used where possible, in other words, where no loss of data would
  10051. result. It is possible, therefore, to have a given entry with a
  10052. <c>Comment</c> encoded in IBM437 and a <c>FileName</c> encoded with the
  10053. specified "provisional" codepage.
  10054. </para>
  10055. <para>
  10056. Be aware that a zip file created after you've explicitly set the <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/> property to a value other than
  10057. IBM437 may not be compliant to the PKWare specification, and may not be
  10058. readable by compliant archivers. On the other hand, many (most?)
  10059. archivers are non-compliant and can read zip files created in arbitrary
  10060. code pages. The trick is to use or specify the proper codepage when
  10061. reading the zip.
  10062. </para>
  10063. <para>
  10064. When creating a zip archive using this library, it is possible to change
  10065. the value of <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/> between each
  10066. entry you add, and between adding entries and the call to
  10067. <c>Save()</c>. Don't do this. It will likely result in a zipfile that is
  10068. not readable. For best interoperability, either leave <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/> alone, or specify it only once,
  10069. before adding any entries to the <c>ZipFile</c> instance. There is one
  10070. exception to this recommendation, described later.
  10071. </para>
  10072. <para>
  10073. When using an arbitrary, non-UTF8 code page for encoding, there is no
  10074. standard way for the creator application - whether DotNetZip, WinZip,
  10075. WinRar, or something else - to formally specify in the zip file which
  10076. codepage has been used for the entries. As a result, readers of zip files
  10077. are not able to inspect the zip file and determine the codepage that was
  10078. used for the entries contained within it. It is left to the application
  10079. or user to determine the necessary codepage when reading zip files encoded
  10080. this way. In other words, if you explicitly specify the codepage when you
  10081. create the zipfile, you must explicitly specify the same codepage when
  10082. reading the zipfile.
  10083. </para>
  10084. <para>
  10085. The way you specify the code page to use when reading a zip file varies
  10086. depending on the tool or library you use to read the zip. In DotNetZip,
  10087. you use a ZipFile.Read() method that accepts an encoding parameter. It
  10088. isn't possible with Windows Explorer, as far as I know, to specify an
  10089. explicit codepage to use when reading a zip. If you use an incorrect
  10090. codepage when reading a zipfile, you will get entries with filenames that
  10091. are incorrect, and the incorrect filenames may even contain characters
  10092. that are not legal for use within filenames in Windows. Extracting entries
  10093. with illegal characters in the filenames will lead to exceptions. It's too
  10094. bad, but this is just the way things are with code pages in zip
  10095. files. Caveat Emptor.
  10096. </para>
  10097. <para>
  10098. Example: Suppose you create a zipfile that contains entries with
  10099. filenames that have Danish characters. If you use <see cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/> equal to "iso-8859-1" (cp 28591),
  10100. the filenames will be correctly encoded in the zip. But, to read that
  10101. zipfile correctly, you have to specify the same codepage at the time you
  10102. read it. If try to read that zip file with Windows Explorer or another
  10103. application that is not flexible with respect to the codepage used to
  10104. decode filenames in zipfiles, you will get a filename like "Inf°.txt".
  10105. </para>
  10106. <para>
  10107. When using DotNetZip to read a zip archive, and the zip archive uses an
  10108. arbitrary code page, you must specify the encoding to use before or when
  10109. the <c>Zipfile</c> is READ. This means you must use a <c>ZipFile.Read()</c>
  10110. method that allows you to specify a System.Text.Encoding parameter. Setting
  10111. the ProvisionalAlternateEncoding property after your application has read in
  10112. the zip archive will not affect the entry names of entries that have already
  10113. been read in.
  10114. </para>
  10115. <para>
  10116. And now, the exception to the rule described above. One strategy for
  10117. specifying the code page for a given zip file is to describe the code page
  10118. in a human-readable form in the Zip comment. For example, the comment may
  10119. read "Entries in this archive are encoded in the Big5 code page". For
  10120. maximum interoperability, the zip comment in this case should be encoded
  10121. in the default, IBM437 code page. In this case, the zip comment is
  10122. encoded using a different page than the filenames. To do this, Specify
  10123. <c>ProvisionalAlternateEncoding</c> to your desired region-specific code
  10124. page, once before adding any entries, and then reset
  10125. <c>ProvisionalAlternateEncoding</c> to IBM437 before setting the <see cref="P:Ionic.Zip.ZipFile.Comment"/> property and calling Save().
  10126. </para>
  10127. </remarks>
  10128. <example>
  10129. This example shows how to read a zip file using the Big-5 Chinese code page
  10130. (950), and extract each entry in the zip file. For this code to work as
  10131. desired, the <c>Zipfile</c> must have been created using the big5 code page
  10132. (CP950). This is typical, for example, when using WinRar on a machine with
  10133. CP950 set as the default code page. In that case, the names of entries
  10134. within the Zip archive will be stored in that code page, and reading the zip
  10135. archive must be done using that code page. If the application did not use
  10136. the correct code page in <c>ZipFile.Read()</c>, then names of entries within the
  10137. zip archive would not be correctly retrieved.
  10138. <code>
  10139. using (var zip = ZipFile.Read(zipFileName, System.Text.Encoding.GetEncoding("big5")))
  10140. {
  10141. // retrieve and extract an entry using a name encoded with CP950
  10142. zip[MyDesiredEntry].Extract("unpack");
  10143. }
  10144. </code>
  10145. <code lang="VB">
  10146. Using zip As ZipFile = ZipFile.Read(ZipToExtract, System.Text.Encoding.GetEncoding("big5"))
  10147. ' retrieve and extract an entry using a name encoded with CP950
  10148. zip(MyDesiredEntry).Extract("unpack")
  10149. End Using
  10150. </code>
  10151. </example>
  10152. <seealso cref="P:Ionic.Zip.ZipFile.DefaultEncoding">DefaultEncoding</seealso>
  10153. </member>
  10154. <member name="P:Ionic.Zip.ZipFile.AlternateEncoding">
  10155. <summary>
  10156. A Text Encoding to use when encoding the filenames and comments for
  10157. all the ZipEntry items, during a ZipFile.Save() operation.
  10158. </summary>
  10159. <remarks>
  10160. <para>
  10161. Whether the encoding specified here is used during the save depends
  10162. on <see cref="P:Ionic.Zip.ZipFile.AlternateEncodingUsage"/>.
  10163. </para>
  10164. </remarks>
  10165. </member>
  10166. <member name="P:Ionic.Zip.ZipFile.AlternateEncodingUsage">
  10167. <summary>
  10168. A flag that tells if and when this instance should apply
  10169. AlternateEncoding to encode the filenames and comments associated to
  10170. of ZipEntry objects contained within this instance.
  10171. </summary>
  10172. </member>
  10173. <member name="P:Ionic.Zip.ZipFile.DefaultEncoding">
  10174. <summary>
  10175. The default text encoding used in zip archives. It is numeric 437, also
  10176. known as IBM437.
  10177. </summary>
  10178. <seealso cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>
  10179. </member>
  10180. <member name="P:Ionic.Zip.ZipFile.StatusMessageTextWriter">
  10181. <summary>
  10182. Gets or sets the <c>TextWriter</c> to which status messages are delivered
  10183. for the instance.
  10184. </summary>
  10185. <remarks>
  10186. If the TextWriter is set to a non-null value, then verbose output is sent
  10187. to the <c>TextWriter</c> during <c>Add</c><c>, Read</c><c>, Save</c> and
  10188. <c>Extract</c> operations. Typically, console applications might use
  10189. <c>Console.Out</c> and graphical or headless applications might use a
  10190. <c>System.IO.StringWriter</c>. The output of this is suitable for viewing
  10191. by humans.
  10192. </remarks>
  10193. <example>
  10194. <para>
  10195. In this example, a console application instantiates a <c>ZipFile</c>, then
  10196. sets the <c>StatusMessageTextWriter</c> to <c>Console.Out</c>. At that
  10197. point, all verbose status messages for that <c>ZipFile</c> are sent to the
  10198. console.
  10199. </para>
  10200. <code lang="C#">
  10201. using (ZipFile zip= ZipFile.Read(FilePath))
  10202. {
  10203. zip.StatusMessageTextWriter= System.Console.Out;
  10204. // messages are sent to the console during extraction
  10205. zip.ExtractAll();
  10206. }
  10207. </code>
  10208. <code lang="VB">
  10209. Using zip As ZipFile = ZipFile.Read(FilePath)
  10210. zip.StatusMessageTextWriter= System.Console.Out
  10211. 'Status Messages will be sent to the console during extraction
  10212. zip.ExtractAll()
  10213. End Using
  10214. </code>
  10215. <para>
  10216. In this example, a Windows Forms application instantiates a
  10217. <c>ZipFile</c>, then sets the <c>StatusMessageTextWriter</c> to a
  10218. <c>StringWriter</c>. At that point, all verbose status messages for that
  10219. <c>ZipFile</c> are sent to the <c>StringWriter</c>.
  10220. </para>
  10221. <code lang="C#">
  10222. var sw = new System.IO.StringWriter();
  10223. using (ZipFile zip= ZipFile.Read(FilePath))
  10224. {
  10225. zip.StatusMessageTextWriter= sw;
  10226. zip.ExtractAll();
  10227. }
  10228. Console.WriteLine("{0}", sw.ToString());
  10229. </code>
  10230. <code lang="VB">
  10231. Dim sw as New System.IO.StringWriter
  10232. Using zip As ZipFile = ZipFile.Read(FilePath)
  10233. zip.StatusMessageTextWriter= sw
  10234. zip.ExtractAll()
  10235. End Using
  10236. 'Status Messages are now available in sw
  10237. </code>
  10238. </example>
  10239. </member>
  10240. <member name="P:Ionic.Zip.ZipFile.TempFileFolder">
  10241. <summary>
  10242. Gets or sets the name for the folder to store the temporary file
  10243. this library writes when saving a zip archive.
  10244. </summary>
  10245. <remarks>
  10246. <para>
  10247. This library will create a temporary file when saving a Zip archive to a
  10248. file. This file is written when calling one of the <c>Save()</c> methods
  10249. that does not save to a stream, or one of the <c>SaveSelfExtractor()</c>
  10250. methods.
  10251. </para>
  10252. <para>
  10253. By default, the library will create the temporary file in the directory
  10254. specified for the file itself, via the <see cref="P:Ionic.Zip.ZipFile.Name"/> property or via
  10255. the <see cref="M:Ionic.Zip.ZipFile.Save(System.String)"/> method.
  10256. </para>
  10257. <para>
  10258. Setting this property allows applications to override this default
  10259. behavior, so that the library will create the temporary file in the
  10260. specified folder. For example, to have the library create the temporary
  10261. file in the current working directory, regardless where the <c>ZipFile</c>
  10262. is saved, specfy ".". To revert to the default behavior, set this
  10263. property to <c>null</c> (<c>Nothing</c> in VB).
  10264. </para>
  10265. <para>
  10266. When setting the property to a non-null value, the folder specified must
  10267. exist; if it does not an exception is thrown. The application should have
  10268. write and delete permissions on the folder. The permissions are not
  10269. explicitly checked ahead of time; if the application does not have the
  10270. appropriate rights, an exception will be thrown at the time <c>Save()</c>
  10271. is called.
  10272. </para>
  10273. <para>
  10274. There is no temporary file created when reading a zip archive. When
  10275. saving to a Stream, there is no temporary file created. For example, if
  10276. the application is an ASP.NET application and calls <c>Save()</c>
  10277. specifying the <c>Response.OutputStream</c> as the output stream, there is
  10278. no temporary file created.
  10279. </para>
  10280. </remarks>
  10281. <exception cref="T:System.IO.FileNotFoundException">
  10282. Thrown when setting the property if the directory does not exist.
  10283. </exception>
  10284. </member>
  10285. <member name="P:Ionic.Zip.ZipFile.Password">
  10286. <summary>
  10287. Sets the password to be used on the <c>ZipFile</c> instance.
  10288. </summary>
  10289. <remarks>
  10290. <para>
  10291. When writing a zip archive, this password is applied to the entries, not
  10292. to the zip archive itself. It applies to any <c>ZipEntry</c> subsequently
  10293. added to the <c>ZipFile</c>, using one of the <c>AddFile</c>,
  10294. <c>AddDirectory</c>, <c>AddEntry</c>, or <c>AddItem</c> methods, etc.
  10295. When reading a zip archive, this property applies to any entry
  10296. subsequently extracted from the <c>ZipFile</c> using one of the Extract
  10297. methods on the <c>ZipFile</c> class.
  10298. </para>
  10299. <para>
  10300. When writing a zip archive, keep this in mind: though the password is set
  10301. on the ZipFile object, according to the Zip spec, the "directory" of the
  10302. archive - in other words the list of entries or files contained in the archive - is
  10303. not encrypted with the password, or protected in any way. If you set the
  10304. Password property, the password actually applies to individual entries
  10305. that are added to the archive, subsequent to the setting of this property.
  10306. The list of filenames in the archive that is eventually created will
  10307. appear in clear text, but the contents of the individual files are
  10308. encrypted. This is how Zip encryption works.
  10309. </para>
  10310. <para>
  10311. One simple way around this limitation is to simply double-wrap sensitive
  10312. filenames: Store the files in a zip file, and then store that zip file
  10313. within a second, "outer" zip file. If you apply a password to the outer
  10314. zip file, then readers will be able to see that the outer zip file
  10315. contains an inner zip file. But readers will not be able to read the
  10316. directory or file list of the inner zip file.
  10317. </para>
  10318. <para>
  10319. If you set the password on the <c>ZipFile</c>, and then add a set of files
  10320. to the archive, then each entry is encrypted with that password. You may
  10321. also want to change the password between adding different entries. If you
  10322. set the password, add an entry, then set the password to <c>null</c>
  10323. (<c>Nothing</c> in VB), and add another entry, the first entry is
  10324. encrypted and the second is not. If you call <c>AddFile()</c>, then set
  10325. the <c>Password</c> property, then call <c>ZipFile.Save</c>, the file
  10326. added will not be password-protected, and no warning will be generated.
  10327. </para>
  10328. <para>
  10329. When setting the Password, you may also want to explicitly set the <see cref="P:Ionic.Zip.ZipFile.Encryption"/> property, to specify how to encrypt the entries added
  10330. to the ZipFile. If you set the Password to a non-null value and do not
  10331. set <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, then PKZip 2.0 ("Weak") encryption is used.
  10332. This encryption is relatively weak but is very interoperable. If you set
  10333. the password to a <c>null</c> value (<c>Nothing</c> in VB), Encryption is
  10334. reset to None.
  10335. </para>
  10336. <para>
  10337. All of the preceding applies to writing zip archives, in other words when
  10338. you use one of the Save methods. To use this property when reading or an
  10339. existing ZipFile, do the following: set the Password property on the
  10340. <c>ZipFile</c>, then call one of the Extract() overloads on the <see cref="T:Ionic.Zip.ZipEntry"/>. In this case, the entry is extracted using the
  10341. <c>Password</c> that is specified on the <c>ZipFile</c> instance. If you
  10342. have not set the <c>Password</c> property, then the password is
  10343. <c>null</c>, and the entry is extracted with no password.
  10344. </para>
  10345. <para>
  10346. If you set the Password property on the <c>ZipFile</c>, then call
  10347. <c>Extract()</c> an entry that has not been encrypted with a password, the
  10348. password is not used for that entry, and the <c>ZipEntry</c> is extracted
  10349. as normal. In other words, the password is used only if necessary.
  10350. </para>
  10351. <para>
  10352. The <see cref="T:Ionic.Zip.ZipEntry"/> class also has a <see cref="P:Ionic.Zip.ZipEntry.Password">Password</see> property. It takes precedence
  10353. over this property on the <c>ZipFile</c>. Typically, you would use the
  10354. per-entry Password when most entries in the zip archive use one password,
  10355. and a few entries use a different password. If all entries in the zip
  10356. file use the same password, then it is simpler to just set this property
  10357. on the <c>ZipFile</c> itself, whether creating a zip archive or extracting
  10358. a zip archive.
  10359. </para>
  10360. </remarks>
  10361. <example>
  10362. <para>
  10363. This example creates a zip file, using password protection for the
  10364. entries, and then extracts the entries from the zip file. When creating
  10365. the zip file, the Readme.txt file is not protected with a password, but
  10366. the other two are password-protected as they are saved. During extraction,
  10367. each file is extracted with the appropriate password.
  10368. </para>
  10369. <code>
  10370. // create a file with encryption
  10371. using (ZipFile zip = new ZipFile())
  10372. {
  10373. zip.AddFile("ReadMe.txt");
  10374. zip.Password= "!Secret1";
  10375. zip.AddFile("MapToTheSite-7440-N49th.png");
  10376. zip.AddFile("2008-Regional-Sales-Report.pdf");
  10377. zip.Save("EncryptedArchive.zip");
  10378. }
  10379. // extract entries that use encryption
  10380. using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip"))
  10381. {
  10382. zip.Password= "!Secret1";
  10383. zip.ExtractAll("extractDir");
  10384. }
  10385. </code>
  10386. <code lang="VB">
  10387. Using zip As New ZipFile
  10388. zip.AddFile("ReadMe.txt")
  10389. zip.Password = "123456!"
  10390. zip.AddFile("MapToTheSite-7440-N49th.png")
  10391. zip.Password= "!Secret1";
  10392. zip.AddFile("2008-Regional-Sales-Report.pdf")
  10393. zip.Save("EncryptedArchive.zip")
  10394. End Using
  10395. ' extract entries that use encryption
  10396. Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip"))
  10397. zip.Password= "!Secret1"
  10398. zip.ExtractAll("extractDir")
  10399. End Using
  10400. </code>
  10401. </example>
  10402. <seealso cref="P:Ionic.Zip.ZipFile.Encryption">ZipFile.Encryption</seealso>
  10403. <seealso cref="P:Ionic.Zip.ZipEntry.Password">ZipEntry.Password</seealso>
  10404. </member>
  10405. <member name="P:Ionic.Zip.ZipFile.ExtractExistingFile">
  10406. <summary>
  10407. The action the library should take when extracting a file that already
  10408. exists.
  10409. </summary>
  10410. <remarks>
  10411. <para>
  10412. This property affects the behavior of the Extract methods (one of the
  10413. <c>Extract()</c> or <c>ExtractWithPassword()</c> overloads), when
  10414. extraction would would overwrite an existing filesystem file. If you do
  10415. not set this property, the library throws an exception when extracting an
  10416. entry would overwrite an existing file.
  10417. </para>
  10418. <para>
  10419. This property has no effect when extracting to a stream, or when the file
  10420. to be extracted does not already exist.
  10421. </para>
  10422. </remarks>
  10423. <seealso cref="P:Ionic.Zip.ZipEntry.ExtractExistingFile"/>
  10424. </member>
  10425. <member name="P:Ionic.Zip.ZipFile.ZipErrorAction">
  10426. <summary>
  10427. The action the library should take when an error is encountered while
  10428. opening or reading files as they are saved into a zip archive.
  10429. </summary>
  10430. <remarks>
  10431. <para>
  10432. Errors can occur as a file is being saved to the zip archive. For
  10433. example, the File.Open may fail, or a File.Read may fail, because of
  10434. lock conflicts or other reasons.
  10435. </para>
  10436. <para>
  10437. The first problem might occur after having called AddDirectory() on a
  10438. directory that contains a Clipper .dbf file; the file is locked by
  10439. Clipper and cannot be opened for read by another process. An example of
  10440. the second problem might occur when trying to zip a .pst file that is in
  10441. use by Microsoft Outlook. Outlook locks a range on the file, which allows
  10442. other processes to open the file, but not read it in its entirety.
  10443. </para>
  10444. <para>
  10445. This property tells DotNetZip what you would like to do in the case of
  10446. these errors. The primary options are: <c>ZipErrorAction.Throw</c> to
  10447. throw an exception (this is the default behavior if you don't set this
  10448. property); <c>ZipErrorAction.Skip</c> to Skip the file for which there
  10449. was an error and continue saving; <c>ZipErrorAction.Retry</c> to Retry
  10450. the entry that caused the problem; or
  10451. <c>ZipErrorAction.InvokeErrorEvent</c> to invoke an event handler.
  10452. </para>
  10453. <para>
  10454. This property is implicitly set to <c>ZipErrorAction.InvokeErrorEvent</c>
  10455. if you add a handler to the <see cref="E:Ionic.Zip.ZipFile.ZipError"/> event. If you set
  10456. this property to something other than
  10457. <c>ZipErrorAction.InvokeErrorEvent</c>, then the <c>ZipError</c>
  10458. event is implicitly cleared. What it means is you can set one or the
  10459. other (or neither), depending on what you want, but you never need to set
  10460. both.
  10461. </para>
  10462. <para>
  10463. As with some other properties on the <c>ZipFile</c> class, like <see cref="P:Ionic.Zip.ZipFile.Password"/>, <see cref="P:Ionic.Zip.ZipFile.Encryption"/>, and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, setting this property on a <c>ZipFile</c>
  10464. instance will cause the specified <c>ZipErrorAction</c> to be used on all
  10465. <see cref="T:Ionic.Zip.ZipEntry"/> items that are subsequently added to the
  10466. <c>ZipFile</c> instance. If you set this property after you have added
  10467. items to the <c>ZipFile</c>, but before you have called <c>Save()</c>,
  10468. those items will not use the specified error handling action.
  10469. </para>
  10470. <para>
  10471. If you want to handle any errors that occur with any entry in the zip
  10472. file in the same way, then set this property once, before adding any
  10473. entries to the zip archive.
  10474. </para>
  10475. <para>
  10476. If you set this property to <c>ZipErrorAction.Skip</c> and you'd like to
  10477. learn which files may have been skipped after a <c>Save()</c>, you can
  10478. set the <see cref="P:Ionic.Zip.ZipFile.StatusMessageTextWriter"/> on the ZipFile before
  10479. calling <c>Save()</c>. A message will be emitted into that writer for
  10480. each skipped file, if any.
  10481. </para>
  10482. </remarks>
  10483. <example>
  10484. This example shows how to tell DotNetZip to skip any files for which an
  10485. error is generated during the Save().
  10486. <code lang="VB">
  10487. Public Sub SaveZipFile()
  10488. Dim SourceFolder As String = "fodder"
  10489. Dim DestFile As String = "eHandler.zip"
  10490. Dim sw as New StringWriter
  10491. Using zipArchive As ZipFile = New ZipFile
  10492. ' Tell DotNetZip to skip any files for which it encounters an error
  10493. zipArchive.ZipErrorAction = ZipErrorAction.Skip
  10494. zipArchive.StatusMessageTextWriter = sw
  10495. zipArchive.AddDirectory(SourceFolder)
  10496. zipArchive.Save(DestFile)
  10497. End Using
  10498. ' examine sw here to see any messages
  10499. End Sub
  10500. </code>
  10501. </example>
  10502. <seealso cref="P:Ionic.Zip.ZipEntry.ZipErrorAction"/>
  10503. <seealso cref="E:Ionic.Zip.ZipFile.ZipError"/>
  10504. </member>
  10505. <member name="P:Ionic.Zip.ZipFile.Encryption">
  10506. <summary>
  10507. The Encryption to use for entries added to the <c>ZipFile</c>.
  10508. </summary>
  10509. <remarks>
  10510. <para>
  10511. Set this when creating a zip archive, or when updating a zip archive. The
  10512. specified Encryption is applied to the entries subsequently added to the
  10513. <c>ZipFile</c> instance. Applications do not need to set the
  10514. <c>Encryption</c> property when reading or extracting a zip archive.
  10515. </para>
  10516. <para>
  10517. If you set this to something other than EncryptionAlgorithm.None, you
  10518. will also need to set the <see cref="P:Ionic.Zip.ZipFile.Password"/>.
  10519. </para>
  10520. <para>
  10521. As with some other properties on the <c>ZipFile</c> class, like <see cref="P:Ionic.Zip.ZipFile.Password"/> and <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/>, setting this
  10522. property on a <c>ZipFile</c> instance will cause the specified
  10523. <c>EncryptionAlgorithm</c> to be used on all <see cref="T:Ionic.Zip.ZipEntry"/> items
  10524. that are subsequently added to the <c>ZipFile</c> instance. In other
  10525. words, if you set this property after you have added items to the
  10526. <c>ZipFile</c>, but before you have called <c>Save()</c>, those items will
  10527. not be encrypted or protected with a password in the resulting zip
  10528. archive. To get a zip archive with encrypted entries, set this property,
  10529. along with the <see cref="P:Ionic.Zip.ZipFile.Password"/> property, before calling
  10530. <c>AddFile</c>, <c>AddItem</c>, or <c>AddDirectory</c> (etc.) on the
  10531. <c>ZipFile</c> instance.
  10532. </para>
  10533. <para>
  10534. If you read a <c>ZipFile</c>, you can modify the <c>Encryption</c> on an
  10535. encrypted entry, only by setting the <c>Encryption</c> property on the
  10536. <c>ZipEntry</c> itself. Setting the <c>Encryption</c> property on the
  10537. <c>ZipFile</c>, once it has been created via a call to
  10538. <c>ZipFile.Read()</c>, does not affect entries that were previously read.
  10539. </para>
  10540. <para>
  10541. For example, suppose you read a <c>ZipFile</c>, and there is an encrypted
  10542. entry. Setting the <c>Encryption</c> property on that <c>ZipFile</c> and
  10543. then calling <c>Save()</c> on the <c>ZipFile</c> does not update the
  10544. <c>Encryption</c> used for the entries in the archive. Neither is an
  10545. exception thrown. Instead, what happens during the <c>Save()</c> is that
  10546. all previously existing entries are copied through to the new zip archive,
  10547. with whatever encryption and password that was used when originally
  10548. creating the zip archive. Upon re-reading that archive, to extract
  10549. entries, applications should use the original password or passwords, if
  10550. any.
  10551. </para>
  10552. <para>
  10553. Suppose an application reads a <c>ZipFile</c>, and there is an encrypted
  10554. entry. Setting the <c>Encryption</c> property on that <c>ZipFile</c> and
  10555. then adding new entries (via <c>AddFile()</c>, <c>AddEntry()</c>, etc)
  10556. and then calling <c>Save()</c> on the <c>ZipFile</c> does not update the
  10557. <c>Encryption</c> on any of the entries that had previously been in the
  10558. <c>ZipFile</c>. The <c>Encryption</c> property applies only to the
  10559. newly-added entries.
  10560. </para>
  10561. </remarks>
  10562. <example>
  10563. <para>
  10564. This example creates a zip archive that uses encryption, and then extracts
  10565. entries from the archive. When creating the zip archive, the ReadMe.txt
  10566. file is zipped without using a password or encryption. The other files
  10567. use encryption.
  10568. </para>
  10569. <code>
  10570. // Create a zip archive with AES Encryption.
  10571. using (ZipFile zip = new ZipFile())
  10572. {
  10573. zip.AddFile("ReadMe.txt");
  10574. zip.Encryption= EncryptionAlgorithm.WinZipAes256;
  10575. zip.Password= "Top.Secret.No.Peeking!";
  10576. zip.AddFile("7440-N49th.png");
  10577. zip.AddFile("2008-Regional-Sales-Report.pdf");
  10578. zip.Save("EncryptedArchive.zip");
  10579. }
  10580. // Extract a zip archive that uses AES Encryption.
  10581. // You do not need to specify the algorithm during extraction.
  10582. using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip"))
  10583. {
  10584. zip.Password= "Top.Secret.No.Peeking!";
  10585. zip.ExtractAll("extractDirectory");
  10586. }
  10587. </code>
  10588. <code lang="VB">
  10589. ' Create a zip that uses Encryption.
  10590. Using zip As New ZipFile()
  10591. zip.Encryption= EncryptionAlgorithm.WinZipAes256
  10592. zip.Password= "Top.Secret.No.Peeking!"
  10593. zip.AddFile("ReadMe.txt")
  10594. zip.AddFile("7440-N49th.png")
  10595. zip.AddFile("2008-Regional-Sales-Report.pdf")
  10596. zip.Save("EncryptedArchive.zip")
  10597. End Using
  10598. ' Extract a zip archive that uses AES Encryption.
  10599. ' You do not need to specify the algorithm during extraction.
  10600. Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip"))
  10601. zip.Password= "Top.Secret.No.Peeking!"
  10602. zip.ExtractAll("extractDirectory")
  10603. End Using
  10604. </code>
  10605. </example>
  10606. <seealso cref="P:Ionic.Zip.ZipFile.Password">ZipFile.Password</seealso>
  10607. <seealso cref="P:Ionic.Zip.ZipEntry.Encryption">ZipEntry.Encryption</seealso>
  10608. </member>
  10609. <member name="P:Ionic.Zip.ZipFile.SetCompression">
  10610. <summary>
  10611. A callback that allows the application to specify the compression level
  10612. to use for entries subsequently added to the zip archive.
  10613. </summary>
  10614. <remarks>
  10615. <para>
  10616. With this callback, the DotNetZip library allows the application to
  10617. determine whether compression will be used, at the time of the
  10618. <c>Save</c>. This may be useful if the application wants to favor
  10619. speed over size, and wants to defer the decision until the time of
  10620. <c>Save</c>.
  10621. </para>
  10622. <para>
  10623. Typically applications set the <see cref="P:Ionic.Zip.ZipFile.CompressionLevel"/> property on
  10624. the <c>ZipFile</c> or on each <c>ZipEntry</c> to determine the level of
  10625. compression used. This is done at the time the entry is added to the
  10626. <c>ZipFile</c>. Setting the property to
  10627. <c>Ionic.Zlib.CompressionLevel.None</c> means no compression will be used.
  10628. </para>
  10629. <para>
  10630. This callback allows the application to defer the decision on the
  10631. <c>CompressionLevel</c> to use, until the time of the call to
  10632. <c>ZipFile.Save()</c>. The callback is invoked once per <c>ZipEntry</c>,
  10633. at the time the data for the entry is being written out as part of a
  10634. <c>Save()</c> operation. The application can use whatever criteria it
  10635. likes in determining the level to return. For example, an application may
  10636. wish that no .mp3 files should be compressed, because they are already
  10637. compressed and the extra compression is not worth the CPU time incurred,
  10638. and so can return <c>None</c> for all .mp3 entries.
  10639. </para>
  10640. <para>
  10641. The library determines whether compression will be attempted for an entry
  10642. this way: If the entry is a zero length file, or a directory, no
  10643. compression is used. Otherwise, if this callback is set, it is invoked
  10644. and the <c>CompressionLevel</c> is set to the return value. If this
  10645. callback has not been set, then the previously set value for
  10646. <c>CompressionLevel</c> is used.
  10647. </para>
  10648. </remarks>
  10649. </member>
  10650. <member name="P:Ionic.Zip.ZipFile.MaxOutputSegmentSize">
  10651. <summary>
  10652. The maximum size of an output segment, when saving a split Zip file.
  10653. </summary>
  10654. <remarks>
  10655. <para>
  10656. Set this to a non-zero value before calling <see cref="M:Ionic.Zip.ZipFile.Save"/> or <see cref="M:Ionic.Zip.ZipFile.Save(System.String)"/> to specify that the ZipFile should be saved as a
  10657. split archive, also sometimes called a spanned archive. Some also
  10658. call them multi-file archives.
  10659. </para>
  10660. <para>
  10661. A split zip archive is saved in a set of discrete filesystem files,
  10662. rather than in a single file. This is handy when transmitting the
  10663. archive in email or some other mechanism that has a limit to the size of
  10664. each file. The first file in a split archive will be named
  10665. <c>basename.z01</c>, the second will be named <c>basename.z02</c>, and
  10666. so on. The final file is named <c>basename.zip</c>. According to the zip
  10667. specification from PKWare, the minimum value is 65536, for a 64k segment
  10668. size. The maximum number of segments allows in a split archive is 99.
  10669. </para>
  10670. <para>
  10671. The value of this property determines the maximum size of a split
  10672. segment when writing a split archive. For example, suppose you have a
  10673. <c>ZipFile</c> that would save to a single file of 200k. If you set the
  10674. <c>MaxOutputSegmentSize</c> to 65536 before calling <c>Save()</c>, you
  10675. will get four distinct output files. On the other hand if you set this
  10676. property to 256k, then you will get a single-file archive for that
  10677. <c>ZipFile</c>.
  10678. </para>
  10679. <para>
  10680. The size of each split output file will be as large as possible, up to
  10681. the maximum size set here. The zip specification requires that some data
  10682. fields in a zip archive may not span a split boundary, and an output
  10683. segment may be smaller than the maximum if necessary to avoid that
  10684. problem. Also, obviously the final segment of the archive may be smaller
  10685. than the maximum segment size. Segments will never be larger than the
  10686. value set with this property.
  10687. </para>
  10688. <para>
  10689. You can save a split Zip file only when saving to a regular filesystem
  10690. file. It's not possible to save a split zip file as a self-extracting
  10691. archive, nor is it possible to save a split zip file to a stream. When
  10692. saving to a SFX or to a Stream, this property is ignored.
  10693. </para>
  10694. <para>
  10695. About interoperability: Split or spanned zip files produced by DotNetZip
  10696. can be read by WinZip or PKZip, and vice-versa. Segmented zip files may
  10697. not be readable by other tools, if those other tools don't support zip
  10698. spanning or splitting. When in doubt, test. I don't believe Windows
  10699. Explorer can extract a split archive.
  10700. </para>
  10701. <para>
  10702. This property has no effect when reading a split archive. You can read
  10703. a split archive in the normal way with DotNetZip.
  10704. </para>
  10705. <para>
  10706. When saving a zip file, if you want a regular zip file rather than a
  10707. split zip file, don't set this property, or set it to Zero.
  10708. </para>
  10709. <para>
  10710. If you read a split archive, with <see cref="M:Ionic.Zip.ZipFile.Read(System.String)"/> and
  10711. then subsequently call <c>ZipFile.Save()</c>, unless you set this
  10712. property before calling <c>Save()</c>, you will get a normal,
  10713. single-file archive.
  10714. </para>
  10715. </remarks>
  10716. <seealso cref="P:Ionic.Zip.ZipFile.NumberOfSegmentsForMostRecentSave"/>
  10717. </member>
  10718. <member name="P:Ionic.Zip.ZipFile.NumberOfSegmentsForMostRecentSave">
  10719. <summary>
  10720. Returns the number of segments used in the most recent Save() operation.
  10721. </summary>
  10722. <remarks>
  10723. <para>
  10724. This is normally zero, unless you have set the <see cref="P:Ionic.Zip.ZipFile.MaxOutputSegmentSize"/> property. If you have set <see cref="P:Ionic.Zip.ZipFile.MaxOutputSegmentSize"/>, and then you save a file, after the call to
  10725. Save() completes, you can read this value to learn the number of segments that
  10726. were created.
  10727. </para>
  10728. <para>
  10729. If you call Save("Archive.zip"), and it creates 5 segments, then you
  10730. will have filesystem files named Archive.z01, Archive.z02, Archive.z03,
  10731. Archive.z04, and Archive.zip, and the value of this property will be 5.
  10732. </para>
  10733. </remarks>
  10734. <seealso cref="P:Ionic.Zip.ZipFile.MaxOutputSegmentSize"/>
  10735. </member>
  10736. <member name="P:Ionic.Zip.ZipFile.ParallelDeflateThreshold">
  10737. <summary>
  10738. The size threshold for an entry, above which a parallel deflate is used.
  10739. </summary>
  10740. <remarks>
  10741. <para>
  10742. DotNetZip will use multiple threads to compress any ZipEntry,
  10743. if the entry is larger than the given size. Zero means "always
  10744. use parallel deflate", while -1 means "never use parallel
  10745. deflate". The default value for this property is 512k. Aside
  10746. from the special values of 0 and 1, the minimum value is 65536.
  10747. </para>
  10748. <para>
  10749. If the entry size cannot be known before compression, as with a
  10750. read-forward stream, then Parallel deflate will never be
  10751. performed, unless the value of this property is zero.
  10752. </para>
  10753. <para>
  10754. A parallel deflate operations will speed up the compression of
  10755. large files, on computers with multiple CPUs or multiple CPU
  10756. cores. For files above 1mb, on a dual core or dual-cpu (2p)
  10757. machine, the time required to compress the file can be 70% of the
  10758. single-threaded deflate. For very large files on 4p machines the
  10759. compression can be done in 30% of the normal time. The downside
  10760. is that parallel deflate consumes extra memory during the deflate,
  10761. and the deflation is not as effective.
  10762. </para>
  10763. <para>
  10764. Parallel deflate tends to yield slightly less compression when
  10765. compared to as single-threaded deflate; this is because the original
  10766. data stream is split into multiple independent buffers, each of which
  10767. is compressed in parallel. But because they are treated
  10768. independently, there is no opportunity to share compression
  10769. dictionaries. For that reason, a deflated stream may be slightly
  10770. larger when compressed using parallel deflate, as compared to a
  10771. traditional single-threaded deflate. Sometimes the increase over the
  10772. normal deflate is as much as 5% of the total compressed size. For
  10773. larger files it can be as small as 0.1%.
  10774. </para>
  10775. <para>
  10776. Multi-threaded compression does not give as much an advantage when
  10777. using Encryption. This is primarily because encryption tends to slow
  10778. down the entire pipeline. Also, multi-threaded compression gives less
  10779. of an advantage when using lower compression levels, for example <see cref="F:Ionic.Zlib.CompressionLevel.BestSpeed"/>. You may have to
  10780. perform some tests to determine the best approach for your situation.
  10781. </para>
  10782. </remarks>
  10783. <seealso cref="P:Ionic.Zip.ZipFile.ParallelDeflateMaxBufferPairs"/>
  10784. </member>
  10785. <member name="P:Ionic.Zip.ZipFile.ParallelDeflateMaxBufferPairs">
  10786. <summary>
  10787. The maximum number of buffer pairs to use when performing
  10788. parallel compression.
  10789. </summary>
  10790. <remarks>
  10791. <para>
  10792. This property sets an upper limit on the number of memory
  10793. buffer pairs to create when performing parallel
  10794. compression. The implementation of the parallel
  10795. compression stream allocates multiple buffers to
  10796. facilitate parallel compression. As each buffer fills up,
  10797. the stream uses <see cref="M:System.Threading.ThreadPool.QueueUserWorkItem(System.Threading.WaitCallback)">
  10798. ThreadPool.QueueUserWorkItem()</see> to compress those
  10799. buffers in a background threadpool thread. After a buffer
  10800. is compressed, it is re-ordered and written to the output
  10801. stream.
  10802. </para>
  10803. <para>
  10804. A higher number of buffer pairs enables a higher degree of
  10805. parallelism, which tends to increase the speed of compression on
  10806. multi-cpu computers. On the other hand, a higher number of buffer
  10807. pairs also implies a larger memory consumption, more active worker
  10808. threads, and a higher cpu utilization for any compression. This
  10809. property enables the application to limit its memory consumption and
  10810. CPU utilization behavior depending on requirements.
  10811. </para>
  10812. <para>
  10813. For each compression "task" that occurs in parallel, there are 2
  10814. buffers allocated: one for input and one for output. This property
  10815. sets a limit for the number of pairs. The total amount of storage
  10816. space allocated for buffering will then be (N*S*2), where N is the
  10817. number of buffer pairs, S is the size of each buffer (<see cref="P:Ionic.Zip.ZipFile.BufferSize"/>). By default, DotNetZip allocates 4 buffer
  10818. pairs per CPU core, so if your machine has 4 cores, and you retain
  10819. the default buffer size of 128k, then the
  10820. ParallelDeflateOutputStream will use 4 * 4 * 2 * 128kb of buffer
  10821. memory in total, or 4mb, in blocks of 128kb. If you then set this
  10822. property to 8, then the number will be 8 * 2 * 128kb of buffer
  10823. memory, or 2mb.
  10824. </para>
  10825. <para>
  10826. CPU utilization will also go up with additional buffers, because a
  10827. larger number of buffer pairs allows a larger number of background
  10828. threads to compress in parallel. If you find that parallel
  10829. compression is consuming too much memory or CPU, you can adjust this
  10830. value downward.
  10831. </para>
  10832. <para>
  10833. The default value is 16. Different values may deliver better or
  10834. worse results, depending on your priorities and the dynamic
  10835. performance characteristics of your storage and compute resources.
  10836. </para>
  10837. <para>
  10838. This property is not the number of buffer pairs to use; it is an
  10839. upper limit. An illustration: Suppose you have an application that
  10840. uses the default value of this property (which is 16), and it runs
  10841. on a machine with 2 CPU cores. In that case, DotNetZip will allocate
  10842. 4 buffer pairs per CPU core, for a total of 8 pairs. The upper
  10843. limit specified by this property has no effect.
  10844. </para>
  10845. <para>
  10846. The application can set this value at any time
  10847. before calling <c>ZipFile.Save()</c>.
  10848. </para>
  10849. </remarks>
  10850. <seealso cref="P:Ionic.Zip.ZipFile.ParallelDeflateThreshold"/>
  10851. </member>
  10852. <member name="P:Ionic.Zip.ZipFile.LibraryVersion">
  10853. <summary>
  10854. Returns the version number on the DotNetZip assembly.
  10855. </summary>
  10856. <remarks>
  10857. <para>
  10858. This property is exposed as a convenience. Callers could also get the
  10859. version value by retrieving GetName().Version on the
  10860. System.Reflection.Assembly object pointing to the DotNetZip
  10861. assembly. But sometimes it is not clear which assembly is being loaded.
  10862. This property makes it clear.
  10863. </para>
  10864. <para>
  10865. This static property is primarily useful for diagnostic purposes.
  10866. </para>
  10867. </remarks>
  10868. </member>
  10869. <member name="P:Ionic.Zip.ZipFile.Item(System.Int32)">
  10870. <summary>
  10871. This is an integer indexer into the Zip archive.
  10872. </summary>
  10873. <remarks>
  10874. <para>
  10875. This property is read-only.
  10876. </para>
  10877. <para>
  10878. Internally, the <c>ZipEntry</c> instances that belong to the
  10879. <c>ZipFile</c> are stored in a Dictionary. When you use this
  10880. indexer the first time, it creates a read-only
  10881. <c>List&lt;ZipEntry&gt;</c> from the Dictionary.Values Collection.
  10882. If at any time you modify the set of entries in the <c>ZipFile</c>,
  10883. either by adding an entry, removing an entry, or renaming an
  10884. entry, a new List will be created, and the numeric indexes for the
  10885. remaining entries may be different.
  10886. </para>
  10887. <para>
  10888. This means you cannot rename any ZipEntry from
  10889. inside an enumeration of the zip file.
  10890. </para>
  10891. <param name="ix">
  10892. The index value.
  10893. </param>
  10894. </remarks>
  10895. <returns>
  10896. The <c>ZipEntry</c> within the Zip archive at the specified index. If the
  10897. entry does not exist in the archive, this indexer throws.
  10898. </returns>
  10899. </member>
  10900. <member name="P:Ionic.Zip.ZipFile.Item(System.String)">
  10901. <summary>
  10902. This is a name-based indexer into the Zip archive.
  10903. </summary>
  10904. <remarks>
  10905. <para>
  10906. This property is read-only.
  10907. </para>
  10908. <para>
  10909. The <see cref="P:Ionic.Zip.ZipFile.CaseSensitiveRetrieval"/> property on the <c>ZipFile</c>
  10910. determines whether retrieval via this indexer is done via case-sensitive
  10911. comparisons. By default, retrieval is not case sensitive. This makes
  10912. sense on Windows, in which filesystems are not case sensitive.
  10913. </para>
  10914. <para>
  10915. Regardless of case-sensitivity, it is not always the case that
  10916. <c>this[value].FileName == value</c>. In other words, the <c>FileName</c>
  10917. property of the <c>ZipEntry</c> retrieved with this indexer, may or may
  10918. not be equal to the index value.
  10919. </para>
  10920. <para>
  10921. This is because DotNetZip performs a normalization of filenames passed to
  10922. this indexer, before attempting to retrieve the item. That normalization
  10923. includes: removal of a volume letter and colon, swapping backward slashes
  10924. for forward slashes. So, <c>zip["dir1\\entry1.txt"].FileName ==
  10925. "dir1/entry.txt"</c>.
  10926. </para>
  10927. <para>
  10928. Directory entries in the zip file may be retrieved via this indexer only
  10929. with names that have a trailing slash. DotNetZip automatically appends a
  10930. trailing slash to the names of any directory entries added to a zip.
  10931. </para>
  10932. </remarks>
  10933. <example>
  10934. This example extracts only the entries in a zip file that are .txt files.
  10935. <code>
  10936. using (ZipFile zip = ZipFile.Read("PackedDocuments.zip"))
  10937. {
  10938. foreach (string s1 in zip.EntryFilenames)
  10939. {
  10940. if (s1.EndsWith(".txt"))
  10941. zip[s1].Extract("textfiles");
  10942. }
  10943. }
  10944. </code>
  10945. <code lang="VB">
  10946. Using zip As ZipFile = ZipFile.Read("PackedDocuments.zip")
  10947. Dim s1 As String
  10948. For Each s1 In zip.EntryFilenames
  10949. If s1.EndsWith(".txt") Then
  10950. zip(s1).Extract("textfiles")
  10951. End If
  10952. Next
  10953. End Using
  10954. </code>
  10955. </example>
  10956. <seealso cref="M:Ionic.Zip.ZipFile.RemoveEntry(System.String)"/>
  10957. <exception cref="T:System.ArgumentException">
  10958. Thrown if the caller attempts to assign a non-null value to the indexer.
  10959. </exception>
  10960. <param name="fileName">
  10961. The name of the file, including any directory path, to retrieve from the
  10962. zip. The filename match is not case-sensitive by default; you can use the
  10963. <see cref="P:Ionic.Zip.ZipFile.CaseSensitiveRetrieval"/> property to change this behavior. The
  10964. pathname can use forward-slashes or backward slashes.
  10965. </param>
  10966. <returns>
  10967. The <c>ZipEntry</c> within the Zip archive, given by the specified
  10968. filename. If the named entry does not exist in the archive, this indexer
  10969. returns <c>null</c> (<c>Nothing</c> in VB).
  10970. </returns>
  10971. </member>
  10972. <member name="P:Ionic.Zip.ZipFile.EntryFileNames">
  10973. <summary>
  10974. The list of filenames for the entries contained within the zip archive.
  10975. </summary>
  10976. <remarks>
  10977. According to the ZIP specification, the names of the entries use forward
  10978. slashes in pathnames. If you are scanning through the list, you may have
  10979. to swap forward slashes for backslashes.
  10980. </remarks>
  10981. <seealso cref="P:Ionic.Zip.ZipFile.Item(System.String)"/>
  10982. <example>
  10983. This example shows one way to test if a filename is already contained
  10984. within a zip archive.
  10985. <code>
  10986. String zipFileToRead= "PackedDocuments.zip";
  10987. string candidate = "DatedMaterial.xps";
  10988. using (ZipFile zip = new ZipFile(zipFileToRead))
  10989. {
  10990. if (zip.EntryFilenames.Contains(candidate))
  10991. Console.WriteLine("The file '{0}' exists in the zip archive '{1}'",
  10992. candidate,
  10993. zipFileName);
  10994. else
  10995. Console.WriteLine("The file, '{0}', does not exist in the zip archive '{1}'",
  10996. candidate,
  10997. zipFileName);
  10998. Console.WriteLine();
  10999. }
  11000. </code>
  11001. <code lang="VB">
  11002. Dim zipFileToRead As String = "PackedDocuments.zip"
  11003. Dim candidate As String = "DatedMaterial.xps"
  11004. Using zip As ZipFile.Read(ZipFileToRead)
  11005. If zip.EntryFilenames.Contains(candidate) Then
  11006. Console.WriteLine("The file '{0}' exists in the zip archive '{1}'", _
  11007. candidate, _
  11008. zipFileName)
  11009. Else
  11010. Console.WriteLine("The file, '{0}', does not exist in the zip archive '{1}'", _
  11011. candidate, _
  11012. zipFileName)
  11013. End If
  11014. Console.WriteLine
  11015. End Using
  11016. </code>
  11017. </example>
  11018. <returns>
  11019. The list of strings for the filenames contained within the Zip archive.
  11020. </returns>
  11021. </member>
  11022. <member name="P:Ionic.Zip.ZipFile.Entries">
  11023. <summary>
  11024. Returns the readonly collection of entries in the Zip archive.
  11025. </summary>
  11026. <remarks>
  11027. <para>
  11028. If there are no entries in the current <c>ZipFile</c>, the value returned is a
  11029. non-null zero-element collection. If there are entries in the zip file,
  11030. the elements are returned in no particular order.
  11031. </para>
  11032. <para>
  11033. This is the implied enumerator on the <c>ZipFile</c> class. If you use a
  11034. <c>ZipFile</c> instance in a context that expects an enumerator, you will
  11035. get this collection.
  11036. </para>
  11037. </remarks>
  11038. <seealso cref="P:Ionic.Zip.ZipFile.EntriesSorted"/>
  11039. </member>
  11040. <member name="P:Ionic.Zip.ZipFile.EntriesSorted">
  11041. <summary>
  11042. Returns a readonly collection of entries in the Zip archive, sorted by FileName.
  11043. </summary>
  11044. <remarks>
  11045. If there are no entries in the current <c>ZipFile</c>, the value returned
  11046. is a non-null zero-element collection. If there are entries in the zip
  11047. file, the elements are returned sorted by the name of the entry.
  11048. </remarks>
  11049. <example>
  11050. This example fills a Windows Forms ListView with the entries in a zip file.
  11051. <code lang="C#">
  11052. using (ZipFile zip = ZipFile.Read(zipFile))
  11053. {
  11054. foreach (ZipEntry entry in zip.EntriesSorted)
  11055. {
  11056. ListViewItem item = new ListViewItem(n.ToString());
  11057. n++;
  11058. string[] subitems = new string[] {
  11059. entry.FileName.Replace("/","\\"),
  11060. entry.LastModified.ToString("yyyy-MM-dd HH:mm:ss"),
  11061. entry.UncompressedSize.ToString(),
  11062. String.Format("{0,5:F0}%", entry.CompressionRatio),
  11063. entry.CompressedSize.ToString(),
  11064. (entry.UsesEncryption) ? "Y" : "N",
  11065. String.Format("{0:X8}", entry.Crc)};
  11066. foreach (String s in subitems)
  11067. {
  11068. ListViewItem.ListViewSubItem subitem = new ListViewItem.ListViewSubItem();
  11069. subitem.Text = s;
  11070. item.SubItems.Add(subitem);
  11071. }
  11072. this.listView1.Items.Add(item);
  11073. }
  11074. }
  11075. </code>
  11076. </example>
  11077. <seealso cref="P:Ionic.Zip.ZipFile.Entries"/>
  11078. </member>
  11079. <member name="P:Ionic.Zip.ZipFile.Count">
  11080. <summary>
  11081. Returns the number of entries in the Zip archive.
  11082. </summary>
  11083. </member>
  11084. <member name="E:Ionic.Zip.ZipFile.SaveProgress">
  11085. <summary>
  11086. An event handler invoked when a Save() starts, before and after each
  11087. entry has been written to the archive, when a Save() completes, and
  11088. during other Save events.
  11089. </summary>
  11090. <remarks>
  11091. <para>
  11092. Depending on the particular event, different properties on the <see cref="T:Ionic.Zip.SaveProgressEventArgs"/> parameter are set. The following
  11093. table summarizes the available EventTypes and the conditions under
  11094. which this event handler is invoked with a
  11095. <c>SaveProgressEventArgs</c> with the given EventType.
  11096. </para>
  11097. <list type="table">
  11098. <listheader>
  11099. <term>value of EntryType</term>
  11100. <description>Meaning and conditions</description>
  11101. </listheader>
  11102. <item>
  11103. <term>ZipProgressEventType.Saving_Started</term>
  11104. <description>Fired when ZipFile.Save() begins.
  11105. </description>
  11106. </item>
  11107. <item>
  11108. <term>ZipProgressEventType.Saving_BeforeSaveEntry</term>
  11109. <description>
  11110. Fired within ZipFile.Save(), just before writing data for each
  11111. particular entry.
  11112. </description>
  11113. </item>
  11114. <item>
  11115. <term>ZipProgressEventType.Saving_AfterSaveEntry</term>
  11116. <description>
  11117. Fired within ZipFile.Save(), just after having finished writing data
  11118. for each particular entry.
  11119. </description>
  11120. </item>
  11121. <item>
  11122. <term>ZipProgressEventType.Saving_Completed</term>
  11123. <description>Fired when ZipFile.Save() has completed.
  11124. </description>
  11125. </item>
  11126. <item>
  11127. <term>ZipProgressEventType.Saving_AfterSaveTempArchive</term>
  11128. <description>
  11129. Fired after the temporary file has been created. This happens only
  11130. when saving to a disk file. This event will not be invoked when
  11131. saving to a stream.
  11132. </description>
  11133. </item>
  11134. <item>
  11135. <term>ZipProgressEventType.Saving_BeforeRenameTempArchive</term>
  11136. <description>
  11137. Fired just before renaming the temporary file to the permanent
  11138. location. This happens only when saving to a disk file. This event
  11139. will not be invoked when saving to a stream.
  11140. </description>
  11141. </item>
  11142. <item>
  11143. <term>ZipProgressEventType.Saving_AfterRenameTempArchive</term>
  11144. <description>
  11145. Fired just after renaming the temporary file to the permanent
  11146. location. This happens only when saving to a disk file. This event
  11147. will not be invoked when saving to a stream.
  11148. </description>
  11149. </item>
  11150. <item>
  11151. <term>ZipProgressEventType.Saving_AfterCompileSelfExtractor</term>
  11152. <description>
  11153. Fired after a self-extracting archive has finished compiling. This
  11154. EventType is used only within SaveSelfExtractor().
  11155. </description>
  11156. </item>
  11157. <item>
  11158. <term>ZipProgressEventType.Saving_BytesRead</term>
  11159. <description>
  11160. Set during the save of a particular entry, to update progress of the
  11161. Save(). When this EventType is set, the BytesTransferred is the
  11162. number of bytes that have been read from the source stream. The
  11163. TotalBytesToTransfer is the number of bytes in the uncompressed
  11164. file.
  11165. </description>
  11166. </item>
  11167. </list>
  11168. </remarks>
  11169. <example>
  11170. This example uses an anonymous method to handle the
  11171. SaveProgress event, by updating a progress bar.
  11172. <code lang="C#">
  11173. progressBar1.Value = 0;
  11174. progressBar1.Max = listbox1.Items.Count;
  11175. using (ZipFile zip = new ZipFile())
  11176. {
  11177. // listbox1 contains a list of filenames
  11178. zip.AddFiles(listbox1.Items);
  11179. // do the progress bar:
  11180. zip.SaveProgress += (sender, e) =&gt; {
  11181. if (e.EventType == ZipProgressEventType.Saving_BeforeWriteEntry) {
  11182. progressBar1.PerformStep();
  11183. }
  11184. };
  11185. zip.Save(fs);
  11186. }
  11187. </code>
  11188. </example>
  11189. <example>
  11190. This example uses a named method as the
  11191. <c>SaveProgress</c> event handler, to update the user, in a
  11192. console-based application.
  11193. <code lang="C#">
  11194. static bool justHadByteUpdate= false;
  11195. public static void SaveProgress(object sender, SaveProgressEventArgs e)
  11196. {
  11197. if (e.EventType == ZipProgressEventType.Saving_Started)
  11198. Console.WriteLine("Saving: {0}", e.ArchiveName);
  11199. else if (e.EventType == ZipProgressEventType.Saving_Completed)
  11200. {
  11201. justHadByteUpdate= false;
  11202. Console.WriteLine();
  11203. Console.WriteLine("Done: {0}", e.ArchiveName);
  11204. }
  11205. else if (e.EventType == ZipProgressEventType.Saving_BeforeWriteEntry)
  11206. {
  11207. if (justHadByteUpdate)
  11208. Console.WriteLine();
  11209. Console.WriteLine(" Writing: {0} ({1}/{2})",
  11210. e.CurrentEntry.FileName, e.EntriesSaved, e.EntriesTotal);
  11211. justHadByteUpdate= false;
  11212. }
  11213. else if (e.EventType == ZipProgressEventType.Saving_EntryBytesRead)
  11214. {
  11215. if (justHadByteUpdate)
  11216. Console.SetCursorPosition(0, Console.CursorTop);
  11217. Console.Write(" {0}/{1} ({2:N0}%)", e.BytesTransferred, e.TotalBytesToTransfer,
  11218. e.BytesTransferred / (0.01 * e.TotalBytesToTransfer ));
  11219. justHadByteUpdate= true;
  11220. }
  11221. }
  11222. public static ZipUp(string targetZip, string directory)
  11223. {
  11224. using (var zip = new ZipFile()) {
  11225. zip.SaveProgress += SaveProgress;
  11226. zip.AddDirectory(directory);
  11227. zip.Save(targetZip);
  11228. }
  11229. }
  11230. </code>
  11231. <code lang="VB">
  11232. Public Sub ZipUp(ByVal targetZip As String, ByVal directory As String)
  11233. Using zip As ZipFile = New ZipFile
  11234. AddHandler zip.SaveProgress, AddressOf MySaveProgress
  11235. zip.AddDirectory(directory)
  11236. zip.Save(targetZip)
  11237. End Using
  11238. End Sub
  11239. Private Shared justHadByteUpdate As Boolean = False
  11240. Public Shared Sub MySaveProgress(ByVal sender As Object, ByVal e As SaveProgressEventArgs)
  11241. If (e.EventType Is ZipProgressEventType.Saving_Started) Then
  11242. Console.WriteLine("Saving: {0}", e.ArchiveName)
  11243. ElseIf (e.EventType Is ZipProgressEventType.Saving_Completed) Then
  11244. justHadByteUpdate = False
  11245. Console.WriteLine
  11246. Console.WriteLine("Done: {0}", e.ArchiveName)
  11247. ElseIf (e.EventType Is ZipProgressEventType.Saving_BeforeWriteEntry) Then
  11248. If justHadByteUpdate Then
  11249. Console.WriteLine
  11250. End If
  11251. Console.WriteLine(" Writing: {0} ({1}/{2})", e.CurrentEntry.FileName, e.EntriesSaved, e.EntriesTotal)
  11252. justHadByteUpdate = False
  11253. ElseIf (e.EventType Is ZipProgressEventType.Saving_EntryBytesRead) Then
  11254. If justHadByteUpdate Then
  11255. Console.SetCursorPosition(0, Console.CursorTop)
  11256. End If
  11257. Console.Write(" {0}/{1} ({2:N0}%)", e.BytesTransferred, _
  11258. e.TotalBytesToTransfer, _
  11259. (CDbl(e.BytesTransferred) / (0.01 * e.TotalBytesToTransfer)))
  11260. justHadByteUpdate = True
  11261. End If
  11262. End Sub
  11263. </code>
  11264. </example>
  11265. <example>
  11266. This is a more complete example of using the SaveProgress
  11267. events in a Windows Forms application, with a
  11268. Thread object.
  11269. <code lang="C#">
  11270. delegate void SaveEntryProgress(SaveProgressEventArgs e);
  11271. delegate void ButtonClick(object sender, EventArgs e);
  11272. public class WorkerOptions
  11273. {
  11274. public string ZipName;
  11275. public string Folder;
  11276. public string Encoding;
  11277. public string Comment;
  11278. public int ZipFlavor;
  11279. public Zip64Option Zip64;
  11280. }
  11281. private int _progress2MaxFactor;
  11282. private bool _saveCanceled;
  11283. private long _totalBytesBeforeCompress;
  11284. private long _totalBytesAfterCompress;
  11285. private Thread _workerThread;
  11286. private void btnZipup_Click(object sender, EventArgs e)
  11287. {
  11288. KickoffZipup();
  11289. }
  11290. private void btnCancel_Click(object sender, EventArgs e)
  11291. {
  11292. if (this.lblStatus.InvokeRequired)
  11293. {
  11294. this.lblStatus.Invoke(new ButtonClick(this.btnCancel_Click), new object[] { sender, e });
  11295. }
  11296. else
  11297. {
  11298. _saveCanceled = true;
  11299. lblStatus.Text = "Canceled...";
  11300. ResetState();
  11301. }
  11302. }
  11303. private void KickoffZipup()
  11304. {
  11305. _folderName = tbDirName.Text;
  11306. if (_folderName == null || _folderName == "") return;
  11307. if (this.tbZipName.Text == null || this.tbZipName.Text == "") return;
  11308. // check for existence of the zip file:
  11309. if (System.IO.File.Exists(this.tbZipName.Text))
  11310. {
  11311. var dlgResult = MessageBox.Show(String.Format("The file you have specified ({0}) already exists." +
  11312. " Do you want to overwrite this file?", this.tbZipName.Text),
  11313. "Confirmation is Required", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
  11314. if (dlgResult != DialogResult.Yes) return;
  11315. System.IO.File.Delete(this.tbZipName.Text);
  11316. }
  11317. _saveCanceled = false;
  11318. _nFilesCompleted = 0;
  11319. _totalBytesAfterCompress = 0;
  11320. _totalBytesBeforeCompress = 0;
  11321. this.btnOk.Enabled = false;
  11322. this.btnOk.Text = "Zipping...";
  11323. this.btnCancel.Enabled = true;
  11324. lblStatus.Text = "Zipping...";
  11325. var options = new WorkerOptions
  11326. {
  11327. ZipName = this.tbZipName.Text,
  11328. Folder = _folderName,
  11329. Encoding = "ibm437"
  11330. };
  11331. if (this.comboBox1.SelectedIndex != 0)
  11332. {
  11333. options.Encoding = this.comboBox1.SelectedItem.ToString();
  11334. }
  11335. if (this.radioFlavorSfxCmd.Checked)
  11336. options.ZipFlavor = 2;
  11337. else if (this.radioFlavorSfxGui.Checked)
  11338. options.ZipFlavor = 1;
  11339. else options.ZipFlavor = 0;
  11340. if (this.radioZip64AsNecessary.Checked)
  11341. options.Zip64 = Zip64Option.AsNecessary;
  11342. else if (this.radioZip64Always.Checked)
  11343. options.Zip64 = Zip64Option.Always;
  11344. else options.Zip64 = Zip64Option.Never;
  11345. options.Comment = String.Format("Encoding:{0} || Flavor:{1} || ZIP64:{2}\r\nCreated at {3} || {4}\r\n",
  11346. options.Encoding,
  11347. FlavorToString(options.ZipFlavor),
  11348. options.Zip64.ToString(),
  11349. System.DateTime.Now.ToString("yyyy-MMM-dd HH:mm:ss"),
  11350. this.Text);
  11351. if (this.tbComment.Text != TB_COMMENT_NOTE)
  11352. options.Comment += this.tbComment.Text;
  11353. _workerThread = new Thread(this.DoSave);
  11354. _workerThread.Name = "Zip Saver thread";
  11355. _workerThread.Start(options);
  11356. this.Cursor = Cursors.WaitCursor;
  11357. }
  11358. private void DoSave(Object p)
  11359. {
  11360. WorkerOptions options = p as WorkerOptions;
  11361. try
  11362. {
  11363. using (var zip1 = new ZipFile())
  11364. {
  11365. zip1.ProvisionalAlternateEncoding = System.Text.Encoding.GetEncoding(options.Encoding);
  11366. zip1.Comment = options.Comment;
  11367. zip1.AddDirectory(options.Folder);
  11368. _entriesToZip = zip1.EntryFileNames.Count;
  11369. SetProgressBars();
  11370. zip1.SaveProgress += this.zip1_SaveProgress;
  11371. zip1.UseZip64WhenSaving = options.Zip64;
  11372. if (options.ZipFlavor == 1)
  11373. zip1.SaveSelfExtractor(options.ZipName, SelfExtractorFlavor.WinFormsApplication);
  11374. else if (options.ZipFlavor == 2)
  11375. zip1.SaveSelfExtractor(options.ZipName, SelfExtractorFlavor.ConsoleApplication);
  11376. else
  11377. zip1.Save(options.ZipName);
  11378. }
  11379. }
  11380. catch (System.Exception exc1)
  11381. {
  11382. MessageBox.Show(String.Format("Exception while zipping: {0}", exc1.Message));
  11383. btnCancel_Click(null, null);
  11384. }
  11385. }
  11386. void zip1_SaveProgress(object sender, SaveProgressEventArgs e)
  11387. {
  11388. switch (e.EventType)
  11389. {
  11390. case ZipProgressEventType.Saving_AfterWriteEntry:
  11391. StepArchiveProgress(e);
  11392. break;
  11393. case ZipProgressEventType.Saving_EntryBytesRead:
  11394. StepEntryProgress(e);
  11395. break;
  11396. case ZipProgressEventType.Saving_Completed:
  11397. SaveCompleted();
  11398. break;
  11399. case ZipProgressEventType.Saving_AfterSaveTempArchive:
  11400. // this event only occurs when saving an SFX file
  11401. TempArchiveSaved();
  11402. break;
  11403. }
  11404. if (_saveCanceled)
  11405. e.Cancel = true;
  11406. }
  11407. private void StepArchiveProgress(SaveProgressEventArgs e)
  11408. {
  11409. if (this.progressBar1.InvokeRequired)
  11410. {
  11411. this.progressBar1.Invoke(new SaveEntryProgress(this.StepArchiveProgress), new object[] { e });
  11412. }
  11413. else
  11414. {
  11415. if (!_saveCanceled)
  11416. {
  11417. _nFilesCompleted++;
  11418. this.progressBar1.PerformStep();
  11419. _totalBytesAfterCompress += e.CurrentEntry.CompressedSize;
  11420. _totalBytesBeforeCompress += e.CurrentEntry.UncompressedSize;
  11421. // reset the progress bar for the entry:
  11422. this.progressBar2.Value = this.progressBar2.Maximum = 1;
  11423. this.Update();
  11424. }
  11425. }
  11426. }
  11427. private void StepEntryProgress(SaveProgressEventArgs e)
  11428. {
  11429. if (this.progressBar2.InvokeRequired)
  11430. {
  11431. this.progressBar2.Invoke(new SaveEntryProgress(this.StepEntryProgress), new object[] { e });
  11432. }
  11433. else
  11434. {
  11435. if (!_saveCanceled)
  11436. {
  11437. if (this.progressBar2.Maximum == 1)
  11438. {
  11439. // reset
  11440. Int64 max = e.TotalBytesToTransfer;
  11441. _progress2MaxFactor = 0;
  11442. while (max &gt; System.Int32.MaxValue)
  11443. {
  11444. max /= 2;
  11445. _progress2MaxFactor++;
  11446. }
  11447. this.progressBar2.Maximum = (int)max;
  11448. lblStatus.Text = String.Format("{0} of {1} files...({2})",
  11449. _nFilesCompleted + 1, _entriesToZip, e.CurrentEntry.FileName);
  11450. }
  11451. int xferred = e.BytesTransferred &gt;&gt; _progress2MaxFactor;
  11452. this.progressBar2.Value = (xferred &gt;= this.progressBar2.Maximum)
  11453. ? this.progressBar2.Maximum
  11454. : xferred;
  11455. this.Update();
  11456. }
  11457. }
  11458. }
  11459. private void SaveCompleted()
  11460. {
  11461. if (this.lblStatus.InvokeRequired)
  11462. {
  11463. this.lblStatus.Invoke(new MethodInvoker(this.SaveCompleted));
  11464. }
  11465. else
  11466. {
  11467. lblStatus.Text = String.Format("Done, Compressed {0} files, {1:N0}% of original.",
  11468. _nFilesCompleted, (100.00 * _totalBytesAfterCompress) / _totalBytesBeforeCompress);
  11469. ResetState();
  11470. }
  11471. }
  11472. private void ResetState()
  11473. {
  11474. this.btnCancel.Enabled = false;
  11475. this.btnOk.Enabled = true;
  11476. this.btnOk.Text = "Zip it!";
  11477. this.progressBar1.Value = 0;
  11478. this.progressBar2.Value = 0;
  11479. this.Cursor = Cursors.Default;
  11480. if (!_workerThread.IsAlive)
  11481. _workerThread.Join();
  11482. }
  11483. </code>
  11484. </example>
  11485. <seealso cref="E:Ionic.Zip.ZipFile.ReadProgress"/>
  11486. <seealso cref="E:Ionic.Zip.ZipFile.AddProgress"/>
  11487. <seealso cref="E:Ionic.Zip.ZipFile.ExtractProgress"/>
  11488. </member>
  11489. <member name="E:Ionic.Zip.ZipFile.ReadProgress">
  11490. <summary>
  11491. An event handler invoked before, during, and after the reading of a zip archive.
  11492. </summary>
  11493. <remarks>
  11494. <para>
  11495. Depending on the particular event being signaled, different properties on the
  11496. <see cref="T:Ionic.Zip.ReadProgressEventArgs"/> parameter are set. The following table
  11497. summarizes the available EventTypes and the conditions under which this
  11498. event handler is invoked with a <c>ReadProgressEventArgs</c> with the given EventType.
  11499. </para>
  11500. <list type="table">
  11501. <listheader>
  11502. <term>value of EntryType</term>
  11503. <description>Meaning and conditions</description>
  11504. </listheader>
  11505. <item>
  11506. <term>ZipProgressEventType.Reading_Started</term>
  11507. <description>Fired just as ZipFile.Read() begins. Meaningful properties: ArchiveName.
  11508. </description>
  11509. </item>
  11510. <item>
  11511. <term>ZipProgressEventType.Reading_Completed</term>
  11512. <description>Fired when ZipFile.Read() has completed. Meaningful properties: ArchiveName.
  11513. </description>
  11514. </item>
  11515. <item>
  11516. <term>ZipProgressEventType.Reading_ArchiveBytesRead</term>
  11517. <description>Fired while reading, updates the number of bytes read for the entire archive.
  11518. Meaningful properties: ArchiveName, CurrentEntry, BytesTransferred, TotalBytesToTransfer.
  11519. </description>
  11520. </item>
  11521. <item>
  11522. <term>ZipProgressEventType.Reading_BeforeReadEntry</term>
  11523. <description>Indicates an entry is about to be read from the archive.
  11524. Meaningful properties: ArchiveName, EntriesTotal.
  11525. </description>
  11526. </item>
  11527. <item>
  11528. <term>ZipProgressEventType.Reading_AfterReadEntry</term>
  11529. <description>Indicates an entry has just been read from the archive.
  11530. Meaningful properties: ArchiveName, EntriesTotal, CurrentEntry.
  11531. </description>
  11532. </item>
  11533. </list>
  11534. </remarks>
  11535. <seealso cref="E:Ionic.Zip.ZipFile.SaveProgress"/>
  11536. <seealso cref="E:Ionic.Zip.ZipFile.AddProgress"/>
  11537. <seealso cref="E:Ionic.Zip.ZipFile.ExtractProgress"/>
  11538. </member>
  11539. <member name="E:Ionic.Zip.ZipFile.ExtractProgress">
  11540. <summary>
  11541. An event handler invoked before, during, and after extraction of
  11542. entries in the zip archive.
  11543. </summary>
  11544. <remarks>
  11545. <para>
  11546. Depending on the particular event, different properties on the <see cref="T:Ionic.Zip.ExtractProgressEventArgs"/> parameter are set. The following
  11547. table summarizes the available EventTypes and the conditions under
  11548. which this event handler is invoked with a
  11549. <c>ExtractProgressEventArgs</c> with the given EventType.
  11550. </para>
  11551. <list type="table">
  11552. <listheader>
  11553. <term>value of EntryType</term>
  11554. <description>Meaning and conditions</description>
  11555. </listheader>
  11556. <item>
  11557. <term>ZipProgressEventType.Extracting_BeforeExtractAll</term>
  11558. <description>
  11559. Set when ExtractAll() begins. The ArchiveName, Overwrite, and
  11560. ExtractLocation properties are meaningful.</description>
  11561. </item>
  11562. <item>
  11563. <term>ZipProgressEventType.Extracting_AfterExtractAll</term>
  11564. <description>
  11565. Set when ExtractAll() has completed. The ArchiveName, Overwrite,
  11566. and ExtractLocation properties are meaningful.
  11567. </description>
  11568. </item>
  11569. <item>
  11570. <term>ZipProgressEventType.Extracting_BeforeExtractEntry</term>
  11571. <description>
  11572. Set when an Extract() on an entry in the ZipFile has begun.
  11573. Properties that are meaningful: ArchiveName, EntriesTotal,
  11574. CurrentEntry, Overwrite, ExtractLocation, EntriesExtracted.
  11575. </description>
  11576. </item>
  11577. <item>
  11578. <term>ZipProgressEventType.Extracting_AfterExtractEntry</term>
  11579. <description>
  11580. Set when an Extract() on an entry in the ZipFile has completed.
  11581. Properties that are meaningful: ArchiveName, EntriesTotal,
  11582. CurrentEntry, Overwrite, ExtractLocation, EntriesExtracted.
  11583. </description>
  11584. </item>
  11585. <item>
  11586. <term>ZipProgressEventType.Extracting_EntryBytesWritten</term>
  11587. <description>
  11588. Set within a call to Extract() on an entry in the ZipFile, as data
  11589. is extracted for the entry. Properties that are meaningful:
  11590. ArchiveName, CurrentEntry, BytesTransferred, TotalBytesToTransfer.
  11591. </description>
  11592. </item>
  11593. <item>
  11594. <term>ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite</term>
  11595. <description>
  11596. Set within a call to Extract() on an entry in the ZipFile, when the
  11597. extraction would overwrite an existing file. This event type is used
  11598. only when <c>ExtractExistingFileAction</c> on the <c>ZipFile</c> or
  11599. <c>ZipEntry</c> is set to <c>InvokeExtractProgressEvent</c>.
  11600. </description>
  11601. </item>
  11602. </list>
  11603. </remarks>
  11604. <example>
  11605. <code>
  11606. private static bool justHadByteUpdate = false;
  11607. public static void ExtractProgress(object sender, ExtractProgressEventArgs e)
  11608. {
  11609. if(e.EventType == ZipProgressEventType.Extracting_EntryBytesWritten)
  11610. {
  11611. if (justHadByteUpdate)
  11612. Console.SetCursorPosition(0, Console.CursorTop);
  11613. Console.Write(" {0}/{1} ({2:N0}%)", e.BytesTransferred, e.TotalBytesToTransfer,
  11614. e.BytesTransferred / (0.01 * e.TotalBytesToTransfer ));
  11615. justHadByteUpdate = true;
  11616. }
  11617. else if(e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry)
  11618. {
  11619. if (justHadByteUpdate)
  11620. Console.WriteLine();
  11621. Console.WriteLine("Extracting: {0}", e.CurrentEntry.FileName);
  11622. justHadByteUpdate= false;
  11623. }
  11624. }
  11625. public static ExtractZip(string zipToExtract, string directory)
  11626. {
  11627. string TargetDirectory= "extract";
  11628. using (var zip = ZipFile.Read(zipToExtract)) {
  11629. zip.ExtractProgress += ExtractProgress;
  11630. foreach (var e in zip1)
  11631. {
  11632. e.Extract(TargetDirectory, true);
  11633. }
  11634. }
  11635. }
  11636. </code>
  11637. <code lang="VB">
  11638. Public Shared Sub Main(ByVal args As String())
  11639. Dim ZipToUnpack As String = "C1P3SML.zip"
  11640. Dim TargetDir As String = "ExtractTest_Extract"
  11641. Console.WriteLine("Extracting file {0} to {1}", ZipToUnpack, TargetDir)
  11642. Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
  11643. AddHandler zip1.ExtractProgress, AddressOf MyExtractProgress
  11644. Dim e As ZipEntry
  11645. For Each e In zip1
  11646. e.Extract(TargetDir, True)
  11647. Next
  11648. End Using
  11649. End Sub
  11650. Private Shared justHadByteUpdate As Boolean = False
  11651. Public Shared Sub MyExtractProgress(ByVal sender As Object, ByVal e As ExtractProgressEventArgs)
  11652. If (e.EventType = ZipProgressEventType.Extracting_EntryBytesWritten) Then
  11653. If ExtractTest.justHadByteUpdate Then
  11654. Console.SetCursorPosition(0, Console.CursorTop)
  11655. End If
  11656. Console.Write(" {0}/{1} ({2:N0}%)", e.BytesTransferred, e.TotalBytesToTransfer, (CDbl(e.BytesTransferred) / (0.01 * e.TotalBytesToTransfer)))
  11657. ExtractTest.justHadByteUpdate = True
  11658. ElseIf (e.EventType = ZipProgressEventType.Extracting_BeforeExtractEntry) Then
  11659. If ExtractTest.justHadByteUpdate Then
  11660. Console.WriteLine
  11661. End If
  11662. Console.WriteLine("Extracting: {0}", e.CurrentEntry.FileName)
  11663. ExtractTest.justHadByteUpdate = False
  11664. End If
  11665. End Sub
  11666. </code>
  11667. </example>
  11668. <seealso cref="E:Ionic.Zip.ZipFile.SaveProgress"/>
  11669. <seealso cref="E:Ionic.Zip.ZipFile.ReadProgress"/>
  11670. <seealso cref="E:Ionic.Zip.ZipFile.AddProgress"/>
  11671. </member>
  11672. <member name="E:Ionic.Zip.ZipFile.AddProgress">
  11673. <summary>
  11674. An event handler invoked before, during, and after Adding entries to a zip archive.
  11675. </summary>
  11676. <remarks>
  11677. Adding a large number of entries to a zip file can take a long
  11678. time. For example, when calling <see cref="M:Ionic.Zip.ZipFile.AddDirectory(System.String)"/> on a
  11679. directory that contains 50,000 files, it could take 3 minutes or so.
  11680. This event handler allws an application to track the progress of the Add
  11681. operation, and to optionally cancel a lengthy Add operation.
  11682. </remarks>
  11683. <example>
  11684. <code lang="C#">
  11685. int _numEntriesToAdd= 0;
  11686. int _numEntriesAdded= 0;
  11687. void AddProgressHandler(object sender, AddProgressEventArgs e)
  11688. {
  11689. switch (e.EventType)
  11690. {
  11691. case ZipProgressEventType.Adding_Started:
  11692. Console.WriteLine("Adding files to the zip...");
  11693. break;
  11694. case ZipProgressEventType.Adding_AfterAddEntry:
  11695. _numEntriesAdded++;
  11696. Console.WriteLine(String.Format("Adding file {0}/{1} :: {2}",
  11697. _numEntriesAdded, _numEntriesToAdd, e.CurrentEntry.FileName));
  11698. break;
  11699. case ZipProgressEventType.Adding_Completed:
  11700. Console.WriteLine("Added all files");
  11701. break;
  11702. }
  11703. }
  11704. void CreateTheZip()
  11705. {
  11706. using (ZipFile zip = new ZipFile())
  11707. {
  11708. zip.AddProgress += AddProgressHandler;
  11709. zip.AddDirectory(System.IO.Path.GetFileName(DirToZip));
  11710. zip.Save(ZipFileToCreate);
  11711. }
  11712. }
  11713. </code>
  11714. <code lang="VB">
  11715. Private Sub AddProgressHandler(ByVal sender As Object, ByVal e As AddProgressEventArgs)
  11716. Select Case e.EventType
  11717. Case ZipProgressEventType.Adding_Started
  11718. Console.WriteLine("Adding files to the zip...")
  11719. Exit Select
  11720. Case ZipProgressEventType.Adding_AfterAddEntry
  11721. Console.WriteLine(String.Format("Adding file {0}", e.CurrentEntry.FileName))
  11722. Exit Select
  11723. Case ZipProgressEventType.Adding_Completed
  11724. Console.WriteLine("Added all files")
  11725. Exit Select
  11726. End Select
  11727. End Sub
  11728. Sub CreateTheZip()
  11729. Using zip as ZipFile = New ZipFile
  11730. AddHandler zip.AddProgress, AddressOf AddProgressHandler
  11731. zip.AddDirectory(System.IO.Path.GetFileName(DirToZip))
  11732. zip.Save(ZipFileToCreate);
  11733. End Using
  11734. End Sub
  11735. </code>
  11736. </example>
  11737. <seealso cref="E:Ionic.Zip.ZipFile.SaveProgress"/>
  11738. <seealso cref="E:Ionic.Zip.ZipFile.ReadProgress"/>
  11739. <seealso cref="E:Ionic.Zip.ZipFile.ExtractProgress"/>
  11740. </member>
  11741. <member name="E:Ionic.Zip.ZipFile.ZipError">
  11742. <summary>
  11743. An event that is raised when an error occurs during open or read of files
  11744. while saving a zip archive.
  11745. </summary>
  11746. <remarks>
  11747. <para>
  11748. Errors can occur as a file is being saved to the zip archive. For
  11749. example, the File.Open may fail, or a File.Read may fail, because of
  11750. lock conflicts or other reasons. If you add a handler to this event,
  11751. you can handle such errors in your own code. If you don't add a
  11752. handler, the library will throw an exception if it encounters an I/O
  11753. error during a call to <c>Save()</c>.
  11754. </para>
  11755. <para>
  11756. Setting a handler implicitly sets <see cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/> to
  11757. <c>ZipErrorAction.InvokeErrorEvent</c>.
  11758. </para>
  11759. <para>
  11760. The handler you add applies to all <see cref="T:Ionic.Zip.ZipEntry"/> items that are
  11761. subsequently added to the <c>ZipFile</c> instance. If you set this
  11762. property after you have added items to the <c>ZipFile</c>, but before you
  11763. have called <c>Save()</c>, errors that occur while saving those items
  11764. will not cause the error handler to be invoked.
  11765. </para>
  11766. <para>
  11767. If you want to handle any errors that occur with any entry in the zip
  11768. file using the same error handler, then add your error handler once,
  11769. before adding any entries to the zip archive.
  11770. </para>
  11771. <para>
  11772. In the error handler method, you need to set the <see cref="P:Ionic.Zip.ZipEntry.ZipErrorAction"/> property on the
  11773. <c>ZipErrorEventArgs.CurrentEntry</c>. This communicates back to
  11774. DotNetZip what you would like to do with this particular error. Within
  11775. an error handler, if you set the <c>ZipEntry.ZipErrorAction</c> property
  11776. on the <c>ZipEntry</c> to <c>ZipErrorAction.InvokeErrorEvent</c> or if
  11777. you don't set it at all, the library will throw the exception. (It is the
  11778. same as if you had set the <c>ZipEntry.ZipErrorAction</c> property on the
  11779. <c>ZipEntry</c> to <c>ZipErrorAction.Throw</c>.) If you set the
  11780. <c>ZipErrorEventArgs.Cancel</c> to true, the entire <c>Save()</c> will be
  11781. canceled.
  11782. </para>
  11783. <para>
  11784. In the case that you use <c>ZipErrorAction.Skip</c>, implying that
  11785. you want to skip the entry for which there's been an error, DotNetZip
  11786. tries to seek backwards in the output stream, and truncate all bytes
  11787. written on behalf of that particular entry. This works only if the
  11788. output stream is seekable. It will not work, for example, when using
  11789. ASPNET's Response.OutputStream.
  11790. </para>
  11791. </remarks>
  11792. <example>
  11793. This example shows how to use an event handler to handle
  11794. errors during save of the zip file.
  11795. <code lang="C#">
  11796. public static void MyZipError(object sender, ZipErrorEventArgs e)
  11797. {
  11798. Console.WriteLine("Error saving {0}...", e.FileName);
  11799. Console.WriteLine(" Exception: {0}", e.exception);
  11800. ZipEntry entry = e.CurrentEntry;
  11801. string response = null;
  11802. // Ask the user whether he wants to skip this error or not
  11803. do
  11804. {
  11805. Console.Write("Retry, Skip, Throw, or Cancel ? (R/S/T/C) ");
  11806. response = Console.ReadLine();
  11807. Console.WriteLine();
  11808. } while (response != null &amp;&amp;
  11809. response[0]!='S' &amp;&amp; response[0]!='s' &amp;&amp;
  11810. response[0]!='R' &amp;&amp; response[0]!='r' &amp;&amp;
  11811. response[0]!='T' &amp;&amp; response[0]!='t' &amp;&amp;
  11812. response[0]!='C' &amp;&amp; response[0]!='c');
  11813. e.Cancel = (response[0]=='C' || response[0]=='c');
  11814. if (response[0]=='S' || response[0]=='s')
  11815. entry.ZipErrorAction = ZipErrorAction.Skip;
  11816. else if (response[0]=='R' || response[0]=='r')
  11817. entry.ZipErrorAction = ZipErrorAction.Retry;
  11818. else if (response[0]=='T' || response[0]=='t')
  11819. entry.ZipErrorAction = ZipErrorAction.Throw;
  11820. }
  11821. public void SaveTheFile()
  11822. {
  11823. string directoryToZip = "fodder";
  11824. string directoryInArchive = "files";
  11825. string zipFileToCreate = "Archive.zip";
  11826. using (var zip = new ZipFile())
  11827. {
  11828. // set the event handler before adding any entries
  11829. zip.ZipError += MyZipError;
  11830. zip.AddDirectory(directoryToZip, directoryInArchive);
  11831. zip.Save(zipFileToCreate);
  11832. }
  11833. }
  11834. </code>
  11835. <code lang="VB">
  11836. Private Sub MyZipError(ByVal sender As Object, ByVal e As Ionic.Zip.ZipErrorEventArgs)
  11837. ' At this point, the application could prompt the user for an action to take.
  11838. ' But in this case, this application will simply automatically skip the file, in case of error.
  11839. Console.WriteLine("Zip Error, entry {0}", e.CurrentEntry.FileName)
  11840. Console.WriteLine(" Exception: {0}", e.exception)
  11841. ' set the desired ZipErrorAction on the CurrentEntry to communicate that to DotNetZip
  11842. e.CurrentEntry.ZipErrorAction = Zip.ZipErrorAction.Skip
  11843. End Sub
  11844. Public Sub SaveTheFile()
  11845. Dim directoryToZip As String = "fodder"
  11846. Dim directoryInArchive As String = "files"
  11847. Dim zipFileToCreate as String = "Archive.zip"
  11848. Using zipArchive As ZipFile = New ZipFile
  11849. ' set the event handler before adding any entries
  11850. AddHandler zipArchive.ZipError, AddressOf MyZipError
  11851. zipArchive.AddDirectory(directoryToZip, directoryInArchive)
  11852. zipArchive.Save(zipFileToCreate)
  11853. End Using
  11854. End Sub
  11855. </code>
  11856. </example>
  11857. <seealso cref="P:Ionic.Zip.ZipFile.ZipErrorAction"/>
  11858. </member>
  11859. <member name="T:Ionic.Zip.Zip64Option">
  11860. <summary>
  11861. Options for using ZIP64 extensions when saving zip archives.
  11862. </summary>
  11863. <remarks>
  11864. <para>
  11865. Designed many years ago, the <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">original zip
  11866. specification from PKWARE</see> allowed for 32-bit quantities for the
  11867. compressed and uncompressed sizes of zip entries, as well as a 32-bit quantity
  11868. for specifying the length of the zip archive itself, and a maximum of 65535
  11869. entries. These limits are now regularly exceeded in many backup and archival
  11870. scenarios. Recently, PKWare added extensions to the original zip spec, called
  11871. "ZIP64 extensions", to raise those limitations. This property governs whether
  11872. DotNetZip will use those extensions when writing zip archives. The use of
  11873. these extensions is optional and explicit in DotNetZip because, despite the
  11874. status of ZIP64 as a bona fide standard, many other zip tools and libraries do
  11875. not support ZIP64, and therefore a zip file with ZIP64 extensions may be
  11876. unreadable by some of those other tools.
  11877. </para>
  11878. <para>
  11879. Set this property to <see cref="F:Ionic.Zip.Zip64Option.Always"/> to always use ZIP64
  11880. extensions when saving, regardless of whether your zip archive needs it.
  11881. Suppose you add 5 files, each under 100k, to a ZipFile. If you specify Always
  11882. for this flag, you will get a ZIP64 archive, though the archive does not need
  11883. to use ZIP64 because none of the original zip limits had been exceeded.
  11884. </para>
  11885. <para>
  11886. Set this property to <see cref="F:Ionic.Zip.Zip64Option.Never"/> to tell the DotNetZip
  11887. library to never use ZIP64 extensions. This is useful for maximum
  11888. compatibility and interoperability, at the expense of the capability of
  11889. handling large files or large archives. NB: Windows Explorer in Windows XP
  11890. and Windows Vista cannot currently extract files from a zip64 archive, so if
  11891. you want to guarantee that a zip archive produced by this library will work in
  11892. Windows Explorer, use <c>Never</c>. If you set this property to <see cref="F:Ionic.Zip.Zip64Option.Never"/>, and your application creates a zip that would
  11893. exceed one of the Zip limits, the library will throw an exception while saving
  11894. the zip file.
  11895. </para>
  11896. <para>
  11897. Set this property to <see cref="F:Ionic.Zip.Zip64Option.AsNecessary"/> to tell the
  11898. DotNetZip library to use the ZIP64 extensions when required by the
  11899. entry. After the file is compressed, the original and compressed sizes are
  11900. checked, and if they exceed the limits described above, then zip64 can be
  11901. used. That is the general idea, but there is an additional wrinkle when saving
  11902. to a non-seekable device, like the ASP.NET <c>Response.OutputStream</c>, or
  11903. <c>Console.Out</c>. When using non-seekable streams for output, the entry
  11904. header - which indicates whether zip64 is in use - is emitted before it is
  11905. known if zip64 is necessary. It is only after all entries have been saved
  11906. that it can be known if ZIP64 will be required. On seekable output streams,
  11907. after saving all entries, the library can seek backward and re-emit the zip
  11908. file header to be consistent with the actual ZIP64 requirement. But using a
  11909. non-seekable output stream, the library cannot seek backward, so the header
  11910. can never be changed. In other words, the archive's use of ZIP64 extensions is
  11911. not alterable after the header is emitted. Therefore, when saving to
  11912. non-seekable streams, using <see cref="F:Ionic.Zip.Zip64Option.AsNecessary"/> is the same
  11913. as using <see cref="F:Ionic.Zip.Zip64Option.Always"/>: it will always produce a zip
  11914. archive that uses ZIP64 extensions.
  11915. </para>
  11916. </remarks>
  11917. </member>
  11918. <member name="F:Ionic.Zip.Zip64Option.Default">
  11919. <summary>
  11920. The default behavior, which is "Never".
  11921. (For COM clients, this is a 0 (zero).)
  11922. </summary>
  11923. </member>
  11924. <member name="F:Ionic.Zip.Zip64Option.Never">
  11925. <summary>
  11926. Do not use ZIP64 extensions when writing zip archives.
  11927. (For COM clients, this is a 0 (zero).)
  11928. </summary>
  11929. </member>
  11930. <member name="F:Ionic.Zip.Zip64Option.AsNecessary">
  11931. <summary>
  11932. Use ZIP64 extensions when writing zip archives, as necessary.
  11933. For example, when a single entry exceeds 0xFFFFFFFF in size, or when the archive as a whole
  11934. exceeds 0xFFFFFFFF in size, or when there are more than 65535 entries in an archive.
  11935. (For COM clients, this is a 1.)
  11936. </summary>
  11937. </member>
  11938. <member name="F:Ionic.Zip.Zip64Option.Always">
  11939. <summary>
  11940. Always use ZIP64 extensions when writing zip archives, even when unnecessary.
  11941. (For COM clients, this is a 2.)
  11942. </summary>
  11943. </member>
  11944. <member name="T:Ionic.Zip.ZipOption">
  11945. <summary>
  11946. An enum representing the values on a three-way toggle switch
  11947. for various options in the library. This might be used to
  11948. specify whether to employ a particular text encoding, or to use
  11949. ZIP64 extensions, or some other option.
  11950. </summary>
  11951. </member>
  11952. <member name="F:Ionic.Zip.ZipOption.Default">
  11953. <summary>
  11954. The default behavior. This is the same as "Never".
  11955. (For COM clients, this is a 0 (zero).)
  11956. </summary>
  11957. </member>
  11958. <member name="F:Ionic.Zip.ZipOption.Never">
  11959. <summary>
  11960. Never use the associated option.
  11961. (For COM clients, this is a 0 (zero).)
  11962. </summary>
  11963. </member>
  11964. <member name="F:Ionic.Zip.ZipOption.AsNecessary">
  11965. <summary>
  11966. Use the associated behavior "as necessary."
  11967. (For COM clients, this is a 1.)
  11968. </summary>
  11969. </member>
  11970. <member name="F:Ionic.Zip.ZipOption.Always">
  11971. <summary>
  11972. Use the associated behavior Always, whether necessary or not.
  11973. (For COM clients, this is a 2.)
  11974. </summary>
  11975. </member>
  11976. <member name="T:Ionic.Zip.ReadOptions">
  11977. <summary>
  11978. A class for collecting the various options that can be used when
  11979. Reading zip files for extraction or update.
  11980. </summary>
  11981. <remarks>
  11982. <para>
  11983. When reading a zip file, there are several options an
  11984. application can set, to modify how the file is read, or what
  11985. the library does while reading. This class collects those
  11986. options into one container.
  11987. </para>
  11988. <para>
  11989. Pass an instance of the <c>ReadOptions</c> class into the
  11990. <c>ZipFile.Read()</c> method.
  11991. </para>
  11992. <seealso cref="M:Ionic.Zip.ZipFile.Read(System.String,Ionic.Zip.ReadOptions)"/>.
  11993. <seealso cref="M:Ionic.Zip.ZipFile.Read(System.IO.Stream,Ionic.Zip.ReadOptions)"/>.
  11994. </remarks>
  11995. </member>
  11996. <member name="P:Ionic.Zip.ReadOptions.ReadProgress">
  11997. <summary>
  11998. An event handler for Read operations. When opening large zip
  11999. archives, you may want to display a progress bar or other
  12000. indicator of status progress while reading. This parameter
  12001. allows you to specify a ReadProgress Event Handler directly.
  12002. When you call <c>Read()</c>, the progress event is invoked as
  12003. necessary.
  12004. </summary>
  12005. </member>
  12006. <member name="P:Ionic.Zip.ReadOptions.StatusMessageWriter">
  12007. <summary>
  12008. The <c>System.IO.TextWriter</c> to use for writing verbose status messages
  12009. during operations on the zip archive. A console application may wish to
  12010. pass <c>System.Console.Out</c> to get messages on the Console. A graphical
  12011. or headless application may wish to capture the messages in a different
  12012. <c>TextWriter</c>, such as a <c>System.IO.StringWriter</c>.
  12013. </summary>
  12014. </member>
  12015. <member name="P:Ionic.Zip.ReadOptions.Encoding">
  12016. <summary>
  12017. The <c>System.Text.Encoding</c> to use when reading in the zip archive. Be
  12018. careful specifying the encoding. If the value you use here is not the same
  12019. as the Encoding used when the zip archive was created (possibly by a
  12020. different archiver) you will get unexpected results and possibly exceptions.
  12021. </summary>
  12022. <seealso cref="P:Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>
  12023. </member>
  12024. <member name="T:Ionic.Zip.SelfExtractorFlavor">
  12025. <summary>
  12026. An enum that provides the different self-extractor flavors
  12027. </summary>
  12028. </member>
  12029. <member name="F:Ionic.Zip.SelfExtractorFlavor.ConsoleApplication">
  12030. <summary>
  12031. A self-extracting zip archive that runs from the console or
  12032. command line.
  12033. </summary>
  12034. </member>
  12035. <member name="F:Ionic.Zip.SelfExtractorFlavor.WinFormsApplication">
  12036. <summary>
  12037. A self-extracting zip archive that presents a graphical user
  12038. interface when it is executed.
  12039. </summary>
  12040. </member>
  12041. <member name="T:Ionic.Zip.SelfExtractorSaveOptions">
  12042. <summary>
  12043. The options for generating a self-extracting archive.
  12044. </summary>
  12045. </member>
  12046. <member name="P:Ionic.Zip.SelfExtractorSaveOptions.Flavor">
  12047. <summary>
  12048. The type of SFX to create.
  12049. </summary>
  12050. </member>
  12051. <member name="P:Ionic.Zip.SelfExtractorSaveOptions.PostExtractCommandLine">
  12052. <summary>
  12053. The command to run after extraction.
  12054. </summary>
  12055. <remarks>
  12056. <para>
  12057. This is optional. Leave it empty (<c>null</c> in C# or <c>Nothing</c> in
  12058. VB) to run no command after extraction.
  12059. </para>
  12060. <para>
  12061. If it is non-empty, the SFX will execute the command specified in this
  12062. string on the user's machine, and using the extract directory as the
  12063. working directory for the process, after unpacking the archive. The
  12064. program to execute can include a path, if you like. If you want to execute
  12065. a program that accepts arguments, specify the program name, followed by a
  12066. space, and then the arguments for the program, each separated by a space,
  12067. just as you would on a normal command line. Example: <c>program.exe arg1
  12068. arg2</c>. The string prior to the first space will be taken as the
  12069. program name, and the string following the first space specifies the
  12070. arguments to the program.
  12071. </para>
  12072. <para>
  12073. If you want to execute a program that has a space in the name or path of
  12074. the file, surround the program name in double-quotes. The first character
  12075. of the command line should be a double-quote character, and there must be
  12076. a matching double-quote following the end of the program file name. Any
  12077. optional arguments to the program follow that, separated by
  12078. spaces. Example: <c>"c:\project files\program name.exe" arg1 arg2</c>.
  12079. </para>
  12080. <para>
  12081. If the flavor of the SFX is <c>SelfExtractorFlavor.ConsoleApplication</c>,
  12082. then the SFX starts a new process, using this string as the post-extract
  12083. command line. The SFX waits for the process to exit. The exit code of
  12084. the post-extract command line is returned as the exit code of the
  12085. command-line self-extractor exe. A non-zero exit code is typically used to
  12086. indicated a failure by the program. In the case of an SFX, a non-zero exit
  12087. code may indicate a failure during extraction, OR, it may indicate a
  12088. failure of the run-after-extract program if specified, OR, it may indicate
  12089. the run-after-extract program could not be fuond. There is no way to
  12090. distinguish these conditions from the calling shell, aside from parsing
  12091. the output of the SFX. If you have Quiet set to <c>true</c>, you may not
  12092. see error messages, if a problem occurs.
  12093. </para>
  12094. <para>
  12095. If the flavor of the SFX is
  12096. <c>SelfExtractorFlavor.WinFormsApplication</c>, then the SFX starts a new
  12097. process, using this string as the post-extract command line, and using the
  12098. extract directory as the working directory for the process. The SFX does
  12099. not wait for the command to complete, and does not check the exit code of
  12100. the program. If the run-after-extract program cannot be fuond, a message
  12101. box is displayed indicating that fact.
  12102. </para>
  12103. <para>
  12104. You can specify environment variables within this string, with a format like
  12105. <c>%NAME%</c>. The value of these variables will be expanded at the time
  12106. the SFX is run. Example: <c>%WINDIR%\system32\xcopy.exe</c> may expand at
  12107. runtime to <c>c:\Windows\System32\xcopy.exe</c>.
  12108. </para>
  12109. <para>
  12110. By combining this with the <c>RemoveUnpackedFilesAfterExecute</c>
  12111. flag, you can create an SFX that extracts itself, runs a file that
  12112. was extracted, then deletes all the files that were extracted. If
  12113. you want it to run "invisibly" then set <c>Flavor</c> to
  12114. <c>SelfExtractorFlavor.ConsoleApplication</c>, and set <c>Quiet</c>
  12115. to true. The user running such an EXE will see a console window
  12116. appear, then disappear quickly. You may also want to specify the
  12117. default extract location, with <c>DefaultExtractDirectory</c>.
  12118. </para>
  12119. <para>
  12120. If you set <c>Flavor</c> to
  12121. <c>SelfExtractorFlavor.WinFormsApplication</c>, and set <c>Quiet</c> to
  12122. true, then a GUI with progressbars is displayed, but it is
  12123. "non-interactive" - it accepts no input from the user. Instead the SFX
  12124. just automatically unpacks and exits.
  12125. </para>
  12126. </remarks>
  12127. </member>
  12128. <member name="P:Ionic.Zip.SelfExtractorSaveOptions.DefaultExtractDirectory">
  12129. <summary>
  12130. The default extract directory the user will see when
  12131. running the self-extracting archive.
  12132. </summary>
  12133. <remarks>
  12134. <para>
  12135. Passing null (or Nothing in VB) here will cause the Self Extractor to use
  12136. the the user's personal directory (<see cref="F:System.Environment.SpecialFolder.Personal"/>) for the default extract
  12137. location.
  12138. </para>
  12139. <para>
  12140. This is only a default location. The actual extract location will be
  12141. settable on the command line when the SFX is executed.
  12142. </para>
  12143. <para>
  12144. You can specify environment variables within this string,
  12145. with <c>%NAME%</c>. The value of these variables will be
  12146. expanded at the time the SFX is run. Example:
  12147. <c>%USERPROFILE%\Documents\unpack</c> may expand at runtime to
  12148. <c>c:\users\melvin\Documents\unpack</c>.
  12149. </para>
  12150. </remarks>
  12151. </member>
  12152. <member name="P:Ionic.Zip.SelfExtractorSaveOptions.IconFile">
  12153. <summary>
  12154. The name of an .ico file in the filesystem to use for the application icon
  12155. for the generated SFX.
  12156. </summary>
  12157. <remarks>
  12158. <para>
  12159. Normally, DotNetZip will embed an "zipped folder" icon into the generated
  12160. SFX. If you prefer to use a different icon, you can specify it here. It
  12161. should be a .ico file. This file is passed as the <c>/win32icon</c>
  12162. option to the csc.exe compiler when constructing the SFX file.
  12163. </para>
  12164. </remarks>
  12165. </member>
  12166. <member name="P:Ionic.Zip.SelfExtractorSaveOptions.Quiet">
  12167. <summary>
  12168. Whether the ConsoleApplication SFX will be quiet during extraction.
  12169. </summary>
  12170. <remarks>
  12171. <para>
  12172. This option affects the way the generated SFX runs. By default it is
  12173. false. When you set it to true,...
  12174. </para>
  12175. <list type="table">
  12176. <listheader>
  12177. <term>Flavor</term>
  12178. <description>Behavior</description>
  12179. </listheader>
  12180. <item>
  12181. <term><c>ConsoleApplication</c></term>
  12182. <description><para>no messages will be emitted during successful
  12183. operation.</para> <para> Double-clicking the SFX in Windows
  12184. Explorer or as an attachment in an email will cause a console
  12185. window to appear briefly, before it disappears. If you run the
  12186. ConsoleApplication SFX from the cmd.exe prompt, it runs as a
  12187. normal console app; by default, because it is quiet, it displays
  12188. no messages to the console. If you pass the -v+ command line
  12189. argument to the Console SFX when you run it, you will get verbose
  12190. messages to the console. </para>
  12191. </description>
  12192. </item>
  12193. <item>
  12194. <term><c>WinFormsApplication</c></term>
  12195. <description>the SFX extracts automatically when the application
  12196. is launched, with no additional user input.
  12197. </description>
  12198. </item>
  12199. </list>
  12200. <para>
  12201. When you set it to false,...
  12202. </para>
  12203. <list type="table">
  12204. <listheader>
  12205. <term>Flavor</term>
  12206. <description>Behavior</description>
  12207. </listheader>
  12208. <item>
  12209. <term><c>ConsoleApplication</c></term>
  12210. <description><para>the extractor will emit a
  12211. message to the console for each entry extracted.</para>
  12212. <para>
  12213. When double-clicking to launch the SFX, the console window will
  12214. remain, and the SFX will emit a message for each file as it
  12215. extracts. The messages fly by quickly, they won't be easily
  12216. readable, unless the extracted files are fairly large.
  12217. </para>
  12218. </description>
  12219. </item>
  12220. <item>
  12221. <term><c>WinFormsApplication</c></term>
  12222. <description>the SFX presents a forms UI and allows the user to select
  12223. options before extracting.
  12224. </description>
  12225. </item>
  12226. </list>
  12227. </remarks>
  12228. </member>
  12229. <member name="P:Ionic.Zip.SelfExtractorSaveOptions.ExtractExistingFile">
  12230. <summary>
  12231. Specify what the self-extractor will do when extracting an entry
  12232. would overwrite an existing file.
  12233. </summary>
  12234. <remarks>
  12235. <para>
  12236. The default behavvior is to Throw.
  12237. </para>
  12238. </remarks>
  12239. </member>
  12240. <member name="P:Ionic.Zip.SelfExtractorSaveOptions.RemoveUnpackedFilesAfterExecute">
  12241. <summary>
  12242. Whether to remove the files that have been unpacked, after executing the
  12243. PostExtractCommandLine.
  12244. </summary>
  12245. <remarks>
  12246. <para>
  12247. If true, and if there is a <see cref="P:Ionic.Zip.SelfExtractorSaveOptions.PostExtractCommandLine">
  12248. PostExtractCommandLine</see>, and if the command runs successfully,
  12249. then the files that the SFX unpacked will be removed, afterwards. If
  12250. the command does not complete successfully (non-zero return code),
  12251. that is interpreted as a failure, and the extracted files will not be
  12252. removed.
  12253. </para>
  12254. <para>
  12255. Setting this flag, and setting <c>Flavor</c> to
  12256. <c>SelfExtractorFlavor.ConsoleApplication</c>, and setting <c>Quiet</c> to
  12257. true, results in an SFX that extracts itself, runs a file that was
  12258. extracted, then deletes all the files that were extracted, with no
  12259. intervention by the user. You may also want to specify the default
  12260. extract location, with <c>DefaultExtractDirectory</c>.
  12261. </para>
  12262. </remarks>
  12263. </member>
  12264. <member name="P:Ionic.Zip.SelfExtractorSaveOptions.FileVersion">
  12265. <summary>
  12266. The file version number to embed into the generated EXE. It will show up, for
  12267. example, during a mouseover in Windows Explorer.
  12268. </summary>
  12269. </member>
  12270. <member name="P:Ionic.Zip.SelfExtractorSaveOptions.ProductVersion">
  12271. <summary>
  12272. The product version to embed into the generated EXE. It will show up, for
  12273. example, during a mouseover in Windows Explorer.
  12274. </summary>
  12275. <remarks>
  12276. You can use any arbitrary string, but a human-readable version number is
  12277. recommended. For example "v1.2 alpha" or "v4.2 RC2". If you specify nothing,
  12278. then there is no product version embedded into the EXE.
  12279. </remarks>
  12280. </member>
  12281. <member name="P:Ionic.Zip.SelfExtractorSaveOptions.Copyright">
  12282. <summary>
  12283. The copyright notice, if any, to embed into the generated EXE.
  12284. </summary>
  12285. <remarks>
  12286. It will show up, for example, while viewing properties of the file in
  12287. Windows Explorer. You can use any arbitrary string, but typically you
  12288. want something like "Copyright © Dino Chiesa 2011".
  12289. </remarks>
  12290. </member>
  12291. <member name="P:Ionic.Zip.SelfExtractorSaveOptions.Description">
  12292. <summary>
  12293. The description to embed into the generated EXE.
  12294. </summary>
  12295. <remarks>
  12296. Use any arbitrary string. This text will be displayed during a
  12297. mouseover in Windows Explorer. If you specify nothing, then the string
  12298. "DotNetZip SFX Archive" is embedded into the EXE as the description.
  12299. </remarks>
  12300. </member>
  12301. <member name="P:Ionic.Zip.SelfExtractorSaveOptions.ProductName">
  12302. <summary>
  12303. The product name to embed into the generated EXE.
  12304. </summary>
  12305. <remarks>
  12306. Use any arbitrary string. This text will be displayed
  12307. while viewing properties of the EXE file in
  12308. Windows Explorer.
  12309. </remarks>
  12310. </member>
  12311. <member name="P:Ionic.Zip.SelfExtractorSaveOptions.SfxExeWindowTitle">
  12312. <summary>
  12313. The title to display in the Window of a GUI SFX, while it extracts.
  12314. </summary>
  12315. <remarks>
  12316. <para>
  12317. By default the title show in the GUI window of a self-extractor
  12318. is "DotNetZip Self-extractor (http://DotNetZip.codeplex.com/)".
  12319. You can change that by setting this property before saving the SFX.
  12320. </para>
  12321. <para>
  12322. This property has an effect only when producing a Self-extractor
  12323. of flavor <c>SelfExtractorFlavor.WinFormsApplication</c>.
  12324. </para>
  12325. </remarks>
  12326. </member>
  12327. <member name="P:Ionic.Zip.SelfExtractorSaveOptions.AdditionalCompilerSwitches">
  12328. <summary>
  12329. Additional options for the csc.exe compiler, when producing the SFX
  12330. EXE.
  12331. </summary>
  12332. <exclude/>
  12333. </member>
  12334. <member name="M:Ionic.BZip2.BitWriter.Reset">
  12335. <summary>
  12336. Reset the BitWriter.
  12337. </summary>
  12338. <remarks>
  12339. <para>
  12340. This is useful when the BitWriter writes into a MemoryStream, and
  12341. is used by a BZip2Compressor, which itself is re-used for multiple
  12342. distinct data blocks.
  12343. </para>
  12344. </remarks>
  12345. </member>
  12346. <member name="M:Ionic.BZip2.BitWriter.WriteBits(System.Int32,System.UInt32)">
  12347. <summary>
  12348. Write some number of bits from the given value, into the output.
  12349. </summary>
  12350. <remarks>
  12351. <para>
  12352. The nbits value should be a max of 25, for safety. For performance
  12353. reasons, this method does not check!
  12354. </para>
  12355. </remarks>
  12356. </member>
  12357. <member name="M:Ionic.BZip2.BitWriter.WriteByte(System.Byte)">
  12358. <summary>
  12359. Write a full 8-bit byte into the output.
  12360. </summary>
  12361. </member>
  12362. <member name="M:Ionic.BZip2.BitWriter.WriteInt(System.UInt32)">
  12363. <summary>
  12364. Write four 8-bit bytes into the output.
  12365. </summary>
  12366. </member>
  12367. <member name="M:Ionic.BZip2.BitWriter.Flush">
  12368. <summary>
  12369. Write all available byte-aligned bytes.
  12370. </summary>
  12371. <remarks>
  12372. <para>
  12373. This method writes no new output, but flushes any accumulated
  12374. bits. At completion, the accumulator may contain up to 7
  12375. bits.
  12376. </para>
  12377. <para>
  12378. This is necessary when re-assembling output from N independent
  12379. compressors, one for each of N blocks. The output of any
  12380. particular compressor will in general have some fragment of a byte
  12381. remaining. This fragment needs to be accumulated into the
  12382. parent BZip2OutputStream.
  12383. </para>
  12384. </remarks>
  12385. </member>
  12386. <member name="M:Ionic.BZip2.BitWriter.FinishAndPad">
  12387. <summary>
  12388. Writes all available bytes, and emits padding for the final byte as
  12389. necessary. This must be the last method invoked on an instance of
  12390. BitWriter.
  12391. </summary>
  12392. </member>
  12393. <member name="P:Ionic.BZip2.BitWriter.RemainingBits">
  12394. <summary>
  12395. Delivers the remaining bits, left-aligned, in a byte.
  12396. </summary>
  12397. <remarks>
  12398. <para>
  12399. This is valid only if NumRemainingBits is less than 8;
  12400. in other words it is valid only after a call to Flush().
  12401. </para>
  12402. </remarks>
  12403. </member>
  12404. <member name="F:Ionic.BZip2.BZip2Compressor.increments">
  12405. Knuth's increments seem to work better than Incerpi-Sedgewick here.
  12406. Possibly because the number of elems to sort is usually small, typically
  12407. &lt;= 20.
  12408. </member>
  12409. <member name="M:Ionic.BZip2.BZip2Compressor.#ctor(Ionic.BZip2.BitWriter)">
  12410. <summary>
  12411. BZip2Compressor writes its compressed data out via a BitWriter. This
  12412. is necessary because BZip2 does byte shredding.
  12413. </summary>
  12414. </member>
  12415. <member name="M:Ionic.BZip2.BZip2Compressor.Fill(System.Byte[],System.Int32,System.Int32)">
  12416. <summary>
  12417. Accept new bytes into the compressor data buffer
  12418. </summary>
  12419. <remarks>
  12420. <para>
  12421. This method does the first-level (cheap) run-length encoding, and
  12422. stores the encoded data into the rle block.
  12423. </para>
  12424. </remarks>
  12425. </member>
  12426. <member name="M:Ionic.BZip2.BZip2Compressor.write0(System.Byte)">
  12427. <summary>
  12428. Process one input byte into the block.
  12429. </summary>
  12430. <remarks>
  12431. <para>
  12432. To "process" the byte means to do the run-length encoding.
  12433. There are 3 possible return values:
  12434. 0 - the byte was not written, in other words, not
  12435. encoded into the block. This happens when the
  12436. byte b would require the start of a new run, and
  12437. the block has no more room for new runs.
  12438. 1 - the byte was written, and the block is not full.
  12439. 2 - the byte was written, and the block is full.
  12440. </para>
  12441. </remarks>
  12442. <returns>0 if the byte was not written, non-zero if written.</returns>
  12443. </member>
  12444. <member name="M:Ionic.BZip2.BZip2Compressor.AddRunToOutputBlock(System.Boolean)">
  12445. <summary>
  12446. Append one run to the output block.
  12447. </summary>
  12448. <remarks>
  12449. <para>
  12450. This compressor does run-length-encoding before BWT and etc. This
  12451. method simply appends a run to the output block. The append always
  12452. succeeds. The return value indicates whether the block is full:
  12453. false (not full) implies that at least one additional run could be
  12454. processed.
  12455. </para>
  12456. </remarks>
  12457. <returns>true if the block is now full; otherwise false.</returns>
  12458. </member>
  12459. <member name="M:Ionic.BZip2.BZip2Compressor.CompressAndWrite">
  12460. <summary>
  12461. Compress the data that has been placed (Run-length-encoded) into the
  12462. block. The compressed data goes into the CompressedBytes array.
  12463. </summary>
  12464. <remarks>
  12465. <para>
  12466. Side effects: 1. fills the CompressedBytes array. 2. sets the
  12467. AvailableBytesOut property.
  12468. </para>
  12469. </remarks>
  12470. </member>
  12471. <member name="M:Ionic.BZip2.BZip2Compressor.mainSimpleSort(Ionic.BZip2.BZip2Compressor.CompressionState,System.Int32,System.Int32,System.Int32)">
  12472. This is the most hammered method of this class.
  12473. <p>
  12474. This is the version using unrolled loops.
  12475. </p>
  12476. </member>
  12477. <member name="M:Ionic.BZip2.BZip2Compressor.mainQSort3(Ionic.BZip2.BZip2Compressor.CompressionState,System.Int32,System.Int32,System.Int32)">
  12478. Method "mainQSort3", file "blocksort.c", BZip2 1.0.2
  12479. </member>
  12480. <member name="P:Ionic.BZip2.BZip2Compressor.UncompressedBytes">
  12481. <summary>
  12482. The number of uncompressed bytes being held in the buffer.
  12483. </summary>
  12484. <remarks>
  12485. <para>
  12486. I am thinking this may be useful in a Stream that uses this
  12487. compressor class. In the Close() method on the stream it could
  12488. check this value to see if anything has been written at all. You
  12489. may think the stream could easily track the number of bytes it
  12490. wrote, which would eliminate the need for this. But, there is the
  12491. case where the stream writes a complete block, and it is full, and
  12492. then writes no more. In that case the stream may want to check.
  12493. </para>
  12494. </remarks>
  12495. </member>
  12496. <member name="F:Ionic.BZip2.BZip2Compressor.CompressionState.quadrant">
  12497. Array instance identical to sfmap, both are used only
  12498. temporarily and independently, so we do not need to allocate
  12499. additional memory.
  12500. </member>
  12501. <member name="T:Ionic.BZip2.BZip2InputStream">
  12502. <summary>
  12503. A read-only decorator stream that performs BZip2 decompression on Read.
  12504. </summary>
  12505. </member>
  12506. <member name="M:Ionic.BZip2.BZip2InputStream.#ctor(System.IO.Stream)">
  12507. <summary>
  12508. Create a BZip2InputStream, wrapping it around the given input Stream.
  12509. </summary>
  12510. <remarks>
  12511. <para>
  12512. The input stream will be closed when the BZip2InputStream is closed.
  12513. </para>
  12514. </remarks>
  12515. <param name='input'>The stream from which to read compressed data</param>
  12516. </member>
  12517. <member name="M:Ionic.BZip2.BZip2InputStream.#ctor(System.IO.Stream,System.Boolean)">
  12518. <summary>
  12519. Create a BZip2InputStream with the given stream, and
  12520. specifying whether to leave the wrapped stream open when
  12521. the BZip2InputStream is closed.
  12522. </summary>
  12523. <param name='input'>The stream from which to read compressed data</param>
  12524. <param name='leaveOpen'>
  12525. Whether to leave the input stream open, when the BZip2InputStream closes.
  12526. </param>
  12527. <example>
  12528. This example reads a bzip2-compressed file, decompresses it,
  12529. and writes the decompressed data into a newly created file.
  12530. <code>
  12531. var fname = "logfile.log.bz2";
  12532. using (var fs = File.OpenRead(fname))
  12533. {
  12534. using (var decompressor = new Ionic.BZip2.BZip2InputStream(fs))
  12535. {
  12536. var outFname = fname + ".decompressed";
  12537. using (var output = File.Create(outFname))
  12538. {
  12539. byte[] buffer = new byte[2048];
  12540. int n;
  12541. while ((n = decompressor.Read(buffer, 0, buffer.Length)) > 0)
  12542. {
  12543. output.Write(buffer, 0, n);
  12544. }
  12545. }
  12546. }
  12547. }
  12548. </code>
  12549. </example>
  12550. </member>
  12551. <member name="M:Ionic.BZip2.BZip2InputStream.Read(System.Byte[],System.Int32,System.Int32)">
  12552. <summary>
  12553. Read data from the stream.
  12554. </summary>
  12555. <remarks>
  12556. <para>
  12557. To decompress a BZip2 data stream, create a <c>BZip2InputStream</c>,
  12558. providing a stream that reads compressed data. Then call Read() on
  12559. that <c>BZip2InputStream</c>, and the data read will be decompressed
  12560. as you read.
  12561. </para>
  12562. <para>
  12563. A <c>BZip2InputStream</c> can be used only for <c>Read()</c>, not for <c>Write()</c>.
  12564. </para>
  12565. </remarks>
  12566. <param name="buffer">The buffer into which the read data should be placed.</param>
  12567. <param name="offset">the offset within that data array to put the first byte read.</param>
  12568. <param name="count">the number of bytes to read.</param>
  12569. <returns>the number of bytes actually read</returns>
  12570. </member>
  12571. <member name="M:Ionic.BZip2.BZip2InputStream.ReadByte">
  12572. <summary>
  12573. Read a single byte from the stream.
  12574. </summary>
  12575. <returns>the byte read from the stream, or -1 if EOF</returns>
  12576. </member>
  12577. <member name="M:Ionic.BZip2.BZip2InputStream.Flush">
  12578. <summary>
  12579. Flush the stream.
  12580. </summary>
  12581. </member>
  12582. <member name="M:Ionic.BZip2.BZip2InputStream.Seek(System.Int64,System.IO.SeekOrigin)">
  12583. <summary>
  12584. Calling this method always throws a <see cref="T:System.NotImplementedException"/>.
  12585. </summary>
  12586. <param name="offset">this is irrelevant, since it will always throw!</param>
  12587. <param name="origin">this is irrelevant, since it will always throw!</param>
  12588. <returns>irrelevant!</returns>
  12589. </member>
  12590. <member name="M:Ionic.BZip2.BZip2InputStream.SetLength(System.Int64)">
  12591. <summary>
  12592. Calling this method always throws a <see cref="T:System.NotImplementedException"/>.
  12593. </summary>
  12594. <param name="value">this is irrelevant, since it will always throw!</param>
  12595. </member>
  12596. <member name="M:Ionic.BZip2.BZip2InputStream.Write(System.Byte[],System.Int32,System.Int32)">
  12597. <summary>
  12598. Calling this method always throws a <see cref="T:System.NotImplementedException"/>.
  12599. </summary>
  12600. <param name="buffer">this parameter is never used</param>
  12601. <param name="offset">this parameter is never used</param>
  12602. <param name="count">this parameter is never used</param>
  12603. </member>
  12604. <member name="M:Ionic.BZip2.BZip2InputStream.Dispose(System.Boolean)">
  12605. <summary>
  12606. Dispose the stream.
  12607. </summary>
  12608. <param name="disposing">
  12609. indicates whether the Dispose method was invoked by user code.
  12610. </param>
  12611. </member>
  12612. <member name="M:Ionic.BZip2.BZip2InputStream.Close">
  12613. <summary>
  12614. Close the stream.
  12615. </summary>
  12616. </member>
  12617. <member name="M:Ionic.BZip2.BZip2InputStream.GetBits(System.Int32)">
  12618. <summary>
  12619. Read n bits from input, right justifying the result.
  12620. </summary>
  12621. <remarks>
  12622. <para>
  12623. For example, if you read 1 bit, the result is either 0
  12624. or 1.
  12625. </para>
  12626. </remarks>
  12627. <param name ="n">
  12628. The number of bits to read, always between 1 and 32.
  12629. </param>
  12630. </member>
  12631. <member name="M:Ionic.BZip2.BZip2InputStream.hbCreateDecodeTables(System.Int32[],System.Int32[],System.Int32[],System.Char[],System.Int32,System.Int32,System.Int32)">
  12632. Called by createHuffmanDecodingTables() exclusively.
  12633. </member>
  12634. <member name="M:Ionic.BZip2.BZip2InputStream.createHuffmanDecodingTables(System.Int32,System.Int32)">
  12635. Called by recvDecodingTables() exclusively.
  12636. </member>
  12637. <member name="P:Ionic.BZip2.BZip2InputStream.CanRead">
  12638. <summary>
  12639. Indicates whether the stream can be read.
  12640. </summary>
  12641. <remarks>
  12642. The return value depends on whether the captive stream supports reading.
  12643. </remarks>
  12644. </member>
  12645. <member name="P:Ionic.BZip2.BZip2InputStream.CanSeek">
  12646. <summary>
  12647. Indicates whether the stream supports Seek operations.
  12648. </summary>
  12649. <remarks>
  12650. Always returns false.
  12651. </remarks>
  12652. </member>
  12653. <member name="P:Ionic.BZip2.BZip2InputStream.CanWrite">
  12654. <summary>
  12655. Indicates whether the stream can be written.
  12656. </summary>
  12657. <remarks>
  12658. The return value depends on whether the captive stream supports writing.
  12659. </remarks>
  12660. </member>
  12661. <member name="P:Ionic.BZip2.BZip2InputStream.Length">
  12662. <summary>
  12663. Reading this property always throws a <see cref="T:System.NotImplementedException"/>.
  12664. </summary>
  12665. </member>
  12666. <member name="P:Ionic.BZip2.BZip2InputStream.Position">
  12667. <summary>
  12668. The position of the stream pointer.
  12669. </summary>
  12670. <remarks>
  12671. Setting this property always throws a <see cref="T:System.NotImplementedException"/>. Reading will return the
  12672. total number of uncompressed bytes read in.
  12673. </remarks>
  12674. </member>
  12675. <member name="T:Ionic.BZip2.BZip2InputStream.CState">
  12676. <summary>
  12677. Compressor State
  12678. </summary>
  12679. </member>
  12680. <member name="F:Ionic.BZip2.BZip2InputStream.DecompressionState.unzftab">
  12681. Freq table collected to save a pass over the data during
  12682. decompression.
  12683. </member>
  12684. <member name="M:Ionic.BZip2.BZip2InputStream.DecompressionState.initTT(System.Int32)">
  12685. Initializes the tt array.
  12686. This method is called when the required length of the array is known.
  12687. I don't initialize it at construction time to avoid unneccessary
  12688. memory allocation when compressing small files.
  12689. </member>
  12690. <member name="T:Ionic.BZip2.BZip2OutputStream">
  12691. <summary>
  12692. A write-only decorator stream that compresses data as it is
  12693. written using the BZip2 algorithm.
  12694. </summary>
  12695. </member>
  12696. <member name="M:Ionic.BZip2.BZip2OutputStream.#ctor(System.IO.Stream)">
  12697. <summary>
  12698. Constructs a new <c>BZip2OutputStream</c>, that sends its
  12699. compressed output to the given output stream.
  12700. </summary>
  12701. <param name='output'>
  12702. The destination stream, to which compressed output will be sent.
  12703. </param>
  12704. <example>
  12705. This example reads a file, then compresses it with bzip2 file,
  12706. and writes the compressed data into a newly created file.
  12707. <code>
  12708. var fname = "logfile.log";
  12709. using (var fs = File.OpenRead(fname))
  12710. {
  12711. var outFname = fname + ".bz2";
  12712. using (var output = File.Create(outFname))
  12713. {
  12714. using (var compressor = new Ionic.BZip2.BZip2OutputStream(output))
  12715. {
  12716. byte[] buffer = new byte[2048];
  12717. int n;
  12718. while ((n = fs.Read(buffer, 0, buffer.Length)) > 0)
  12719. {
  12720. compressor.Write(buffer, 0, n);
  12721. }
  12722. }
  12723. }
  12724. }
  12725. </code>
  12726. </example>
  12727. </member>
  12728. <member name="M:Ionic.BZip2.BZip2OutputStream.#ctor(System.IO.Stream,System.Int32)">
  12729. <summary>
  12730. Constructs a new <c>BZip2OutputStream</c> with specified blocksize.
  12731. </summary>
  12732. <param name = "output">the destination stream.</param>
  12733. <param name = "blockSize">
  12734. The blockSize in units of 100000 bytes.
  12735. The valid range is 1..9.
  12736. </param>
  12737. </member>
  12738. <member name="M:Ionic.BZip2.BZip2OutputStream.#ctor(System.IO.Stream,System.Boolean)">
  12739. <summary>
  12740. Constructs a new <c>BZip2OutputStream</c>.
  12741. </summary>
  12742. <param name = "output">the destination stream.</param>
  12743. <param name = "leaveOpen">
  12744. whether to leave the captive stream open upon closing this stream.
  12745. </param>
  12746. </member>
  12747. <member name="M:Ionic.BZip2.BZip2OutputStream.#ctor(System.IO.Stream,System.Int32,System.Boolean)">
  12748. <summary>
  12749. Constructs a new <c>BZip2OutputStream</c> with specified blocksize,
  12750. and explicitly specifies whether to leave the wrapped stream open.
  12751. </summary>
  12752. <param name = "output">the destination stream.</param>
  12753. <param name = "blockSize">
  12754. The blockSize in units of 100000 bytes.
  12755. The valid range is 1..9.
  12756. </param>
  12757. <param name = "leaveOpen">
  12758. whether to leave the captive stream open upon closing this stream.
  12759. </param>
  12760. </member>
  12761. <member name="M:Ionic.BZip2.BZip2OutputStream.Close">
  12762. <summary>
  12763. Close the stream.
  12764. </summary>
  12765. <remarks>
  12766. <para>
  12767. This may or may not close the underlying stream. Check the
  12768. constructors that accept a bool value.
  12769. </para>
  12770. </remarks>
  12771. </member>
  12772. <member name="M:Ionic.BZip2.BZip2OutputStream.Flush">
  12773. <summary>
  12774. Flush the stream.
  12775. </summary>
  12776. </member>
  12777. <member name="M:Ionic.BZip2.BZip2OutputStream.Write(System.Byte[],System.Int32,System.Int32)">
  12778. <summary>
  12779. Write data to the stream.
  12780. </summary>
  12781. <remarks>
  12782. <para>
  12783. Use the <c>BZip2OutputStream</c> to compress data while writing:
  12784. create a <c>BZip2OutputStream</c> with a writable output stream.
  12785. Then call <c>Write()</c> on that <c>BZip2OutputStream</c>, providing
  12786. uncompressed data as input. The data sent to the output stream will
  12787. be the compressed form of the input data.
  12788. </para>
  12789. <para>
  12790. A <c>BZip2OutputStream</c> can be used only for <c>Write()</c> not for <c>Read()</c>.
  12791. </para>
  12792. </remarks>
  12793. <param name="buffer">The buffer holding data to write to the stream.</param>
  12794. <param name="offset">the offset within that data array to find the first byte to write.</param>
  12795. <param name="count">the number of bytes to write.</param>
  12796. </member>
  12797. <member name="M:Ionic.BZip2.BZip2OutputStream.Seek(System.Int64,System.IO.SeekOrigin)">
  12798. <summary>
  12799. Calling this method always throws a <see cref="T:System.NotImplementedException"/>.
  12800. </summary>
  12801. <param name="offset">this is irrelevant, since it will always throw!</param>
  12802. <param name="origin">this is irrelevant, since it will always throw!</param>
  12803. <returns>irrelevant!</returns>
  12804. </member>
  12805. <member name="M:Ionic.BZip2.BZip2OutputStream.SetLength(System.Int64)">
  12806. <summary>
  12807. Calling this method always throws a <see cref="T:System.NotImplementedException"/>.
  12808. </summary>
  12809. <param name="value">this is irrelevant, since it will always throw!</param>
  12810. </member>
  12811. <member name="M:Ionic.BZip2.BZip2OutputStream.Read(System.Byte[],System.Int32,System.Int32)">
  12812. <summary>
  12813. Calling this method always throws a <see cref="T:System.NotImplementedException"/>.
  12814. </summary>
  12815. <param name="buffer">this parameter is never used</param>
  12816. <param name="offset">this parameter is never used</param>
  12817. <param name="count">this parameter is never used</param>
  12818. <returns>never returns anything; always throws</returns>
  12819. </member>
  12820. <member name="P:Ionic.BZip2.BZip2OutputStream.BlockSize">
  12821. <summary>
  12822. The blocksize parameter specified at construction time.
  12823. </summary>
  12824. </member>
  12825. <member name="P:Ionic.BZip2.BZip2OutputStream.CanRead">
  12826. <summary>
  12827. Indicates whether the stream can be read.
  12828. </summary>
  12829. <remarks>
  12830. The return value is always false.
  12831. </remarks>
  12832. </member>
  12833. <member name="P:Ionic.BZip2.BZip2OutputStream.CanSeek">
  12834. <summary>
  12835. Indicates whether the stream supports Seek operations.
  12836. </summary>
  12837. <remarks>
  12838. Always returns false.
  12839. </remarks>
  12840. </member>
  12841. <member name="P:Ionic.BZip2.BZip2OutputStream.CanWrite">
  12842. <summary>
  12843. Indicates whether the stream can be written.
  12844. </summary>
  12845. <remarks>
  12846. The return value should always be true, unless and until the
  12847. object is disposed and closed.
  12848. </remarks>
  12849. </member>
  12850. <member name="P:Ionic.BZip2.BZip2OutputStream.Length">
  12851. <summary>
  12852. Reading this property always throws a <see cref="T:System.NotImplementedException"/>.
  12853. </summary>
  12854. </member>
  12855. <member name="P:Ionic.BZip2.BZip2OutputStream.Position">
  12856. <summary>
  12857. The position of the stream pointer.
  12858. </summary>
  12859. <remarks>
  12860. Setting this property always throws a <see cref="T:System.NotImplementedException"/>. Reading will return the
  12861. total number of uncompressed bytes written through.
  12862. </remarks>
  12863. </member>
  12864. <member name="T:Ionic.BZip2.ParallelBZip2OutputStream">
  12865. <summary>
  12866. A write-only decorator stream that compresses data as it is
  12867. written using the BZip2 algorithm. This stream compresses by
  12868. block using multiple threads.
  12869. </summary>
  12870. <para>
  12871. This class performs BZIP2 compression through writing. For
  12872. more information on the BZIP2 algorithm, see
  12873. <see href="http://en.wikipedia.org/wiki/BZIP2"/>.
  12874. </para>
  12875. <para>
  12876. This class is similar to <see cref="T:Ionic.BZip2.BZip2OutputStream"/>,
  12877. except that this implementation uses an approach that employs multiple
  12878. worker threads to perform the compression. On a multi-cpu or multi-core
  12879. computer, the performance of this class can be significantly higher than
  12880. the single-threaded BZip2OutputStream, particularly for larger streams.
  12881. How large? Anything over 10mb is a good candidate for parallel
  12882. compression.
  12883. </para>
  12884. <para>
  12885. The tradeoff is that this class uses more memory and more CPU than the
  12886. vanilla <c>BZip2OutputStream</c>. Also, for small files, the
  12887. <c>ParallelBZip2OutputStream</c> can be much slower than the vanilla
  12888. <c>BZip2OutputStream</c>, because of the overhead associated to using the
  12889. thread pool.
  12890. </para>
  12891. <seealso cref="T:Ionic.BZip2.BZip2OutputStream"/>
  12892. </member>
  12893. <member name="M:Ionic.BZip2.ParallelBZip2OutputStream.#ctor(System.IO.Stream)">
  12894. <summary>
  12895. Constructs a new <c>ParallelBZip2OutputStream</c>, that sends its
  12896. compressed output to the given output stream.
  12897. </summary>
  12898. <param name='output'>
  12899. The destination stream, to which compressed output will be sent.
  12900. </param>
  12901. <example>
  12902. This example reads a file, then compresses it with bzip2 file,
  12903. and writes the compressed data into a newly created file.
  12904. <code>
  12905. var fname = "logfile.log";
  12906. using (var fs = File.OpenRead(fname))
  12907. {
  12908. var outFname = fname + ".bz2";
  12909. using (var output = File.Create(outFname))
  12910. {
  12911. using (var compressor = new Ionic.BZip2.ParallelBZip2OutputStream(output))
  12912. {
  12913. byte[] buffer = new byte[2048];
  12914. int n;
  12915. while ((n = fs.Read(buffer, 0, buffer.Length)) > 0)
  12916. {
  12917. compressor.Write(buffer, 0, n);
  12918. }
  12919. }
  12920. }
  12921. }
  12922. </code>
  12923. </example>
  12924. </member>
  12925. <member name="M:Ionic.BZip2.ParallelBZip2OutputStream.#ctor(System.IO.Stream,System.Int32)">
  12926. <summary>
  12927. Constructs a new <c>ParallelBZip2OutputStream</c> with specified blocksize.
  12928. </summary>
  12929. <param name = "output">the destination stream.</param>
  12930. <param name = "blockSize">
  12931. The blockSize in units of 100000 bytes.
  12932. The valid range is 1..9.
  12933. </param>
  12934. </member>
  12935. <member name="M:Ionic.BZip2.ParallelBZip2OutputStream.#ctor(System.IO.Stream,System.Boolean)">
  12936. <summary>
  12937. Constructs a new <c>ParallelBZip2OutputStream</c>.
  12938. </summary>
  12939. <param name = "output">the destination stream.</param>
  12940. <param name = "leaveOpen">
  12941. whether to leave the captive stream open upon closing this stream.
  12942. </param>
  12943. </member>
  12944. <member name="M:Ionic.BZip2.ParallelBZip2OutputStream.#ctor(System.IO.Stream,System.Int32,System.Boolean)">
  12945. <summary>
  12946. Constructs a new <c>ParallelBZip2OutputStream</c> with specified blocksize,
  12947. and explicitly specifies whether to leave the wrapped stream open.
  12948. </summary>
  12949. <param name = "output">the destination stream.</param>
  12950. <param name = "blockSize">
  12951. The blockSize in units of 100000 bytes.
  12952. The valid range is 1..9.
  12953. </param>
  12954. <param name = "leaveOpen">
  12955. whether to leave the captive stream open upon closing this stream.
  12956. </param>
  12957. </member>
  12958. <member name="M:Ionic.BZip2.ParallelBZip2OutputStream.Close">
  12959. <summary>
  12960. Close the stream.
  12961. </summary>
  12962. <remarks>
  12963. <para>
  12964. This may or may not close the underlying stream. Check the
  12965. constructors that accept a bool value.
  12966. </para>
  12967. </remarks>
  12968. </member>
  12969. <member name="M:Ionic.BZip2.ParallelBZip2OutputStream.Flush">
  12970. <summary>
  12971. Flush the stream.
  12972. </summary>
  12973. </member>
  12974. <member name="M:Ionic.BZip2.ParallelBZip2OutputStream.Write(System.Byte[],System.Int32,System.Int32)">
  12975. <summary>
  12976. Write data to the stream.
  12977. </summary>
  12978. <remarks>
  12979. <para>
  12980. Use the <c>ParallelBZip2OutputStream</c> to compress data while
  12981. writing: create a <c>ParallelBZip2OutputStream</c> with a writable
  12982. output stream. Then call <c>Write()</c> on that
  12983. <c>ParallelBZip2OutputStream</c>, providing uncompressed data as
  12984. input. The data sent to the output stream will be the compressed
  12985. form of the input data.
  12986. </para>
  12987. <para>
  12988. A <c>ParallelBZip2OutputStream</c> can be used only for
  12989. <c>Write()</c> not for <c>Read()</c>.
  12990. </para>
  12991. </remarks>
  12992. <param name="buffer">The buffer holding data to write to the stream.</param>
  12993. <param name="offset">the offset within that data array to find the first byte to write.</param>
  12994. <param name="count">the number of bytes to write.</param>
  12995. </member>
  12996. <member name="M:Ionic.BZip2.ParallelBZip2OutputStream.Seek(System.Int64,System.IO.SeekOrigin)">
  12997. <summary>
  12998. Calling this method always throws a <see cref="T:System.NotImplementedException"/>.
  12999. </summary>
  13000. <param name="offset">this is irrelevant, since it will always throw!</param>
  13001. <param name="origin">this is irrelevant, since it will always throw!</param>
  13002. <returns>irrelevant!</returns>
  13003. </member>
  13004. <member name="M:Ionic.BZip2.ParallelBZip2OutputStream.SetLength(System.Int64)">
  13005. <summary>
  13006. Calling this method always throws a <see cref="T:System.NotImplementedException"/>.
  13007. </summary>
  13008. <param name="value">this is irrelevant, since it will always throw!</param>
  13009. </member>
  13010. <member name="M:Ionic.BZip2.ParallelBZip2OutputStream.Read(System.Byte[],System.Int32,System.Int32)">
  13011. <summary>
  13012. Calling this method always throws a <see cref="T:System.NotImplementedException"/>.
  13013. </summary>
  13014. <param name="buffer">this parameter is never used</param>
  13015. <param name="offset">this parameter is never used</param>
  13016. <param name="count">this parameter is never used</param>
  13017. <returns>never returns anything; always throws</returns>
  13018. </member>
  13019. <member name="P:Ionic.BZip2.ParallelBZip2OutputStream.MaxWorkers">
  13020. <summary>
  13021. The maximum number of concurrent compression worker threads to use.
  13022. </summary>
  13023. <remarks>
  13024. <para>
  13025. This property sets an upper limit on the number of concurrent worker
  13026. threads to employ for compression. The implementation of this stream
  13027. employs multiple threads from the .NET thread pool, via <see cref="M:System.Threading.ThreadPool.QueueUserWorkItem(System.Threading.WaitCallback)">
  13028. ThreadPool.QueueUserWorkItem()</see>, to compress the incoming data by
  13029. block. As each block of data is compressed, this stream re-orders the
  13030. compressed blocks and writes them to the output stream.
  13031. </para>
  13032. <para>
  13033. A higher number of workers enables a higher degree of
  13034. parallelism, which tends to increase the speed of compression on
  13035. multi-cpu computers. On the other hand, a higher number of buffer
  13036. pairs also implies a larger memory consumption, more active worker
  13037. threads, and a higher cpu utilization for any compression. This
  13038. property enables the application to limit its memory consumption and
  13039. CPU utilization behavior depending on requirements.
  13040. </para>
  13041. <para>
  13042. By default, DotNetZip allocates 4 workers per CPU core, subject to the
  13043. upper limit specified in this property. For example, suppose the
  13044. application sets this property to 16. Then, on a machine with 2
  13045. cores, DotNetZip will use 8 workers; that number does not exceed the
  13046. upper limit specified by this property, so the actual number of
  13047. workers used will be 4 * 2 = 8. On a machine with 4 cores, DotNetZip
  13048. will use 16 workers; again, the limit does not apply. On a machine
  13049. with 8 cores, DotNetZip will use 16 workers, because of the limit.
  13050. </para>
  13051. <para>
  13052. For each compression "worker thread" that occurs in parallel, there is
  13053. up to 2mb of memory allocated, for buffering and processing. The
  13054. actual number depends on the <see cref="P:Ionic.BZip2.ParallelBZip2OutputStream.BlockSize"/> property.
  13055. </para>
  13056. <para>
  13057. CPU utilization will also go up with additional workers, because a
  13058. larger number of buffer pairs allows a larger number of background
  13059. threads to compress in parallel. If you find that parallel
  13060. compression is consuming too much memory or CPU, you can adjust this
  13061. value downward.
  13062. </para>
  13063. <para>
  13064. The default value is 16. Different values may deliver better or
  13065. worse results, depending on your priorities and the dynamic
  13066. performance characteristics of your storage and compute resources.
  13067. </para>
  13068. <para>
  13069. The application can set this value at any time, but it is effective
  13070. only before the first call to Write(), which is when the buffers are
  13071. allocated.
  13072. </para>
  13073. </remarks>
  13074. </member>
  13075. <member name="P:Ionic.BZip2.ParallelBZip2OutputStream.BlockSize">
  13076. <summary>
  13077. The blocksize parameter specified at construction time.
  13078. </summary>
  13079. </member>
  13080. <member name="P:Ionic.BZip2.ParallelBZip2OutputStream.CanRead">
  13081. <summary>
  13082. Indicates whether the stream can be read.
  13083. </summary>
  13084. <remarks>
  13085. The return value is always false.
  13086. </remarks>
  13087. </member>
  13088. <member name="P:Ionic.BZip2.ParallelBZip2OutputStream.CanSeek">
  13089. <summary>
  13090. Indicates whether the stream supports Seek operations.
  13091. </summary>
  13092. <remarks>
  13093. Always returns false.
  13094. </remarks>
  13095. </member>
  13096. <member name="P:Ionic.BZip2.ParallelBZip2OutputStream.CanWrite">
  13097. <summary>
  13098. Indicates whether the stream can be written.
  13099. </summary>
  13100. <remarks>
  13101. The return value depends on whether the captive stream supports writing.
  13102. </remarks>
  13103. </member>
  13104. <member name="P:Ionic.BZip2.ParallelBZip2OutputStream.Length">
  13105. <summary>
  13106. Reading this property always throws a <see cref="T:System.NotImplementedException"/>.
  13107. </summary>
  13108. </member>
  13109. <member name="P:Ionic.BZip2.ParallelBZip2OutputStream.Position">
  13110. <summary>
  13111. The position of the stream pointer.
  13112. </summary>
  13113. <remarks>
  13114. Setting this property always throws a <see cref="T:System.NotImplementedException"/>. Reading will return the
  13115. total number of uncompressed bytes written through.
  13116. </remarks>
  13117. </member>
  13118. <member name="P:Ionic.BZip2.ParallelBZip2OutputStream.BytesWrittenOut">
  13119. <summary>
  13120. The total number of bytes written out by the stream.
  13121. </summary>
  13122. <remarks>
  13123. This value is meaningful only after a call to Close().
  13124. </remarks>
  13125. </member>
  13126. <member name="M:Ionic.BZip2.Rand.Rnums(System.Int32)">
  13127. <summary>
  13128. Returns the "random" number at a specific index.
  13129. </summary>
  13130. <param name='i'>the index</param>
  13131. <returns>the random number</returns>
  13132. </member>
  13133. <member name="T:Ionic.Zlib.DeflateStream">
  13134. <summary>
  13135. A class for compressing and decompressing streams using the Deflate algorithm.
  13136. </summary>
  13137. <remarks>
  13138. <para>
  13139. The DeflateStream is a <see href="http://en.wikipedia.org/wiki/Decorator_pattern">Decorator</see> on a <see cref="T:System.IO.Stream"/>. It adds DEFLATE compression or decompression to any
  13140. stream.
  13141. </para>
  13142. <para>
  13143. Using this stream, applications can compress or decompress data via stream
  13144. <c>Read</c> and <c>Write</c> operations. Either compresssion or decompression
  13145. can occur through either reading or writing. The compression format used is
  13146. DEFLATE, which is documented in <see href="http://www.ietf.org/rfc/rfc1951.txt">IETF RFC 1951</see>, "DEFLATE
  13147. Compressed Data Format Specification version 1.3.".
  13148. </para>
  13149. <para>
  13150. This class is similar to <see cref="T:Ionic.Zlib.ZlibStream"/>, except that
  13151. <c>ZlibStream</c> adds the <see href="http://www.ietf.org/rfc/rfc1950.txt">RFC
  13152. 1950 - ZLIB</see> framing bytes to a compressed stream when compressing, or
  13153. expects the RFC1950 framing bytes when decompressing. The <c>DeflateStream</c>
  13154. does not.
  13155. </para>
  13156. </remarks>
  13157. <seealso cref="T:Ionic.Zlib.ZlibStream"/>
  13158. <seealso cref="T:Ionic.Zlib.GZipStream"/>
  13159. </member>
  13160. <member name="M:Ionic.Zlib.DeflateStream.#ctor(System.IO.Stream,Ionic.Zlib.CompressionMode)">
  13161. <summary>
  13162. Create a DeflateStream using the specified CompressionMode.
  13163. </summary>
  13164. <remarks>
  13165. When mode is <c>CompressionMode.Compress</c>, the DeflateStream will use
  13166. the default compression level. The "captive" stream will be closed when
  13167. the DeflateStream is closed.
  13168. </remarks>
  13169. <example>
  13170. This example uses a DeflateStream to compress data from a file, and writes
  13171. the compressed data to another file.
  13172. <code>
  13173. using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
  13174. {
  13175. using (var raw = System.IO.File.Create(fileToCompress + ".deflated"))
  13176. {
  13177. using (Stream compressor = new DeflateStream(raw, CompressionMode.Compress))
  13178. {
  13179. byte[] buffer = new byte[WORKING_BUFFER_SIZE];
  13180. int n;
  13181. while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
  13182. {
  13183. compressor.Write(buffer, 0, n);
  13184. }
  13185. }
  13186. }
  13187. }
  13188. </code>
  13189. <code lang="VB">
  13190. Using input As Stream = File.OpenRead(fileToCompress)
  13191. Using raw As FileStream = File.Create(fileToCompress &amp; ".deflated")
  13192. Using compressor As Stream = New DeflateStream(raw, CompressionMode.Compress)
  13193. Dim buffer As Byte() = New Byte(4096) {}
  13194. Dim n As Integer = -1
  13195. Do While (n &lt;&gt; 0)
  13196. If (n &gt; 0) Then
  13197. compressor.Write(buffer, 0, n)
  13198. End If
  13199. n = input.Read(buffer, 0, buffer.Length)
  13200. Loop
  13201. End Using
  13202. End Using
  13203. End Using
  13204. </code>
  13205. </example>
  13206. <param name="stream">The stream which will be read or written.</param>
  13207. <param name="mode">Indicates whether the DeflateStream will compress or decompress.</param>
  13208. </member>
  13209. <member name="M:Ionic.Zlib.DeflateStream.#ctor(System.IO.Stream,Ionic.Zlib.CompressionMode,Ionic.Zlib.CompressionLevel)">
  13210. <summary>
  13211. Create a DeflateStream using the specified CompressionMode and the specified CompressionLevel.
  13212. </summary>
  13213. <remarks>
  13214. <para>
  13215. When mode is <c>CompressionMode.Decompress</c>, the level parameter is
  13216. ignored. The "captive" stream will be closed when the DeflateStream is
  13217. closed.
  13218. </para>
  13219. </remarks>
  13220. <example>
  13221. This example uses a DeflateStream to compress data from a file, and writes
  13222. the compressed data to another file.
  13223. <code>
  13224. using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
  13225. {
  13226. using (var raw = System.IO.File.Create(fileToCompress + ".deflated"))
  13227. {
  13228. using (Stream compressor = new DeflateStream(raw,
  13229. CompressionMode.Compress,
  13230. CompressionLevel.BestCompression))
  13231. {
  13232. byte[] buffer = new byte[WORKING_BUFFER_SIZE];
  13233. int n= -1;
  13234. while (n != 0)
  13235. {
  13236. if (n &gt; 0)
  13237. compressor.Write(buffer, 0, n);
  13238. n= input.Read(buffer, 0, buffer.Length);
  13239. }
  13240. }
  13241. }
  13242. }
  13243. </code>
  13244. <code lang="VB">
  13245. Using input As Stream = File.OpenRead(fileToCompress)
  13246. Using raw As FileStream = File.Create(fileToCompress &amp; ".deflated")
  13247. Using compressor As Stream = New DeflateStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression)
  13248. Dim buffer As Byte() = New Byte(4096) {}
  13249. Dim n As Integer = -1
  13250. Do While (n &lt;&gt; 0)
  13251. If (n &gt; 0) Then
  13252. compressor.Write(buffer, 0, n)
  13253. End If
  13254. n = input.Read(buffer, 0, buffer.Length)
  13255. Loop
  13256. End Using
  13257. End Using
  13258. End Using
  13259. </code>
  13260. </example>
  13261. <param name="stream">The stream to be read or written while deflating or inflating.</param>
  13262. <param name="mode">Indicates whether the <c>DeflateStream</c> will compress or decompress.</param>
  13263. <param name="level">A tuning knob to trade speed for effectiveness.</param>
  13264. </member>
  13265. <member name="M:Ionic.Zlib.DeflateStream.#ctor(System.IO.Stream,Ionic.Zlib.CompressionMode,System.Boolean)">
  13266. <summary>
  13267. Create a <c>DeflateStream</c> using the specified
  13268. <c>CompressionMode</c>, and explicitly specify whether the
  13269. stream should be left open after Deflation or Inflation.
  13270. </summary>
  13271. <remarks>
  13272. <para>
  13273. This constructor allows the application to request that the captive stream
  13274. remain open after the deflation or inflation occurs. By default, after
  13275. <c>Close()</c> is called on the stream, the captive stream is also
  13276. closed. In some cases this is not desired, for example if the stream is a
  13277. memory stream that will be re-read after compression. Specify true for
  13278. the <paramref name="leaveOpen"/> parameter to leave the stream open.
  13279. </para>
  13280. <para>
  13281. The <c>DeflateStream</c> will use the default compression level.
  13282. </para>
  13283. <para>
  13284. See the other overloads of this constructor for example code.
  13285. </para>
  13286. </remarks>
  13287. <param name="stream">
  13288. The stream which will be read or written. This is called the
  13289. "captive" stream in other places in this documentation.
  13290. </param>
  13291. <param name="mode">
  13292. Indicates whether the <c>DeflateStream</c> will compress or decompress.
  13293. </param>
  13294. <param name="leaveOpen">true if the application would like the stream to
  13295. remain open after inflation/deflation.</param>
  13296. </member>
  13297. <member name="M:Ionic.Zlib.DeflateStream.#ctor(System.IO.Stream,Ionic.Zlib.CompressionMode,Ionic.Zlib.CompressionLevel,System.Boolean)">
  13298. <summary>
  13299. Create a <c>DeflateStream</c> using the specified <c>CompressionMode</c>
  13300. and the specified <c>CompressionLevel</c>, and explicitly specify whether
  13301. the stream should be left open after Deflation or Inflation.
  13302. </summary>
  13303. <remarks>
  13304. <para>
  13305. When mode is <c>CompressionMode.Decompress</c>, the level parameter is ignored.
  13306. </para>
  13307. <para>
  13308. This constructor allows the application to request that the captive stream
  13309. remain open after the deflation or inflation occurs. By default, after
  13310. <c>Close()</c> is called on the stream, the captive stream is also
  13311. closed. In some cases this is not desired, for example if the stream is a
  13312. <see cref="T:System.IO.MemoryStream"/> that will be re-read after
  13313. compression. Specify true for the <paramref name="leaveOpen"/> parameter
  13314. to leave the stream open.
  13315. </para>
  13316. </remarks>
  13317. <example>
  13318. This example shows how to use a <c>DeflateStream</c> to compress data from
  13319. a file, and store the compressed data into another file.
  13320. <code>
  13321. using (var output = System.IO.File.Create(fileToCompress + ".deflated"))
  13322. {
  13323. using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
  13324. {
  13325. using (Stream compressor = new DeflateStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, true))
  13326. {
  13327. byte[] buffer = new byte[WORKING_BUFFER_SIZE];
  13328. int n= -1;
  13329. while (n != 0)
  13330. {
  13331. if (n &gt; 0)
  13332. compressor.Write(buffer, 0, n);
  13333. n= input.Read(buffer, 0, buffer.Length);
  13334. }
  13335. }
  13336. }
  13337. // can write additional data to the output stream here
  13338. }
  13339. </code>
  13340. <code lang="VB">
  13341. Using output As FileStream = File.Create(fileToCompress &amp; ".deflated")
  13342. Using input As Stream = File.OpenRead(fileToCompress)
  13343. Using compressor As Stream = New DeflateStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, True)
  13344. Dim buffer As Byte() = New Byte(4096) {}
  13345. Dim n As Integer = -1
  13346. Do While (n &lt;&gt; 0)
  13347. If (n &gt; 0) Then
  13348. compressor.Write(buffer, 0, n)
  13349. End If
  13350. n = input.Read(buffer, 0, buffer.Length)
  13351. Loop
  13352. End Using
  13353. End Using
  13354. ' can write additional data to the output stream here.
  13355. End Using
  13356. </code>
  13357. </example>
  13358. <param name="stream">The stream which will be read or written.</param>
  13359. <param name="mode">Indicates whether the DeflateStream will compress or decompress.</param>
  13360. <param name="leaveOpen">true if the application would like the stream to remain open after inflation/deflation.</param>
  13361. <param name="level">A tuning knob to trade speed for effectiveness.</param>
  13362. </member>
  13363. <member name="M:Ionic.Zlib.DeflateStream.Dispose(System.Boolean)">
  13364. <summary>
  13365. Dispose the stream.
  13366. </summary>
  13367. <remarks>
  13368. <para>
  13369. This may or may not result in a <c>Close()</c> call on the captive
  13370. stream. See the constructors that have a <c>leaveOpen</c> parameter
  13371. for more information.
  13372. </para>
  13373. <para>
  13374. Application code won't call this code directly. This method may be
  13375. invoked in two distinct scenarios. If disposing == true, the method
  13376. has been called directly or indirectly by a user's code, for example
  13377. via the public Dispose() method. In this case, both managed and
  13378. unmanaged resources can be referenced and disposed. If disposing ==
  13379. false, the method has been called by the runtime from inside the
  13380. object finalizer and this method should not reference other objects;
  13381. in that case only unmanaged resources must be referenced or
  13382. disposed.
  13383. </para>
  13384. </remarks>
  13385. <param name="disposing">
  13386. true if the Dispose method was invoked by user code.
  13387. </param>
  13388. </member>
  13389. <member name="M:Ionic.Zlib.DeflateStream.Flush">
  13390. <summary>
  13391. Flush the stream.
  13392. </summary>
  13393. </member>
  13394. <member name="M:Ionic.Zlib.DeflateStream.Read(System.Byte[],System.Int32,System.Int32)">
  13395. <summary>
  13396. Read data from the stream.
  13397. </summary>
  13398. <remarks>
  13399. <para>
  13400. If you wish to use the <c>DeflateStream</c> to compress data while
  13401. reading, you can create a <c>DeflateStream</c> with
  13402. <c>CompressionMode.Compress</c>, providing an uncompressed data stream.
  13403. Then call Read() on that <c>DeflateStream</c>, and the data read will be
  13404. compressed as you read. If you wish to use the <c>DeflateStream</c> to
  13405. decompress data while reading, you can create a <c>DeflateStream</c> with
  13406. <c>CompressionMode.Decompress</c>, providing a readable compressed data
  13407. stream. Then call Read() on that <c>DeflateStream</c>, and the data read
  13408. will be decompressed as you read.
  13409. </para>
  13410. <para>
  13411. A <c>DeflateStream</c> can be used for <c>Read()</c> or <c>Write()</c>, but not both.
  13412. </para>
  13413. </remarks>
  13414. <param name="buffer">The buffer into which the read data should be placed.</param>
  13415. <param name="offset">the offset within that data array to put the first byte read.</param>
  13416. <param name="count">the number of bytes to read.</param>
  13417. <returns>the number of bytes actually read</returns>
  13418. </member>
  13419. <member name="M:Ionic.Zlib.DeflateStream.Seek(System.Int64,System.IO.SeekOrigin)">
  13420. <summary>
  13421. Calling this method always throws a <see cref="T:System.NotImplementedException"/>.
  13422. </summary>
  13423. <param name="offset">this is irrelevant, since it will always throw!</param>
  13424. <param name="origin">this is irrelevant, since it will always throw!</param>
  13425. <returns>irrelevant!</returns>
  13426. </member>
  13427. <member name="M:Ionic.Zlib.DeflateStream.SetLength(System.Int64)">
  13428. <summary>
  13429. Calling this method always throws a <see cref="T:System.NotImplementedException"/>.
  13430. </summary>
  13431. <param name="value">this is irrelevant, since it will always throw!</param>
  13432. </member>
  13433. <member name="M:Ionic.Zlib.DeflateStream.Write(System.Byte[],System.Int32,System.Int32)">
  13434. <summary>
  13435. Write data to the stream.
  13436. </summary>
  13437. <remarks>
  13438. <para>
  13439. If you wish to use the <c>DeflateStream</c> to compress data while
  13440. writing, you can create a <c>DeflateStream</c> with
  13441. <c>CompressionMode.Compress</c>, and a writable output stream. Then call
  13442. <c>Write()</c> on that <c>DeflateStream</c>, providing uncompressed data
  13443. as input. The data sent to the output stream will be the compressed form
  13444. of the data written. If you wish to use the <c>DeflateStream</c> to
  13445. decompress data while writing, you can create a <c>DeflateStream</c> with
  13446. <c>CompressionMode.Decompress</c>, and a writable output stream. Then
  13447. call <c>Write()</c> on that stream, providing previously compressed
  13448. data. The data sent to the output stream will be the decompressed form of
  13449. the data written.
  13450. </para>
  13451. <para>
  13452. A <c>DeflateStream</c> can be used for <c>Read()</c> or <c>Write()</c>,
  13453. but not both.
  13454. </para>
  13455. </remarks>
  13456. <param name="buffer">The buffer holding data to write to the stream.</param>
  13457. <param name="offset">the offset within that data array to find the first byte to write.</param>
  13458. <param name="count">the number of bytes to write.</param>
  13459. </member>
  13460. <member name="M:Ionic.Zlib.DeflateStream.CompressString(System.String)">
  13461. <summary>
  13462. Compress a string into a byte array using DEFLATE (RFC 1951).
  13463. </summary>
  13464. <remarks>
  13465. Uncompress it with <see cref="M:Ionic.Zlib.DeflateStream.UncompressString(System.Byte[])"/>.
  13466. </remarks>
  13467. <seealso cref="M:Ionic.Zlib.DeflateStream.UncompressString(System.Byte[])">DeflateStream.UncompressString(byte[])</seealso>
  13468. <seealso cref="M:Ionic.Zlib.DeflateStream.CompressBuffer(System.Byte[])">DeflateStream.CompressBuffer(byte[])</seealso>
  13469. <seealso cref="M:Ionic.Zlib.GZipStream.CompressString(System.String)">GZipStream.CompressString(string)</seealso>
  13470. <seealso cref="M:Ionic.Zlib.ZlibStream.CompressString(System.String)">ZlibStream.CompressString(string)</seealso>
  13471. <param name="s">
  13472. A string to compress. The string will first be encoded
  13473. using UTF8, then compressed.
  13474. </param>
  13475. <returns>The string in compressed form</returns>
  13476. </member>
  13477. <member name="M:Ionic.Zlib.DeflateStream.CompressBuffer(System.Byte[])">
  13478. <summary>
  13479. Compress a byte array into a new byte array using DEFLATE.
  13480. </summary>
  13481. <remarks>
  13482. Uncompress it with <see cref="M:Ionic.Zlib.DeflateStream.UncompressBuffer(System.Byte[])"/>.
  13483. </remarks>
  13484. <seealso cref="M:Ionic.Zlib.DeflateStream.CompressString(System.String)">DeflateStream.CompressString(string)</seealso>
  13485. <seealso cref="M:Ionic.Zlib.DeflateStream.UncompressBuffer(System.Byte[])">DeflateStream.UncompressBuffer(byte[])</seealso>
  13486. <seealso cref="M:Ionic.Zlib.GZipStream.CompressBuffer(System.Byte[])">GZipStream.CompressBuffer(byte[])</seealso>
  13487. <seealso cref="M:Ionic.Zlib.ZlibStream.CompressBuffer(System.Byte[])">ZlibStream.CompressBuffer(byte[])</seealso>
  13488. <param name="b">
  13489. A buffer to compress.
  13490. </param>
  13491. <returns>The data in compressed form</returns>
  13492. </member>
  13493. <member name="M:Ionic.Zlib.DeflateStream.UncompressString(System.Byte[])">
  13494. <summary>
  13495. Uncompress a DEFLATE'd byte array into a single string.
  13496. </summary>
  13497. <seealso cref="M:Ionic.Zlib.DeflateStream.CompressString(System.String)">DeflateStream.CompressString(String)</seealso>
  13498. <seealso cref="M:Ionic.Zlib.DeflateStream.UncompressBuffer(System.Byte[])">DeflateStream.UncompressBuffer(byte[])</seealso>
  13499. <seealso cref="M:Ionic.Zlib.GZipStream.UncompressString(System.Byte[])">GZipStream.UncompressString(byte[])</seealso>
  13500. <seealso cref="M:Ionic.Zlib.ZlibStream.UncompressString(System.Byte[])">ZlibStream.UncompressString(byte[])</seealso>
  13501. <param name="compressed">
  13502. A buffer containing DEFLATE-compressed data.
  13503. </param>
  13504. <returns>The uncompressed string</returns>
  13505. </member>
  13506. <member name="M:Ionic.Zlib.DeflateStream.UncompressBuffer(System.Byte[])">
  13507. <summary>
  13508. Uncompress a DEFLATE'd byte array into a byte array.
  13509. </summary>
  13510. <seealso cref="M:Ionic.Zlib.DeflateStream.CompressBuffer(System.Byte[])">DeflateStream.CompressBuffer(byte[])</seealso>
  13511. <seealso cref="M:Ionic.Zlib.DeflateStream.UncompressString(System.Byte[])">DeflateStream.UncompressString(byte[])</seealso>
  13512. <seealso cref="M:Ionic.Zlib.GZipStream.UncompressBuffer(System.Byte[])">GZipStream.UncompressBuffer(byte[])</seealso>
  13513. <seealso cref="M:Ionic.Zlib.ZlibStream.UncompressBuffer(System.Byte[])">ZlibStream.UncompressBuffer(byte[])</seealso>
  13514. <param name="compressed">
  13515. A buffer containing data that has been compressed with DEFLATE.
  13516. </param>
  13517. <returns>The data in uncompressed form</returns>
  13518. </member>
  13519. <member name="P:Ionic.Zlib.DeflateStream.FlushMode">
  13520. <summary>
  13521. This property sets the flush behavior on the stream.
  13522. </summary>
  13523. <remarks> See the ZLIB documentation for the meaning of the flush behavior.
  13524. </remarks>
  13525. </member>
  13526. <member name="P:Ionic.Zlib.DeflateStream.BufferSize">
  13527. <summary>
  13528. The size of the working buffer for the compression codec.
  13529. </summary>
  13530. <remarks>
  13531. <para>
  13532. The working buffer is used for all stream operations. The default size is
  13533. 1024 bytes. The minimum size is 128 bytes. You may get better performance
  13534. with a larger buffer. Then again, you might not. You would have to test
  13535. it.
  13536. </para>
  13537. <para>
  13538. Set this before the first call to <c>Read()</c> or <c>Write()</c> on the
  13539. stream. If you try to set it afterwards, it will throw.
  13540. </para>
  13541. </remarks>
  13542. </member>
  13543. <member name="P:Ionic.Zlib.DeflateStream.Strategy">
  13544. <summary>
  13545. The ZLIB strategy to be used during compression.
  13546. </summary>
  13547. <remarks>
  13548. By tweaking this parameter, you may be able to optimize the compression for
  13549. data with particular characteristics.
  13550. </remarks>
  13551. </member>
  13552. <member name="P:Ionic.Zlib.DeflateStream.TotalIn">
  13553. <summary> Returns the total number of bytes input so far.</summary>
  13554. </member>
  13555. <member name="P:Ionic.Zlib.DeflateStream.TotalOut">
  13556. <summary> Returns the total number of bytes output so far.</summary>
  13557. </member>
  13558. <member name="P:Ionic.Zlib.DeflateStream.CanRead">
  13559. <summary>
  13560. Indicates whether the stream can be read.
  13561. </summary>
  13562. <remarks>
  13563. The return value depends on whether the captive stream supports reading.
  13564. </remarks>
  13565. </member>
  13566. <member name="P:Ionic.Zlib.DeflateStream.CanSeek">
  13567. <summary>
  13568. Indicates whether the stream supports Seek operations.
  13569. </summary>
  13570. <remarks>
  13571. Always returns false.
  13572. </remarks>
  13573. </member>
  13574. <member name="P:Ionic.Zlib.DeflateStream.CanWrite">
  13575. <summary>
  13576. Indicates whether the stream can be written.
  13577. </summary>
  13578. <remarks>
  13579. The return value depends on whether the captive stream supports writing.
  13580. </remarks>
  13581. </member>
  13582. <member name="P:Ionic.Zlib.DeflateStream.Length">
  13583. <summary>
  13584. Reading this property always throws a <see cref="T:System.NotImplementedException"/>.
  13585. </summary>
  13586. </member>
  13587. <member name="P:Ionic.Zlib.DeflateStream.Position">
  13588. <summary>
  13589. The position of the stream pointer.
  13590. </summary>
  13591. <remarks>
  13592. Setting this property always throws a <see cref="T:System.NotImplementedException"/>. Reading will return the total bytes
  13593. written out, if used in writing, or the total bytes read in, if used in
  13594. reading. The count may refer to compressed bytes or uncompressed bytes,
  13595. depending on how you've used the stream.
  13596. </remarks>
  13597. </member>
  13598. <member name="T:Ionic.Zlib.GZipStream">
  13599. <summary>
  13600. A class for compressing and decompressing GZIP streams.
  13601. </summary>
  13602. <remarks>
  13603. <para>
  13604. The <c>GZipStream</c> is a <see href="http://en.wikipedia.org/wiki/Decorator_pattern">Decorator</see> on a
  13605. <see cref="T:System.IO.Stream"/>. It adds GZIP compression or decompression to any
  13606. stream.
  13607. </para>
  13608. <para>
  13609. Like the <c>System.IO.Compression.GZipStream</c> in the .NET Base Class Library, the
  13610. <c>Ionic.Zlib.GZipStream</c> can compress while writing, or decompress while
  13611. reading, but not vice versa. The compression method used is GZIP, which is
  13612. documented in <see href="http://www.ietf.org/rfc/rfc1952.txt">IETF RFC
  13613. 1952</see>, "GZIP file format specification version 4.3".</para>
  13614. <para>
  13615. A <c>GZipStream</c> can be used to decompress data (through <c>Read()</c>) or
  13616. to compress data (through <c>Write()</c>), but not both.
  13617. </para>
  13618. <para>
  13619. If you wish to use the <c>GZipStream</c> to compress data, you must wrap it
  13620. around a write-able stream. As you call <c>Write()</c> on the <c>GZipStream</c>, the
  13621. data will be compressed into the GZIP format. If you want to decompress data,
  13622. you must wrap the <c>GZipStream</c> around a readable stream that contains an
  13623. IETF RFC 1952-compliant stream. The data will be decompressed as you call
  13624. <c>Read()</c> on the <c>GZipStream</c>.
  13625. </para>
  13626. <para>
  13627. Though the GZIP format allows data from multiple files to be concatenated
  13628. together, this stream handles only a single segment of GZIP format, typically
  13629. representing a single file.
  13630. </para>
  13631. <para>
  13632. This class is similar to <see cref="T:Ionic.Zlib.ZlibStream"/> and <see cref="T:Ionic.Zlib.DeflateStream"/>.
  13633. <c>ZlibStream</c> handles RFC1950-compliant streams. <see cref="T:Ionic.Zlib.DeflateStream"/>
  13634. handles RFC1951-compliant streams. This class handles RFC1952-compliant streams.
  13635. </para>
  13636. </remarks>
  13637. <seealso cref="T:Ionic.Zlib.DeflateStream"/>
  13638. <seealso cref="T:Ionic.Zlib.ZlibStream"/>
  13639. </member>
  13640. <member name="F:Ionic.Zlib.GZipStream.LastModified">
  13641. <summary>
  13642. The last modified time for the GZIP stream.
  13643. </summary>
  13644. <remarks>
  13645. GZIP allows the storage of a last modified time with each GZIP entry.
  13646. When compressing data, you can set this before the first call to
  13647. <c>Write()</c>. When decompressing, you can retrieve this value any time
  13648. after the first call to <c>Read()</c>.
  13649. </remarks>
  13650. </member>
  13651. <member name="M:Ionic.Zlib.GZipStream.#ctor(System.IO.Stream,Ionic.Zlib.CompressionMode)">
  13652. <summary>
  13653. Create a <c>GZipStream</c> using the specified <c>CompressionMode</c>.
  13654. </summary>
  13655. <remarks>
  13656. <para>
  13657. When mode is <c>CompressionMode.Compress</c>, the <c>GZipStream</c> will use the
  13658. default compression level.
  13659. </para>
  13660. <para>
  13661. As noted in the class documentation, the <c>CompressionMode</c> (Compress
  13662. or Decompress) also establishes the "direction" of the stream. A
  13663. <c>GZipStream</c> with <c>CompressionMode.Compress</c> works only through
  13664. <c>Write()</c>. A <c>GZipStream</c> with
  13665. <c>CompressionMode.Decompress</c> works only through <c>Read()</c>.
  13666. </para>
  13667. </remarks>
  13668. <example>
  13669. This example shows how to use a GZipStream to compress data.
  13670. <code>
  13671. using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
  13672. {
  13673. using (var raw = System.IO.File.Create(outputFile))
  13674. {
  13675. using (Stream compressor = new GZipStream(raw, CompressionMode.Compress))
  13676. {
  13677. byte[] buffer = new byte[WORKING_BUFFER_SIZE];
  13678. int n;
  13679. while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
  13680. {
  13681. compressor.Write(buffer, 0, n);
  13682. }
  13683. }
  13684. }
  13685. }
  13686. </code>
  13687. <code lang="VB">
  13688. Dim outputFile As String = (fileToCompress &amp; ".compressed")
  13689. Using input As Stream = File.OpenRead(fileToCompress)
  13690. Using raw As FileStream = File.Create(outputFile)
  13691. Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress)
  13692. Dim buffer As Byte() = New Byte(4096) {}
  13693. Dim n As Integer = -1
  13694. Do While (n &lt;&gt; 0)
  13695. If (n &gt; 0) Then
  13696. compressor.Write(buffer, 0, n)
  13697. End If
  13698. n = input.Read(buffer, 0, buffer.Length)
  13699. Loop
  13700. End Using
  13701. End Using
  13702. End Using
  13703. </code>
  13704. </example>
  13705. <example>
  13706. This example shows how to use a GZipStream to uncompress a file.
  13707. <code>
  13708. private void GunZipFile(string filename)
  13709. {
  13710. if (!filename.EndsWith(".gz))
  13711. throw new ArgumentException("filename");
  13712. var DecompressedFile = filename.Substring(0,filename.Length-3);
  13713. byte[] working = new byte[WORKING_BUFFER_SIZE];
  13714. int n= 1;
  13715. using (System.IO.Stream input = System.IO.File.OpenRead(filename))
  13716. {
  13717. using (Stream decompressor= new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, true))
  13718. {
  13719. using (var output = System.IO.File.Create(DecompressedFile))
  13720. {
  13721. while (n !=0)
  13722. {
  13723. n= decompressor.Read(working, 0, working.Length);
  13724. if (n > 0)
  13725. {
  13726. output.Write(working, 0, n);
  13727. }
  13728. }
  13729. }
  13730. }
  13731. }
  13732. }
  13733. </code>
  13734. <code lang="VB">
  13735. Private Sub GunZipFile(ByVal filename as String)
  13736. If Not (filename.EndsWith(".gz)) Then
  13737. Throw New ArgumentException("filename")
  13738. End If
  13739. Dim DecompressedFile as String = filename.Substring(0,filename.Length-3)
  13740. Dim working(WORKING_BUFFER_SIZE) as Byte
  13741. Dim n As Integer = 1
  13742. Using input As Stream = File.OpenRead(filename)
  13743. Using decompressor As Stream = new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, True)
  13744. Using output As Stream = File.Create(UncompressedFile)
  13745. Do
  13746. n= decompressor.Read(working, 0, working.Length)
  13747. If n > 0 Then
  13748. output.Write(working, 0, n)
  13749. End IF
  13750. Loop While (n > 0)
  13751. End Using
  13752. End Using
  13753. End Using
  13754. End Sub
  13755. </code>
  13756. </example>
  13757. <param name="stream">The stream which will be read or written.</param>
  13758. <param name="mode">Indicates whether the GZipStream will compress or decompress.</param>
  13759. </member>
  13760. <member name="M:Ionic.Zlib.GZipStream.#ctor(System.IO.Stream,Ionic.Zlib.CompressionMode,Ionic.Zlib.CompressionLevel)">
  13761. <summary>
  13762. Create a <c>GZipStream</c> using the specified <c>CompressionMode</c> and
  13763. the specified <c>CompressionLevel</c>.
  13764. </summary>
  13765. <remarks>
  13766. <para>
  13767. The <c>CompressionMode</c> (Compress or Decompress) also establishes the
  13768. "direction" of the stream. A <c>GZipStream</c> with
  13769. <c>CompressionMode.Compress</c> works only through <c>Write()</c>. A
  13770. <c>GZipStream</c> with <c>CompressionMode.Decompress</c> works only
  13771. through <c>Read()</c>.
  13772. </para>
  13773. </remarks>
  13774. <example>
  13775. This example shows how to use a <c>GZipStream</c> to compress a file into a .gz file.
  13776. <code>
  13777. using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
  13778. {
  13779. using (var raw = System.IO.File.Create(fileToCompress + ".gz"))
  13780. {
  13781. using (Stream compressor = new GZipStream(raw,
  13782. CompressionMode.Compress,
  13783. CompressionLevel.BestCompression))
  13784. {
  13785. byte[] buffer = new byte[WORKING_BUFFER_SIZE];
  13786. int n;
  13787. while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
  13788. {
  13789. compressor.Write(buffer, 0, n);
  13790. }
  13791. }
  13792. }
  13793. }
  13794. </code>
  13795. <code lang="VB">
  13796. Using input As Stream = File.OpenRead(fileToCompress)
  13797. Using raw As FileStream = File.Create(fileToCompress &amp; ".gz")
  13798. Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression)
  13799. Dim buffer As Byte() = New Byte(4096) {}
  13800. Dim n As Integer = -1
  13801. Do While (n &lt;&gt; 0)
  13802. If (n &gt; 0) Then
  13803. compressor.Write(buffer, 0, n)
  13804. End If
  13805. n = input.Read(buffer, 0, buffer.Length)
  13806. Loop
  13807. End Using
  13808. End Using
  13809. End Using
  13810. </code>
  13811. </example>
  13812. <param name="stream">The stream to be read or written while deflating or inflating.</param>
  13813. <param name="mode">Indicates whether the <c>GZipStream</c> will compress or decompress.</param>
  13814. <param name="level">A tuning knob to trade speed for effectiveness.</param>
  13815. </member>
  13816. <member name="M:Ionic.Zlib.GZipStream.#ctor(System.IO.Stream,Ionic.Zlib.CompressionMode,System.Boolean)">
  13817. <summary>
  13818. Create a <c>GZipStream</c> using the specified <c>CompressionMode</c>, and
  13819. explicitly specify whether the stream should be left open after Deflation
  13820. or Inflation.
  13821. </summary>
  13822. <remarks>
  13823. <para>
  13824. This constructor allows the application to request that the captive stream
  13825. remain open after the deflation or inflation occurs. By default, after
  13826. <c>Close()</c> is called on the stream, the captive stream is also
  13827. closed. In some cases this is not desired, for example if the stream is a
  13828. memory stream that will be re-read after compressed data has been written
  13829. to it. Specify true for the <paramref name="leaveOpen"/> parameter to leave
  13830. the stream open.
  13831. </para>
  13832. <para>
  13833. The <see cref="T:Ionic.Zlib.CompressionMode"/> (Compress or Decompress) also
  13834. establishes the "direction" of the stream. A <c>GZipStream</c> with
  13835. <c>CompressionMode.Compress</c> works only through <c>Write()</c>. A <c>GZipStream</c>
  13836. with <c>CompressionMode.Decompress</c> works only through <c>Read()</c>.
  13837. </para>
  13838. <para>
  13839. The <c>GZipStream</c> will use the default compression level. If you want
  13840. to specify the compression level, see <see cref="M:Ionic.Zlib.GZipStream.#ctor(System.IO.Stream,Ionic.Zlib.CompressionMode,Ionic.Zlib.CompressionLevel,System.Boolean)"/>.
  13841. </para>
  13842. <para>
  13843. See the other overloads of this constructor for example code.
  13844. </para>
  13845. </remarks>
  13846. <param name="stream">
  13847. The stream which will be read or written. This is called the "captive"
  13848. stream in other places in this documentation.
  13849. </param>
  13850. <param name="mode">Indicates whether the GZipStream will compress or decompress.
  13851. </param>
  13852. <param name="leaveOpen">
  13853. true if the application would like the base stream to remain open after
  13854. inflation/deflation.
  13855. </param>
  13856. </member>
  13857. <member name="M:Ionic.Zlib.GZipStream.#ctor(System.IO.Stream,Ionic.Zlib.CompressionMode,Ionic.Zlib.CompressionLevel,System.Boolean)">
  13858. <summary>
  13859. Create a <c>GZipStream</c> using the specified <c>CompressionMode</c> and the
  13860. specified <c>CompressionLevel</c>, and explicitly specify whether the
  13861. stream should be left open after Deflation or Inflation.
  13862. </summary>
  13863. <remarks>
  13864. <para>
  13865. This constructor allows the application to request that the captive stream
  13866. remain open after the deflation or inflation occurs. By default, after
  13867. <c>Close()</c> is called on the stream, the captive stream is also
  13868. closed. In some cases this is not desired, for example if the stream is a
  13869. memory stream that will be re-read after compressed data has been written
  13870. to it. Specify true for the <paramref name="leaveOpen"/> parameter to
  13871. leave the stream open.
  13872. </para>
  13873. <para>
  13874. As noted in the class documentation, the <c>CompressionMode</c> (Compress
  13875. or Decompress) also establishes the "direction" of the stream. A
  13876. <c>GZipStream</c> with <c>CompressionMode.Compress</c> works only through
  13877. <c>Write()</c>. A <c>GZipStream</c> with <c>CompressionMode.Decompress</c> works only
  13878. through <c>Read()</c>.
  13879. </para>
  13880. </remarks>
  13881. <example>
  13882. This example shows how to use a <c>GZipStream</c> to compress data.
  13883. <code>
  13884. using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
  13885. {
  13886. using (var raw = System.IO.File.Create(outputFile))
  13887. {
  13888. using (Stream compressor = new GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, true))
  13889. {
  13890. byte[] buffer = new byte[WORKING_BUFFER_SIZE];
  13891. int n;
  13892. while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
  13893. {
  13894. compressor.Write(buffer, 0, n);
  13895. }
  13896. }
  13897. }
  13898. }
  13899. </code>
  13900. <code lang="VB">
  13901. Dim outputFile As String = (fileToCompress &amp; ".compressed")
  13902. Using input As Stream = File.OpenRead(fileToCompress)
  13903. Using raw As FileStream = File.Create(outputFile)
  13904. Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, True)
  13905. Dim buffer As Byte() = New Byte(4096) {}
  13906. Dim n As Integer = -1
  13907. Do While (n &lt;&gt; 0)
  13908. If (n &gt; 0) Then
  13909. compressor.Write(buffer, 0, n)
  13910. End If
  13911. n = input.Read(buffer, 0, buffer.Length)
  13912. Loop
  13913. End Using
  13914. End Using
  13915. End Using
  13916. </code>
  13917. </example>
  13918. <param name="stream">The stream which will be read or written.</param>
  13919. <param name="mode">Indicates whether the GZipStream will compress or decompress.</param>
  13920. <param name="leaveOpen">true if the application would like the stream to remain open after inflation/deflation.</param>
  13921. <param name="level">A tuning knob to trade speed for effectiveness.</param>
  13922. </member>
  13923. <member name="M:Ionic.Zlib.GZipStream.Dispose(System.Boolean)">
  13924. <summary>
  13925. Dispose the stream.
  13926. </summary>
  13927. <remarks>
  13928. <para>
  13929. This may or may not result in a <c>Close()</c> call on the captive
  13930. stream. See the constructors that have a <c>leaveOpen</c> parameter
  13931. for more information.
  13932. </para>
  13933. <para>
  13934. This method may be invoked in two distinct scenarios. If disposing
  13935. == true, the method has been called directly or indirectly by a
  13936. user's code, for example via the public Dispose() method. In this
  13937. case, both managed and unmanaged resources can be referenced and
  13938. disposed. If disposing == false, the method has been called by the
  13939. runtime from inside the object finalizer and this method should not
  13940. reference other objects; in that case only unmanaged resources must
  13941. be referenced or disposed.
  13942. </para>
  13943. </remarks>
  13944. <param name="disposing">
  13945. indicates whether the Dispose method was invoked by user code.
  13946. </param>
  13947. </member>
  13948. <member name="M:Ionic.Zlib.GZipStream.Flush">
  13949. <summary>
  13950. Flush the stream.
  13951. </summary>
  13952. </member>
  13953. <member name="M:Ionic.Zlib.GZipStream.Read(System.Byte[],System.Int32,System.Int32)">
  13954. <summary>
  13955. Read and decompress data from the source stream.
  13956. </summary>
  13957. <remarks>
  13958. With a <c>GZipStream</c>, decompression is done through reading.
  13959. </remarks>
  13960. <example>
  13961. <code>
  13962. byte[] working = new byte[WORKING_BUFFER_SIZE];
  13963. using (System.IO.Stream input = System.IO.File.OpenRead(_CompressedFile))
  13964. {
  13965. using (Stream decompressor= new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, true))
  13966. {
  13967. using (var output = System.IO.File.Create(_DecompressedFile))
  13968. {
  13969. int n;
  13970. while ((n= decompressor.Read(working, 0, working.Length)) !=0)
  13971. {
  13972. output.Write(working, 0, n);
  13973. }
  13974. }
  13975. }
  13976. }
  13977. </code>
  13978. </example>
  13979. <param name="buffer">The buffer into which the decompressed data should be placed.</param>
  13980. <param name="offset">the offset within that data array to put the first byte read.</param>
  13981. <param name="count">the number of bytes to read.</param>
  13982. <returns>the number of bytes actually read</returns>
  13983. </member>
  13984. <member name="M:Ionic.Zlib.GZipStream.Seek(System.Int64,System.IO.SeekOrigin)">
  13985. <summary>
  13986. Calling this method always throws a <see cref="T:System.NotImplementedException"/>.
  13987. </summary>
  13988. <param name="offset">irrelevant; it will always throw!</param>
  13989. <param name="origin">irrelevant; it will always throw!</param>
  13990. <returns>irrelevant!</returns>
  13991. </member>
  13992. <member name="M:Ionic.Zlib.GZipStream.SetLength(System.Int64)">
  13993. <summary>
  13994. Calling this method always throws a <see cref="T:System.NotImplementedException"/>.
  13995. </summary>
  13996. <param name="value">irrelevant; this method will always throw!</param>
  13997. </member>
  13998. <member name="M:Ionic.Zlib.GZipStream.Write(System.Byte[],System.Int32,System.Int32)">
  13999. <summary>
  14000. Write data to the stream.
  14001. </summary>
  14002. <remarks>
  14003. <para>
  14004. If you wish to use the <c>GZipStream</c> to compress data while writing,
  14005. you can create a <c>GZipStream</c> with <c>CompressionMode.Compress</c>, and a
  14006. writable output stream. Then call <c>Write()</c> on that <c>GZipStream</c>,
  14007. providing uncompressed data as input. The data sent to the output stream
  14008. will be the compressed form of the data written.
  14009. </para>
  14010. <para>
  14011. A <c>GZipStream</c> can be used for <c>Read()</c> or <c>Write()</c>, but not
  14012. both. Writing implies compression. Reading implies decompression.
  14013. </para>
  14014. </remarks>
  14015. <param name="buffer">The buffer holding data to write to the stream.</param>
  14016. <param name="offset">the offset within that data array to find the first byte to write.</param>
  14017. <param name="count">the number of bytes to write.</param>
  14018. </member>
  14019. <member name="M:Ionic.Zlib.GZipStream.CompressString(System.String)">
  14020. <summary>
  14021. Compress a string into a byte array using GZip.
  14022. </summary>
  14023. <remarks>
  14024. Uncompress it with <see cref="M:Ionic.Zlib.GZipStream.UncompressString(System.Byte[])"/>.
  14025. </remarks>
  14026. <seealso cref="M:Ionic.Zlib.GZipStream.UncompressString(System.Byte[])"/>
  14027. <seealso cref="M:Ionic.Zlib.GZipStream.CompressBuffer(System.Byte[])"/>
  14028. <param name="s">
  14029. A string to compress. The string will first be encoded
  14030. using UTF8, then compressed.
  14031. </param>
  14032. <returns>The string in compressed form</returns>
  14033. </member>
  14034. <member name="M:Ionic.Zlib.GZipStream.CompressBuffer(System.Byte[])">
  14035. <summary>
  14036. Compress a byte array into a new byte array using GZip.
  14037. </summary>
  14038. <remarks>
  14039. Uncompress it with <see cref="M:Ionic.Zlib.GZipStream.UncompressBuffer(System.Byte[])"/>.
  14040. </remarks>
  14041. <seealso cref="M:Ionic.Zlib.GZipStream.CompressString(System.String)"/>
  14042. <seealso cref="M:Ionic.Zlib.GZipStream.UncompressBuffer(System.Byte[])"/>
  14043. <param name="b">
  14044. A buffer to compress.
  14045. </param>
  14046. <returns>The data in compressed form</returns>
  14047. </member>
  14048. <member name="M:Ionic.Zlib.GZipStream.UncompressString(System.Byte[])">
  14049. <summary>
  14050. Uncompress a GZip'ed byte array into a single string.
  14051. </summary>
  14052. <seealso cref="M:Ionic.Zlib.GZipStream.CompressString(System.String)"/>
  14053. <seealso cref="M:Ionic.Zlib.GZipStream.UncompressBuffer(System.Byte[])"/>
  14054. <param name="compressed">
  14055. A buffer containing GZIP-compressed data.
  14056. </param>
  14057. <returns>The uncompressed string</returns>
  14058. </member>
  14059. <member name="M:Ionic.Zlib.GZipStream.UncompressBuffer(System.Byte[])">
  14060. <summary>
  14061. Uncompress a GZip'ed byte array into a byte array.
  14062. </summary>
  14063. <seealso cref="M:Ionic.Zlib.GZipStream.CompressBuffer(System.Byte[])"/>
  14064. <seealso cref="M:Ionic.Zlib.GZipStream.UncompressString(System.Byte[])"/>
  14065. <param name="compressed">
  14066. A buffer containing data that has been compressed with GZip.
  14067. </param>
  14068. <returns>The data in uncompressed form</returns>
  14069. </member>
  14070. <member name="P:Ionic.Zlib.GZipStream.Comment">
  14071. <summary>
  14072. The comment on the GZIP stream.
  14073. </summary>
  14074. <remarks>
  14075. <para>
  14076. The GZIP format allows for each file to optionally have an associated
  14077. comment stored with the file. The comment is encoded with the ISO-8859-1
  14078. code page. To include a comment in a GZIP stream you create, set this
  14079. property before calling <c>Write()</c> for the first time on the
  14080. <c>GZipStream</c>.
  14081. </para>
  14082. <para>
  14083. When using <c>GZipStream</c> to decompress, you can retrieve this property
  14084. after the first call to <c>Read()</c>. If no comment has been set in the
  14085. GZIP bytestream, the Comment property will return <c>null</c>
  14086. (<c>Nothing</c> in VB).
  14087. </para>
  14088. </remarks>
  14089. </member>
  14090. <member name="P:Ionic.Zlib.GZipStream.FileName">
  14091. <summary>
  14092. The FileName for the GZIP stream.
  14093. </summary>
  14094. <remarks>
  14095. <para>
  14096. The GZIP format optionally allows each file to have an associated
  14097. filename. When compressing data (through <c>Write()</c>), set this
  14098. FileName before calling <c>Write()</c> the first time on the <c>GZipStream</c>.
  14099. The actual filename is encoded into the GZIP bytestream with the
  14100. ISO-8859-1 code page, according to RFC 1952. It is the application's
  14101. responsibility to insure that the FileName can be encoded and decoded
  14102. correctly with this code page.
  14103. </para>
  14104. <para>
  14105. When decompressing (through <c>Read()</c>), you can retrieve this value
  14106. any time after the first <c>Read()</c>. In the case where there was no filename
  14107. encoded into the GZIP bytestream, the property will return <c>null</c> (<c>Nothing</c>
  14108. in VB).
  14109. </para>
  14110. </remarks>
  14111. </member>
  14112. <member name="P:Ionic.Zlib.GZipStream.Crc32">
  14113. <summary>
  14114. The CRC on the GZIP stream.
  14115. </summary>
  14116. <remarks>
  14117. This is used for internal error checking. You probably don't need to look at this property.
  14118. </remarks>
  14119. </member>
  14120. <member name="P:Ionic.Zlib.GZipStream.FlushMode">
  14121. <summary>
  14122. This property sets the flush behavior on the stream.
  14123. </summary>
  14124. </member>
  14125. <member name="P:Ionic.Zlib.GZipStream.BufferSize">
  14126. <summary>
  14127. The size of the working buffer for the compression codec.
  14128. </summary>
  14129. <remarks>
  14130. <para>
  14131. The working buffer is used for all stream operations. The default size is
  14132. 1024 bytes. The minimum size is 128 bytes. You may get better performance
  14133. with a larger buffer. Then again, you might not. You would have to test
  14134. it.
  14135. </para>
  14136. <para>
  14137. Set this before the first call to <c>Read()</c> or <c>Write()</c> on the
  14138. stream. If you try to set it afterwards, it will throw.
  14139. </para>
  14140. </remarks>
  14141. </member>
  14142. <member name="P:Ionic.Zlib.GZipStream.TotalIn">
  14143. <summary> Returns the total number of bytes input so far.</summary>
  14144. </member>
  14145. <member name="P:Ionic.Zlib.GZipStream.TotalOut">
  14146. <summary> Returns the total number of bytes output so far.</summary>
  14147. </member>
  14148. <member name="P:Ionic.Zlib.GZipStream.CanRead">
  14149. <summary>
  14150. Indicates whether the stream can be read.
  14151. </summary>
  14152. <remarks>
  14153. The return value depends on whether the captive stream supports reading.
  14154. </remarks>
  14155. </member>
  14156. <member name="P:Ionic.Zlib.GZipStream.CanSeek">
  14157. <summary>
  14158. Indicates whether the stream supports Seek operations.
  14159. </summary>
  14160. <remarks>
  14161. Always returns false.
  14162. </remarks>
  14163. </member>
  14164. <member name="P:Ionic.Zlib.GZipStream.CanWrite">
  14165. <summary>
  14166. Indicates whether the stream can be written.
  14167. </summary>
  14168. <remarks>
  14169. The return value depends on whether the captive stream supports writing.
  14170. </remarks>
  14171. </member>
  14172. <member name="P:Ionic.Zlib.GZipStream.Length">
  14173. <summary>
  14174. Reading this property always throws a <see cref="T:System.NotImplementedException"/>.
  14175. </summary>
  14176. </member>
  14177. <member name="P:Ionic.Zlib.GZipStream.Position">
  14178. <summary>
  14179. The position of the stream pointer.
  14180. </summary>
  14181. <remarks>
  14182. Setting this property always throws a <see cref="T:System.NotImplementedException"/>. Reading will return the total bytes
  14183. written out, if used in writing, or the total bytes read in, if used in
  14184. reading. The count may refer to compressed bytes or uncompressed bytes,
  14185. depending on how you've used the stream.
  14186. </remarks>
  14187. </member>
  14188. <member name="T:Ionic.Zlib.ParallelDeflateOutputStream">
  14189. <summary>
  14190. A class for compressing streams using the
  14191. Deflate algorithm with multiple threads.
  14192. </summary>
  14193. <remarks>
  14194. <para>
  14195. This class performs DEFLATE compression through writing. For
  14196. more information on the Deflate algorithm, see IETF RFC 1951,
  14197. "DEFLATE Compressed Data Format Specification version 1.3."
  14198. </para>
  14199. <para>
  14200. This class is similar to <see cref="T:Ionic.Zlib.DeflateStream"/>, except
  14201. that this class is for compression only, and this implementation uses an
  14202. approach that employs multiple worker threads to perform the DEFLATE. On
  14203. a multi-cpu or multi-core computer, the performance of this class can be
  14204. significantly higher than the single-threaded DeflateStream, particularly
  14205. for larger streams. How large? Anything over 10mb is a good candidate
  14206. for parallel compression.
  14207. </para>
  14208. <para>
  14209. The tradeoff is that this class uses more memory and more CPU than the
  14210. vanilla DeflateStream, and also is less efficient as a compressor. For
  14211. large files the size of the compressed data stream can be less than 1%
  14212. larger than the size of a compressed data stream from the vanialla
  14213. DeflateStream. For smaller files the difference can be larger. The
  14214. difference will also be larger if you set the BufferSize to be lower than
  14215. the default value. Your mileage may vary. Finally, for small files, the
  14216. ParallelDeflateOutputStream can be much slower than the vanilla
  14217. DeflateStream, because of the overhead associated to using the thread
  14218. pool.
  14219. </para>
  14220. </remarks>
  14221. <seealso cref="T:Ionic.Zlib.DeflateStream"/>
  14222. </member>
  14223. <member name="M:Ionic.Zlib.ParallelDeflateOutputStream.#ctor(System.IO.Stream)">
  14224. <summary>
  14225. Create a ParallelDeflateOutputStream.
  14226. </summary>
  14227. <remarks>
  14228. <para>
  14229. This stream compresses data written into it via the DEFLATE
  14230. algorithm (see RFC 1951), and writes out the compressed byte stream.
  14231. </para>
  14232. <para>
  14233. The instance will use the default compression level, the default
  14234. buffer sizes and the default number of threads and buffers per
  14235. thread.
  14236. </para>
  14237. <para>
  14238. This class is similar to <see cref="T:Ionic.Zlib.DeflateStream"/>,
  14239. except that this implementation uses an approach that employs
  14240. multiple worker threads to perform the DEFLATE. On a multi-cpu or
  14241. multi-core computer, the performance of this class can be
  14242. significantly higher than the single-threaded DeflateStream,
  14243. particularly for larger streams. How large? Anything over 10mb is
  14244. a good candidate for parallel compression.
  14245. </para>
  14246. </remarks>
  14247. <example>
  14248. This example shows how to use a ParallelDeflateOutputStream to compress
  14249. data. It reads a file, compresses it, and writes the compressed data to
  14250. a second, output file.
  14251. <code>
  14252. byte[] buffer = new byte[WORKING_BUFFER_SIZE];
  14253. int n= -1;
  14254. String outputFile = fileToCompress + ".compressed";
  14255. using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
  14256. {
  14257. using (var raw = System.IO.File.Create(outputFile))
  14258. {
  14259. using (Stream compressor = new ParallelDeflateOutputStream(raw))
  14260. {
  14261. while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
  14262. {
  14263. compressor.Write(buffer, 0, n);
  14264. }
  14265. }
  14266. }
  14267. }
  14268. </code>
  14269. <code lang="VB">
  14270. Dim buffer As Byte() = New Byte(4096) {}
  14271. Dim n As Integer = -1
  14272. Dim outputFile As String = (fileToCompress &amp; ".compressed")
  14273. Using input As Stream = File.OpenRead(fileToCompress)
  14274. Using raw As FileStream = File.Create(outputFile)
  14275. Using compressor As Stream = New ParallelDeflateOutputStream(raw)
  14276. Do While (n &lt;&gt; 0)
  14277. If (n &gt; 0) Then
  14278. compressor.Write(buffer, 0, n)
  14279. End If
  14280. n = input.Read(buffer, 0, buffer.Length)
  14281. Loop
  14282. End Using
  14283. End Using
  14284. End Using
  14285. </code>
  14286. </example>
  14287. <param name="stream">The stream to which compressed data will be written.</param>
  14288. </member>
  14289. <member name="M:Ionic.Zlib.ParallelDeflateOutputStream.#ctor(System.IO.Stream,Ionic.Zlib.CompressionLevel)">
  14290. <summary>
  14291. Create a ParallelDeflateOutputStream using the specified CompressionLevel.
  14292. </summary>
  14293. <remarks>
  14294. See the <see cref="M:Ionic.Zlib.ParallelDeflateOutputStream.#ctor(System.IO.Stream)"/>
  14295. constructor for example code.
  14296. </remarks>
  14297. <param name="stream">The stream to which compressed data will be written.</param>
  14298. <param name="level">A tuning knob to trade speed for effectiveness.</param>
  14299. </member>
  14300. <member name="M:Ionic.Zlib.ParallelDeflateOutputStream.#ctor(System.IO.Stream,System.Boolean)">
  14301. <summary>
  14302. Create a ParallelDeflateOutputStream and specify whether to leave the captive stream open
  14303. when the ParallelDeflateOutputStream is closed.
  14304. </summary>
  14305. <remarks>
  14306. See the <see cref="M:Ionic.Zlib.ParallelDeflateOutputStream.#ctor(System.IO.Stream)"/>
  14307. constructor for example code.
  14308. </remarks>
  14309. <param name="stream">The stream to which compressed data will be written.</param>
  14310. <param name="leaveOpen">
  14311. true if the application would like the stream to remain open after inflation/deflation.
  14312. </param>
  14313. </member>
  14314. <member name="M:Ionic.Zlib.ParallelDeflateOutputStream.#ctor(System.IO.Stream,Ionic.Zlib.CompressionLevel,System.Boolean)">
  14315. <summary>
  14316. Create a ParallelDeflateOutputStream and specify whether to leave the captive stream open
  14317. when the ParallelDeflateOutputStream is closed.
  14318. </summary>
  14319. <remarks>
  14320. See the <see cref="M:Ionic.Zlib.ParallelDeflateOutputStream.#ctor(System.IO.Stream)"/>
  14321. constructor for example code.
  14322. </remarks>
  14323. <param name="stream">The stream to which compressed data will be written.</param>
  14324. <param name="level">A tuning knob to trade speed for effectiveness.</param>
  14325. <param name="leaveOpen">
  14326. true if the application would like the stream to remain open after inflation/deflation.
  14327. </param>
  14328. </member>
  14329. <member name="M:Ionic.Zlib.ParallelDeflateOutputStream.#ctor(System.IO.Stream,Ionic.Zlib.CompressionLevel,Ionic.Zlib.CompressionStrategy,System.Boolean)">
  14330. <summary>
  14331. Create a ParallelDeflateOutputStream using the specified
  14332. CompressionLevel and CompressionStrategy, and specifying whether to
  14333. leave the captive stream open when the ParallelDeflateOutputStream is
  14334. closed.
  14335. </summary>
  14336. <remarks>
  14337. See the <see cref="M:Ionic.Zlib.ParallelDeflateOutputStream.#ctor(System.IO.Stream)"/>
  14338. constructor for example code.
  14339. </remarks>
  14340. <param name="stream">The stream to which compressed data will be written.</param>
  14341. <param name="level">A tuning knob to trade speed for effectiveness.</param>
  14342. <param name="strategy">
  14343. By tweaking this parameter, you may be able to optimize the compression for
  14344. data with particular characteristics.
  14345. </param>
  14346. <param name="leaveOpen">
  14347. true if the application would like the stream to remain open after inflation/deflation.
  14348. </param>
  14349. </member>
  14350. <member name="M:Ionic.Zlib.ParallelDeflateOutputStream.Write(System.Byte[],System.Int32,System.Int32)">
  14351. <summary>
  14352. Write data to the stream.
  14353. </summary>
  14354. <remarks>
  14355. <para>
  14356. To use the ParallelDeflateOutputStream to compress data, create a
  14357. ParallelDeflateOutputStream with CompressionMode.Compress, passing a
  14358. writable output stream. Then call Write() on that
  14359. ParallelDeflateOutputStream, providing uncompressed data as input. The
  14360. data sent to the output stream will be the compressed form of the data
  14361. written.
  14362. </para>
  14363. <para>
  14364. To decompress data, use the <see cref="T:Ionic.Zlib.DeflateStream"/> class.
  14365. </para>
  14366. </remarks>
  14367. <param name="buffer">The buffer holding data to write to the stream.</param>
  14368. <param name="offset">the offset within that data array to find the first byte to write.</param>
  14369. <param name="count">the number of bytes to write.</param>
  14370. </member>
  14371. <member name="M:Ionic.Zlib.ParallelDeflateOutputStream.Flush">
  14372. <summary>
  14373. Flush the stream.
  14374. </summary>
  14375. </member>
  14376. <member name="M:Ionic.Zlib.ParallelDeflateOutputStream.Close">
  14377. <summary>
  14378. Close the stream.
  14379. </summary>
  14380. <remarks>
  14381. You must call Close on the stream to guarantee that all of the data written in has
  14382. been compressed, and the compressed data has been written out.
  14383. </remarks>
  14384. </member>
  14385. <member name="M:Ionic.Zlib.ParallelDeflateOutputStream.Dispose">
  14386. <summary>Dispose the object</summary>
  14387. <remarks>
  14388. <para>
  14389. Because ParallelDeflateOutputStream is IDisposable, the
  14390. application must call this method when finished using the instance.
  14391. </para>
  14392. <para>
  14393. This method is generally called implicitly upon exit from
  14394. a <c>using</c> scope in C# (<c>Using</c> in VB).
  14395. </para>
  14396. </remarks>
  14397. </member>
  14398. <member name="M:Ionic.Zlib.ParallelDeflateOutputStream.Dispose(System.Boolean)">
  14399. <summary>The Dispose method</summary>
  14400. <param name="disposing">
  14401. indicates whether the Dispose method was invoked by user code.
  14402. </param>
  14403. </member>
  14404. <member name="M:Ionic.Zlib.ParallelDeflateOutputStream.Reset(System.IO.Stream)">
  14405. <summary>
  14406. Resets the stream for use with another stream.
  14407. </summary>
  14408. <remarks>
  14409. Because the ParallelDeflateOutputStream is expensive to create, it
  14410. has been designed so that it can be recycled and re-used. You have
  14411. to call Close() on the stream first, then you can call Reset() on
  14412. it, to use it again on another stream.
  14413. </remarks>
  14414. <param name="stream">
  14415. The new output stream for this era.
  14416. </param>
  14417. <example>
  14418. <code>
  14419. ParallelDeflateOutputStream deflater = null;
  14420. foreach (var inputFile in listOfFiles)
  14421. {
  14422. string outputFile = inputFile + ".compressed";
  14423. using (System.IO.Stream input = System.IO.File.OpenRead(inputFile))
  14424. {
  14425. using (var outStream = System.IO.File.Create(outputFile))
  14426. {
  14427. if (deflater == null)
  14428. deflater = new ParallelDeflateOutputStream(outStream,
  14429. CompressionLevel.Best,
  14430. CompressionStrategy.Default,
  14431. true);
  14432. deflater.Reset(outStream);
  14433. while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
  14434. {
  14435. deflater.Write(buffer, 0, n);
  14436. }
  14437. }
  14438. }
  14439. }
  14440. </code>
  14441. </example>
  14442. </member>
  14443. <member name="M:Ionic.Zlib.ParallelDeflateOutputStream.Read(System.Byte[],System.Int32,System.Int32)">
  14444. <summary>
  14445. This method always throws a NotSupportedException.
  14446. </summary>
  14447. <param name="buffer">
  14448. The buffer into which data would be read, IF THIS METHOD
  14449. ACTUALLY DID ANYTHING.
  14450. </param>
  14451. <param name="offset">
  14452. The offset within that data array at which to insert the
  14453. data that is read, IF THIS METHOD ACTUALLY DID
  14454. ANYTHING.
  14455. </param>
  14456. <param name="count">
  14457. The number of bytes to write, IF THIS METHOD ACTUALLY DID
  14458. ANYTHING.
  14459. </param>
  14460. <returns>nothing.</returns>
  14461. </member>
  14462. <member name="M:Ionic.Zlib.ParallelDeflateOutputStream.Seek(System.Int64,System.IO.SeekOrigin)">
  14463. <summary>
  14464. This method always throws a NotSupportedException.
  14465. </summary>
  14466. <param name="offset">
  14467. The offset to seek to....
  14468. IF THIS METHOD ACTUALLY DID ANYTHING.
  14469. </param>
  14470. <param name="origin">
  14471. The reference specifying how to apply the offset.... IF
  14472. THIS METHOD ACTUALLY DID ANYTHING.
  14473. </param>
  14474. <returns>nothing. It always throws.</returns>
  14475. </member>
  14476. <member name="M:Ionic.Zlib.ParallelDeflateOutputStream.SetLength(System.Int64)">
  14477. <summary>
  14478. This method always throws a NotSupportedException.
  14479. </summary>
  14480. <param name="value">
  14481. The new value for the stream length.... IF
  14482. THIS METHOD ACTUALLY DID ANYTHING.
  14483. </param>
  14484. </member>
  14485. <member name="P:Ionic.Zlib.ParallelDeflateOutputStream.Strategy">
  14486. <summary>
  14487. The ZLIB strategy to be used during compression.
  14488. </summary>
  14489. </member>
  14490. <member name="P:Ionic.Zlib.ParallelDeflateOutputStream.MaxBufferPairs">
  14491. <summary>
  14492. The maximum number of buffer pairs to use.
  14493. </summary>
  14494. <remarks>
  14495. <para>
  14496. This property sets an upper limit on the number of memory buffer
  14497. pairs to create. The implementation of this stream allocates
  14498. multiple buffers to facilitate parallel compression. As each buffer
  14499. fills up, this stream uses <see cref="M:System.Threading.ThreadPool.QueueUserWorkItem(System.Threading.WaitCallback)">
  14500. ThreadPool.QueueUserWorkItem()</see>
  14501. to compress those buffers in a background threadpool thread. After a
  14502. buffer is compressed, it is re-ordered and written to the output
  14503. stream.
  14504. </para>
  14505. <para>
  14506. A higher number of buffer pairs enables a higher degree of
  14507. parallelism, which tends to increase the speed of compression on
  14508. multi-cpu computers. On the other hand, a higher number of buffer
  14509. pairs also implies a larger memory consumption, more active worker
  14510. threads, and a higher cpu utilization for any compression. This
  14511. property enables the application to limit its memory consumption and
  14512. CPU utilization behavior depending on requirements.
  14513. </para>
  14514. <para>
  14515. For each compression "task" that occurs in parallel, there are 2
  14516. buffers allocated: one for input and one for output. This property
  14517. sets a limit for the number of pairs. The total amount of storage
  14518. space allocated for buffering will then be (N*S*2), where N is the
  14519. number of buffer pairs, S is the size of each buffer (<see cref="P:Ionic.Zlib.ParallelDeflateOutputStream.BufferSize"/>). By default, DotNetZip allocates 4 buffer
  14520. pairs per CPU core, so if your machine has 4 cores, and you retain
  14521. the default buffer size of 128k, then the
  14522. ParallelDeflateOutputStream will use 4 * 4 * 2 * 128kb of buffer
  14523. memory in total, or 4mb, in blocks of 128kb. If you then set this
  14524. property to 8, then the number will be 8 * 2 * 128kb of buffer
  14525. memory, or 2mb.
  14526. </para>
  14527. <para>
  14528. CPU utilization will also go up with additional buffers, because a
  14529. larger number of buffer pairs allows a larger number of background
  14530. threads to compress in parallel. If you find that parallel
  14531. compression is consuming too much memory or CPU, you can adjust this
  14532. value downward.
  14533. </para>
  14534. <para>
  14535. The default value is 16. Different values may deliver better or
  14536. worse results, depending on your priorities and the dynamic
  14537. performance characteristics of your storage and compute resources.
  14538. </para>
  14539. <para>
  14540. This property is not the number of buffer pairs to use; it is an
  14541. upper limit. An illustration: Suppose you have an application that
  14542. uses the default value of this property (which is 16), and it runs
  14543. on a machine with 2 CPU cores. In that case, DotNetZip will allocate
  14544. 4 buffer pairs per CPU core, for a total of 8 pairs. The upper
  14545. limit specified by this property has no effect.
  14546. </para>
  14547. <para>
  14548. The application can set this value at any time, but it is effective
  14549. only before the first call to Write(), which is when the buffers are
  14550. allocated.
  14551. </para>
  14552. </remarks>
  14553. </member>
  14554. <member name="P:Ionic.Zlib.ParallelDeflateOutputStream.BufferSize">
  14555. <summary>
  14556. The size of the buffers used by the compressor threads.
  14557. </summary>
  14558. <remarks>
  14559. <para>
  14560. The default buffer size is 128k. The application can set this value
  14561. at any time, but it is effective only before the first Write().
  14562. </para>
  14563. <para>
  14564. Larger buffer sizes implies larger memory consumption but allows
  14565. more efficient compression. Using smaller buffer sizes consumes less
  14566. memory but may result in less effective compression. For example,
  14567. using the default buffer size of 128k, the compression delivered is
  14568. within 1% of the compression delivered by the single-threaded <see cref="T:Ionic.Zlib.DeflateStream"/>. On the other hand, using a
  14569. BufferSize of 8k can result in a compressed data stream that is 5%
  14570. larger than that delivered by the single-threaded
  14571. <c>DeflateStream</c>. Excessively small buffer sizes can also cause
  14572. the speed of the ParallelDeflateOutputStream to drop, because of
  14573. larger thread scheduling overhead dealing with many many small
  14574. buffers.
  14575. </para>
  14576. <para>
  14577. The total amount of storage space allocated for buffering will be
  14578. (N*S*2), where N is the number of buffer pairs, and S is the size of
  14579. each buffer (this property). There are 2 buffers used by the
  14580. compressor, one for input and one for output. By default, DotNetZip
  14581. allocates 4 buffer pairs per CPU core, so if your machine has 4
  14582. cores, then the number of buffer pairs used will be 16. If you
  14583. accept the default value of this property, 128k, then the
  14584. ParallelDeflateOutputStream will use 16 * 2 * 128kb of buffer memory
  14585. in total, or 4mb, in blocks of 128kb. If you set this property to
  14586. 64kb, then the number will be 16 * 2 * 64kb of buffer memory, or
  14587. 2mb.
  14588. </para>
  14589. </remarks>
  14590. </member>
  14591. <member name="P:Ionic.Zlib.ParallelDeflateOutputStream.Crc32">
  14592. <summary>
  14593. The CRC32 for the data that was written out, prior to compression.
  14594. </summary>
  14595. <remarks>
  14596. This value is meaningful only after a call to Close().
  14597. </remarks>
  14598. </member>
  14599. <member name="P:Ionic.Zlib.ParallelDeflateOutputStream.BytesProcessed">
  14600. <summary>
  14601. The total number of uncompressed bytes processed by the ParallelDeflateOutputStream.
  14602. </summary>
  14603. <remarks>
  14604. This value is meaningful only after a call to Close().
  14605. </remarks>
  14606. </member>
  14607. <member name="P:Ionic.Zlib.ParallelDeflateOutputStream.CanSeek">
  14608. <summary>
  14609. Indicates whether the stream supports Seek operations.
  14610. </summary>
  14611. <remarks>
  14612. Always returns false.
  14613. </remarks>
  14614. </member>
  14615. <member name="P:Ionic.Zlib.ParallelDeflateOutputStream.CanRead">
  14616. <summary>
  14617. Indicates whether the stream supports Read operations.
  14618. </summary>
  14619. <remarks>
  14620. Always returns false.
  14621. </remarks>
  14622. </member>
  14623. <member name="P:Ionic.Zlib.ParallelDeflateOutputStream.CanWrite">
  14624. <summary>
  14625. Indicates whether the stream supports Write operations.
  14626. </summary>
  14627. <remarks>
  14628. Returns true if the provided stream is writable.
  14629. </remarks>
  14630. </member>
  14631. <member name="P:Ionic.Zlib.ParallelDeflateOutputStream.Length">
  14632. <summary>
  14633. Reading this property always throws a NotSupportedException.
  14634. </summary>
  14635. </member>
  14636. <member name="P:Ionic.Zlib.ParallelDeflateOutputStream.Position">
  14637. <summary>
  14638. Returns the current position of the output stream.
  14639. </summary>
  14640. <remarks>
  14641. <para>
  14642. Because the output gets written by a background thread,
  14643. the value may change asynchronously. Setting this
  14644. property always throws a NotSupportedException.
  14645. </para>
  14646. </remarks>
  14647. </member>
  14648. <member name="M:Ionic.Zlib.Tree.DistanceCode(System.Int32)">
  14649. <summary>
  14650. Map from a distance to a distance code.
  14651. </summary>
  14652. <remarks>
  14653. No side effects. _dist_code[256] and _dist_code[257] are never used.
  14654. </remarks>
  14655. </member>
  14656. <member name="T:Ionic.Zlib.FlushType">
  14657. <summary>
  14658. Describes how to flush the current deflate operation.
  14659. </summary>
  14660. <remarks>
  14661. The different FlushType values are useful when using a Deflate in a streaming application.
  14662. </remarks>
  14663. </member>
  14664. <member name="F:Ionic.Zlib.FlushType.None">
  14665. <summary>No flush at all.</summary>
  14666. </member>
  14667. <member name="F:Ionic.Zlib.FlushType.Partial">
  14668. <summary>Closes the current block, but doesn't flush it to
  14669. the output. Used internally only in hypothetical
  14670. scenarios. This was supposed to be removed by Zlib, but it is
  14671. still in use in some edge cases.
  14672. </summary>
  14673. </member>
  14674. <member name="F:Ionic.Zlib.FlushType.Sync">
  14675. <summary>
  14676. Use this during compression to specify that all pending output should be
  14677. flushed to the output buffer and the output should be aligned on a byte
  14678. boundary. You might use this in a streaming communication scenario, so that
  14679. the decompressor can get all input data available so far. When using this
  14680. with a ZlibCodec, <c>AvailableBytesIn</c> will be zero after the call if
  14681. enough output space has been provided before the call. Flushing will
  14682. degrade compression and so it should be used only when necessary.
  14683. </summary>
  14684. </member>
  14685. <member name="F:Ionic.Zlib.FlushType.Full">
  14686. <summary>
  14687. Use this during compression to specify that all output should be flushed, as
  14688. with <c>FlushType.Sync</c>, but also, the compression state should be reset
  14689. so that decompression can restart from this point if previous compressed
  14690. data has been damaged or if random access is desired. Using
  14691. <c>FlushType.Full</c> too often can significantly degrade the compression.
  14692. </summary>
  14693. </member>
  14694. <member name="F:Ionic.Zlib.FlushType.Finish">
  14695. <summary>Signals the end of the compression/decompression stream.</summary>
  14696. </member>
  14697. <member name="T:Ionic.Zlib.CompressionLevel">
  14698. <summary>
  14699. The compression level to be used when using a DeflateStream or ZlibStream with CompressionMode.Compress.
  14700. </summary>
  14701. </member>
  14702. <member name="F:Ionic.Zlib.CompressionLevel.None">
  14703. <summary>
  14704. None means that the data will be simply stored, with no change at all.
  14705. If you are producing ZIPs for use on Mac OSX, be aware that archives produced with CompressionLevel.None
  14706. cannot be opened with the default zip reader. Use a different CompressionLevel.
  14707. </summary>
  14708. </member>
  14709. <member name="F:Ionic.Zlib.CompressionLevel.Level0">
  14710. <summary>
  14711. Same as None.
  14712. </summary>
  14713. </member>
  14714. <member name="F:Ionic.Zlib.CompressionLevel.BestSpeed">
  14715. <summary>
  14716. The fastest but least effective compression.
  14717. </summary>
  14718. </member>
  14719. <member name="F:Ionic.Zlib.CompressionLevel.Level1">
  14720. <summary>
  14721. A synonym for BestSpeed.
  14722. </summary>
  14723. </member>
  14724. <member name="F:Ionic.Zlib.CompressionLevel.Level2">
  14725. <summary>
  14726. A little slower, but better, than level 1.
  14727. </summary>
  14728. </member>
  14729. <member name="F:Ionic.Zlib.CompressionLevel.Level3">
  14730. <summary>
  14731. A little slower, but better, than level 2.
  14732. </summary>
  14733. </member>
  14734. <member name="F:Ionic.Zlib.CompressionLevel.Level4">
  14735. <summary>
  14736. A little slower, but better, than level 3.
  14737. </summary>
  14738. </member>
  14739. <member name="F:Ionic.Zlib.CompressionLevel.Level5">
  14740. <summary>
  14741. A little slower than level 4, but with better compression.
  14742. </summary>
  14743. </member>
  14744. <member name="F:Ionic.Zlib.CompressionLevel.Default">
  14745. <summary>
  14746. The default compression level, with a good balance of speed and compression efficiency.
  14747. </summary>
  14748. </member>
  14749. <member name="F:Ionic.Zlib.CompressionLevel.Level6">
  14750. <summary>
  14751. A synonym for Default.
  14752. </summary>
  14753. </member>
  14754. <member name="F:Ionic.Zlib.CompressionLevel.Level7">
  14755. <summary>
  14756. Pretty good compression!
  14757. </summary>
  14758. </member>
  14759. <member name="F:Ionic.Zlib.CompressionLevel.Level8">
  14760. <summary>
  14761. Better compression than Level7!
  14762. </summary>
  14763. </member>
  14764. <member name="F:Ionic.Zlib.CompressionLevel.BestCompression">
  14765. <summary>
  14766. The "best" compression, where best means greatest reduction in size of the input data stream.
  14767. This is also the slowest compression.
  14768. </summary>
  14769. </member>
  14770. <member name="F:Ionic.Zlib.CompressionLevel.Level9">
  14771. <summary>
  14772. A synonym for BestCompression.
  14773. </summary>
  14774. </member>
  14775. <member name="T:Ionic.Zlib.CompressionStrategy">
  14776. <summary>
  14777. Describes options for how the compression algorithm is executed. Different strategies
  14778. work better on different sorts of data. The strategy parameter can affect the compression
  14779. ratio and the speed of compression but not the correctness of the compresssion.
  14780. </summary>
  14781. </member>
  14782. <member name="F:Ionic.Zlib.CompressionStrategy.Default">
  14783. <summary>
  14784. The default strategy is probably the best for normal data.
  14785. </summary>
  14786. </member>
  14787. <member name="F:Ionic.Zlib.CompressionStrategy.Filtered">
  14788. <summary>
  14789. The <c>Filtered</c> strategy is intended to be used most effectively with data produced by a
  14790. filter or predictor. By this definition, filtered data consists mostly of small
  14791. values with a somewhat random distribution. In this case, the compression algorithm
  14792. is tuned to compress them better. The effect of <c>Filtered</c> is to force more Huffman
  14793. coding and less string matching; it is a half-step between <c>Default</c> and <c>HuffmanOnly</c>.
  14794. </summary>
  14795. </member>
  14796. <member name="F:Ionic.Zlib.CompressionStrategy.HuffmanOnly">
  14797. <summary>
  14798. Using <c>HuffmanOnly</c> will force the compressor to do Huffman encoding only, with no
  14799. string matching.
  14800. </summary>
  14801. </member>
  14802. <member name="T:Ionic.Zlib.CompressionMode">
  14803. <summary>
  14804. An enum to specify the direction of transcoding - whether to compress or decompress.
  14805. </summary>
  14806. </member>
  14807. <member name="F:Ionic.Zlib.CompressionMode.Compress">
  14808. <summary>
  14809. Used to specify that the stream should compress the data.
  14810. </summary>
  14811. </member>
  14812. <member name="F:Ionic.Zlib.CompressionMode.Decompress">
  14813. <summary>
  14814. Used to specify that the stream should decompress the data.
  14815. </summary>
  14816. </member>
  14817. <member name="T:Ionic.Zlib.ZlibException">
  14818. <summary>
  14819. A general purpose exception class for exceptions in the Zlib library.
  14820. </summary>
  14821. </member>
  14822. <member name="M:Ionic.Zlib.ZlibException.#ctor">
  14823. <summary>
  14824. The ZlibException class captures exception information generated
  14825. by the Zlib library.
  14826. </summary>
  14827. </member>
  14828. <member name="M:Ionic.Zlib.ZlibException.#ctor(System.String)">
  14829. <summary>
  14830. This ctor collects a message attached to the exception.
  14831. </summary>
  14832. <param name="s">the message for the exception.</param>
  14833. </member>
  14834. <member name="M:Ionic.Zlib.SharedUtils.URShift(System.Int32,System.Int32)">
  14835. <summary>
  14836. Performs an unsigned bitwise right shift with the specified number
  14837. </summary>
  14838. <param name="number">Number to operate on</param>
  14839. <param name="bits">Ammount of bits to shift</param>
  14840. <returns>The resulting number from the shift operation</returns>
  14841. </member>
  14842. <member name="M:Ionic.Zlib.SharedUtils.ReadInput(System.IO.TextReader,System.Byte[],System.Int32,System.Int32)">
  14843. <summary>
  14844. Reads a number of characters from the current source TextReader and writes
  14845. the data to the target array at the specified index.
  14846. </summary>
  14847. <param name="sourceTextReader">The source TextReader to read from</param>
  14848. <param name="target">Contains the array of characteres read from the source TextReader.</param>
  14849. <param name="start">The starting index of the target array.</param>
  14850. <param name="count">The maximum number of characters to read from the source TextReader.</param>
  14851. <returns>
  14852. The number of characters read. The number will be less than or equal to
  14853. count depending on the data available in the source TextReader. Returns -1
  14854. if the end of the stream is reached.
  14855. </returns>
  14856. </member>
  14857. <member name="T:Ionic.Zlib.Adler">
  14858. <summary>
  14859. Computes an Adler-32 checksum.
  14860. </summary>
  14861. <remarks>
  14862. The Adler checksum is similar to a CRC checksum, but faster to compute, though less
  14863. reliable. It is used in producing RFC1950 compressed streams. The Adler checksum
  14864. is a required part of the "ZLIB" standard. Applications will almost never need to
  14865. use this class directly.
  14866. </remarks>
  14867. <exclude/>
  14868. </member>
  14869. <member name="M:Ionic.Zlib.Adler.Adler32(System.UInt32,System.Byte[],System.Int32,System.Int32)">
  14870. <summary>
  14871. Calculates the Adler32 checksum.
  14872. </summary>
  14873. <remarks>
  14874. <para>
  14875. This is used within ZLIB. You probably don't need to use this directly.
  14876. </para>
  14877. </remarks>
  14878. <example>
  14879. To compute an Adler32 checksum on a byte array:
  14880. <code>
  14881. var adler = Adler.Adler32(0, null, 0, 0);
  14882. adler = Adler.Adler32(adler, buffer, index, length);
  14883. </code>
  14884. </example>
  14885. </member>
  14886. <member name="T:Ionic.Zlib.ZlibCodec">
  14887. <summary>
  14888. Encoder and Decoder for ZLIB and DEFLATE (IETF RFC1950 and RFC1951).
  14889. </summary>
  14890. <remarks>
  14891. This class compresses and decompresses data according to the Deflate algorithm
  14892. and optionally, the ZLIB format, as documented in <see
  14893. href="http://www.ietf.org/rfc/rfc1950.txt">RFC 1950 - ZLIB</see> and <see
  14894. href="http://www.ietf.org/rfc/rfc1951.txt">RFC 1951 - DEFLATE</see>.
  14895. </remarks>
  14896. </member>
  14897. <member name="F:Ionic.Zlib.ZlibCodec.InputBuffer">
  14898. <summary>
  14899. The buffer from which data is taken.
  14900. </summary>
  14901. </member>
  14902. <member name="F:Ionic.Zlib.ZlibCodec.NextIn">
  14903. <summary>
  14904. An index into the InputBuffer array, indicating where to start reading.
  14905. </summary>
  14906. </member>
  14907. <member name="F:Ionic.Zlib.ZlibCodec.AvailableBytesIn">
  14908. <summary>
  14909. The number of bytes available in the InputBuffer, starting at NextIn.
  14910. </summary>
  14911. <remarks>
  14912. Generally you should set this to InputBuffer.Length before the first Inflate() or Deflate() call.
  14913. The class will update this number as calls to Inflate/Deflate are made.
  14914. </remarks>
  14915. </member>
  14916. <member name="F:Ionic.Zlib.ZlibCodec.TotalBytesIn">
  14917. <summary>
  14918. Total number of bytes read so far, through all calls to Inflate()/Deflate().
  14919. </summary>
  14920. </member>
  14921. <member name="F:Ionic.Zlib.ZlibCodec.OutputBuffer">
  14922. <summary>
  14923. Buffer to store output data.
  14924. </summary>
  14925. </member>
  14926. <member name="F:Ionic.Zlib.ZlibCodec.NextOut">
  14927. <summary>
  14928. An index into the OutputBuffer array, indicating where to start writing.
  14929. </summary>
  14930. </member>
  14931. <member name="F:Ionic.Zlib.ZlibCodec.AvailableBytesOut">
  14932. <summary>
  14933. The number of bytes available in the OutputBuffer, starting at NextOut.
  14934. </summary>
  14935. <remarks>
  14936. Generally you should set this to OutputBuffer.Length before the first Inflate() or Deflate() call.
  14937. The class will update this number as calls to Inflate/Deflate are made.
  14938. </remarks>
  14939. </member>
  14940. <member name="F:Ionic.Zlib.ZlibCodec.TotalBytesOut">
  14941. <summary>
  14942. Total number of bytes written to the output so far, through all calls to Inflate()/Deflate().
  14943. </summary>
  14944. </member>
  14945. <member name="F:Ionic.Zlib.ZlibCodec.Message">
  14946. <summary>
  14947. used for diagnostics, when something goes wrong!
  14948. </summary>
  14949. </member>
  14950. <member name="F:Ionic.Zlib.ZlibCodec.CompressLevel">
  14951. <summary>
  14952. The compression level to use in this codec. Useful only in compression mode.
  14953. </summary>
  14954. </member>
  14955. <member name="F:Ionic.Zlib.ZlibCodec.WindowBits">
  14956. <summary>
  14957. The number of Window Bits to use.
  14958. </summary>
  14959. <remarks>
  14960. This gauges the size of the sliding window, and hence the
  14961. compression effectiveness as well as memory consumption. It's best to just leave this
  14962. setting alone if you don't know what it is. The maximum value is 15 bits, which implies
  14963. a 32k window.
  14964. </remarks>
  14965. </member>
  14966. <member name="F:Ionic.Zlib.ZlibCodec.Strategy">
  14967. <summary>
  14968. The compression strategy to use.
  14969. </summary>
  14970. <remarks>
  14971. This is only effective in compression. The theory offered by ZLIB is that different
  14972. strategies could potentially produce significant differences in compression behavior
  14973. for different data sets. Unfortunately I don't have any good recommendations for how
  14974. to set it differently. When I tested changing the strategy I got minimally different
  14975. compression performance. It's best to leave this property alone if you don't have a
  14976. good feel for it. Or, you may want to produce a test harness that runs through the
  14977. different strategy options and evaluates them on different file types. If you do that,
  14978. let me know your results.
  14979. </remarks>
  14980. </member>
  14981. <member name="M:Ionic.Zlib.ZlibCodec.#ctor">
  14982. <summary>
  14983. Create a ZlibCodec.
  14984. </summary>
  14985. <remarks>
  14986. If you use this default constructor, you will later have to explicitly call
  14987. InitializeInflate() or InitializeDeflate() before using the ZlibCodec to compress
  14988. or decompress.
  14989. </remarks>
  14990. </member>
  14991. <member name="M:Ionic.Zlib.ZlibCodec.#ctor(Ionic.Zlib.CompressionMode)">
  14992. <summary>
  14993. Create a ZlibCodec that either compresses or decompresses.
  14994. </summary>
  14995. <param name="mode">
  14996. Indicates whether the codec should compress (deflate) or decompress (inflate).
  14997. </param>
  14998. </member>
  14999. <member name="M:Ionic.Zlib.ZlibCodec.InitializeInflate">
  15000. <summary>
  15001. Initialize the inflation state.
  15002. </summary>
  15003. <remarks>
  15004. It is not necessary to call this before using the ZlibCodec to inflate data;
  15005. It is implicitly called when you call the constructor.
  15006. </remarks>
  15007. <returns>Z_OK if everything goes well.</returns>
  15008. </member>
  15009. <member name="M:Ionic.Zlib.ZlibCodec.InitializeInflate(System.Boolean)">
  15010. <summary>
  15011. Initialize the inflation state with an explicit flag to
  15012. govern the handling of RFC1950 header bytes.
  15013. </summary>
  15014. <remarks>
  15015. By default, the ZLIB header defined in <see
  15016. href="http://www.ietf.org/rfc/rfc1950.txt">RFC 1950</see> is expected. If
  15017. you want to read a zlib stream you should specify true for
  15018. expectRfc1950Header. If you have a deflate stream, you will want to specify
  15019. false. It is only necessary to invoke this initializer explicitly if you
  15020. want to specify false.
  15021. </remarks>
  15022. <param name="expectRfc1950Header">whether to expect an RFC1950 header byte
  15023. pair when reading the stream of data to be inflated.</param>
  15024. <returns>Z_OK if everything goes well.</returns>
  15025. </member>
  15026. <member name="M:Ionic.Zlib.ZlibCodec.InitializeInflate(System.Int32)">
  15027. <summary>
  15028. Initialize the ZlibCodec for inflation, with the specified number of window bits.
  15029. </summary>
  15030. <param name="windowBits">The number of window bits to use. If you need to ask what that is,
  15031. then you shouldn't be calling this initializer.</param>
  15032. <returns>Z_OK if all goes well.</returns>
  15033. </member>
  15034. <member name="M:Ionic.Zlib.ZlibCodec.InitializeInflate(System.Int32,System.Boolean)">
  15035. <summary>
  15036. Initialize the inflation state with an explicit flag to govern the handling of
  15037. RFC1950 header bytes.
  15038. </summary>
  15039. <remarks>
  15040. If you want to read a zlib stream you should specify true for
  15041. expectRfc1950Header. In this case, the library will expect to find a ZLIB
  15042. header, as defined in <see href="http://www.ietf.org/rfc/rfc1950.txt">RFC
  15043. 1950</see>, in the compressed stream. If you will be reading a DEFLATE or
  15044. GZIP stream, which does not have such a header, you will want to specify
  15045. false.
  15046. </remarks>
  15047. <param name="expectRfc1950Header">whether to expect an RFC1950 header byte pair when reading
  15048. the stream of data to be inflated.</param>
  15049. <param name="windowBits">The number of window bits to use. If you need to ask what that is,
  15050. then you shouldn't be calling this initializer.</param>
  15051. <returns>Z_OK if everything goes well.</returns>
  15052. </member>
  15053. <member name="M:Ionic.Zlib.ZlibCodec.Inflate(Ionic.Zlib.FlushType)">
  15054. <summary>
  15055. Inflate the data in the InputBuffer, placing the result in the OutputBuffer.
  15056. </summary>
  15057. <remarks>
  15058. You must have set InputBuffer and OutputBuffer, NextIn and NextOut, and AvailableBytesIn and
  15059. AvailableBytesOut before calling this method.
  15060. </remarks>
  15061. <example>
  15062. <code>
  15063. private void InflateBuffer()
  15064. {
  15065. int bufferSize = 1024;
  15066. byte[] buffer = new byte[bufferSize];
  15067. ZlibCodec decompressor = new ZlibCodec();
  15068. Console.WriteLine("\n============================================");
  15069. Console.WriteLine("Size of Buffer to Inflate: {0} bytes.", CompressedBytes.Length);
  15070. MemoryStream ms = new MemoryStream(DecompressedBytes);
  15071. int rc = decompressor.InitializeInflate();
  15072. decompressor.InputBuffer = CompressedBytes;
  15073. decompressor.NextIn = 0;
  15074. decompressor.AvailableBytesIn = CompressedBytes.Length;
  15075. decompressor.OutputBuffer = buffer;
  15076. // pass 1: inflate
  15077. do
  15078. {
  15079. decompressor.NextOut = 0;
  15080. decompressor.AvailableBytesOut = buffer.Length;
  15081. rc = decompressor.Inflate(FlushType.None);
  15082. if (rc != ZlibConstants.Z_OK &amp;&amp; rc != ZlibConstants.Z_STREAM_END)
  15083. throw new Exception("inflating: " + decompressor.Message);
  15084. ms.Write(decompressor.OutputBuffer, 0, buffer.Length - decompressor.AvailableBytesOut);
  15085. }
  15086. while (decompressor.AvailableBytesIn &gt; 0 || decompressor.AvailableBytesOut == 0);
  15087. // pass 2: finish and flush
  15088. do
  15089. {
  15090. decompressor.NextOut = 0;
  15091. decompressor.AvailableBytesOut = buffer.Length;
  15092. rc = decompressor.Inflate(FlushType.Finish);
  15093. if (rc != ZlibConstants.Z_STREAM_END &amp;&amp; rc != ZlibConstants.Z_OK)
  15094. throw new Exception("inflating: " + decompressor.Message);
  15095. if (buffer.Length - decompressor.AvailableBytesOut &gt; 0)
  15096. ms.Write(buffer, 0, buffer.Length - decompressor.AvailableBytesOut);
  15097. }
  15098. while (decompressor.AvailableBytesIn &gt; 0 || decompressor.AvailableBytesOut == 0);
  15099. decompressor.EndInflate();
  15100. }
  15101. </code>
  15102. </example>
  15103. <param name="flush">The flush to use when inflating.</param>
  15104. <returns>Z_OK if everything goes well.</returns>
  15105. </member>
  15106. <member name="M:Ionic.Zlib.ZlibCodec.EndInflate">
  15107. <summary>
  15108. Ends an inflation session.
  15109. </summary>
  15110. <remarks>
  15111. Call this after successively calling Inflate(). This will cause all buffers to be flushed.
  15112. After calling this you cannot call Inflate() without a intervening call to one of the
  15113. InitializeInflate() overloads.
  15114. </remarks>
  15115. <returns>Z_OK if everything goes well.</returns>
  15116. </member>
  15117. <member name="M:Ionic.Zlib.ZlibCodec.SyncInflate">
  15118. <summary>
  15119. I don't know what this does!
  15120. </summary>
  15121. <returns>Z_OK if everything goes well.</returns>
  15122. </member>
  15123. <member name="M:Ionic.Zlib.ZlibCodec.InitializeDeflate">
  15124. <summary>
  15125. Initialize the ZlibCodec for deflation operation.
  15126. </summary>
  15127. <remarks>
  15128. The codec will use the MAX window bits and the default level of compression.
  15129. </remarks>
  15130. <example>
  15131. <code>
  15132. int bufferSize = 40000;
  15133. byte[] CompressedBytes = new byte[bufferSize];
  15134. byte[] DecompressedBytes = new byte[bufferSize];
  15135. ZlibCodec compressor = new ZlibCodec();
  15136. compressor.InitializeDeflate(CompressionLevel.Default);
  15137. compressor.InputBuffer = System.Text.ASCIIEncoding.ASCII.GetBytes(TextToCompress);
  15138. compressor.NextIn = 0;
  15139. compressor.AvailableBytesIn = compressor.InputBuffer.Length;
  15140. compressor.OutputBuffer = CompressedBytes;
  15141. compressor.NextOut = 0;
  15142. compressor.AvailableBytesOut = CompressedBytes.Length;
  15143. while (compressor.TotalBytesIn != TextToCompress.Length &amp;&amp; compressor.TotalBytesOut &lt; bufferSize)
  15144. {
  15145. compressor.Deflate(FlushType.None);
  15146. }
  15147. while (true)
  15148. {
  15149. int rc= compressor.Deflate(FlushType.Finish);
  15150. if (rc == ZlibConstants.Z_STREAM_END) break;
  15151. }
  15152. compressor.EndDeflate();
  15153. </code>
  15154. </example>
  15155. <returns>Z_OK if all goes well. You generally don't need to check the return code.</returns>
  15156. </member>
  15157. <member name="M:Ionic.Zlib.ZlibCodec.InitializeDeflate(Ionic.Zlib.CompressionLevel)">
  15158. <summary>
  15159. Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel.
  15160. </summary>
  15161. <remarks>
  15162. The codec will use the maximum window bits (15) and the specified
  15163. CompressionLevel. It will emit a ZLIB stream as it compresses.
  15164. </remarks>
  15165. <param name="level">The compression level for the codec.</param>
  15166. <returns>Z_OK if all goes well.</returns>
  15167. </member>
  15168. <member name="M:Ionic.Zlib.ZlibCodec.InitializeDeflate(Ionic.Zlib.CompressionLevel,System.Boolean)">
  15169. <summary>
  15170. Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel,
  15171. and the explicit flag governing whether to emit an RFC1950 header byte pair.
  15172. </summary>
  15173. <remarks>
  15174. The codec will use the maximum window bits (15) and the specified CompressionLevel.
  15175. If you want to generate a zlib stream, you should specify true for
  15176. wantRfc1950Header. In this case, the library will emit a ZLIB
  15177. header, as defined in <see href="http://www.ietf.org/rfc/rfc1950.txt">RFC
  15178. 1950</see>, in the compressed stream.
  15179. </remarks>
  15180. <param name="level">The compression level for the codec.</param>
  15181. <param name="wantRfc1950Header">whether to emit an initial RFC1950 byte pair in the compressed stream.</param>
  15182. <returns>Z_OK if all goes well.</returns>
  15183. </member>
  15184. <member name="M:Ionic.Zlib.ZlibCodec.InitializeDeflate(Ionic.Zlib.CompressionLevel,System.Int32)">
  15185. <summary>
  15186. Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel,
  15187. and the specified number of window bits.
  15188. </summary>
  15189. <remarks>
  15190. The codec will use the specified number of window bits and the specified CompressionLevel.
  15191. </remarks>
  15192. <param name="level">The compression level for the codec.</param>
  15193. <param name="bits">the number of window bits to use. If you don't know what this means, don't use this method.</param>
  15194. <returns>Z_OK if all goes well.</returns>
  15195. </member>
  15196. <member name="M:Ionic.Zlib.ZlibCodec.InitializeDeflate(Ionic.Zlib.CompressionLevel,System.Int32,System.Boolean)">
  15197. <summary>
  15198. Initialize the ZlibCodec for deflation operation, using the specified
  15199. CompressionLevel, the specified number of window bits, and the explicit flag
  15200. governing whether to emit an RFC1950 header byte pair.
  15201. </summary>
  15202. <param name="level">The compression level for the codec.</param>
  15203. <param name="wantRfc1950Header">whether to emit an initial RFC1950 byte pair in the compressed stream.</param>
  15204. <param name="bits">the number of window bits to use. If you don't know what this means, don't use this method.</param>
  15205. <returns>Z_OK if all goes well.</returns>
  15206. </member>
  15207. <member name="M:Ionic.Zlib.ZlibCodec.Deflate(Ionic.Zlib.FlushType)">
  15208. <summary>
  15209. Deflate one batch of data.
  15210. </summary>
  15211. <remarks>
  15212. You must have set InputBuffer and OutputBuffer before calling this method.
  15213. </remarks>
  15214. <example>
  15215. <code>
  15216. private void DeflateBuffer(CompressionLevel level)
  15217. {
  15218. int bufferSize = 1024;
  15219. byte[] buffer = new byte[bufferSize];
  15220. ZlibCodec compressor = new ZlibCodec();
  15221. Console.WriteLine("\n============================================");
  15222. Console.WriteLine("Size of Buffer to Deflate: {0} bytes.", UncompressedBytes.Length);
  15223. MemoryStream ms = new MemoryStream();
  15224. int rc = compressor.InitializeDeflate(level);
  15225. compressor.InputBuffer = UncompressedBytes;
  15226. compressor.NextIn = 0;
  15227. compressor.AvailableBytesIn = UncompressedBytes.Length;
  15228. compressor.OutputBuffer = buffer;
  15229. // pass 1: deflate
  15230. do
  15231. {
  15232. compressor.NextOut = 0;
  15233. compressor.AvailableBytesOut = buffer.Length;
  15234. rc = compressor.Deflate(FlushType.None);
  15235. if (rc != ZlibConstants.Z_OK &amp;&amp; rc != ZlibConstants.Z_STREAM_END)
  15236. throw new Exception("deflating: " + compressor.Message);
  15237. ms.Write(compressor.OutputBuffer, 0, buffer.Length - compressor.AvailableBytesOut);
  15238. }
  15239. while (compressor.AvailableBytesIn &gt; 0 || compressor.AvailableBytesOut == 0);
  15240. // pass 2: finish and flush
  15241. do
  15242. {
  15243. compressor.NextOut = 0;
  15244. compressor.AvailableBytesOut = buffer.Length;
  15245. rc = compressor.Deflate(FlushType.Finish);
  15246. if (rc != ZlibConstants.Z_STREAM_END &amp;&amp; rc != ZlibConstants.Z_OK)
  15247. throw new Exception("deflating: " + compressor.Message);
  15248. if (buffer.Length - compressor.AvailableBytesOut &gt; 0)
  15249. ms.Write(buffer, 0, buffer.Length - compressor.AvailableBytesOut);
  15250. }
  15251. while (compressor.AvailableBytesIn &gt; 0 || compressor.AvailableBytesOut == 0);
  15252. compressor.EndDeflate();
  15253. ms.Seek(0, SeekOrigin.Begin);
  15254. CompressedBytes = new byte[compressor.TotalBytesOut];
  15255. ms.Read(CompressedBytes, 0, CompressedBytes.Length);
  15256. }
  15257. </code>
  15258. </example>
  15259. <param name="flush">whether to flush all data as you deflate. Generally you will want to
  15260. use Z_NO_FLUSH here, in a series of calls to Deflate(), and then call EndDeflate() to
  15261. flush everything.
  15262. </param>
  15263. <returns>Z_OK if all goes well.</returns>
  15264. </member>
  15265. <member name="M:Ionic.Zlib.ZlibCodec.EndDeflate">
  15266. <summary>
  15267. End a deflation session.
  15268. </summary>
  15269. <remarks>
  15270. Call this after making a series of one or more calls to Deflate(). All buffers are flushed.
  15271. </remarks>
  15272. <returns>Z_OK if all goes well.</returns>
  15273. </member>
  15274. <member name="M:Ionic.Zlib.ZlibCodec.ResetDeflate">
  15275. <summary>
  15276. Reset a codec for another deflation session.
  15277. </summary>
  15278. <remarks>
  15279. Call this to reset the deflation state. For example if a thread is deflating
  15280. non-consecutive blocks, you can call Reset() after the Deflate(Sync) of the first
  15281. block and before the next Deflate(None) of the second block.
  15282. </remarks>
  15283. <returns>Z_OK if all goes well.</returns>
  15284. </member>
  15285. <member name="M:Ionic.Zlib.ZlibCodec.SetDeflateParams(Ionic.Zlib.CompressionLevel,Ionic.Zlib.CompressionStrategy)">
  15286. <summary>
  15287. Set the CompressionStrategy and CompressionLevel for a deflation session.
  15288. </summary>
  15289. <param name="level">the level of compression to use.</param>
  15290. <param name="strategy">the strategy to use for compression.</param>
  15291. <returns>Z_OK if all goes well.</returns>
  15292. </member>
  15293. <member name="M:Ionic.Zlib.ZlibCodec.SetDictionary(System.Byte[])">
  15294. <summary>
  15295. Set the dictionary to be used for either Inflation or Deflation.
  15296. </summary>
  15297. <param name="dictionary">The dictionary bytes to use.</param>
  15298. <returns>Z_OK if all goes well.</returns>
  15299. </member>
  15300. <member name="P:Ionic.Zlib.ZlibCodec.Adler32">
  15301. <summary>
  15302. The Adler32 checksum on the data transferred through the codec so far. You probably don't need to look at this.
  15303. </summary>
  15304. </member>
  15305. <member name="T:Ionic.Zlib.ZlibConstants">
  15306. <summary>
  15307. A bunch of constants used in the Zlib interface.
  15308. </summary>
  15309. </member>
  15310. <member name="F:Ionic.Zlib.ZlibConstants.WindowBitsMax">
  15311. <summary>
  15312. The maximum number of window bits for the Deflate algorithm.
  15313. </summary>
  15314. </member>
  15315. <member name="F:Ionic.Zlib.ZlibConstants.WindowBitsDefault">
  15316. <summary>
  15317. The default number of window bits for the Deflate algorithm.
  15318. </summary>
  15319. </member>
  15320. <member name="F:Ionic.Zlib.ZlibConstants.Z_OK">
  15321. <summary>
  15322. indicates everything is A-OK
  15323. </summary>
  15324. </member>
  15325. <member name="F:Ionic.Zlib.ZlibConstants.Z_STREAM_END">
  15326. <summary>
  15327. Indicates that the last operation reached the end of the stream.
  15328. </summary>
  15329. </member>
  15330. <member name="F:Ionic.Zlib.ZlibConstants.Z_NEED_DICT">
  15331. <summary>
  15332. The operation ended in need of a dictionary.
  15333. </summary>
  15334. </member>
  15335. <member name="F:Ionic.Zlib.ZlibConstants.Z_STREAM_ERROR">
  15336. <summary>
  15337. There was an error with the stream - not enough data, not open and readable, etc.
  15338. </summary>
  15339. </member>
  15340. <member name="F:Ionic.Zlib.ZlibConstants.Z_DATA_ERROR">
  15341. <summary>
  15342. There was an error with the data - not enough data, bad data, etc.
  15343. </summary>
  15344. </member>
  15345. <member name="F:Ionic.Zlib.ZlibConstants.Z_BUF_ERROR">
  15346. <summary>
  15347. There was an error with the working buffer.
  15348. </summary>
  15349. </member>
  15350. <member name="F:Ionic.Zlib.ZlibConstants.WorkingBufferSizeDefault">
  15351. <summary>
  15352. The size of the working buffer used in the ZlibCodec class. Defaults to 8192 bytes.
  15353. </summary>
  15354. </member>
  15355. <member name="F:Ionic.Zlib.ZlibConstants.WorkingBufferSizeMin">
  15356. <summary>
  15357. The minimum size of the working buffer used in the ZlibCodec class. Currently it is 128 bytes.
  15358. </summary>
  15359. </member>
  15360. <member name="T:Ionic.Zlib.ZlibStream">
  15361. <summary>
  15362. Represents a Zlib stream for compression or decompression.
  15363. </summary>
  15364. <remarks>
  15365. <para>
  15366. The ZlibStream is a <see href="http://en.wikipedia.org/wiki/Decorator_pattern">Decorator</see> on a <see cref="T:System.IO.Stream"/>. It adds ZLIB compression or decompression to any
  15367. stream.
  15368. </para>
  15369. <para> Using this stream, applications can compress or decompress data via
  15370. stream <c>Read()</c> and <c>Write()</c> operations. Either compresssion or
  15371. decompression can occur through either reading or writing. The compression
  15372. format used is ZLIB, which is documented in <see href="http://www.ietf.org/rfc/rfc1950.txt">IETF RFC 1950</see>, "ZLIB Compressed
  15373. Data Format Specification version 3.3". This implementation of ZLIB always uses
  15374. DEFLATE as the compression method. (see <see href="http://www.ietf.org/rfc/rfc1951.txt">IETF RFC 1951</see>, "DEFLATE
  15375. Compressed Data Format Specification version 1.3.") </para>
  15376. <para>
  15377. The ZLIB format allows for varying compression methods, window sizes, and dictionaries.
  15378. This implementation always uses the DEFLATE compression method, a preset dictionary,
  15379. and 15 window bits by default.
  15380. </para>
  15381. <para>
  15382. This class is similar to <see cref="T:Ionic.Zlib.DeflateStream"/>, except that it adds the
  15383. RFC1950 header and trailer bytes to a compressed stream when compressing, or expects
  15384. the RFC1950 header and trailer bytes when decompressing. It is also similar to the
  15385. <see cref="T:Ionic.Zlib.GZipStream"/>.
  15386. </para>
  15387. </remarks>
  15388. <seealso cref="T:Ionic.Zlib.DeflateStream"/>
  15389. <seealso cref="T:Ionic.Zlib.GZipStream"/>
  15390. </member>
  15391. <member name="M:Ionic.Zlib.ZlibStream.#ctor(System.IO.Stream,Ionic.Zlib.CompressionMode)">
  15392. <summary>
  15393. Create a <c>ZlibStream</c> using the specified <c>CompressionMode</c>.
  15394. </summary>
  15395. <remarks>
  15396. <para>
  15397. When mode is <c>CompressionMode.Compress</c>, the <c>ZlibStream</c>
  15398. will use the default compression level. The "captive" stream will be
  15399. closed when the <c>ZlibStream</c> is closed.
  15400. </para>
  15401. </remarks>
  15402. <example>
  15403. This example uses a <c>ZlibStream</c> to compress a file, and writes the
  15404. compressed data to another file.
  15405. <code>
  15406. using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
  15407. {
  15408. using (var raw = System.IO.File.Create(fileToCompress + ".zlib"))
  15409. {
  15410. using (Stream compressor = new ZlibStream(raw, CompressionMode.Compress))
  15411. {
  15412. byte[] buffer = new byte[WORKING_BUFFER_SIZE];
  15413. int n;
  15414. while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
  15415. {
  15416. compressor.Write(buffer, 0, n);
  15417. }
  15418. }
  15419. }
  15420. }
  15421. </code>
  15422. <code lang="VB">
  15423. Using input As Stream = File.OpenRead(fileToCompress)
  15424. Using raw As FileStream = File.Create(fileToCompress &amp; ".zlib")
  15425. Using compressor As Stream = New ZlibStream(raw, CompressionMode.Compress)
  15426. Dim buffer As Byte() = New Byte(4096) {}
  15427. Dim n As Integer = -1
  15428. Do While (n &lt;&gt; 0)
  15429. If (n &gt; 0) Then
  15430. compressor.Write(buffer, 0, n)
  15431. End If
  15432. n = input.Read(buffer, 0, buffer.Length)
  15433. Loop
  15434. End Using
  15435. End Using
  15436. End Using
  15437. </code>
  15438. </example>
  15439. <param name="stream">The stream which will be read or written.</param>
  15440. <param name="mode">Indicates whether the ZlibStream will compress or decompress.</param>
  15441. </member>
  15442. <member name="M:Ionic.Zlib.ZlibStream.#ctor(System.IO.Stream,Ionic.Zlib.CompressionMode,Ionic.Zlib.CompressionLevel)">
  15443. <summary>
  15444. Create a <c>ZlibStream</c> using the specified <c>CompressionMode</c> and
  15445. the specified <c>CompressionLevel</c>.
  15446. </summary>
  15447. <remarks>
  15448. <para>
  15449. When mode is <c>CompressionMode.Decompress</c>, the level parameter is ignored.
  15450. The "captive" stream will be closed when the <c>ZlibStream</c> is closed.
  15451. </para>
  15452. </remarks>
  15453. <example>
  15454. This example uses a <c>ZlibStream</c> to compress data from a file, and writes the
  15455. compressed data to another file.
  15456. <code>
  15457. using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
  15458. {
  15459. using (var raw = System.IO.File.Create(fileToCompress + ".zlib"))
  15460. {
  15461. using (Stream compressor = new ZlibStream(raw,
  15462. CompressionMode.Compress,
  15463. CompressionLevel.BestCompression))
  15464. {
  15465. byte[] buffer = new byte[WORKING_BUFFER_SIZE];
  15466. int n;
  15467. while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
  15468. {
  15469. compressor.Write(buffer, 0, n);
  15470. }
  15471. }
  15472. }
  15473. }
  15474. </code>
  15475. <code lang="VB">
  15476. Using input As Stream = File.OpenRead(fileToCompress)
  15477. Using raw As FileStream = File.Create(fileToCompress &amp; ".zlib")
  15478. Using compressor As Stream = New ZlibStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression)
  15479. Dim buffer As Byte() = New Byte(4096) {}
  15480. Dim n As Integer = -1
  15481. Do While (n &lt;&gt; 0)
  15482. If (n &gt; 0) Then
  15483. compressor.Write(buffer, 0, n)
  15484. End If
  15485. n = input.Read(buffer, 0, buffer.Length)
  15486. Loop
  15487. End Using
  15488. End Using
  15489. End Using
  15490. </code>
  15491. </example>
  15492. <param name="stream">The stream to be read or written while deflating or inflating.</param>
  15493. <param name="mode">Indicates whether the ZlibStream will compress or decompress.</param>
  15494. <param name="level">A tuning knob to trade speed for effectiveness.</param>
  15495. </member>
  15496. <member name="M:Ionic.Zlib.ZlibStream.#ctor(System.IO.Stream,Ionic.Zlib.CompressionMode,System.Boolean)">
  15497. <summary>
  15498. Create a <c>ZlibStream</c> using the specified <c>CompressionMode</c>, and
  15499. explicitly specify whether the captive stream should be left open after
  15500. Deflation or Inflation.
  15501. </summary>
  15502. <remarks>
  15503. <para>
  15504. When mode is <c>CompressionMode.Compress</c>, the <c>ZlibStream</c> will use
  15505. the default compression level.
  15506. </para>
  15507. <para>
  15508. This constructor allows the application to request that the captive stream
  15509. remain open after the deflation or inflation occurs. By default, after
  15510. <c>Close()</c> is called on the stream, the captive stream is also
  15511. closed. In some cases this is not desired, for example if the stream is a
  15512. <see cref="T:System.IO.MemoryStream"/> that will be re-read after
  15513. compression. Specify true for the <paramref name="leaveOpen"/> parameter to leave the stream
  15514. open.
  15515. </para>
  15516. <para>
  15517. See the other overloads of this constructor for example code.
  15518. </para>
  15519. </remarks>
  15520. <param name="stream">The stream which will be read or written. This is called the
  15521. "captive" stream in other places in this documentation.</param>
  15522. <param name="mode">Indicates whether the ZlibStream will compress or decompress.</param>
  15523. <param name="leaveOpen">true if the application would like the stream to remain
  15524. open after inflation/deflation.</param>
  15525. </member>
  15526. <member name="M:Ionic.Zlib.ZlibStream.#ctor(System.IO.Stream,Ionic.Zlib.CompressionMode,Ionic.Zlib.CompressionLevel,System.Boolean)">
  15527. <summary>
  15528. Create a <c>ZlibStream</c> using the specified <c>CompressionMode</c>
  15529. and the specified <c>CompressionLevel</c>, and explicitly specify
  15530. whether the stream should be left open after Deflation or Inflation.
  15531. </summary>
  15532. <remarks>
  15533. <para>
  15534. This constructor allows the application to request that the captive
  15535. stream remain open after the deflation or inflation occurs. By
  15536. default, after <c>Close()</c> is called on the stream, the captive
  15537. stream is also closed. In some cases this is not desired, for example
  15538. if the stream is a <see cref="T:System.IO.MemoryStream"/> that will be
  15539. re-read after compression. Specify true for the <paramref name="leaveOpen"/> parameter to leave the stream open.
  15540. </para>
  15541. <para>
  15542. When mode is <c>CompressionMode.Decompress</c>, the level parameter is
  15543. ignored.
  15544. </para>
  15545. </remarks>
  15546. <example>
  15547. This example shows how to use a ZlibStream to compress the data from a file,
  15548. and store the result into another file. The filestream remains open to allow
  15549. additional data to be written to it.
  15550. <code>
  15551. using (var output = System.IO.File.Create(fileToCompress + ".zlib"))
  15552. {
  15553. using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
  15554. {
  15555. using (Stream compressor = new ZlibStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, true))
  15556. {
  15557. byte[] buffer = new byte[WORKING_BUFFER_SIZE];
  15558. int n;
  15559. while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
  15560. {
  15561. compressor.Write(buffer, 0, n);
  15562. }
  15563. }
  15564. }
  15565. // can write additional data to the output stream here
  15566. }
  15567. </code>
  15568. <code lang="VB">
  15569. Using output As FileStream = File.Create(fileToCompress &amp; ".zlib")
  15570. Using input As Stream = File.OpenRead(fileToCompress)
  15571. Using compressor As Stream = New ZlibStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, True)
  15572. Dim buffer As Byte() = New Byte(4096) {}
  15573. Dim n As Integer = -1
  15574. Do While (n &lt;&gt; 0)
  15575. If (n &gt; 0) Then
  15576. compressor.Write(buffer, 0, n)
  15577. End If
  15578. n = input.Read(buffer, 0, buffer.Length)
  15579. Loop
  15580. End Using
  15581. End Using
  15582. ' can write additional data to the output stream here.
  15583. End Using
  15584. </code>
  15585. </example>
  15586. <param name="stream">The stream which will be read or written.</param>
  15587. <param name="mode">Indicates whether the ZlibStream will compress or decompress.</param>
  15588. <param name="leaveOpen">
  15589. true if the application would like the stream to remain open after
  15590. inflation/deflation.
  15591. </param>
  15592. <param name="level">
  15593. A tuning knob to trade speed for effectiveness. This parameter is
  15594. effective only when mode is <c>CompressionMode.Compress</c>.
  15595. </param>
  15596. </member>
  15597. <member name="M:Ionic.Zlib.ZlibStream.Dispose(System.Boolean)">
  15598. <summary>
  15599. Dispose the stream.
  15600. </summary>
  15601. <remarks>
  15602. <para>
  15603. This may or may not result in a <c>Close()</c> call on the captive
  15604. stream. See the constructors that have a <c>leaveOpen</c> parameter
  15605. for more information.
  15606. </para>
  15607. <para>
  15608. This method may be invoked in two distinct scenarios. If disposing
  15609. == true, the method has been called directly or indirectly by a
  15610. user's code, for example via the public Dispose() method. In this
  15611. case, both managed and unmanaged resources can be referenced and
  15612. disposed. If disposing == false, the method has been called by the
  15613. runtime from inside the object finalizer and this method should not
  15614. reference other objects; in that case only unmanaged resources must
  15615. be referenced or disposed.
  15616. </para>
  15617. </remarks>
  15618. <param name="disposing">
  15619. indicates whether the Dispose method was invoked by user code.
  15620. </param>
  15621. </member>
  15622. <member name="M:Ionic.Zlib.ZlibStream.Flush">
  15623. <summary>
  15624. Flush the stream.
  15625. </summary>
  15626. </member>
  15627. <member name="M:Ionic.Zlib.ZlibStream.Read(System.Byte[],System.Int32,System.Int32)">
  15628. <summary>
  15629. Read data from the stream.
  15630. </summary>
  15631. <remarks>
  15632. <para>
  15633. If you wish to use the <c>ZlibStream</c> to compress data while reading,
  15634. you can create a <c>ZlibStream</c> with <c>CompressionMode.Compress</c>,
  15635. providing an uncompressed data stream. Then call <c>Read()</c> on that
  15636. <c>ZlibStream</c>, and the data read will be compressed. If you wish to
  15637. use the <c>ZlibStream</c> to decompress data while reading, you can create
  15638. a <c>ZlibStream</c> with <c>CompressionMode.Decompress</c>, providing a
  15639. readable compressed data stream. Then call <c>Read()</c> on that
  15640. <c>ZlibStream</c>, and the data will be decompressed as it is read.
  15641. </para>
  15642. <para>
  15643. A <c>ZlibStream</c> can be used for <c>Read()</c> or <c>Write()</c>, but
  15644. not both.
  15645. </para>
  15646. </remarks>
  15647. <param name="buffer">
  15648. The buffer into which the read data should be placed.</param>
  15649. <param name="offset">
  15650. the offset within that data array to put the first byte read.</param>
  15651. <param name="count">the number of bytes to read.</param>
  15652. <returns>the number of bytes read</returns>
  15653. </member>
  15654. <member name="M:Ionic.Zlib.ZlibStream.Seek(System.Int64,System.IO.SeekOrigin)">
  15655. <summary>
  15656. Calling this method always throws a <see cref="T:System.NotSupportedException"/>.
  15657. </summary>
  15658. <param name="offset">
  15659. The offset to seek to....
  15660. IF THIS METHOD ACTUALLY DID ANYTHING.
  15661. </param>
  15662. <param name="origin">
  15663. The reference specifying how to apply the offset.... IF
  15664. THIS METHOD ACTUALLY DID ANYTHING.
  15665. </param>
  15666. <returns>nothing. This method always throws.</returns>
  15667. </member>
  15668. <member name="M:Ionic.Zlib.ZlibStream.SetLength(System.Int64)">
  15669. <summary>
  15670. Calling this method always throws a <see cref="T:System.NotSupportedException"/>.
  15671. </summary>
  15672. <param name="value">
  15673. The new value for the stream length.... IF
  15674. THIS METHOD ACTUALLY DID ANYTHING.
  15675. </param>
  15676. </member>
  15677. <member name="M:Ionic.Zlib.ZlibStream.Write(System.Byte[],System.Int32,System.Int32)">
  15678. <summary>
  15679. Write data to the stream.
  15680. </summary>
  15681. <remarks>
  15682. <para>
  15683. If you wish to use the <c>ZlibStream</c> to compress data while writing,
  15684. you can create a <c>ZlibStream</c> with <c>CompressionMode.Compress</c>,
  15685. and a writable output stream. Then call <c>Write()</c> on that
  15686. <c>ZlibStream</c>, providing uncompressed data as input. The data sent to
  15687. the output stream will be the compressed form of the data written. If you
  15688. wish to use the <c>ZlibStream</c> to decompress data while writing, you
  15689. can create a <c>ZlibStream</c> with <c>CompressionMode.Decompress</c>, and a
  15690. writable output stream. Then call <c>Write()</c> on that stream,
  15691. providing previously compressed data. The data sent to the output stream
  15692. will be the decompressed form of the data written.
  15693. </para>
  15694. <para>
  15695. A <c>ZlibStream</c> can be used for <c>Read()</c> or <c>Write()</c>, but not both.
  15696. </para>
  15697. </remarks>
  15698. <param name="buffer">The buffer holding data to write to the stream.</param>
  15699. <param name="offset">the offset within that data array to find the first byte to write.</param>
  15700. <param name="count">the number of bytes to write.</param>
  15701. </member>
  15702. <member name="M:Ionic.Zlib.ZlibStream.CompressString(System.String)">
  15703. <summary>
  15704. Compress a string into a byte array using ZLIB.
  15705. </summary>
  15706. <remarks>
  15707. Uncompress it with <see cref="M:Ionic.Zlib.ZlibStream.UncompressString(System.Byte[])"/>.
  15708. </remarks>
  15709. <seealso cref="M:Ionic.Zlib.ZlibStream.UncompressString(System.Byte[])"/>
  15710. <seealso cref="M:Ionic.Zlib.ZlibStream.CompressBuffer(System.Byte[])"/>
  15711. <seealso cref="M:Ionic.Zlib.GZipStream.CompressString(System.String)"/>
  15712. <param name="s">
  15713. A string to compress. The string will first be encoded
  15714. using UTF8, then compressed.
  15715. </param>
  15716. <returns>The string in compressed form</returns>
  15717. </member>
  15718. <member name="M:Ionic.Zlib.ZlibStream.CompressBuffer(System.Byte[])">
  15719. <summary>
  15720. Compress a byte array into a new byte array using ZLIB.
  15721. </summary>
  15722. <remarks>
  15723. Uncompress it with <see cref="M:Ionic.Zlib.ZlibStream.UncompressBuffer(System.Byte[])"/>.
  15724. </remarks>
  15725. <seealso cref="M:Ionic.Zlib.ZlibStream.CompressString(System.String)"/>
  15726. <seealso cref="M:Ionic.Zlib.ZlibStream.UncompressBuffer(System.Byte[])"/>
  15727. <param name="b">
  15728. A buffer to compress.
  15729. </param>
  15730. <returns>The data in compressed form</returns>
  15731. </member>
  15732. <member name="M:Ionic.Zlib.ZlibStream.UncompressString(System.Byte[])">
  15733. <summary>
  15734. Uncompress a ZLIB-compressed byte array into a single string.
  15735. </summary>
  15736. <seealso cref="M:Ionic.Zlib.ZlibStream.CompressString(System.String)"/>
  15737. <seealso cref="M:Ionic.Zlib.ZlibStream.UncompressBuffer(System.Byte[])"/>
  15738. <param name="compressed">
  15739. A buffer containing ZLIB-compressed data.
  15740. </param>
  15741. <returns>The uncompressed string</returns>
  15742. </member>
  15743. <member name="M:Ionic.Zlib.ZlibStream.UncompressBuffer(System.Byte[])">
  15744. <summary>
  15745. Uncompress a ZLIB-compressed byte array into a byte array.
  15746. </summary>
  15747. <seealso cref="M:Ionic.Zlib.ZlibStream.CompressBuffer(System.Byte[])"/>
  15748. <seealso cref="M:Ionic.Zlib.ZlibStream.UncompressString(System.Byte[])"/>
  15749. <param name="compressed">
  15750. A buffer containing ZLIB-compressed data.
  15751. </param>
  15752. <returns>The data in uncompressed form</returns>
  15753. </member>
  15754. <member name="P:Ionic.Zlib.ZlibStream.FlushMode">
  15755. <summary>
  15756. This property sets the flush behavior on the stream.
  15757. Sorry, though, not sure exactly how to describe all the various settings.
  15758. </summary>
  15759. </member>
  15760. <member name="P:Ionic.Zlib.ZlibStream.BufferSize">
  15761. <summary>
  15762. The size of the working buffer for the compression codec.
  15763. </summary>
  15764. <remarks>
  15765. <para>
  15766. The working buffer is used for all stream operations. The default size is
  15767. 1024 bytes. The minimum size is 128 bytes. You may get better performance
  15768. with a larger buffer. Then again, you might not. You would have to test
  15769. it.
  15770. </para>
  15771. <para>
  15772. Set this before the first call to <c>Read()</c> or <c>Write()</c> on the
  15773. stream. If you try to set it afterwards, it will throw.
  15774. </para>
  15775. </remarks>
  15776. </member>
  15777. <member name="P:Ionic.Zlib.ZlibStream.TotalIn">
  15778. <summary> Returns the total number of bytes input so far.</summary>
  15779. </member>
  15780. <member name="P:Ionic.Zlib.ZlibStream.TotalOut">
  15781. <summary> Returns the total number of bytes output so far.</summary>
  15782. </member>
  15783. <member name="P:Ionic.Zlib.ZlibStream.CanRead">
  15784. <summary>
  15785. Indicates whether the stream can be read.
  15786. </summary>
  15787. <remarks>
  15788. The return value depends on whether the captive stream supports reading.
  15789. </remarks>
  15790. </member>
  15791. <member name="P:Ionic.Zlib.ZlibStream.CanSeek">
  15792. <summary>
  15793. Indicates whether the stream supports Seek operations.
  15794. </summary>
  15795. <remarks>
  15796. Always returns false.
  15797. </remarks>
  15798. </member>
  15799. <member name="P:Ionic.Zlib.ZlibStream.CanWrite">
  15800. <summary>
  15801. Indicates whether the stream can be written.
  15802. </summary>
  15803. <remarks>
  15804. The return value depends on whether the captive stream supports writing.
  15805. </remarks>
  15806. </member>
  15807. <member name="P:Ionic.Zlib.ZlibStream.Length">
  15808. <summary>
  15809. Reading this property always throws a <see cref="T:System.NotSupportedException"/>.
  15810. </summary>
  15811. </member>
  15812. <member name="P:Ionic.Zlib.ZlibStream.Position">
  15813. <summary>
  15814. The position of the stream pointer.
  15815. </summary>
  15816. <remarks>
  15817. Setting this property always throws a <see cref="T:System.NotSupportedException"/>. Reading will return the total bytes
  15818. written out, if used in writing, or the total bytes read in, if used in
  15819. reading. The count may refer to compressed bytes or uncompressed bytes,
  15820. depending on how you've used the stream.
  15821. </remarks>
  15822. </member>
  15823. <member name="T:Ionic.Crc.CRC32">
  15824. <summary>
  15825. Computes a CRC-32. The CRC-32 algorithm is parameterized - you
  15826. can set the polynomial and enable or disable bit
  15827. reversal. This can be used for GZIP, BZip2, or ZIP.
  15828. </summary>
  15829. <remarks>
  15830. This type is used internally by DotNetZip; it is generally not used
  15831. directly by applications wishing to create, read, or manipulate zip
  15832. archive files.
  15833. </remarks>
  15834. </member>
  15835. <member name="M:Ionic.Crc.CRC32.GetCrc32(System.IO.Stream)">
  15836. <summary>
  15837. Returns the CRC32 for the specified stream.
  15838. </summary>
  15839. <param name="input">The stream over which to calculate the CRC32</param>
  15840. <returns>the CRC32 calculation</returns>
  15841. </member>
  15842. <member name="M:Ionic.Crc.CRC32.GetCrc32AndCopy(System.IO.Stream,System.IO.Stream)">
  15843. <summary>
  15844. Returns the CRC32 for the specified stream, and writes the input into the
  15845. output stream.
  15846. </summary>
  15847. <param name="input">The stream over which to calculate the CRC32</param>
  15848. <param name="output">The stream into which to deflate the input</param>
  15849. <returns>the CRC32 calculation</returns>
  15850. </member>
  15851. <member name="M:Ionic.Crc.CRC32.ComputeCrc32(System.Int32,System.Byte)">
  15852. <summary>
  15853. Get the CRC32 for the given (word,byte) combo. This is a
  15854. computation defined by PKzip for PKZIP 2.0 (weak) encryption.
  15855. </summary>
  15856. <param name="W">The word to start with.</param>
  15857. <param name="B">The byte to combine it with.</param>
  15858. <returns>The CRC-ized result.</returns>
  15859. </member>
  15860. <member name="M:Ionic.Crc.CRC32.SlurpBlock(System.Byte[],System.Int32,System.Int32)">
  15861. <summary>
  15862. Update the value for the running CRC32 using the given block of bytes.
  15863. This is useful when using the CRC32() class in a Stream.
  15864. </summary>
  15865. <param name="block">block of bytes to slurp</param>
  15866. <param name="offset">starting point in the block</param>
  15867. <param name="count">how many bytes within the block to slurp</param>
  15868. </member>
  15869. <member name="M:Ionic.Crc.CRC32.UpdateCRC(System.Byte)">
  15870. <summary>
  15871. Process one byte in the CRC.
  15872. </summary>
  15873. <param name = "b">the byte to include into the CRC . </param>
  15874. </member>
  15875. <member name="M:Ionic.Crc.CRC32.UpdateCRC(System.Byte,System.Int32)">
  15876. <summary>
  15877. Process a run of N identical bytes into the CRC.
  15878. </summary>
  15879. <remarks>
  15880. <para>
  15881. This method serves as an optimization for updating the CRC when a
  15882. run of identical bytes is found. Rather than passing in a buffer of
  15883. length n, containing all identical bytes b, this method accepts the
  15884. byte value and the length of the (virtual) buffer - the length of
  15885. the run.
  15886. </para>
  15887. </remarks>
  15888. <param name = "b">the byte to include into the CRC. </param>
  15889. <param name = "n">the number of times that byte should be repeated. </param>
  15890. </member>
  15891. <member name="M:Ionic.Crc.CRC32.Combine(System.Int32,System.Int32)">
  15892. <summary>
  15893. Combines the given CRC32 value with the current running total.
  15894. </summary>
  15895. <remarks>
  15896. This is useful when using a divide-and-conquer approach to
  15897. calculating a CRC. Multiple threads can each calculate a
  15898. CRC32 on a segment of the data, and then combine the
  15899. individual CRC32 values at the end.
  15900. </remarks>
  15901. <param name="crc">the crc value to be combined with this one</param>
  15902. <param name="length">the length of data the CRC value was calculated on</param>
  15903. </member>
  15904. <member name="M:Ionic.Crc.CRC32.#ctor">
  15905. <summary>
  15906. Create an instance of the CRC32 class using the default settings: no
  15907. bit reversal, and a polynomial of 0xEDB88320.
  15908. </summary>
  15909. </member>
  15910. <member name="M:Ionic.Crc.CRC32.#ctor(System.Boolean)">
  15911. <summary>
  15912. Create an instance of the CRC32 class, specifying whether to reverse
  15913. data bits or not.
  15914. </summary>
  15915. <param name='reverseBits'>
  15916. specify true if the instance should reverse data bits.
  15917. </param>
  15918. <remarks>
  15919. <para>
  15920. In the CRC-32 used by BZip2, the bits are reversed. Therefore if you
  15921. want a CRC32 with compatibility with BZip2, you should pass true
  15922. here. In the CRC-32 used by GZIP and PKZIP, the bits are not
  15923. reversed; Therefore if you want a CRC32 with compatibility with
  15924. those, you should pass false.
  15925. </para>
  15926. </remarks>
  15927. </member>
  15928. <member name="M:Ionic.Crc.CRC32.#ctor(System.Int32,System.Boolean)">
  15929. <summary>
  15930. Create an instance of the CRC32 class, specifying the polynomial and
  15931. whether to reverse data bits or not.
  15932. </summary>
  15933. <param name='polynomial'>
  15934. The polynomial to use for the CRC, expressed in the reversed (LSB)
  15935. format: the highest ordered bit in the polynomial value is the
  15936. coefficient of the 0th power; the second-highest order bit is the
  15937. coefficient of the 1 power, and so on. Expressed this way, the
  15938. polynomial for the CRC-32C used in IEEE 802.3, is 0xEDB88320.
  15939. </param>
  15940. <param name='reverseBits'>
  15941. specify true if the instance should reverse data bits.
  15942. </param>
  15943. <remarks>
  15944. <para>
  15945. In the CRC-32 used by BZip2, the bits are reversed. Therefore if you
  15946. want a CRC32 with compatibility with BZip2, you should pass true
  15947. here for the <c>reverseBits</c> parameter. In the CRC-32 used by
  15948. GZIP and PKZIP, the bits are not reversed; Therefore if you want a
  15949. CRC32 with compatibility with those, you should pass false for the
  15950. <c>reverseBits</c> parameter.
  15951. </para>
  15952. </remarks>
  15953. </member>
  15954. <member name="M:Ionic.Crc.CRC32.Reset">
  15955. <summary>
  15956. Reset the CRC-32 class - clear the CRC "remainder register."
  15957. </summary>
  15958. <remarks>
  15959. <para>
  15960. Use this when employing a single instance of this class to compute
  15961. multiple, distinct CRCs on multiple, distinct data blocks.
  15962. </para>
  15963. </remarks>
  15964. </member>
  15965. <member name="P:Ionic.Crc.CRC32.TotalBytesRead">
  15966. <summary>
  15967. Indicates the total number of bytes applied to the CRC.
  15968. </summary>
  15969. </member>
  15970. <member name="P:Ionic.Crc.CRC32.Crc32Result">
  15971. <summary>
  15972. Indicates the current CRC for all blocks slurped in.
  15973. </summary>
  15974. </member>
  15975. <member name="T:Ionic.Crc.CrcCalculatorStream">
  15976. <summary>
  15977. A Stream that calculates a CRC32 (a checksum) on all bytes read,
  15978. or on all bytes written.
  15979. </summary>
  15980. <remarks>
  15981. <para>
  15982. This class can be used to verify the CRC of a ZipEntry when
  15983. reading from a stream, or to calculate a CRC when writing to a
  15984. stream. The stream should be used to either read, or write, but
  15985. not both. If you intermix reads and writes, the results are not
  15986. defined.
  15987. </para>
  15988. <para>
  15989. This class is intended primarily for use internally by the
  15990. DotNetZip library.
  15991. </para>
  15992. </remarks>
  15993. </member>
  15994. <member name="M:Ionic.Crc.CrcCalculatorStream.#ctor(System.IO.Stream)">
  15995. <summary>
  15996. The default constructor.
  15997. </summary>
  15998. <remarks>
  15999. <para>
  16000. Instances returned from this constructor will leave the underlying
  16001. stream open upon Close(). The stream uses the default CRC32
  16002. algorithm, which implies a polynomial of 0xEDB88320.
  16003. </para>
  16004. </remarks>
  16005. <param name="stream">The underlying stream</param>
  16006. </member>
  16007. <member name="M:Ionic.Crc.CrcCalculatorStream.#ctor(System.IO.Stream,System.Boolean)">
  16008. <summary>
  16009. The constructor allows the caller to specify how to handle the
  16010. underlying stream at close.
  16011. </summary>
  16012. <remarks>
  16013. <para>
  16014. The stream uses the default CRC32 algorithm, which implies a
  16015. polynomial of 0xEDB88320.
  16016. </para>
  16017. </remarks>
  16018. <param name="stream">The underlying stream</param>
  16019. <param name="leaveOpen">true to leave the underlying stream
  16020. open upon close of the <c>CrcCalculatorStream</c>; false otherwise.</param>
  16021. </member>
  16022. <member name="M:Ionic.Crc.CrcCalculatorStream.#ctor(System.IO.Stream,System.Int64)">
  16023. <summary>
  16024. A constructor allowing the specification of the length of the stream
  16025. to read.
  16026. </summary>
  16027. <remarks>
  16028. <para>
  16029. The stream uses the default CRC32 algorithm, which implies a
  16030. polynomial of 0xEDB88320.
  16031. </para>
  16032. <para>
  16033. Instances returned from this constructor will leave the underlying
  16034. stream open upon Close().
  16035. </para>
  16036. </remarks>
  16037. <param name="stream">The underlying stream</param>
  16038. <param name="length">The length of the stream to slurp</param>
  16039. </member>
  16040. <member name="M:Ionic.Crc.CrcCalculatorStream.#ctor(System.IO.Stream,System.Int64,System.Boolean)">
  16041. <summary>
  16042. A constructor allowing the specification of the length of the stream
  16043. to read, as well as whether to keep the underlying stream open upon
  16044. Close().
  16045. </summary>
  16046. <remarks>
  16047. <para>
  16048. The stream uses the default CRC32 algorithm, which implies a
  16049. polynomial of 0xEDB88320.
  16050. </para>
  16051. </remarks>
  16052. <param name="stream">The underlying stream</param>
  16053. <param name="length">The length of the stream to slurp</param>
  16054. <param name="leaveOpen">true to leave the underlying stream
  16055. open upon close of the <c>CrcCalculatorStream</c>; false otherwise.</param>
  16056. </member>
  16057. <member name="M:Ionic.Crc.CrcCalculatorStream.#ctor(System.IO.Stream,System.Int64,System.Boolean,Ionic.Crc.CRC32)">
  16058. <summary>
  16059. A constructor allowing the specification of the length of the stream
  16060. to read, as well as whether to keep the underlying stream open upon
  16061. Close(), and the CRC32 instance to use.
  16062. </summary>
  16063. <remarks>
  16064. <para>
  16065. The stream uses the specified CRC32 instance, which allows the
  16066. application to specify how the CRC gets calculated.
  16067. </para>
  16068. </remarks>
  16069. <param name="stream">The underlying stream</param>
  16070. <param name="length">The length of the stream to slurp</param>
  16071. <param name="leaveOpen">true to leave the underlying stream
  16072. open upon close of the <c>CrcCalculatorStream</c>; false otherwise.</param>
  16073. <param name="crc32">the CRC32 instance to use to calculate the CRC32</param>
  16074. </member>
  16075. <member name="M:Ionic.Crc.CrcCalculatorStream.Read(System.Byte[],System.Int32,System.Int32)">
  16076. <summary>
  16077. Read from the stream
  16078. </summary>
  16079. <param name="buffer">the buffer to read</param>
  16080. <param name="offset">the offset at which to start</param>
  16081. <param name="count">the number of bytes to read</param>
  16082. <returns>the number of bytes actually read</returns>
  16083. </member>
  16084. <member name="M:Ionic.Crc.CrcCalculatorStream.Write(System.Byte[],System.Int32,System.Int32)">
  16085. <summary>
  16086. Write to the stream.
  16087. </summary>
  16088. <param name="buffer">the buffer from which to write</param>
  16089. <param name="offset">the offset at which to start writing</param>
  16090. <param name="count">the number of bytes to write</param>
  16091. </member>
  16092. <member name="M:Ionic.Crc.CrcCalculatorStream.Flush">
  16093. <summary>
  16094. Flush the stream.
  16095. </summary>
  16096. </member>
  16097. <member name="M:Ionic.Crc.CrcCalculatorStream.Seek(System.Int64,System.IO.SeekOrigin)">
  16098. <summary>
  16099. Seeking is not supported on this stream. This method always throws
  16100. <see cref="T:System.NotSupportedException"/>
  16101. </summary>
  16102. <param name="offset">N/A</param>
  16103. <param name="origin">N/A</param>
  16104. <returns>N/A</returns>
  16105. </member>
  16106. <member name="M:Ionic.Crc.CrcCalculatorStream.SetLength(System.Int64)">
  16107. <summary>
  16108. This method always throws
  16109. <see cref="T:System.NotSupportedException"/>
  16110. </summary>
  16111. <param name="value">N/A</param>
  16112. </member>
  16113. <member name="M:Ionic.Crc.CrcCalculatorStream.Close">
  16114. <summary>
  16115. Closes the stream.
  16116. </summary>
  16117. </member>
  16118. <member name="P:Ionic.Crc.CrcCalculatorStream.TotalBytesSlurped">
  16119. <summary>
  16120. Gets the total number of bytes run through the CRC32 calculator.
  16121. </summary>
  16122. <remarks>
  16123. This is either the total number of bytes read, or the total number of
  16124. bytes written, depending on the direction of this stream.
  16125. </remarks>
  16126. </member>
  16127. <member name="P:Ionic.Crc.CrcCalculatorStream.Crc">
  16128. <summary>
  16129. Provides the current CRC for all blocks slurped in.
  16130. </summary>
  16131. <remarks>
  16132. <para>
  16133. The running total of the CRC is kept as data is written or read
  16134. through the stream. read this property after all reads or writes to
  16135. get an accurate CRC for the entire stream.
  16136. </para>
  16137. </remarks>
  16138. </member>
  16139. <member name="P:Ionic.Crc.CrcCalculatorStream.LeaveOpen">
  16140. <summary>
  16141. Indicates whether the underlying stream will be left open when the
  16142. <c>CrcCalculatorStream</c> is Closed.
  16143. </summary>
  16144. <remarks>
  16145. <para>
  16146. Set this at any point before calling <see cref="M:Ionic.Crc.CrcCalculatorStream.Close"/>.
  16147. </para>
  16148. </remarks>
  16149. </member>
  16150. <member name="P:Ionic.Crc.CrcCalculatorStream.CanRead">
  16151. <summary>
  16152. Indicates whether the stream supports reading.
  16153. </summary>
  16154. </member>
  16155. <member name="P:Ionic.Crc.CrcCalculatorStream.CanSeek">
  16156. <summary>
  16157. Indicates whether the stream supports seeking.
  16158. </summary>
  16159. <remarks>
  16160. <para>
  16161. Always returns false.
  16162. </para>
  16163. </remarks>
  16164. </member>
  16165. <member name="P:Ionic.Crc.CrcCalculatorStream.CanWrite">
  16166. <summary>
  16167. Indicates whether the stream supports writing.
  16168. </summary>
  16169. </member>
  16170. <member name="P:Ionic.Crc.CrcCalculatorStream.Length">
  16171. <summary>
  16172. Returns the length of the underlying stream.
  16173. </summary>
  16174. </member>
  16175. <member name="P:Ionic.Crc.CrcCalculatorStream.Position">
  16176. <summary>
  16177. The getter for this property returns the total bytes read.
  16178. If you use the setter, it will throw
  16179. <see cref="T:System.NotSupportedException"/>.
  16180. </summary>
  16181. </member>
  16182. </members>
  16183. </doc>