//================================= //ファイルを分割します。 //================================= HRESULT CompressData::Split(char *inFileName) { Clear(); strcpy(m_fileName,inFileName); FILE *fin = fopen(m_fileName,"rb"); if(fin == NULL) { assert(!"分割する元のファイルがないですよ"); return E_FAIL; } //============================ //ファイルヘッダーの読み込み //============================ ReadHeader(fin); puts("結合ファイルの読み込み成功"); std::map<std::string,FileInfo>::iterator p = m_mapFile.begin(); for(DWORD i = 0; i < m_dwFileNum; i++) { FileInfo &fd = p->second; char *fileName = (char *)p->first.c_str(); DirectoryName(fileName); //ファイルを作成する前にディレクトリの作成 FILE *fout = fopen(fileName,"wb"); if(fout == NULL) { assert(!"引数の設定がおかしいです"); return E_FAIL; } fseek(fin,fd.startAdress,SEEK_SET); Decompress(fin,fout); fclose(fout); p++; printf("%sの書き込み成功\n",fileName); } puts("書き込み成功"); fclose(fin); return S_OK; }
static bool TryGetDirectoryCreationTimeUtc(const FString& InDirectoryName, FDateTime& OutCreationTime) { FString DirectoryName(InDirectoryName); FPaths::MakePlatformFilename(DirectoryName); WIN32_FILE_ATTRIBUTE_DATA Info; if (!GetFileAttributesExW(*DirectoryName, GetFileExInfoStandard, &Info)) { OutCreationTime = FDateTime(); return false; } SYSTEMTIME SysTime; if (!FileTimeToSystemTime(&Info.ftCreationTime, &SysTime)) { OutCreationTime = FDateTime(); return false; } OutCreationTime = FDateTime(SysTime.wYear, SysTime.wMonth, SysTime.wDay, SysTime.wHour, SysTime.wMinute, SysTime.wSecond); return true; }
void Directory::Load(const String &DirectoryPath) { _DirectoryPath = DirectoryPath + "\\"; _Files.FreeMemory(); _Directories.FreeMemory(); WIN32_FIND_DATA FindResult; //LARGE_INTEGER FileSize; HANDLE hFind = FindFirstFile((DirectoryPath + String("\\*")).CString(), &FindResult); if (hFind == INVALID_HANDLE_VALUE) { return; } do { if (FindResult.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { String DirectoryName(FindResult.cFileName); if(DirectoryName != String(".") && DirectoryName != String("..") && DirectoryName != String(".svn")) { _Directories.PushEnd(DirectoryName); } } else { //FileSize.LowPart = FindResult.nFileSizeLow; //FileSize.HighPart = FindResult.nFileSizeHigh; _Files.PushEnd(String(FindResult.cFileName)); } } while (FindNextFile(hFind, &FindResult) != 0); FindClose(hFind); }