no message
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package Common.Utils;
|
||||
import Common.CommonConstants;
|
||||
import Common.Database.VisualiserDatabase;
|
||||
import Common.Mode;
|
||||
import Common_old.Current;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
@@ -24,15 +22,20 @@ import java.util.concurrent.Semaphore;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.stream.Collectors;
|
||||
public class CommonUtils {
|
||||
//Режим
|
||||
public static Mode mode= Mode.Undefined;
|
||||
public static boolean hasUI() {
|
||||
return mode.equals(Mode.Normal);
|
||||
static String HomePath = System.getProperty("user.dir");
|
||||
public static void setHomePath(String path_in){
|
||||
HomePath = path_in;
|
||||
}
|
||||
//Текущая оперционная система
|
||||
public static boolean isWindows=true;
|
||||
//Домашняя папка.
|
||||
public static String Home;
|
||||
public static boolean isWindows() {
|
||||
return System.getProperty("os.name").startsWith("Windows");
|
||||
}
|
||||
public static String getHomePath(){
|
||||
return HomePath;
|
||||
}
|
||||
public static File getHomeDirectory(){
|
||||
return new File(getHomePath());
|
||||
};
|
||||
//ГЛОБАЛЬНЫЙ ЖУРНАЛ
|
||||
public static Loggable MainLog;
|
||||
public static Semaphore date_semaphore = new Semaphore(1);
|
||||
@@ -148,9 +151,9 @@ public class CommonUtils {
|
||||
return res.toString();
|
||||
}
|
||||
//Синтаксис и регулярные выражения
|
||||
public static String printAllForbiddenCharacters(){
|
||||
public static String printAllForbiddenCharacters() {
|
||||
Vector<String> res = new Vector<>();
|
||||
for (char c: CommonConstants.forbidden_file_name_characters)
|
||||
for (char c : CommonConstants.forbidden_file_name_characters)
|
||||
res.add(String.valueOf(c));
|
||||
return String.join(" ", res);
|
||||
}
|
||||
@@ -385,7 +388,7 @@ public class CommonUtils {
|
||||
return path.replace('/', '\\');
|
||||
}
|
||||
public static double getFileSizeMegaBytes(File file) {
|
||||
return ((double)file.length()) / (1024 * 1024);
|
||||
return ((double) file.length()) / (1024 * 1024);
|
||||
}
|
||||
public static byte[] fileToBytes(File src) throws Exception {
|
||||
byte[] dst = Files.readAllBytes(src.toPath());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package Common.Utils;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common_old.UI.DebugPrintLevel;
|
||||
import Common_old.UI.UI;
|
||||
import Common_old.Utils.Utils;
|
||||
|
||||
import java.io.File;
|
||||
@@ -40,8 +40,8 @@ public interface Loggable {
|
||||
ex.printStackTrace(writer);
|
||||
writer.flush();
|
||||
Print(out.toString());
|
||||
if (CommonUtils.hasUI())
|
||||
UI.Error("Возникло исключение. Подробности в файле журнала\n" +
|
||||
if (CommonUI.isActive())
|
||||
CommonUI.Error("Возникло исключение. Подробности в файле журнала\n" +
|
||||
CommonUtils.Brackets(getLogFile().getAbsolutePath()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user