MSDN > フォーラム ホーム > MSDN Online: Future Plans > Idle Comment from the Peanut Gallery
質問する質問する
 

全般的な情報交換Idle Comment from the Peanut Gallery

  • 2009年1月28日 18:26JaedenRuiner ユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     

    Greetings,

    I dunno what it is, but perhaps i feel the urge to develop as many things in such a wide range for others to use.  Sure there are occasional times where a Friend or Private class/structure is necessary, even useful, but the sheer volume of such classes that exist in the .Net framework is pathetic.

    In a class that sometimes needs to pass multiple data structures asynchronously within itself (like Net.Mail.SendAsync()) , it is appropriate that since all of this is in the private scope of the class, to create a quick private class/structure within that lets you pass three different values to the UserState object of the Asynchronous method.  This makes sense.

    But there I am trying to find a non-external method of creating a zip file.  I could use the Shell32 method, creating the quick byte header of a zip file and then linking a Shell32.Folder object to it, and moving the files into that folder uses the Shell32 for XP to "zip" it.  Or, to use a .Net method I could use the IO.Packages.ZipPackage found in the WindowsBase.dll.  

    However, the Shell32 method requires the Interop.Shell32.dll file to be included with my application, which i find annoyingly redundant with regards to COM and it's design, which with any other language framework that utilizes it doesn't require an "interim" dll to interface with the default dll.  I can understand using that interim dll for type checking during development, but once the app is compiled it should just link directly to shell32.dll in the system directory.

    Additionally the IO.Packages.ZipPackage works great, is completely internal so no additional assemblies need to be included with my application, but on the other side of annoying it adds this [Contenttypes].xml file to every zip it creates which could be confusing to those who end up having to extract the useful files from the Zip file.  

    There are of course countless Zip Libraries out there, DotNetZip is one that I've found that is very good, and donation ware to boot.  But that is again an additional Assembly that would need to be included with my application, either in the install or combined via ILMerge.

    So i thought, well, i only want a simple zip created, a few files on the fly, with no excessive accoutrement, and so I go into .Net Reflector to see if I can figure out how the ZipPackage works, to see if this is something I could code myself quickly and easily...and what do i find:
    • Namespace MS.Internal.IO.Zip
      • Friend Class ZipArchive
    Why in the world is this an Internal "Friend" class?!?!?!?!?!?!?  This should just be part of the .Net environment.  They've obviously coded it for the ZipPackage class to create a zip file, and just think of all those extraneous libraries out there that have been made for creating Zip files, and yet all the while, Microsoft has one made and ready to go, but for some annoying reason they've hid it in such a manner that it will never be used by anyone but them.  *sigh*  Perhaps there are some licensing rights that PKWare imposed, but if one can use Shell32, or one of the countless other Freeware or commercial based zip libraries to create a Zip file based on the PKWare specification, than that shouldn't prevent Microsoft from providing the same thing.  

    Oh well, Perhaps if I point this out to the good people at Microsoft it could be a great day to have an update of the 3.0 framework that exposes these internal namespaces and classes so that others may use them as well...doubt it.

    Just an idle comment...cheers!

    __________________
    Jaeden "Sifo Dyas" al'Raec Ruiner
    http://www.wayoftheleaf.net/