Ejemplo n.º 1
0
		void recursiveFillIncludedLuaFileNames(std::set<string>& mLuaScriptNames, const Path& mPackPath, const string& mLuaScript)
		{
			for(const auto& name : getIncludedLuaFileNames(mLuaScript))
			{
				mLuaScriptNames.insert(name);
				recursiveFillIncludedLuaFileNames(mLuaScriptNames, mPackPath, getFileContents(mPackPath + "/Scripts/" + name));
			}
		}
Ejemplo n.º 2
0
		void recursiveFillIncludedLuaFileNames(unordered_set<string>& mLuaScriptNames, const string& mPackPath, const string& mLuaScript)
		{
			unordered_set<string> current{getIncludedLuaFileNames(mLuaScript)};
			for(const auto& name : current)
			{
				mLuaScriptNames.insert(name);
				recursiveFillIncludedLuaFileNames(mLuaScriptNames, mPackPath, getFileContents(mPackPath + "/Scripts/" + name));
			}
		}
Ejemplo n.º 3
0
		string get182Validator(const string& mPackPath, const string& mLevelId, const string& mLevelRootPath, const string& mStyleRootPath, const string& mLuaScriptPath, float mDifficultyMultiplier)
		{
			string luaScriptContents{get182FileContents(mLuaScriptPath)}, toEncrypt{""};
			unordered_set<string> luaScriptNames;
			recursiveFillIncludedLuaFileNames(luaScriptNames, mPackPath, luaScriptContents);

			toEncrypt.append(mLevelId);
			toEncrypt.append(toStr(mDifficultyMultiplier));
			toEncrypt.append(get182FileContents(mLevelRootPath));
			toEncrypt.append(get182FileContents(mStyleRootPath));
			toEncrypt.append(luaScriptContents);

			for(auto& luaScriptName : luaScriptNames) toEncrypt.append(get182FileContents(mPackPath + "/Scripts/" + luaScriptName));

			toEncrypt = get182ControlStripped(toEncrypt);
			return get182UrlEncoded(mLevelId) + get182MD5Hash(toEncrypt + serverKey182);
		}
Ejemplo n.º 4
0
		string get181Validator(const string& mPackPath, const string& mLevelId, const string& mJsonRootPath, const string& mLuaScriptPath, float mDifficultyMultiplier)
		{
			string luaScriptContents{get181FileContents(mLuaScriptPath)}, result{""};
			unordered_set<string> luaScriptNames;
			recursiveFillIncludedLuaFileNames(luaScriptNames, mPackPath, luaScriptContents);

			result.append(get181UrlEncoded(mLevelId));
			result.append(get181MD5Hash(get181FileContents(mJsonRootPath) + serverKey182));
			result.append(get181MD5Hash(luaScriptContents + serverKey182));

			for(auto& luaScriptName : luaScriptNames)
			{
				string path{mPackPath + "/Scripts/" + luaScriptName}, contents{get181FileContents(path)}, hash{get181MD5Hash(contents + serverKey182)}, compressedHash{""};
				for(unsigned int i{0}; i < hash.length(); ++i) if(i % 3 == 0) compressedHash.append(toStr(hash[i]));
				result.append(compressedHash);
			}

			result.append(get181UrlEncoded(toStr(mDifficultyMultiplier))); return result;
		}
Ejemplo n.º 5
0
		string getValidator(const Path& mPackPath, const string& mLevelId, const string& mLevelRootString, const Path& mStyleRootPath, const Path& mLuaScriptPath)
		{
			string luaScriptContents{mLuaScriptPath.getContentsAsStr()};
			std::set<string> luaScriptNames;
			recursiveFillIncludedLuaFileNames(luaScriptNames, mPackPath, luaScriptContents);

			string toEncrypt;
			toEncrypt += mLevelId;
			toEncrypt += getControlStripped(mLevelRootString);
			toEncrypt += mStyleRootPath.getContentsAsStr();
			toEncrypt += luaScriptContents;
			for(const auto& lsn : luaScriptNames)
			{
				Path path{mPackPath + "/Scripts/" + lsn};
				toEncrypt += path.getContentsAsStr();
			}

			toEncrypt = getControlStripped(toEncrypt);
			return getUrlEncoded(mLevelId) + getMD5Hash(HG_ENCRYPT(toEncrypt));
		}