no message

This commit is contained in:
2024-10-08 22:33:49 +03:00
parent 90546fc62e
commit e0974fe4a8
246 changed files with 1170 additions and 849 deletions

View File

@@ -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());