рефакторинг. ввел оберточные методы работы с json объектами
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package Common;
|
||||
import Common.Database.DataSet;
|
||||
import Common.ModesSupervisors.PackageModeSupervisor;
|
||||
import Common.UI.Menus_2023.ComponentsMenuBar.ComponentsMenuBar;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
@@ -14,16 +13,15 @@ import Repository.Component.Sapfor.MessagesServer;
|
||||
import Repository.Component.Sapfor.Sapfor_F;
|
||||
import Repository.Component.Sapfor.TransformationPermission;
|
||||
import Repository.Server.ComponentsServer;
|
||||
import SapforTestingSystem.SapforTestingPlaner.SapforTestingPlanner;
|
||||
import TestingSystem.TestingServer;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
import Visual_DVM_2021.UI.Interface.Loggable;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory;
|
||||
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Vector;
|
||||
public class Global {
|
||||
@@ -106,15 +104,11 @@ public class Global {
|
||||
//------------------------------------------------------------------------
|
||||
public static Loggable Log;
|
||||
public static void SynschronizeProperties() {
|
||||
//---- NEW -----
|
||||
try {
|
||||
File new_propertiesFile = Paths.get(Home, "properties").toFile();
|
||||
if (new_propertiesFile.exists()) {
|
||||
String packed = FileUtils.readFileToString(new_propertiesFile, Charset.defaultCharset());
|
||||
properties = Utils.gson.fromJson(packed, GlobalProperties.class);
|
||||
}
|
||||
//пусть всегда в него пишет. с учетом того, что новые настройки могут появиться.
|
||||
FileUtils.writeStringToFile(new_propertiesFile, Utils.jsonToPrettyFormat(Utils.gson.toJson(properties)));
|
||||
if (new_propertiesFile.exists())
|
||||
properties = (GlobalProperties) Utils.jsonFromFile(new_propertiesFile, GlobalProperties.class);
|
||||
Utils.jsonToFile(properties, new_propertiesFile);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
@@ -350,6 +344,21 @@ public class Global {
|
||||
testingServer.Start();
|
||||
System.exit(0);
|
||||
}
|
||||
public static void ScenarioMode() throws Exception {
|
||||
Log = new Loggable() {
|
||||
@Override
|
||||
public String getLogHomePath() {
|
||||
return Home;
|
||||
}
|
||||
@Override
|
||||
public String getLogName() {
|
||||
return "Scenario";
|
||||
}
|
||||
};
|
||||
Log.ClearLog();
|
||||
SapforTestingPlanner planner = new SapforTestingPlanner();
|
||||
//planner.Start();
|
||||
}
|
||||
//---
|
||||
public static void Init(String... args) {
|
||||
System.out.println("VisualSapfor.jar started..");
|
||||
@@ -370,19 +379,8 @@ public class Global {
|
||||
case Testing:
|
||||
TestingSystemMode();
|
||||
break;
|
||||
case Package:
|
||||
Log = new Loggable() {
|
||||
@Override
|
||||
public String getLogHomePath() {
|
||||
return Home;
|
||||
}
|
||||
@Override
|
||||
public String getLogName() {
|
||||
return "PackageMode";
|
||||
}
|
||||
};
|
||||
Log.ClearLog();
|
||||
new PackageModeSupervisor().Do();
|
||||
case Scenario:
|
||||
ScenarioMode();
|
||||
break;
|
||||
case Undefined:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user