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)
47 auto size = kmyIO::getResourceFileSize(p.c_str());
48 auto buff = gcnew array<byte>(size);
52 auto* fs = kmyIO::FS::newFS();
53 auto* stream = fs->open(p.c_str(), kmyIO::StreamBase::kREAD_MODE);
55 if (stream !=
nullptr)
59 TRACK_NEW_ARRAY(tmp,
byte, size);
61 stream->read(tmp,
sizeof(
byte), size);
63 for (
size_t i = 0; i < size; i++)
70 SAFE_DELETE_ARRAY(tmp);
86 static unsigned char*
getCodes(
bool flag,
int& refCodeCnt)
89 return kmyIO::getCodes(flag, refCodeCnt);
99 static bool compress(System::IO::BinaryWriter^ inWriter, System::IO::MemoryStream^ inStream)
102 auto srcSize = inStream->Length;
105 TRACK_NEW_ARRAY(srcBuff,
byte, srcSize);
107 for (
size_t i = 0; i < srcSize; i++)
109 srcBuff[i] = (byte)inStream->ReadByte();
114 TRACK_NEW_ARRAY(compressBuff,
byte, srcSize);
116 auto compressSize = (size_t)srcSize;
120 switch (kmyBase::CompressUtil::compress(srcBuff, inStream->Length, compressBuff, compressSize))
126 auto outSize = min(compressSize, srcSize);
127 auto outBuff = outSize == srcSize ? srcBuff : compressBuff;
129 for (
size_t i = 0; i < outSize; i++)
131 inWriter->Write(outBuff[i]);
140 SAFE_DELETE_ARRAY(srcBuff);
141 SAFE_DELETE_ARRAY(compressBuff);
static std::string convert(System::String^ s)
Definition: SharpKmyCore.cpp:36
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:99
static unsigned char * getCodes(bool flag, int &refCodeCnt)
スクランブルコードの取得
Definition: FSEx.h:86