164 lines
4.4 KiB
Java
164 lines
4.4 KiB
Java
package com.ubt.jimu.diy;
|
|
|
|
import android.text.TextUtils;
|
|
import com.ubt.jimu.JimuApplication;
|
|
import com.ubt.jimu.base.cache.Cache;
|
|
import com.ubt.jimu.base.cache.Constants;
|
|
import com.ubt.jimu.blockly.Utils;
|
|
import com.ubt.jimu.unity.ModelType;
|
|
import com.ubt.jimu.utils.ExternalOverFroyoUtils;
|
|
import com.ubt.jimu.utils.LocaleUtils;
|
|
import java.io.File;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class DiyRobotFile {
|
|
public static final String PATH_TO_ACTION = "actions";
|
|
public static final String PATH_TO_SERVO = "servos";
|
|
public static final int TYPE_ACTION = 513;
|
|
public static final int TYPE_LOGO = 259;
|
|
public static final int TYPE_MODEL = 257;
|
|
public static final int TYPE_PROGRAM = 769;
|
|
public static final int TYPE_SERVO = 258;
|
|
private String content;
|
|
private long createDate;
|
|
private String customModelId;
|
|
private String displayName;
|
|
private String fileName;
|
|
private int fileType;
|
|
private String fileUrl;
|
|
private Long id;
|
|
private String remark;
|
|
private int serverModelId;
|
|
private long updateDate;
|
|
|
|
public DiyRobotFile(Long l, int i, String str, int i2, String str2, String str3, String str4, String str5, String str6, long j, long j2) {
|
|
this.id = l;
|
|
this.serverModelId = i;
|
|
this.customModelId = str;
|
|
this.fileType = i2;
|
|
this.displayName = str2;
|
|
this.fileUrl = str3;
|
|
this.fileName = str4;
|
|
this.content = str5;
|
|
this.remark = str6;
|
|
this.createDate = j;
|
|
this.updateDate = j2;
|
|
}
|
|
|
|
public static boolean exists(DiyRobotFile diyRobotFile) {
|
|
String str = ExternalOverFroyoUtils.a(JimuApplication.l(), ModelType.DOWNLOAD) + diyRobotFile.getCustomModelId() + File.separator;
|
|
if (513 == diyRobotFile.getFileType()) {
|
|
str = str + "actions" + File.separator;
|
|
} else if (769 == diyRobotFile.getFileType()) {
|
|
str = str + diyRobotFile.getCustomModelId() + Utils.BLOCKLY_ADD_PATH + File.separator;
|
|
if (!LocaleUtils.b().equals(Cache.getInstance().getSettings().getString(Constants.KEY_PROGRAM_LANGUAGE, ""))) {
|
|
return false;
|
|
}
|
|
} else if (258 == diyRobotFile.getFileType()) {
|
|
str = str + "servos" + File.separator;
|
|
}
|
|
String str2 = str + diyRobotFile.getFileName();
|
|
if (259 == diyRobotFile.getFileType()) {
|
|
String fileName = diyRobotFile.getFileName();
|
|
if (TextUtils.isEmpty(fileName)) {
|
|
return true;
|
|
}
|
|
str2 = str + diyRobotFile.customModelId + diyRobotFile.getFileName().substring(fileName.indexOf("."));
|
|
} else if (257 == diyRobotFile.getFileType()) {
|
|
str2 = str + diyRobotFile.customModelId + ".xml";
|
|
}
|
|
return new File(str2).exists();
|
|
}
|
|
|
|
public String getContent() {
|
|
return this.content;
|
|
}
|
|
|
|
public long getCreateDate() {
|
|
return this.createDate;
|
|
}
|
|
|
|
public String getCustomModelId() {
|
|
return this.customModelId;
|
|
}
|
|
|
|
public String getDisplayName() {
|
|
return this.displayName;
|
|
}
|
|
|
|
public String getFileName() {
|
|
return this.fileName;
|
|
}
|
|
|
|
public int getFileType() {
|
|
return this.fileType;
|
|
}
|
|
|
|
public String getFileUrl() {
|
|
return this.fileUrl;
|
|
}
|
|
|
|
public Long getId() {
|
|
return this.id;
|
|
}
|
|
|
|
public String getRemark() {
|
|
return this.remark;
|
|
}
|
|
|
|
public int getServerModelId() {
|
|
return this.serverModelId;
|
|
}
|
|
|
|
public long getUpdateDate() {
|
|
return this.updateDate;
|
|
}
|
|
|
|
public void setContent(String str) {
|
|
this.content = str;
|
|
}
|
|
|
|
public void setCreateDate(long j) {
|
|
this.createDate = j;
|
|
}
|
|
|
|
public void setCustomModelId(String str) {
|
|
this.customModelId = str;
|
|
}
|
|
|
|
public void setDisplayName(String str) {
|
|
this.displayName = str;
|
|
}
|
|
|
|
public void setFileName(String str) {
|
|
this.fileName = str;
|
|
}
|
|
|
|
public void setFileType(int i) {
|
|
this.fileType = i;
|
|
}
|
|
|
|
public void setFileUrl(String str) {
|
|
this.fileUrl = str;
|
|
}
|
|
|
|
public void setId(Long l) {
|
|
this.id = l;
|
|
}
|
|
|
|
public void setRemark(String str) {
|
|
this.remark = str;
|
|
}
|
|
|
|
public void setServerModelId(int i) {
|
|
this.serverModelId = i;
|
|
}
|
|
|
|
public void setUpdateDate(long j) {
|
|
this.updateDate = j;
|
|
}
|
|
|
|
public DiyRobotFile() {
|
|
}
|
|
}
|