青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

posts - 94, comments - 250, trackbacks - 0, articles - 0
  C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

上一次熟悉了IO系統后, 寫個程序來練練手.

正好這次看到App命名空間, 正好熟悉一下ConsoleApplication的用法. 因為Nebula3內置了ZipFileSystem, 但不支持壓縮, 只支持解壓縮, 就試著寫了一個命令行的unzip.exe, 算是對之前所學的一個總結.

沒想解壓縮就像拷貝文件一樣簡單! 因為當zip文件掛載到IO系統后, 可以像本地文件一樣使用其中的文件, 呵呵.

 1: /********************************************************************
 2: 	created:	2008/07/08
 3: 	created:	8:7:2008   16:15
 4: 	filename: 	UnZip.cpp
 5: 	author:		xoyojank
 6: 	
 7: 	purpose:	zip file extract test
 8: *********************************************************************/
 9: 
10: #include "stdneb.h"
11: #include "UnZipApp.h"
12: 
13: using namespace Util;
14: 
15: //------------------------------------------------------------------------------
16: /**
17: */
18: void __cdecl
19: main(int argc, const char** argv)
20: {
21: 	CmdLineArgs args(argc, argv);
22: 	UnZipApp app;
23: 	app.SetCompanyName("Xoyojank");
24: 	app.SetAppName("UnZip");
25: 	app.SetCmdLineArgs(args);
26: 	if (app.Open())
27: 	{
28: 		app.Run();
29: 		app.Close();
30: 	}
31: 	system("pause");
32: 	app.Exit();
33: }
 1: /********************************************************************
 2: 	created:	2008/07/08
 3: 	created:	8:7:2008   16:16
 4: 	filename: 	UnZipApp.h
 5: 	author:		xoyojank
 6: 	
 7: 	purpose:	UnZip Application
 8: *********************************************************************/
 9: #pragma once
10: #include "stdneb.h"
11: #include "app/consoleapplication.h"
12: 
13: class UnZipApp : public App::ConsoleApplication
14: {
15: public:
16: 	UnZipApp(void);
17: 
18: 	/// open the application
19: 	virtual bool Open();
20: 	/// run the application, return when user wants to exit
21: 	virtual void Run();
22: 
23: private:
24: 	/// a recursion method to unzip the files under "dir"
25: 	void UnZipDir(Util::String& dir);
26: private:
27: 	Util::String zipFileName;
28: 	Util::String sourcePath;
29: 	Util::String targetPath;
30: };
 1: /********************************************************************
 2: 	created:	2008/07/08
 3: 	created:	8:7:2008   16:19
 4: 	filename: 	UnZipApp.cpp
 5: 	author:		xoyojank
 6: 	
 7: 	purpose:	UnZip Application
 8: *********************************************************************/
 9: #include "UnZipApp.h"
