94 lines
2.5 KiB
C
94 lines
2.5 KiB
C
|
|
#pragma once
|
|||
|
|
#include <fstream>
|
|||
|
|
#include <Windows.h>
|
|||
|
|
#include <iostream>
|
|||
|
|
class BaseRead :public std::fstream
|
|||
|
|
{
|
|||
|
|
private:
|
|||
|
|
|
|||
|
|
const BYTE Key[256] = { 112,117,99,104,105,107,111,110,64,110,101,111,112,108,101,32,100,117,110,103,101,111,110,32,97,110,100,32,102,105,103,104,116,101,114,32,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,68,78,70,0 };
|
|||
|
|
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
//char* ת<><D7AA><EFBFBD><EFBFBD>
|
|||
|
|
int CharToInt(char* Str)
|
|||
|
|
{
|
|||
|
|
return *(int*)Str;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//char* תLong
|
|||
|
|
long CharToLong(char* Str)
|
|||
|
|
{
|
|||
|
|
return *(long long*)Str;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
int ReadInt()
|
|||
|
|
{
|
|||
|
|
char* CountBuffer = new char[4];
|
|||
|
|
for (int i = 0; i < 4; i++)
|
|||
|
|
{
|
|||
|
|
this->get(CountBuffer[i]);
|
|||
|
|
}
|
|||
|
|
int Count = CharToInt(CountBuffer);
|
|||
|
|
delete[]CountBuffer;
|
|||
|
|
return Count;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
|||
|
|
std::string ReadString()
|
|||
|
|
{
|
|||
|
|
char* CharBuffer = new char[1024];
|
|||
|
|
this->get(CharBuffer, 1024, '\0');
|
|||
|
|
std::string Str = CharBuffer;
|
|||
|
|
delete[]CharBuffer;
|
|||
|
|
this->seekg(1, std::ios::cur);
|
|||
|
|
return Str;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ȡNPK<50><4B>Ϣ
|
|||
|
|
std::string ReadInfo()
|
|||
|
|
{
|
|||
|
|
char* CharBuffer = new char[256];
|
|||
|
|
char var;
|
|||
|
|
int i = 0;
|
|||
|
|
while (i < 256)
|
|||
|
|
{
|
|||
|
|
this->get(var);
|
|||
|
|
CharBuffer[i] = var ^ Key[i];
|
|||
|
|
++i;
|
|||
|
|
}
|
|||
|
|
std::string Str = CharBuffer;
|
|||
|
|
delete[] CharBuffer;
|
|||
|
|
return Str;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>LONG
|
|||
|
|
int ReadLong()
|
|||
|
|
{
|
|||
|
|
char* CountBuffer = new char[8];
|
|||
|
|
for (int i = 0; i < 8; i++)
|
|||
|
|
{
|
|||
|
|
this->get(CountBuffer[i]);
|
|||
|
|
}
|
|||
|
|
long Count = CharToLong(CountBuffer);
|
|||
|
|
delete[]CountBuffer;
|
|||
|
|
return Count;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
BYTE* ReadCustomSize(int Size)
|
|||
|
|
{
|
|||
|
|
BYTE* CharBuffer = new BYTE[Size];
|
|||
|
|
for (int j = 0; j < Size; j++)
|
|||
|
|
{
|
|||
|
|
char var;
|
|||
|
|
this->get(var);
|
|||
|
|
CharBuffer[j] = var;
|
|||
|
|
}
|
|||
|
|
return CharBuffer;
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|