A simple file Splitter

Source: Internet
Author: User

after a day, the Program is finally completed. This software is actually easy to implement. It took me a few hours to complete a simple version this Friday. But it seems that the implementation is too bad. As the boss of our group said, many people like to put all the logic implementations into the UI interface, this sentence touched me a lot. I suddenly felt a little bit aware of how to generate a class. I used to know the concept of a class, but I had to design it myself, I don't know how to put some logic and data into a class. Although I use an object-oriented tool, I write a process-oriented program. I used to put all the logic into the UI. I don't know how to extract a class for processing. I am so grateful to you for your support. Then I made an improvement last night and wrote several more logic processing classes.

one is the class of the file merge, and the other is the class of the file splitter. After reading The multithreading of a program, I also made a two-thread method to implement file separation, because now it is usually two CPU computers, this is quite useful, in fact, the file merging function can also be implemented using two threads, but I will not do it, it is a bit boring and time-consuming. First, this software was available only because it was always depressing due to file size restrictions during email uploading. You can use it if you know how to implement it. The implementation of file splitting and merging is actually quite simple. When splitting, you only need to open the file, read the size of the file you want to split, and write data into a file, you can do this once. Merging reads data from multiple files in sequence, and then writes all the data to one file. Other complicated problems are the processing of small issues such as file names and file paths, which are simple but easy to make mistakes and ignore. I planted them here. It makes me stay up late from last night to more than 5. What impressed me most when I wrote this program is that I thought of the delegate to transfer the data when processing progress in the splitter and merge, to process the value of the current progress bar in the window, then I designed an interface for it to be executed in multiple classes. Originally, this interface uses classes. In that case, we had to inherit the class and rewrite different methods of different classes. Later I thought that we could inherit the class in the window, then you can process it in the window class, which saves the trouble of applying the form progress bar to the newly inherited class and the window class. Because C # does not support multi-inheritance, I made an interface and later found that it is better to use the interface, this is exactly what I have read in the Article . In the future, the development of software will be interface-oriented, although this may not be a big deal for the experts, it may be a bad design idea. In this case, I hope the experts can give some advice and I will thank you first here.

There is nothing else to say about this program, which is simple. If you want to see the program directly, you can. To use this software, note that by default, this software generates a file name with the suffix _ divided in the current directory as the name of the folder, then the split files will be stored in this folder. When creating this folder, pay special attention to the content to be deleted, so keep your data safe. Note that the merged folder must be suffixed with _ divided. By default, the file name is the name after the suffix is removed, but you can enter this by yourself. Then the generated file is placed in the same directory as the merged folder.

Okay, let's not talk about anything else,Source codeSee the following (including my previous two projects and an example of online download): file Splitter
I hope you can give me some advice.

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.