10: 
11: 
12: UnZipApp::UnZipApp(void)
13: {
14: }
15: 
16: bool UnZipApp::Open()
17: {
18: 	if (ConsoleApplication::Open())
19: 	{
20: 		// help info
21: 		if (this->args.HasArg("-help"))
22: 		{
23: 			n_printf("-file: the .zip file to unzip.\n");
24: 			n_printf("-path: where are the files unzip to, if this args is omitted, the file will be unzip into current directory.\n");
25: 			return false;
26: 		}
27: 
28: 		Util::String zipFile;
29: 		zipFile = this->args.GetString("-file");
30: 		// current .exe directory
31: 		this->sourcePath = Util::String("bin:") + zipFile;
32: 		bool fileValid = this->ioServer->MountZipArchive(this->sourcePath);
33: 		if (!fileValid)
34: 		{
35: 			// absolute path
36: 			this->sourcePath = Util::String("file:///") + zipFile;
37: 			fileValid = this->ioServer->MountZipArchive(this->sourcePath);
38: 			if (!fileValid)
39: 			{
40: 				n_error("Cannot open zip file.\n");
41: 				return false;
42: 			}
43: 		}
44: 		this->zipFileName = zipFile.ExtractFileName();
45: 		this->zipFileName.StripFileExtension();
46: 		this->sourcePath = this->sourcePath.ExtractDirName() + "/";
47: 
48: 		// target directory
49: 		this->targetPath = this->args.GetString("-path");
50: 		if (this->targetPath.Length() <= 1 || this->targetPath[1] != ':')
51: 		{// relative path
52: 			this->targetPath = Util::String("bin:") + this->targetPath;
53: 		}
54: 		else
55: 		{// absolute path
56: 			this->targetPath = Util::String("file:///") + this->targetPath;
57: 		}
58: 		this->targetPath += "/";
59: 		if (this->sourcePath == this->targetPath)
60: 		{
61: 			n_printf("the source diretory cannot be the same with the destination!");
62: 			return false;
63: 		}
64: 		return true;
65: 	}
66: 	return false;
67: }
68: 
69: void UnZipApp::Run()
70: {
71: 	UnZipDir(this->zipFileName);
72: }
73: 
74: void UnZipApp::UnZipDir( Util::String& dir )
75: {
76: 	// create a new directory
77: 	this->ioServer->CreateDirectory(this->targetPath + dir);
78: 	// unzip the files in this directory
79: 	Util::Array<Util::String> listFile = this->ioServer->ListFiles(this->sourcePath + dir, "*");
80: 	for (IndexT i = 0; i < listFile.Size(); i++)
81: 	{
82: 		Util::String curFile = this->targetPath + dir + "/" + listFile[i];
83: 		this->ioServer->CopyFile(this->sourcePath + dir + "/" + listFile[i], curFile);
84: 		n_printf("%s\n", curFile.AsCharPtr());
85: 	}
86: 	// unzip the sub directories
87: 	Util::Array<Util::String> listDir = this->ioServer->ListDirectories(this->sourcePath + dir, "*");
88: 	for (IndexT i = 0; i < listDir.Size(); i++)
89: 	{
90: 		Util::String curDir = dir + "/" + listDir[i];
91: 		n_printf("%s\n", (this->targetPath + curDir).AsCharPtr());
92: 		UnZipDir(curDir);
93: 	}
94: }

調試參數:

