OROCHI
 
Loading...
Searching...
No Matches
GxResLicense.h
Go to the documentation of this file.
1//===========================================================================
9//===========================================================================
10#pragma once
11
12#if GX_DEVELOP
13
14GX_CORE_NAMESPACE_BEGIN()
15
16//===========================================================================
18//===========================================================================
19class GxResLicense : public GxResBase
20{
21 //-----------------------------------------------------------
23 //-----------------------------------------------------------
25public:
26 // RTTI宣言
27 GX_RTTI_RESOURCE(GxResLicense, GxResBase)
28 // ClassBaseReference継承クラス用禁止宣言
30
31
32 //-------------------------------------------------------------
34 //-------------------------------------------------------------
36
38 GxResLicense(void);
40 void cleanup(void) override;
42 virtual void clear(void);
43
45 //-----------------------------------------------------------
47 //-----------------------------------------------------------
49public:
50 // ライセンスチェック
51 static void checkLicense(void);
52 // ライセンスの期限取得(期限が1ヵ月前まで迫っている場合は、第1引数がtrueとなり、第2引数に期日を含んだ文字列が入ります。)
53 static void checkLicense(b32& isReportLog, GxString& reportString);
54private:
56 b32 load(GxStream& stream, u32 dataSize);
58 b32 save(GxStream& stream);
59 // 日数変換
60 static u32 getDays(u32 year, u32 month, u32 day);
61 // 入力データから指定場所のビットのみを残して出力
62 u8 pickupUCharFromUChar(const u32 position, const u8 value) const;
63 // 入力文字列から出力データにアンパック
64 void unpackString(s32* const pDst, const GX_CHAR* pSrc) const;
65 // 入力データから指定場所のビットを出力
66 b32 pickupBitFromUChar(const u32 position, const u8 value) const;
67 // 入力データの指定場所にビットを立てて出力
68 void setBitToUChar(u8* const pDst, const u32 position, const b32 value) const;
69 // 文字列をXOR暗号化
70 u32 encrypt(GX_CHAR** const pDst, const GX_CHAR* const pSrc, u32 dataSize, const GX_CHAR* const pSeed, u32 seedSize) const;
71 // ミックスされたデータから2つの文字列を復元
72 void decodeRandomMix(GX_CHAR** const ppDataLeft, u32* pDataLeftSize, GX_CHAR** const ppDataRight, u32* pDataRightSize, const GX_CHAR* const pSrc, const u32 dataSize) const;
73 // KEYデータ読み込み、年、月、日、文字列に出力
74 b32 readKey(s32* const pOutYear, s32* const pOutMonth, s32* const pOutDay, GX_CHAR** const ppDst, u32* const pOutDataSize, const GX_CHAR* const pSrc, const u32 srcDataSize, const GX_CHAR* const pSeed, const u32 seedSize) const;
75
77 //-------------------------------------------------------------
79 //-------------------------------------------------------------
81protected:
82 void* _pReadBuff;
83 u32 _fileSize;
84
86};
87
88//===========================================================================
90//===========================================================================
91class GxResLicenseOlf : public GxResLicense
92{
93 //-----------------------------------------------------------
95 //-----------------------------------------------------------
97public:
98 // RTTI宣言
99 GX_RTTI_RESOURCE(GxResLicenseOlf, GxResLicense)
100 // ClassBaseReference継承クラス用禁止宣言
101 GX_PROHIBIT_CLASS_BASE_REFERENCE(GxResLicenseOlf)
102
103
104 //-----------------------------------------------------------
106 //-----------------------------------------------------------
108
110 GxResLicenseOlf(void){}
111
113 //-----------------------------------------------------------
115 //-----------------------------------------------------------
117
119 GX_FORCE_INLINE b32 finalize(void){ return true; }
120
121protected:
123 b32 load(GxStream& stream, u32 dataSize);
125 b32 save(GxStream& stream);
126
128};
129
130GX_CORE_NAMESPACE_END()
131
132#endif //GX_DEVELOP
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
#define GX_RTTI_RESOURCE(__THIS__, __BASE__)
リソースクラス型情報宣言
Definition GxRttiResource.h:102
リソース基底クラス
Definition GxResBase.h:23
ストリーム基礎クラス
Definition GxStream.h:20
文字列型クラス
Definition GxString.h:18
32bitブーリアン
Definition GxDefine.h:173