9#define Z_STREAM_ERROR (-2)
10#define Z_DATA_ERROR (-3)
11#define Z_MEM_ERROR (-4)
12#define Z_BUF_ERROR (-5)
13#define Z_VERSION_ERROR (-6)
46 auto size = kmyIO::getResourceFileSize(p.c_str());
47 auto buff = gcnew array<byte>(size);
51 auto* fs = kmyIO::FS::newFS();
52 auto* stream = fs->open(p.c_str(), kmyIO::StreamBase::kREAD_MODE);
54 if (stream !=
nullptr)
58 TRACK_NEW_ARRAY(tmp,
byte, size);
60 stream->read(tmp,
sizeof(
byte), size);
62 for (
size_t i = 0; i < size; i++)
69 SAFE_DELETE_ARRAY(tmp);
84 static unsigned char*
getCodes(
bool flag,
int& refCodeCnt)
86 return kmyIO::getCodes(flag, refCodeCnt);
95 static bool compress(System::IO::BinaryWriter^ inWriter, System::IO::MemoryStream^ inStream)
97 auto srcSize = inStream->Length;
100 TRACK_NEW_ARRAY(srcBuff,
byte, srcSize);
102 for (
size_t i = 0; i < srcSize; i++)
104 srcBuff[i] = (byte)inStream->ReadByte();
109 TRACK_NEW_ARRAY(compressBuff,
byte, srcSize);
111 auto compressSize = (size_t)srcSize;
115 switch (kmyBase::CompressUtil::compress(srcBuff, inStream->Length, compressBuff, compressSize))
121 auto outSize = min(compressSize, srcSize);
122 auto outBuff = outSize == srcSize ? srcBuff : compressBuff;
124 for (
size_t i = 0; i < outSize; i++)
126 inWriter->Write(outBuff[i]);
135 SAFE_DELETE_ARRAY(srcBuff);
136 SAFE_DELETE_ARRAY(compressBuff);
static std::string convert(System::String^ s)
Definition: SharpKmyCore.h:33
static bool initializeResourceFileInfo(System::String^ inPath)
リソースファイルの管理情報の初期化
Definition: FSEx.h:23
static array< byte > readResourceFileAllBytes(System::String^ inPath)
リソースファイルの全バイナリの取得
Definition: FSEx.h:43
static bool existsResourceFile(System::String^ inPath)
リソースファイルの存在確認
Definition: FSEx.h:33
static bool compress(System::IO::BinaryWriter^ inWriter, System::IO::MemoryStream^ inStream)
圧縮処理
Definition: FSEx.h:95
static unsigned char * getCodes(bool flag, int &refCodeCnt)
スクランブルコードの取得
Definition: FSEx.h:84