運行結果:


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            国产伦一区二区三区色一情| 亚洲免费影视第一页| 久热精品视频在线免费观看| 亚洲午夜免费视频| 亚洲欧洲日本国产| 欧美丰满少妇xxxbbb| 亚洲福利视频免费观看| 亚洲国产日韩欧美| 亚洲视频播放| 欧美一级视频| 噜噜噜久久亚洲精品国产品小说| 欧美成年人网| 国产精品久久久久久久午夜| 国产一区二区三区日韩| 亚洲国产欧美在线人成| 亚洲一区免费网站| 久久久久久久久久码影片| 欧美成人亚洲成人| 亚洲手机视频| 欧美a级片网| 国产精品一区二区在线| 亚洲黄色小视频| 欧美在线视频日韩| 亚洲日本精品国产第一区| 亚洲欧美亚洲| 欧美日韩成人在线观看| 国产视频一区二区在线观看| 99国产精品久久久久久久| 久久国产精品99国产精| 亚洲精选视频免费看| 久久三级视频| 国产日韩综合| 亚洲一区二区久久| 欧美成va人片在线观看| 欧美大片一区| 国产欧美在线| 国产精品99久久久久久白浆小说 | 91久久午夜| 亚洲欧美成人| 亚洲人成小说网站色在线| 欧美在线观看视频| 欧美一区二区三区电影在线观看| 久久久久久久久久久久久9999| 欧美顶级艳妇交换群宴| 国产精品一区二区在线观看网站| 亚洲激情不卡| 久久9热精品视频| 日韩小视频在线观看专区| 久久全国免费视频| 国产欧美一区二区精品婷婷| 一本色道久久综合亚洲精品婷婷| 蜜臀91精品一区二区三区| 亚洲欧美日产图| 欧美日韩精品久久久| 亚洲高清视频一区| 久久综合中文字幕| 久久精品国产久精国产一老狼| 国产农村妇女毛片精品久久麻豆| 亚洲一区二区三区在线播放| 亚洲免费不卡| 欧美三日本三级少妇三2023| 99精品久久久| 99视频国产精品免费观看| 欧美日韩三级| 亚洲欧美影院| 亚洲欧美另类国产| 国产亚洲精品福利| 久久这里只有精品视频首页| 久久久噜噜噜| 亚洲国产日韩美| 亚洲国产一区二区精品专区| 欧美精品乱码久久久久久按摩| 99re热精品| 一区二区高清视频在线观看| 国产精品观看| 久久九九国产精品| 久久久久国产精品一区二区| 亚洲高清网站| 一区二区不卡在线视频 午夜欧美不卡在| 欧美午夜精品一区| 久久成人精品电影| 久久婷婷久久一区二区三区| 91久久夜色精品国产九色| 亚洲国产精品一区二区三区| 欧美日韩人人澡狠狠躁视频| 欧美一区国产一区| 久久精品免费| 欧美在线|欧美| 欧美日韩一区二区三区在线 | 亚洲宅男天堂在线观看无病毒| 国产欧美日韩精品专区| 欧美成人中文| 国产精品免费网站| 欧美韩日精品| 国产精品嫩草久久久久| 美女视频一区免费观看| 欧美日韩一区二区在线观看视频| 欧美中文字幕在线视频| 老司机久久99久久精品播放免费 | 亚洲激情视频网| 亚洲综合视频网| 一区二区三区无毛| 最新中文字幕一区二区三区| 国产欧美婷婷中文| 亚洲欧洲日本国产| 韩日欧美一区| 亚洲调教视频在线观看| 亚洲欧洲一区二区在线播放| 亚洲欧美综合国产精品一区| 亚洲三级电影在线观看| 亚洲综合色丁香婷婷六月图片| 亚洲欧洲一区二区三区久久| 性做久久久久久免费观看欧美| 日韩写真视频在线观看| 久久国产欧美精品| 亚洲尤物在线视频观看| 久久影视三级福利片| 羞羞答答国产精品www一本| 欧美精品日韩综合在线| 欧美成年人在线观看| 狠狠狠色丁香婷婷综合激情| 亚洲一区视频| 亚洲一区二区三区777| 看欧美日韩国产| 久久理论片午夜琪琪电影网| 国产欧美在线看| 亚洲免费在线观看视频| 一区二区三区av| 亚洲欧美日韩在线高清直播| 欧美精品精品一区| 免费看成人av| 久久精品国产一区二区三| 亚洲精品视频在线播放| 久久精品一区二区三区四区| 欧美在线看片| 国产乱子伦一区二区三区国色天香| 99精品久久| 亚洲主播在线观看| 国产精品久久久亚洲一区 | 久久久国产成人精品| 久久aⅴ国产欧美74aaa| 国产女主播一区二区三区| 亚洲综合丁香| 久久精品国产第一区二区三区| 国产伦精品一区二区三区| 久久九九精品| 国产欧美日韩高清| 欧美国产极速在线| 亚洲国产成人av| 欧美成人在线免费视频| 91久久久一线二线三线品牌| 久久精品国产久精国产爱| 久久免费视频一区| 一区二区三区在线视频观看| 久久久欧美一区二区| 亚洲二区免费| 亚洲性感激情| 国产一区二区三区在线观看视频| 欧美一区二区三区在线视频 | 久久亚洲不卡| 亚洲高清久久网| 欧美色区777第一页| 亚洲一区久久| 蜜桃av一区二区在线观看| 亚洲精品小视频| 美女网站久久| 亚洲性色视频| 牛人盗摄一区二区三区视频| 亚洲精品免费一二三区| 国产精品国产三级国产| 久久久久久久欧美精品| 91久久夜色精品国产九色| 亚洲少妇最新在线视频| 国产日韩欧美在线| 暖暖成人免费视频| 午夜精品影院在线观看| 巨胸喷奶水www久久久免费动漫| 亚洲精品欧美在线| 国产精品户外野外| 久久久国产午夜精品| 亚洲日本激情| 久久久91精品国产一区二区三区| 亚洲国产日韩在线| 国产精品久久久久永久免费观看| 久久夜色精品| 中文精品视频一区二区在线观看| 午夜在线观看免费一区| 亚洲国产精品成人久久综合一区| 国产精品久久97| 麻豆精品在线视频| 欧美亚洲网站| 日韩一区二区精品葵司在线| 久久综合中文色婷婷| 一区二区三区精品国产| 91久久国产综合久久| 国产综合久久久久影院| 欧美性大战xxxxx久久久| 麻豆成人在线播放| 久久国产精品72免费观看| 亚洲综合日韩|