#include "stdafx.h" #include "CSndHandler.h" CSndHandler::~CSndHandler() { entries.clear(); file.close(); } CSndHandler::CSndHandler(std::string fname):CHUNK(65535) { file.open(fname.c_str(),std::ios::binary); if (!file.is_open()) throw new std::exception((std::string("Cannot open ")+fname).c_str()); int nr = readNormalNr(0,4); char tempc; for (int i=0;i=0) file.seekg(pos,std::ios_base::beg); int ret=0; int amp=1; unsigned char zcz=0; for (int i=0; iCHUNK) { file.read(buffer,CHUNK); out.write(buffer,CHUNK); toRead-=CHUNK; } file.read(buffer,toRead); out.write(buffer,toRead); out.close(); } void CSndHandler::extract(std::string srcfile, std::string dstfile, bool caseSens) //saves selected file { if (caseSens) { for (int i=0;i0) entries[i-1].size=entry.offset-entries[i-1].offset; if (i==nr-1) { file.seekg(0,std::ios::end); entry.size = ((int)file.tellg())-entry.offset; file.seekg(0,std::ios::beg); } entries.push_back(entry); } } int CVidHandler::readNormalNr (int pos, int bytCon) { if (pos>=0) file.seekg(pos,std::ios_base::beg); int ret=0; int amp=1; unsigned char zcz=0; for (int i=0; iCHUNK) { file.read(buffer,CHUNK); out.write(buffer,CHUNK); toRead-=CHUNK; } file.read(buffer,toRead); out.write(buffer,toRead); out.close(); } void CVidHandler::extract(std::string srcfile, std::string dstfile, bool caseSens) //saves selected file { if (caseSens) { for (int i=0;i