239 lines
12 KiB
Java
239 lines
12 KiB
Java
package com.ubt.jimu.connect.model;
|
|
|
|
import android.util.Xml;
|
|
import com.ubt.jimu.base.util.PathHelper;
|
|
import com.ubt.jimu.controller.data.widget.JockstickDataConverter;
|
|
import com.ubtrobot.jimu.robotapi.BoardInfo;
|
|
import com.unity3d.ads.metadata.MediationMetaData;
|
|
import java.io.File;
|
|
import java.io.FileNotFoundException;
|
|
import java.io.FileOutputStream;
|
|
import java.io.IOException;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import org.xmlpull.v1.XmlSerializer;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class ModelMatchXmlFileManager {
|
|
private List<Integer> a = new ArrayList();
|
|
private List<Integer> b = new ArrayList();
|
|
|
|
public List<Integer> a() {
|
|
return this.b;
|
|
}
|
|
|
|
public List<Integer> b() {
|
|
return this.a;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX WARN: Removed duplicated region for block: B:69:0x00fb A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
|
/* JADX WARN: Type inference failed for: r8v13, types: [java.io.InputStream] */
|
|
/* JADX WARN: Type inference failed for: r8v14 */
|
|
/* JADX WARN: Type inference failed for: r8v17 */
|
|
/* JADX WARN: Type inference failed for: r8v18 */
|
|
/* JADX WARN: Type inference failed for: r8v19 */
|
|
/* JADX WARN: Type inference failed for: r8v2 */
|
|
/* JADX WARN: Type inference failed for: r8v20 */
|
|
/* JADX WARN: Type inference failed for: r8v21 */
|
|
/* JADX WARN: Type inference failed for: r8v22 */
|
|
/* JADX WARN: Type inference failed for: r8v3, types: [java.io.IOException] */
|
|
/* JADX WARN: Type inference failed for: r8v4 */
|
|
/* JADX WARN: Type inference failed for: r8v7 */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
|
*/
|
|
public void a(java.lang.String r8) {
|
|
/*
|
|
Method dump skipped, instructions count: 260
|
|
To view this dump change 'Code comments level' option to 'DEBUG'
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.ubt.jimu.connect.model.ModelMatchXmlFileManager.a(java.lang.String):void");
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX WARN: Type inference failed for: r10v22, types: [java.lang.String] */
|
|
public void a(BoardInfo boardInfo, String str) {
|
|
Throwable th;
|
|
FileOutputStream fileOutputStream;
|
|
if (boardInfo == null) {
|
|
return;
|
|
}
|
|
File file = new File(str);
|
|
String str2 = PathHelper.OLD_CONTROLLER_PREFIX + System.currentTimeMillis();
|
|
String property = System.getProperty("line.separator");
|
|
List<Integer> i = boardInfo.i();
|
|
BoardInfo.SensorBoardInfo sensorBoardInfo = boardInfo.h().get(10);
|
|
FileOutputStream fileOutputStream2 = null;
|
|
r10 = null;
|
|
FileOutputStream fileOutputStream3 = null;
|
|
fileOutputStream2 = null;
|
|
fileOutputStream2 = null;
|
|
fileOutputStream2 = null;
|
|
fileOutputStream2 = null;
|
|
List<Integer> b = sensorBoardInfo != null ? sensorBoardInfo.b() : null;
|
|
try {
|
|
try {
|
|
try {
|
|
FileOutputStream fileOutputStream4 = new FileOutputStream(file);
|
|
try {
|
|
XmlSerializer newSerializer = Xml.newSerializer();
|
|
newSerializer.setOutput(fileOutputStream4, "UTF-8");
|
|
int i2 = 1;
|
|
newSerializer.startDocument("UTF-8", true);
|
|
newSerializer.text(property);
|
|
newSerializer.startTag(null, "Root");
|
|
newSerializer.text(property);
|
|
newSerializer.startTag(null, "RobotID");
|
|
newSerializer.text(str2);
|
|
newSerializer.endTag(null, "RobotID");
|
|
newSerializer.text(property);
|
|
newSerializer.startTag(null, "DataType");
|
|
newSerializer.text("playerdata");
|
|
newSerializer.endTag(null, "DataType");
|
|
newSerializer.text(property);
|
|
newSerializer.startTag(null, "Level");
|
|
newSerializer.text("level");
|
|
newSerializer.endTag(null, "Level");
|
|
newSerializer.text(property);
|
|
if (i != null) {
|
|
Iterator<Integer> it = i.iterator();
|
|
while (it.hasNext()) {
|
|
int intValue = it.next().intValue();
|
|
Iterator<Integer> it2 = it;
|
|
newSerializer.startTag(null, "GO");
|
|
fileOutputStream = fileOutputStream4;
|
|
try {
|
|
newSerializer.attribute(null, JockstickDataConverter.ID, String.valueOf(i2));
|
|
newSerializer.attribute(null, "type", "seivo");
|
|
newSerializer.attribute(null, MediationMetaData.KEY_NAME, "seivo_" + intValue);
|
|
newSerializer.attribute(null, "djid", String.valueOf(intValue));
|
|
newSerializer.attribute(null, "motorID", "0");
|
|
newSerializer.attribute(null, "goPos", "(0,0,0)");
|
|
newSerializer.attribute(null, "goAngle", "(0,0,0)");
|
|
newSerializer.attribute(null, "goScale", "(1,1,1)");
|
|
newSerializer.attribute(null, "goColor", "(0,0,0,1)");
|
|
newSerializer.attribute(null, "isDP", "1");
|
|
newSerializer.endTag(null, "GO");
|
|
newSerializer.text(property);
|
|
i2++;
|
|
it = it2;
|
|
fileOutputStream4 = fileOutputStream;
|
|
fileOutputStream3 = null;
|
|
} catch (FileNotFoundException e) {
|
|
e = e;
|
|
fileOutputStream2 = fileOutputStream;
|
|
e.printStackTrace();
|
|
if (fileOutputStream2 != null) {
|
|
fileOutputStream2.close();
|
|
fileOutputStream2 = fileOutputStream2;
|
|
}
|
|
} catch (IOException e2) {
|
|
e = e2;
|
|
fileOutputStream2 = fileOutputStream;
|
|
e.printStackTrace();
|
|
if (fileOutputStream2 != null) {
|
|
fileOutputStream2.close();
|
|
fileOutputStream2 = fileOutputStream2;
|
|
}
|
|
} catch (IllegalArgumentException e3) {
|
|
e = e3;
|
|
fileOutputStream2 = fileOutputStream;
|
|
e.printStackTrace();
|
|
if (fileOutputStream2 != null) {
|
|
fileOutputStream2.close();
|
|
fileOutputStream2 = fileOutputStream2;
|
|
}
|
|
} catch (IllegalStateException e4) {
|
|
e = e4;
|
|
fileOutputStream2 = fileOutputStream;
|
|
e.printStackTrace();
|
|
if (fileOutputStream2 != null) {
|
|
fileOutputStream2.close();
|
|
fileOutputStream2 = fileOutputStream2;
|
|
}
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
th = th;
|
|
if (fileOutputStream != null) {
|
|
try {
|
|
fileOutputStream.close();
|
|
throw th;
|
|
} catch (Exception e5) {
|
|
e5.printStackTrace();
|
|
throw th;
|
|
}
|
|
}
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
fileOutputStream = fileOutputStream4;
|
|
if (b != null) {
|
|
Iterator<Integer> it3 = b.iterator();
|
|
fileOutputStream3 = fileOutputStream3;
|
|
while (it3.hasNext()) {
|
|
int intValue2 = it3.next().intValue();
|
|
newSerializer.startTag(null, "GO");
|
|
newSerializer.attribute(null, JockstickDataConverter.ID, String.valueOf(i2));
|
|
newSerializer.attribute(null, "type", "motor");
|
|
newSerializer.attribute(null, MediationMetaData.KEY_NAME, "motor_" + intValue2);
|
|
newSerializer.attribute(null, "djid", "0");
|
|
newSerializer.attribute(null, "motorID", String.valueOf(intValue2));
|
|
newSerializer.attribute(null, "goPos", "(0,0,0)");
|
|
newSerializer.attribute(null, "goAngle", "(0,0,0)");
|
|
newSerializer.attribute(null, "goScale", "(1,1,1)");
|
|
newSerializer.attribute(null, "goColor", "(0,0,0,1)");
|
|
newSerializer.attribute(null, "isDP", "1");
|
|
newSerializer.endTag(null, "GO");
|
|
newSerializer.text(property);
|
|
i2++;
|
|
fileOutputStream3 = "1";
|
|
}
|
|
}
|
|
newSerializer.endTag(null, "Root");
|
|
newSerializer.text(property);
|
|
newSerializer.endDocument();
|
|
newSerializer.flush();
|
|
fileOutputStream.close();
|
|
fileOutputStream2 = fileOutputStream3;
|
|
} catch (FileNotFoundException e6) {
|
|
e = e6;
|
|
fileOutputStream = fileOutputStream4;
|
|
} catch (IOException e7) {
|
|
e = e7;
|
|
fileOutputStream = fileOutputStream4;
|
|
} catch (IllegalArgumentException e8) {
|
|
e = e8;
|
|
fileOutputStream = fileOutputStream4;
|
|
} catch (IllegalStateException e9) {
|
|
e = e9;
|
|
fileOutputStream = fileOutputStream4;
|
|
} catch (Throwable th3) {
|
|
th = th3;
|
|
fileOutputStream = fileOutputStream4;
|
|
}
|
|
} catch (FileNotFoundException e10) {
|
|
e = e10;
|
|
} catch (IOException e11) {
|
|
e = e11;
|
|
} catch (IllegalArgumentException e12) {
|
|
e = e12;
|
|
} catch (IllegalStateException e13) {
|
|
e = e13;
|
|
} catch (Throwable th4) {
|
|
th = th4;
|
|
fileOutputStream = null;
|
|
}
|
|
} catch (Throwable th5) {
|
|
th = th5;
|
|
fileOutputStream = fileOutputStream2;
|
|
}
|
|
} catch (Exception e14) {
|
|
e14.printStackTrace();
|
|
}
|
|
}
|
|
}
|