2023-09-21 20:55:14 +03:00
|
|
|
package SapforTestingSystem.Json;
|
2023-10-30 22:37:03 +03:00
|
|
|
import Common.Global;
|
|
|
|
|
import Common.Utils.Utils;
|
2023-10-31 01:02:11 +03:00
|
|
|
import ProjectData.Files.DBProjectFile;
|
|
|
|
|
import ProjectData.Files.FileType;
|
2023-09-17 22:13:42 +03:00
|
|
|
import com.google.gson.annotations.Expose;
|
2023-10-25 16:33:02 +03:00
|
|
|
|
2023-10-30 22:37:03 +03:00
|
|
|
import java.io.File;
|
2023-10-25 16:33:02 +03:00
|
|
|
import java.io.Serializable;
|
2023-10-30 22:37:03 +03:00
|
|
|
import java.nio.file.Paths;
|
2023-10-31 01:02:11 +03:00
|
|
|
import java.util.Vector;
|
2023-10-25 16:33:02 +03:00
|
|
|
public class SapforVersion_json implements Serializable {
|
2023-09-17 22:13:42 +03:00
|
|
|
@Expose
|
|
|
|
|
public String version = "";
|
|
|
|
|
@Expose
|
|
|
|
|
public String description = "";
|
2023-10-31 01:02:11 +03:00
|
|
|
//поля для отображения деревьев.
|
|
|
|
|
public File Home = null;
|
|
|
|
|
public Vector<DBProjectFile> files = null;
|
|
|
|
|
//-
|
2023-09-17 22:13:42 +03:00
|
|
|
public SapforVersion_json(String version_in, String description_in) {
|
|
|
|
|
version = version_in;
|
|
|
|
|
description = description_in;
|
|
|
|
|
}
|
2023-10-29 01:03:37 +03:00
|
|
|
public SapforVersion_json(String root_in, String version_in, String description_in) {
|
|
|
|
|
version = version_in.substring(root_in.length() + 1);
|
|
|
|
|
description = description_in;
|
|
|
|
|
}
|
2023-10-30 22:37:03 +03:00
|
|
|
@Override
|
|
|
|
|
public String toString() {
|
2023-10-31 01:02:11 +03:00
|
|
|
return Home.getName() + " : " + Utils.Brackets(description);
|
2023-10-30 22:37:03 +03:00
|
|
|
}
|
2023-10-31 01:02:11 +03:00
|
|
|
public void init(File configurationRoot) {
|
2023-10-30 22:37:03 +03:00
|
|
|
String relativePath = Global.isWindows ? Utils.toW(version) : version;
|
|
|
|
|
Home = Paths.get(configurationRoot.getAbsolutePath(), relativePath).toFile();
|
2023-10-31 01:02:11 +03:00
|
|
|
files = new Vector<>();
|
|
|
|
|
//--
|
|
|
|
|
File[] files_ = Home.listFiles();
|
|
|
|
|
if (files_ != null) {
|
|
|
|
|
for (File file: files_){
|
|
|
|
|
if (file.isFile()) {
|
|
|
|
|
DBProjectFile dbProjectFile = new DBProjectFile();
|
|
|
|
|
dbProjectFile.file = file;
|
|
|
|
|
dbProjectFile.AutoDetectProperties();
|
|
|
|
|
if (dbProjectFile.fileType.equals(FileType.forbidden)) {
|
|
|
|
|
files.add(dbProjectFile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-30 22:37:03 +03:00
|
|
|
}
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|