一个工具类,生成一些废代码,用于混淆

发布多个微信小游戏,因为用的游戏框架是同一个,被微信判定代码雷同不给过审核。

于是加了点废代码。不知道能不能过哦。如果是人工审核,那基本没戏。。。 

工具类

/**
 * 生成一些废代码,用于混淆
 * @author chenkai 2018/10/7
 */
class ConfuseTool {
	public constructor() {


	}

	public static createClass(num:number){
		let str = "";
		for(let i=0;i<num;i++){
			//类
			str += "class " + this.getLetter() + "{" + "\n";

			//属性
			for(let i=0;i<20;i++){
				str += "    public " + this.getLetter() + ";"+ "\n";
			}

			//函数
			for(let i=0;i<20;i++){
				str += "    public " + this.getLetter() + "(){"+ "\n";
				for(let i=0;i<10;i++){
					str += "        let " + this.getLetter() + " = '" + this.getLetter() + "';"+ "\n";
				}
				str += "    }"+ "\n";
			}
			//类结束
			str += "}"+ "\n";
		}
		return str;
	}




	/**混淆的字母和数字 */
	public static confuseStr = "abcdefghijklmnopqrstuvwxyz";
	/**获取混淆的字符串 */
	public static getLetter(){
		let str = "";
		let strLen = this.confuseStr.length;
		let len = 20;
		for(let i=0;i<len;i++){
			str += this.confuseStr.charAt(Math.round(Math.random()*(strLen-1)));
		}
		return str;
	}

}

  

使用

console.log(ConfuseTool.createClass(1));

  

浏览器打印

猜你喜欢

转载自www.cnblogs.com/gamedaybyday/p/9751918.html