Added storage classes - work in progress V

This commit is contained in:
Robert Vokac 2024-08-10 18:55:15 +02:00
parent c4f577a701
commit 20799c7413
No known key found for this signature in database
GPG Key ID: C459E1E4B4A986BB
35 changed files with 201 additions and 87 deletions

View File

@ -57,7 +57,8 @@ dependencies {
implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
implementation "com.github.MrStahlfelge.gdx-websockets:common:$websocketVersion"
implementation project(':core')
//implementation "com.openeggbert.gdx:gdx-storage:0.0.0-SNAPSHOT"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"

View File

@ -17,7 +17,7 @@ dependencies {
api "com.github.tommyettinger:libgdx-utils:$utilsVersion"
api "de.golfgl.gdxcontrollerutils:gdx-controllerutils-mapping:$controllerMappingVersion"
api "games.rednblack.miniaudio:miniaudio:$miniaudioVersion"
api "com.openeggbert.gdx:gdx-storage:0.0.0-SNAPSHOT"
//api "com.openeggbert.gdx:gdx-storage:0.0.0-SNAPSHOT"
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.3"

View File

@ -28,6 +28,8 @@ import lombok.Getter;
* @author robertvokac
*/
public enum OpenEggbertScreenType {
MAIN,
GAME_SPACE_SELECTION,
INIT("INIT"),
GAMER("GAMER"),
MAIN_HUB(""),

View File

@ -0,0 +1,32 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation, either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.gdx.storage;
/**
*
* @author robertvokac
*/
public class GdxStorageException extends RuntimeException {
public GdxStorageException(String string) {
super(string);
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.11.0//EN" "https://www.gwtproject.org/doctype/2.11.0/gwt-module.dtd">
<module>
<!-- Paths to source are relative to this file and separated by slashes ('/'). -->
<source path="" />
<!-- Reflection includes may be needed for your code or library code. Each value is separated by periods ('.'). -->
<!-- You can include a full package by not including the name of a type at the end. -->
</module>

View File

@ -0,0 +1,34 @@
package com.openeggbert.gdx.storage;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.ScreenUtils;
/** {@link com.badlogic.gdx.ApplicationListener} implementation shared by all platforms. */
public class GdxStorageMainClass extends ApplicationAdapter {
private SpriteBatch batch;
private Texture image;
@Override
public void create() {
batch = new SpriteBatch();
image = new Texture("libgdx.png");
}
@Override
public void render() {
ScreenUtils.clear(0.15f, 0.15f, 0.2f, 1f);
batch.begin();
batch.draw(image, 140, 210);
batch.end();
}
@Override
public void dispose() {
batch.dispose();
image.dispose();
}
}

View File

@ -0,0 +1,50 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation, either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.gdx.storage;
import com.badlogic.gdx.utils.Base64Coder;
/**
*
* @author robertvokac
*/
public class GdxStorageUtils {
private GdxStorageUtils() {
//Not meant to be instantiated.
}
public static String decodeBase64AsString(String string) {
return new String(decodeBase64AsByteArray(string));
}
public static byte[] decodeBase64AsByteArray(String string) {
return Base64Coder.decode(string);
}
public static String encodeToBase64(String string) {
return encodeToBase64(string.getBytes());
}
public static String encodeToBase64(byte[] data) {
return String.valueOf(Base64Coder.encode(data));
}
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,7 +17,7 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage;
package com.openeggbert.gdx.storage;
import com.badlogic.gdx.Application;
import java.util.List;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,15 +17,14 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage;
package com.openeggbert.gdx.storage;
import com.openeggbert.storage.map.WebGLStorage;
import com.openeggbert.storage.map.MemoryStorage;
import com.openeggbert.storage.filesystem.AndroidStorage;
import com.openeggbert.storage.filesystem.DesktopStorage;
import com.openeggbert.gdx.storage.map.WebGLStorage;
import com.openeggbert.gdx.storage.map.MemoryStorage;
import com.openeggbert.gdx.storage.filesystem.AndroidStorage;
import com.openeggbert.gdx.storage.filesystem.DesktopStorage;
import com.badlogic.gdx.Application;
import com.badlogic.gdx.Gdx;
import com.openeggbert.entity.common.OpenEggbertException;
/**
*
@ -56,7 +55,7 @@ public class StorageImplementationLoader {
}
}
if (storage == null) {
throw new OpenEggbertException("Platform is not supported: " + type);
throw new GdxStorageException("Platform is not supported: " + type);
}
return storage;
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,7 +17,7 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage.filesystem.command;
package com.openeggbert.gdx.storage.command;
import java.util.function.Function;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,7 +17,7 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage.filesystem.command;
package com.openeggbert.gdx.storage.command;
/**
*

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,7 +17,7 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage.filesystem.command;
package com.openeggbert.gdx.storage.command;
/**
*

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,9 +17,9 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage.filesystem.command;
package com.openeggbert.gdx.storage.command;
import com.openeggbert.storage.Storage;
import com.openeggbert.gdx.storage.Storage;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,9 +17,9 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage.filesystem.command;
package com.openeggbert.gdx.storage.command;
import com.openeggbert.storage.map.MemoryStorage;
import com.openeggbert.gdx.storage.map.MemoryStorage;
import java.util.Scanner;
/**

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,7 +17,7 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage.filesystem.command;
package com.openeggbert.gdx.storage.command;
/**
*

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,7 +17,7 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage.filesystem;
package com.openeggbert.gdx.storage.filesystem;
/**
*

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,10 +17,10 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage.filesystem;
package com.openeggbert.gdx.storage.filesystem;
import com.badlogic.gdx.Application;
import com.openeggbert.storage.Storage;
import com.openeggbert.gdx.storage.Storage;
import java.util.List;
/**

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,7 +17,7 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage.filesystem;
package com.openeggbert.gdx.storage.filesystem;
/**
*

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,9 +17,10 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage.map;
package com.openeggbert.gdx.storage.map;
import com.openeggbert.gdx.storage.GdxStorageException;
import com.openeggbert.entity.common.OpenEggbertException;
/**
*
@ -30,7 +31,7 @@ public enum MapFileType {
public static MapFileType ofKey(String key, SimpleMap map) {
if (!map.contains(key)) {
throw new OpenEggbertException("Map does not contain key: " + key);
throw new GdxStorageException("Map does not contain key: " + key);
}
String value = map.getString(key);
if (value.startsWith(FILE.name())) {
@ -39,7 +40,7 @@ public enum MapFileType {
if (value.startsWith(DIRECTORY.name())) {
return DIRECTORY;
}
throw new OpenEggbertException("Unsupported MapFileType for key in the map: " + key);
throw new GdxStorageException("Unsupported MapFileType for key in the map: " + key);
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,13 +17,13 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage.map;
package com.openeggbert.gdx.storage.map;
import com.badlogic.gdx.Application;
import com.badlogic.gdx.Gdx;
import com.openeggbert.entity.common.OpenEggbertException;
import com.openeggbert.storage.Storage;
import com.openeggbert.utils.OpenEggbertUtils;
import com.openeggbert.gdx.storage.GdxStorageException;
import com.openeggbert.gdx.storage.GdxStorageUtils;
import com.openeggbert.gdx.storage.Storage;
import java.util.List;
import java.util.stream.Collectors;
@ -124,10 +124,10 @@ public class MapStorage implements Storage {
private static String getParentPath(String path) {
// System.out.println("getParentPath()");
if (path == null) {
throw new OpenEggbertException("Path is null");
throw new GdxStorageException("Path is null");
}
if (path.trim().isEmpty()) {
throw new OpenEggbertException("Path is empty");
throw new GdxStorageException("Path is empty");
}
if (path.equals("/")) {
@ -218,10 +218,10 @@ public class MapStorage implements Storage {
private String moveOrCp(String source, String target, boolean move, boolean cp) {
if (move && cp) {
throw new OpenEggbertException("move == true && cp == true");
throw new GdxStorageException("move == true && cp == true");
}
if (!move && !cp) {
throw new OpenEggbertException("move != true && cp != true");
throw new GdxStorageException("move != true && cp != true");
}
String absolutePathSource = convertToAbsolutePathIfNeeded(source);
String absolutePathTarget = convertToAbsolutePathIfNeeded(target);
@ -287,7 +287,7 @@ public class MapStorage implements Storage {
return null;
}
text = text.substring(BINARYFILE.length());
return OpenEggbertUtils.decodeBase64AsByteArray(text);
return GdxStorageUtils.decodeBase64AsByteArray(text);
}
private static final String BINARYFILE = "BINARYFILE";
@ -298,7 +298,7 @@ public class MapStorage implements Storage {
@Override
public String savebin(String name, byte[] data) {
return savetext(name, BINARYFILE + OpenEggbertUtils.encodeToBase64(data));
return savetext(name, BINARYFILE + GdxStorageUtils.encodeToBase64(data));
}
@Override

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,7 +17,7 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage.map;
package com.openeggbert.gdx.storage.map;
/**
*

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,7 +17,7 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage.map;
package com.openeggbert.gdx.storage.map;
import com.badlogic.gdx.Application;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,7 +17,7 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage.map;
package com.openeggbert.gdx.storage.map;
import java.util.Collections;
import java.util.HashMap;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,7 +17,7 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage.map;
package com.openeggbert.gdx.storage.map;
import com.badlogic.gdx.Preferences;
import java.util.Collections;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,7 +17,7 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage.map;
package com.openeggbert.gdx.storage.map;
import java.util.List;
import java.util.Map;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////////////////
// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
// Gdx Storage: Multiplatform persistent storage.
// Copyright (C) 2024 the original author or authors.
//
// This program is free software: you can redistribute it and/or
@ -17,7 +17,7 @@
// <https://www.gnu.org/licenses/> or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.storage.map;
package com.openeggbert.gdx.storage.map;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Preferences;

View File

@ -37,8 +37,8 @@ import com.openeggbert.mods.Mod;
import com.openeggbert.mods.ModIdentification;
import com.openeggbert.screens.GameSpaceListScreen;
import com.openeggbert.screens.InitScreen;
import com.openeggbert.storage.Storage;
import com.openeggbert.storage.StorageImplementationLoader;
import com.openeggbert.gdx.storage.Storage;
import com.openeggbert.gdx.storage.StorageImplementationLoader;
import com.openeggbert.utils.OpenEggbertDisplayMode;
import java.util.ArrayList;
import java.util.List;

View File

@ -19,7 +19,6 @@
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.utils;
import com.badlogic.gdx.utils.Base64Coder;
import com.openeggbert.compatibility.FileNameCaseType;
import com.openeggbert.compatibility.ImageFormat;
import com.openeggbert.compatibility.MusicFormat;
@ -114,20 +113,4 @@ public class OpenEggbertUtils {
}
public static String decodeBase64AsString(String string) {
return new String(decodeBase64AsByteArray(string));
}
public static byte[] decodeBase64AsByteArray(String string) {
return Base64Coder.decode(string);
}
public static String encodeToBase64(String string) {
return encodeToBase64(string.getBytes());
}
public static String encodeToBase64(byte[] data) {
return String.valueOf(Base64Coder.encode(data));
}
}

View File

@ -20,9 +20,7 @@
package com.openeggbert.utils;
import com.openeggbert.entity.common.GameFileType;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;

View File

@ -18,6 +18,7 @@ gwt {
src = files(file('src/main/java')) // Needs to be in front of "modules" below.
modules 'com.openeggbert.GdxDefinition'
//,'com.openeggbert.gdx.storage.GdxStorageMainClass'
devModules 'com.openeggbert.GdxDefinitionSuperdev'
project.webAppDirName = 'webapp'
@ -50,6 +51,7 @@ dependencies {
implementation("com.badlogicgames.gdx-controllers:gdx-controllers-gwt:$gdxControllersVersion:sources"){exclude group: "com.badlogicgames.gdx", module: "gdx-backend-gwt"}
implementation("com.badlogicgames.gdx:gdx-box2d-gwt:$gdxVersion:sources") {exclude group: "com.google.gwt", module: "gwt-user"}
implementation("com.github.crykn.guacamole:gdx-gwt:$guacamoleVersion:sources"){exclude group: "com.badlogicgames.gdx", module: "gdx-backend-gwt"}
//implementation "com.openeggbert.gdx:gdx-storage:0.0.0-SNAPSHOT"
}

View File

@ -23,6 +23,7 @@
<inherits name="com.github.czyzby.websocket.GdxWebSocketGwt" />
<inherits name="com.github.czyzby.websocket.GdxWebSocketSerialization" />
<inherits name="com.openeggbert.main.OpenEggbertGame" />
<!--<inherits name="com.openeggbert.gdx.storage.GdxStorageMainClass" />-->
<inherits name="formic" />
<inherits name="guacamole_gdx_gwt" />
<inherits name="libgdx-utils" />
@ -38,4 +39,4 @@
<set-property name="user.agent" value="gecko1_8, safari"/>
<collapse-property name="user.agent" values="*" />
<!-- Remove the "user.agent" lines above if you encounter issues with Safari or other Gecko browsers. -->
</module>
</module>

View File

@ -31,6 +31,7 @@ dependencies {
implementation "com.github.MrStahlfelge.gdx-websockets:common:$websocketVersion"
implementation "com.github.crykn.guacamole:gdx-desktop:$guacamoleVersion"
implementation "games.rednblack.miniaudio:miniaudio:$miniaudioVersion:natives-desktop"
//implementation "com.openeggbert.gdx:gdx-storage:0.0.0-SNAPSHOT"
implementation project(':core')
}

View File

@ -19,7 +19,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.lwjgl3.debugging.storage;
import com.openeggbert.storage.filesystem.command.CommandLineScanner;
import com.openeggbert.gdx.storage.command.CommandLineScanner;
import java.util.Scanner;
/**

View File

@ -19,9 +19,9 @@
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.lwjgl3.debugging.storage;
import com.openeggbert.storage.filesystem.command.StorageCommandLine;
import com.openeggbert.storage.filesystem.command.StorageCommandLineScanner;
import com.openeggbert.storage.map.MemoryStorage;
import com.openeggbert.gdx.storage.command.StorageCommandLine;
import com.openeggbert.gdx.storage.command.StorageCommandLineScanner;
import com.openeggbert.gdx.storage.map.MemoryStorage;
/**
*