asp.net professional Source code Packaging Tools _ Basic Application

Source: Internet
Author: User
Tags naming convention pack rar svn wrapper

However, some people tend to be sloppy, often directly package the VS-generated solution directory, which will contain a lot of junk files, such as: All files under the obj directory, and sometimes there are two directories in the bin directory, and two PDB files, Even the Xxx.vshost.exe file has two copies! What's even more silent is that some people use SVN source code management software, each directory also has an. SVN directory!

This approach is obviously very easy to make a small project into a relatively large compression package, this compression package once done, upload is slow, people download is slow, but also waste a lot of server resources, download to this compression package, can only let people have no language. No way, some people are very lazy, and those compression software also do not understand this is a source code directory, anyway, see the file on the compression! Although very tragic, but the tragedy has been repeatedly staged! The reality is this, some people are estimated to have been numb!

I am a person who pursues perfection, and naturally does not want to let tragedies repeat themselves here. I do not want to waste my upload time, do not want to waste the server's hard disk resources, do not want to waste the bandwidth of the server, do not want to waste all users download time, but also do not want someone to scold me. So every time I make a compressed package that doesn't contain that junk file. How did I do that? It's easy, don't pack some junk files in. What else do you want?

However, I also understand some lazy people, every time to pack to find out these files, delete them, but also some trouble. Of course, I also do not want to do this kind of mechanical things every time, I also want to be lazy.

Well, since it's a mechanical thing to delete these junk files before you pack them, can you get a program to do it, I'm a programmer.

Finally one day, I also can not stand, especially I usually like to write a little things, every day after the change to back up, but also to use compression package, but I do not want to waste hard disk space AH. After a time of being tortured by those compression software, I chose to design a tool to solve the problem. No, it's a compressed thing, it's hard to solve. I'll do it myself, anyway, now the Compression class library is a lot, however, I finally chose the Windows FCI/FDI interface, it can directly generate the CAB format compression package, and now popular compression software can support it. There are other reasons to choose it: 1. I have used it before using C #, there is a ready-made packaging library (C language version, the speed is good), 2. Because it is the interface with Windows, so there is no need to introduce additional components, the tool can maintain a small size, the 3.cab algorithm has a good compression rate, Better than zip (equivalent to RAR, 7z almost).

Today, I'm going to recommend a tool that I use almost every day. It can perfectly solve the above problem, it has other functions, I also like it very much. Next, I'll introduce you to this tool.

Remember, the name of this tool is: Fishcabtool

Tools Introduction

Take a look at my tools, a total of 4 files:

Although it is 4 files, but still very small, from 300K still some distance oh. The following describes the purpose of these 4 files in turn:

1. Fishcabtoolhelp.chm, it is a help file that describes the features of the tool, how it works, and other instructions:

2. FishCabTool.exe, it is the main program of this tool, is a WinForm program, run the interface as follows:

Typically, you do not need to run it directly, but you start it from the context menu of the resource Manager, in the same way as today's popular compression software, as shown below.

3. FishCabToolExt.dll, which is a plugin for Windows Explorer, allows my tools to operate directly in Windows Explorer's right-click menu like some compression software, as shown in the following illustration:

In order not to affect the operation experience, the plug-in is implemented in an ATL manner, so the speed is still very good. Speaking of speed, give a specific data: in the development of this tool in the year, is in a (02) old machine, due to poor machine configuration, so the performance is very sensitive. I select all the files under the Windows/system32 folder, right-click the mouse and measure the time the menu appears, WinRar V2.6 spent 27 seconds, 7z v4.x spent almost 8 seconds, my tool is less than 3 seconds. So don't worry about this plugin's impact on your machine performance.

Note: FishCabToolExt.dll is written in Unicode, so it is theoretically possible to display Chinese characters even if it is not a simplified Chinese version of Windows.

4. FishCabLibU.dll, which is a wrapper layer that encapsulates the FCI/FDI interface of Windows, because these two interfaces are based on C and the interfaces are more complex, I have to encapsulate them in C and provide them to other programming language calls with standard export functions. The exported API functions are shown below:

in writing this blog, I saw the name of the API that year, I also depressed: these names are too messy. Well, 2004 is really a lousy naming convention.

FCI/FDI is the abbreviation for Windows file compression interface/File decompression interface. It provides a concrete implementation algorithm for manipulating the CAB compression package, which involves a large stack of C-style callback functions.
Microsoft's SDK documentation for this interface: click here to download (Microsoft's website is not available, sorry)

The interface I encapsulate is a simplified version of the API functions that are already simple data types, so it is easier to use and provide Unicode and non-Unicode two sets of APIs, if you are also interested in the CAB format, And would like to use my FishCabLibU.dll, please reply, I can provide the C # version of the wrapper class.
Function Introduction
As shown in the Help file screenshot earlier in this article, this gadget has the following features:

1. Designed for backup source code, you can selectively exclude files in the source code directory that do not need to be backed up.
such as: Obj directory and. pdb and other source code version control information such as "garbage" files.
Specifically which files do not need to be compressed in the compression package, the program provides the following settings interface to control

2. The operation mode and the current popular compression software consistent, directly in the resource manager of the right menu operation.
In front of the introduction of FishCabToolExt.dll has been explained, here again to quote the two photos:

3. The resulting compression package uses the CAB's compression format, which is compatible with today's popular compression software.
The CAB format actually existed long ago, at least 15 years old. This file format is developed by Microsoft and is used in many Microsoft installation packages. Because of its long history and the open file format, all kinds of compression software today are popular to support it.
Note: WinRAR support for the cab is not good enough, if the CAB uses UTF-8 encoding to create the package file name, in WinRAR will see garbled. and 7z has no problem, of course, my tool can also solve the package correctly.

4. The file name of the package contains the date of operation for the day, easy to manage and find later.
I usually like to write some small tools or small projects in my spare time, and naturally I will face the source version management problem. But I don't want to install a large source code management software, it is completely unnecessary. You usually package the project directory directly, and then add the day date to the file name. It is for this reason that the tool automatically generates a suitable cabinet file name based on the directory name and day date. You can see a screenshot of the main screen of the previous program. Description: Press F12 to remove the date part of the file name.

5. More flexible backup options, you can compress multiple directories and some directories or files in multiple partitions into a single compressed package.
My tools can also package files from different disk partitions in a compressed file. The action method is also simple: directly drag the file or folder you want to compress into the main window, as shown in the following figure:

The program generates a compression package with 7z Open Interface as follows:

6. You can easily get the full pathname of a directory or file.
One of the most common features I use in FishCabToolExt.dll is that when you right-click a file or folder, you can easily get its full path. Before the effect chart, please refer to the previous article.

7. You can easily open a command line window from any directory.
I prefer to use Windows Server 2003, but whenever I perform some tasks on the command line, I have to open the "Run" window, enter "cmd", then switch the path, too troublesome. There is a feature in the FishCabToolExt.dll that can easily solve this tedious process. You only need to right-click the directory in Windows Explorer, or right-click in the margin of the directory window, and click the menu "Open Command Window from here", and you will find that the current directory of the command line window is the directory you need. Before the effect chart, please refer to the previous article.
Compression Effect
To demonstrate that my tools are significantly improving on the source code catalog compression, I'm now going to compare my tools with 7-zip.
First of all, I would like to explain that 7-zip is the world's best compression software, it has the highest compression rate.
But its only regret is that it does not automatically filter unnecessary junk files (relative to the source code) during compression, so the resulting compression package is not the smallest.

First, I open VS2008, create a consoleapplication, and then do not modify any settings, and write the following code:

Copy Code code as follows:

Namespace ConsoleApplication1
{
Class Program
{
static void Main (string[] args)
{
Console.WriteLine ("Hello Fish.");
}
}
}

Again, I compile this project in debug and release mode.

Then I asked the 7-zip V9.2 I installed to make a compression package for this project directory. Then, I used my tools to make a compression package. The size of the two packages is as follows:

If there is a picture of the truth, I will not explain it more.
Supplementary Notes
The default parameters are set according to the C # project and the SVN version control software, and if there are additional backup requirements, reset the parameters.
The default parameter does not use the best compression quality, if you need high compression quality, then please adjust yourself.
Running this program requires. NET Frarmework 2.0
Because FishCabToolExt.dll is an ATL COM, compiled by a 32-bit VC + + compiler, this plugin can only run in 32-bit Windows.
However, FishCabTool.exe is a WinForm program written in C # and requires 32-bit operation, so if you are in 64-bit Windows, you can only enable this program from the Start menu.
At this point, the program still works, but it cannot be started from the right menu of the resource manager.


How to clean Uninstall this tool

I'm writing a gadget that I think is useful, not rogue software. If you think it has no advantages, uninstall it as follows.

Since FishCabToolExt.dll is a plug-in for Windows Explorer, it cannot be uninstalled immediately once it is loaded. For details, please refer to the following:

The Fishcabtool installer can remove Fishcabtool from your computer very cleanly (including all files and registry entries).
To uninstall, close all Explorer windows (log back on after we recommend logoff), and then open Add or Remove Programs directly in Control Panel and select Delete Fishcabtool.
Note: Because a part of the Fishcabtool is automatically loaded as a resource manager, it is important to be sure to close all Explorer windows (including the desktop process) when uninstalling.


Upload Code to Blog Park
Because the background operation interface of Blog Park only supports three kinds of compressed package: Zip, rar, 7z, so if you intend to use this tool to package your code and upload it to the blog park, please modify the filename, followed by the. 7z
For example: My blog "client-side asynchronous operation" provides some sample code, I packed the tool, the generated file name is "Asyncclient_20111023.cab", and then I modify the filename to "asyncclient_20111023.cab.7z", You can upload it.
Can be assured that: 7-zip can be identified with this renamed file.

Because there are fewer people who know the cab format, and some sites may not be able to support direct uploads, you can modify the extension in this way.

Here, I send an initiative: From now on, if you want to share your sample code with others, do not include unnecessary junk files when you package.
Because those rubbish file will: Waste your upload time, waste the server's hard disk resources, waste the server bandwidth, waste all users download time.
It is a good effort to benefit people.

Description: Tools available free of charge, no copyright restrictions.

Click here to download the installer (2011-10-30 update)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.