上线专用客户端修复工具

This commit is contained in:
Yutousama 2019-06-10 17:41:37 +08:00
parent 825b3d820f
commit d18de231d0

View File

@ -10,6 +10,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.Switch;
import android.widget.TextView;
@ -30,6 +31,7 @@ public class MainActivity implements BaseActivityInterface {
private Context context;
private KProgressHUD hud;
public MainActivity() {
}
@ -44,7 +46,6 @@ public class MainActivity implements BaseActivityInterface {
}
@Override
public void onRestart() {
@ -97,12 +98,22 @@ public class MainActivity implements BaseActivityInterface {
Button button = new Button(context);
Button button2 = new Button(context);
final Switch siwtch = new Switch(context);
siwtch.setTextOn("覆盖版");
siwtch.setTextOff("共存版");
text1.setText("请将proj.manifest、Cocos2dxPrefsFile.xml和压缩包放到jianRMG/harmony/文件夹中\n压缩包请重命名为data.zip");
siwtch.setText("共存版");
text1.setText("请将proj.manifest、Cocos2dxPrefsFile.xml和压缩包放到jianRMG/harmony/文件夹中");
button.setText("创建harmony文件夹");
button2.setText("开始");
siwtch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked){
siwtch.setText("覆盖版");
}else{
siwtch.setText("共存版");
}
}
});
linearLayout.addView(text1);
linearLayout.addView(button);
linearLayout.addView(button2);
@ -123,40 +134,29 @@ public class MainActivity implements BaseActivityInterface {
@Override
public void onClick(View v) {
hud.show();
new Thread(new Runnable() {
@Override
public void run() {
File file=new File(Utils.getAppPath()+"/harmony/");
final File file = new File(Utils.getAppPath() + "/harmony/");
if (file.listFiles().length == 0) {
Utils.toast(context, "文件夹内为空请放入harmony文件夹中");
return;
}
for (File listFile : file.listFiles()) {
System.out.println("处理文件:"+listFile.getAbsolutePath());
switch (listFile.getName()){
case "proj.manifest":
ClientUttls.install(context, listFile, "/files/", new ModInterface() {
@Override
public void onAction(boolean flag, int type) {
System.out.println("操作manifest文件"+flag);
}
});
break;
case "Cocos2dxPrefsFile.xml":
ClientUttls.install(context, listFile, "../shared_prefs/", new ModInterface() {
File xml = new File(file.getAbsolutePath() + "/Cocos2dxPrefsFile.xml");
System.out.println(xml.getAbsoluteFile());
if (xml.exists()) {
ClientUttls.install(context, xml, "../shared_prefs/", new ModInterface() {
@Override
public void onAction(boolean flag, int type) {
System.out.println("处理xml" + flag);
}
});
break;
case "data.zip":
if (flag) {
for (File listFile : file.listFiles()) {
System.out.println("处理文件:" + listFile.getAbsolutePath());
if (listFile.getName().contains(".zip")) {
File path;
if (siwtch.isChecked()) {
path = new File(Utils.getSDCardPath() + "/Android/data/com.huanmeng.zhanjian2/files/res_default/10/");
System.out.println("操作对象:覆盖版");
} else {
path = new File(Utils.getSDCardPath() + "/Android/data/com.bigzhao.jianrmagicbox/files/res_default/10/");
System.out.println("操作对象:共存版");
}
if (!path.exists()) {
path.mkdirs();
@ -173,8 +173,16 @@ public class MainActivity implements BaseActivityInterface {
}
});
Utils.toast(context, "操作完成");
}else{
Utils.toast(context, "Cocos2dxPrefsFile.xml处理失败");
hud.dismiss();
}
}
});
} else {
Utils.toast(context, "Cocos2dxPrefsFile.xml文件不存在!");
hud.dismiss();
}
}).start();
}
});