diff --git a/app-core/pom.xml b/app-core/pom.xml index 5badaeee..3f0837c1 100644 --- a/app-core/pom.xml +++ b/app-core/pom.xml @@ -17,12 +17,12 @@ com.home.mercury app-shared - 1.0.0 - - - lc.kra.system - system-hook + 1.0.0.1 + + + + com.sun.jna jna diff --git a/app-core/src/main/java/com/mercury/platform/core/ChatHelper.java b/app-core/src/main/java/com/mercury/platform/core/ChatHelper.java index 095287be..a38c95ee 100644 --- a/app-core/src/main/java/com/mercury/platform/core/ChatHelper.java +++ b/app-core/src/main/java/com/mercury/platform/core/ChatHelper.java @@ -1,8 +1,10 @@ package com.mercury.platform.core; +import com.mercury.platform.shared.ConfigManager; import com.mercury.platform.shared.HasEventHandlers; import com.mercury.platform.shared.events.EventRouter; import com.mercury.platform.shared.events.custom.ChatCommandEvent; +import com.mercury.platform.shared.events.custom.DndModeEvent; import com.mercury.platform.shared.events.custom.OpenChatEvent; import com.sun.jna.Native; import org.apache.logging.log4j.LogManager; @@ -30,65 +32,61 @@ public ChatHelper() { } private void executeMessage(String message) { - new Thread(() -> { - StringSelection selection = new StringSelection(message); - Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); - clipboard.setContents(selection, null); - - gameToFront(); - - robot.keyPress(KeyEvent.VK_ENTER); - robot.keyRelease(KeyEvent.VK_ENTER); - - robot.keyPress(KeyEvent.VK_CONTROL); - robot.keyPress(KeyEvent.VK_A); - robot.keyRelease(KeyEvent.VK_CONTROL); - robot.keyRelease(KeyEvent.VK_A); - - robot.keyPress(KeyEvent.VK_BACK_SPACE); - robot.keyRelease(KeyEvent.VK_BACK_SPACE); - - robot.keyPress(KeyEvent.VK_CONTROL); - robot.keyPress(KeyEvent.VK_V); - robot.keyRelease(KeyEvent.VK_V); - robot.keyRelease(KeyEvent.VK_CONTROL); - robot.keyPress(KeyEvent.VK_ENTER); - robot.keyRelease(KeyEvent.VK_ENTER); - }).start(); + StringSelection selection = new StringSelection(message); + Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + clipboard.setContents(selection, null); + + gameToFront(); + + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); + + robot.keyPress(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_A); + robot.keyRelease(KeyEvent.VK_CONTROL); + robot.keyRelease(KeyEvent.VK_A); + + robot.keyPress(KeyEvent.VK_BACK_SPACE); + robot.keyRelease(KeyEvent.VK_BACK_SPACE); + + robot.keyPress(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_V); + robot.keyRelease(KeyEvent.VK_V); + robot.keyRelease(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); } - private void openChat(String whisper){ - new Thread(() -> { - gameToFront(); - - StringSelection selection = new StringSelection("@" + whisper); - Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); - clipboard.setContents(selection, selection); - - robot.keyPress(KeyEvent.VK_ENTER); - robot.keyRelease(KeyEvent.VK_ENTER); - - robot.keyPress(KeyEvent.VK_CONTROL); - robot.keyPress(KeyEvent.VK_A); - robot.keyRelease(KeyEvent.VK_CONTROL); - robot.keyRelease(KeyEvent.VK_A); - - robot.keyPress(KeyEvent.VK_BACK_SPACE); - robot.keyRelease(KeyEvent.VK_BACK_SPACE); - - robot.keyPress(KeyEvent.VK_CONTROL); - robot.keyPress(KeyEvent.VK_V); - robot.keyRelease(KeyEvent.VK_V); - robot.keyRelease(KeyEvent.VK_CONTROL); - robot.keyPress(KeyEvent.VK_SPACE); - robot.keyRelease(KeyEvent.VK_SPACE); - }).start(); + private void openChat(String whisper) { + gameToFront(); + + StringSelection selection = new StringSelection("@" + whisper); + Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + clipboard.setContents(selection, selection); + + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); + + robot.keyPress(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_A); + robot.keyRelease(KeyEvent.VK_CONTROL); + robot.keyRelease(KeyEvent.VK_A); + + robot.keyPress(KeyEvent.VK_BACK_SPACE); + robot.keyRelease(KeyEvent.VK_BACK_SPACE); + + robot.keyPress(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_V); + robot.keyRelease(KeyEvent.VK_V); + robot.keyRelease(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_SPACE); + robot.keyRelease(KeyEvent.VK_SPACE); } - + /** + * NEED REFACTORING + */ private void gameToFront(){ List titles = new ArrayList<>(); titles.add("Path of Exile"); - titles.add("PathOfExile"); - titles.add("PathOfExile_64"); user32.EnumWindows((hWnd, arg1) -> { byte[] windowText = new byte[512]; user32.GetWindowTextA(hWnd, windowText, 512); @@ -113,5 +111,15 @@ public void initHandlers() { EventRouter.INSTANCE.registerHandler(OpenChatEvent.class, event -> { openChat(((OpenChatEvent) event).getWhisper()); }); + EventRouter.INSTANCE.registerHandler(DndModeEvent.class, event -> { + boolean dnd = ((DndModeEvent) event).isDnd(); + if(ConfigManager.INSTANCE.isInGameDnd()){ + if(dnd) { + executeMessage("/dnd " + ConfigManager.INSTANCE.getDndResponseText()); + }else { + executeMessage("/dnd"); + } + } + }); } } diff --git a/app-core/src/main/java/com/mercury/platform/core/MercuryConstants.java b/app-core/src/main/java/com/mercury/platform/core/MercuryConstants.java index dc06d865..6723205b 100644 --- a/app-core/src/main/java/com/mercury/platform/core/MercuryConstants.java +++ b/app-core/src/main/java/com/mercury/platform/core/MercuryConstants.java @@ -4,7 +4,7 @@ * Created by Константин on 29.01.2017. */ public class MercuryConstants { - public static final String APP_VERSION = "1.0.0.3"; + public static final String APP_VERSION = "1.0.0.4"; public static final String SERVER_HOST = "exslims.ddns.net"; public static final int PORT = 5555; } diff --git a/app-core/src/main/java/com/mercury/platform/shared/ConfigManager.java b/app-core/src/main/java/com/mercury/platform/shared/ConfigManager.java index 51df97ca..7ebc1ed5 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/ConfigManager.java +++ b/app-core/src/main/java/com/mercury/platform/shared/ConfigManager.java @@ -52,6 +52,8 @@ private static class ConfigManagerHolder { private boolean itemsGridEnable = true; private boolean checkUpdateOnStartUp = true; private boolean dismissAfterKick = false; + private boolean inGameDnd = false; + private String dndResponseText = "Response text"; public ConfigManager() { minimumFrameSize = new HashMap<>(); @@ -59,7 +61,7 @@ public ConfigManager() { minimumFrameSize.put("IncMessageFrame",new Dimension(315,10)); minimumFrameSize.put("OutMessageFrame",new Dimension(280,115)); minimumFrameSize.put("TestCasesFrame",new Dimension(400,100)); - minimumFrameSize.put("SettingsFrame",new Dimension(540,100)); + minimumFrameSize.put("SettingsFrame",new Dimension(540,400)); minimumFrameSize.put("HistoryFrame",new Dimension(280,400)); minimumFrameSize.put("TimerFrame",new Dimension(240,102)); minimumFrameSize.put("ChatScannerFrame",new Dimension(200,100)); @@ -85,6 +87,8 @@ public ConfigManager() { defaultAppSettings.put("itemsGridEnable",true); defaultAppSettings.put("checkUpdateOnStartUp",true); defaultAppSettings.put("dismissAfterKick",false); + defaultAppSettings.put("inGameDnd",false); + defaultAppSettings.put("dndResponseText","Response text"); } @@ -126,6 +130,8 @@ public void load() { saveProperty("itemsGridEnable", String.valueOf(defaultAppSettings.get("itemsGridEnable"))); saveProperty("checkUpdateOnStartUp", String.valueOf(defaultAppSettings.get("checkUpdateOnStartUp"))); saveProperty("dismissAfterKick", String.valueOf(defaultAppSettings.get("dismissAfterKick"))); + saveProperty("inGameDnd", String.valueOf(defaultAppSettings.get("inGameDnd"))); + saveProperty("dndResponseText", defaultAppSettings.get("dndResponseText")); } catch (Exception e) { logger.error(e); @@ -181,6 +187,8 @@ private void loadConfigFile(){ itemsGridEnable = Boolean.valueOf(loadProperty("itemsGridEnable")); checkUpdateOnStartUp = Boolean.valueOf(loadProperty("checkUpdateOnStartUp")); dismissAfterKick = Boolean.valueOf(loadProperty("dismissAfterKick")); + inGameDnd = Boolean.valueOf(loadProperty("inGameDnd")); + dndResponseText = loadProperty("dndResponseText"); } catch (Exception e) { logger.error("Error in loadConfigFile: ",e); } @@ -390,6 +398,25 @@ public void setItemsGridEnable(boolean itemsGridEnable) { this.itemsGridEnable = itemsGridEnable; saveProperty("itemsGridEnable",String.valueOf(this.itemsGridEnable)); } + + public boolean isInGameDnd() { + return inGameDnd; + } + + public void setInGameDnd(boolean inGameDnd) { + this.inGameDnd = inGameDnd; + saveProperty("inGameDnd",String.valueOf(this.inGameDnd)); + } + + public String getDndResponseText() { + return dndResponseText; + } + + public void setDndResponseText(String dndResponseText) { + this.dndResponseText = dndResponseText; + saveProperty("dndResponseText",dndResponseText); + } + private List getDefaultButtons(){ List defaultButtons = new ArrayList<>(); defaultButtons.add(new ResponseButton(0,"1m","one minute",false,false)); @@ -404,7 +431,7 @@ public Map getDefaultFramesSettings(){ defaultFramesSettings.put("IncMessageFrame",new FrameSettings(new Point(700, 600),new Dimension(315,0))); defaultFramesSettings.put("OutMessageFrame",new FrameSettings(new Point(200, 500),new Dimension(280,115))); defaultFramesSettings.put("TestCasesFrame",new FrameSettings(new Point(1400, 500),new Dimension(400,100))); - defaultFramesSettings.put("SettingsFrame",new FrameSettings(new Point(600, 600),new Dimension(540,100))); + defaultFramesSettings.put("SettingsFrame",new FrameSettings(new Point(600, 600),new Dimension(540,500))); defaultFramesSettings.put("HistoryFrame",new FrameSettings(new Point(600, 500),new Dimension(280,400))); defaultFramesSettings.put("TimerFrame",new FrameSettings(new Point(400, 600),new Dimension(240,102))); defaultFramesSettings.put("ChatScannerFrame",new FrameSettings(new Point(400, 600),new Dimension(500,250))); diff --git a/app-shared/pom.xml b/app-shared/pom.xml index 92405666..82d407e4 100644 --- a/app-shared/pom.xml +++ b/app-shared/pom.xml @@ -4,13 +4,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - com.home.mercury - MercuryTrade - ${project.version} - - + com.home.mercury app-shared + 1.0.0.4 jar diff --git a/app-socket-server/pom.xml b/app-socket-server/pom.xml deleted file mode 100644 index 6f2121b2..00000000 --- a/app-socket-server/pom.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - 4.0.0 - - - - maven-assembly-plugin - - - - com.mercury.platform.server.main.ServerMain - - - - jar-with-dependencies - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - - - - com.home.mercury - MercuryTrade - ${project.version} - - - jar - app-socket-server - - - 2.5 - 2.7 - 3.0 - 4.12 - 1.9.5 - 4.1.3.Final - 3.2.0 - 21.0 - - - - - com.home.mercury - app-shared - 1.0.0 - - - commons-io - commons-io - ${commons-io.version} - - - - io.netty - netty-all - ${netty.version} - - - - com.lmax - disruptor - ${disruptor.version} - - - - com.google.guava - guava - ${guava.version} - - - - org.apache.commons - commons-lang3 - ${commons-lang3.version} - - - - org.apache.logging.log4j - log4j-api - ${log4j.version} - - - - org.apache.logging.log4j - log4j-core - ${log4j.version} - - - - junit - junit - test - ${junit.version} - - - - org.mockito - mockito-all - ${mockito.version} - - - \ No newline at end of file diff --git a/app-socket-server/src/main/java/com/mercury/platform/client/ClientMain.java b/app-socket-server/src/main/java/com/mercury/platform/client/ClientMain.java deleted file mode 100644 index b553933d..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/client/ClientMain.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.mercury.platform.client; - -import com.mercury.platform.client.bus.event.UpdateReceivedEvent; -import com.mercury.platform.client.bus.handlers.UpdateEventHandler; -import com.mercury.platform.client.core.UpdaterClient; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.nio.file.StandardOpenOption; - -/** - * Created by Frost on 14.01.2017. - */ -public class ClientMain { - private static final Logger LOGGER = LogManager.getLogger(ClientMain.class); - - public static void main(String[] args) throws Exception { - String host = "localhost"; - String mercuryVersion = "1.0"; - int port = 10000; - UpdaterClient updaterClient = new UpdaterClient(host, mercuryVersion, port); - updaterClient.registerListener(handler -> LOGGER.info("update received, size = {} bytes" , handler.getBytes().length)); - updaterClient.registerListener(new UpdateEventHandler() { - @Override - public void onUpdateReceived(UpdateReceivedEvent handler) throws IOException { - - Files.write(Paths.get("test-mercury.jar") , handler.getBytes() , StandardOpenOption.CREATE); - } - }); - updaterClient.start(); - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/client/bus/UpdaterClientEventBus.java b/app-socket-server/src/main/java/com/mercury/platform/client/bus/UpdaterClientEventBus.java deleted file mode 100644 index c1955eb8..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/client/bus/UpdaterClientEventBus.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.mercury.platform.client.bus; - -import com.google.common.eventbus.EventBus; - -/** - * Created by Frost on 25.01.2017. - */ -public class UpdaterClientEventBus extends EventBus{ - - private static final UpdaterClientEventBus instance = new UpdaterClientEventBus(); - - public static UpdaterClientEventBus getInstance() { - return instance; - } - - private EventBus eventBus; - - private UpdaterClientEventBus() { - this.eventBus = new EventBus(); - } - - @Override - public void register(Object object) { - eventBus.register(object); - } - - @Override - public void unregister(Object object) { - eventBus.unregister(object); - } - - @Override - public void post(Object event) { - eventBus.post(event); - } - -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/client/bus/event/UpdateReceivedEvent.java b/app-socket-server/src/main/java/com/mercury/platform/client/bus/event/UpdateReceivedEvent.java deleted file mode 100644 index 83b62c76..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/client/bus/event/UpdateReceivedEvent.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.mercury.platform.client.bus.event; - -/** - * Created by Frost on 25.01.2017. - */ -public class UpdateReceivedEvent { - - private byte[] bytes; - - - public UpdateReceivedEvent(byte [] bytes) { - this.bytes = bytes; - } - - public byte[] getBytes() { - return bytes; - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/client/bus/handlers/UpdateEventHandler.java b/app-socket-server/src/main/java/com/mercury/platform/client/bus/handlers/UpdateEventHandler.java deleted file mode 100644 index f3b381df..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/client/bus/handlers/UpdateEventHandler.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.mercury.platform.client.bus.handlers; - -import com.google.common.eventbus.Subscribe; -import com.mercury.platform.client.bus.event.UpdateReceivedEvent; - -import java.io.IOException; - -/** - * Created by Frost on 25.01.2017. - */ -public interface UpdateEventHandler { - @Subscribe void onUpdateReceived(UpdateReceivedEvent jarFile) throws IOException; -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/client/converter/JarFactory.java b/app-socket-server/src/main/java/com/mercury/platform/client/converter/JarFactory.java deleted file mode 100644 index cd89e827..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/client/converter/JarFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.mercury.platform.client.converter; - -/** - * Created by Frost on 25.01.2017. - */ -public class JarFactory { - -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/client/core/UpdaterClient.java b/app-socket-server/src/main/java/com/mercury/platform/client/core/UpdaterClient.java deleted file mode 100644 index 9dacfc4f..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/client/core/UpdaterClient.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.mercury.platform.client.core; - -import com.mercury.platform.client.bus.UpdaterClientEventBus; -import com.mercury.platform.client.bus.handlers.UpdateEventHandler; -import com.mercury.platform.client.holder.VersionHolder; -import com.mercury.platform.client.init.ClientChannelInitializer; -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.EventLoopGroup; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.channel.socket.nio.NioSocketChannel; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.net.InetSocketAddress; - -/** - * Created by Frost on 14.01.2017. - */ -public class UpdaterClient { - - private static final Logger LOGGER = LogManager.getLogger(UpdaterClient.class); - - private final String host; - private final int port; - private volatile boolean stopped; - - public UpdaterClient(String host, String mercuryVersion, int port) { - this.host = host; - this.port = port; - String version = mercuryVersion.replace(".", "0"); - VersionHolder.getInstance().setVersion(Integer.valueOf(version)); - } - - public void start() throws InterruptedException { - this.stopped = false; - while (!stopped) { - EventLoopGroup group = null; - try { - group = new NioEventLoopGroup(); - LOGGER.info("Starting updater client"); - Bootstrap bootstrap = new Bootstrap(); - bootstrap.group(group).channel(NioSocketChannel.class) - .remoteAddress(new InetSocketAddress(host, port)) - .handler(new ClientChannelInitializer()); - LOGGER.info("Updater client was started"); - ChannelFuture channelFuture = bootstrap.connect().sync(); - channelFuture.channel().closeFuture().sync(); - } catch (Exception e) { - LOGGER.error(e.getMessage()); - } finally { - if (group != null) - group.shutdownGracefully().sync(); - } - Thread.sleep(5000); //TIMEOUT 5 sec - } - } - public void shutdown() { - this.stopped = true; - } - public int getMercuryVersion() { - return VersionHolder.getInstance().getVersion(); - } - - public void registerListener(UpdateEventHandler handler) { - UpdaterClientEventBus.getInstance().register(handler); - } - - public void removeListener(UpdateEventHandler handler) { - UpdaterClientEventBus.getInstance().unregister(handler); - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/client/handlers/ClientHandler.java b/app-socket-server/src/main/java/com/mercury/platform/client/handlers/ClientHandler.java deleted file mode 100644 index 0aba036b..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/client/handlers/ClientHandler.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.mercury.platform.client.handlers; - -import com.google.common.primitives.Bytes; -import com.mercury.platform.client.bus.UpdaterClientEventBus; -import com.mercury.platform.client.bus.event.UpdateReceivedEvent; -import com.mercury.platform.client.holder.VersionHolder; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.SimpleChannelInboundHandler; -import org.apache.commons.lang3.ArrayUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * Created by Frost on 14.01.2017. - */ -public class ClientHandler extends SimpleChannelInboundHandler { - - - private static final Logger LOGGER = LogManager.getLogger(ClientHandler.class); - - private volatile List chunks; - private volatile int length; - - public ClientHandler() { - this.chunks = new ArrayList<>(); - } - - @Override - protected void channelRead0(ChannelHandlerContext channelHandlerContext, Object object) throws Exception { -// LOGGER.debug("Server says \"{}\"", object); - - if (object instanceof Integer) - this.length = (int) object; - - if (object instanceof byte[]) { - byte[] bytes = (byte[]) object; - Byte[] received = ArrayUtils.toObject(bytes); - chunks.addAll(Arrays.asList(received)); - if (chunks.size() == length) { - byte[] array = Bytes.toArray(chunks); - UpdateReceivedEvent event = new UpdateReceivedEvent(array); - UpdaterClientEventBus.getInstance().post(event); - } - } - } - - - @Override - public void channelActive(ChannelHandlerContext context) throws Exception { - LOGGER.debug("Sending version message to server"); - Integer version = VersionHolder.getInstance().getVersion(); - context.channel().writeAndFlush(version); - - } - - - @Override - public void channelInactive(ChannelHandlerContext context) throws Exception { - LOGGER.info("Channel {} is inactive", context.channel().id()); - } - - @Override - public void exceptionCaught(ChannelHandlerContext context, Throwable cause) throws Exception { - LOGGER.error(cause); - } - -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/client/holder/VersionHolder.java b/app-socket-server/src/main/java/com/mercury/platform/client/holder/VersionHolder.java deleted file mode 100644 index 8d6e5628..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/client/holder/VersionHolder.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.mercury.platform.client.holder; - -import com.mercury.platform.holder.UpdateHolder; - -/** - * Created by Frost on 28.01.2017. - */ -public class VersionHolder { - - private static volatile VersionHolder instance; - - public static VersionHolder getInstance() { - VersionHolder localInstance = instance; - if (localInstance == null) { - synchronized (VersionHolder.class) { - localInstance = instance; - if (localInstance == null) { - instance = localInstance = new VersionHolder(); - } - } - } - return localInstance; - } - - private volatile int version; - - private VersionHolder() { - } - - - public int getVersion() { - return version; - } - - public synchronized void setVersion(int version) { - this.version = version; - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/client/init/ClientChannelInitializer.java b/app-socket-server/src/main/java/com/mercury/platform/client/init/ClientChannelInitializer.java deleted file mode 100644 index 67000df1..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/client/init/ClientChannelInitializer.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.mercury.platform.client.init; - -import com.mercury.platform.client.handlers.ClientHandler; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.serialization.ClassResolver; -import io.netty.handler.codec.serialization.ClassResolvers; -import io.netty.handler.codec.serialization.ObjectDecoder; -import io.netty.handler.codec.serialization.ObjectEncoder; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -/** - * Created by Frost on 14.01.2017. - */ -public class ClientChannelInitializer extends ChannelInitializer { - - private static final Logger LOGGER = LogManager.getLogger(ClientChannelInitializer.class); - - @Override - protected void initChannel(SocketChannel socketChannel) throws Exception { - LOGGER.info("Initializing client channel"); - socketChannel.pipeline().addLast(new ObjectEncoder()); - ClassLoader classLoader = this.getClass().getClassLoader(); - ClassResolver classResolver = ClassResolvers.weakCachingResolver(classLoader); - socketChannel.pipeline().addLast(new ObjectDecoder(classResolver)); - socketChannel.pipeline().addLast(new ClientHandler()); - LOGGER.info("Client channel was initialized"); - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/config/MercuryServerConfig.java b/app-socket-server/src/main/java/com/mercury/platform/config/MercuryServerConfig.java deleted file mode 100644 index e6a61272..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/config/MercuryServerConfig.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.mercury.platform.config; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.io.FileReader; -import java.io.IOException; -import java.util.Properties; - -/** - * Created by Frost on 25.01.2017. - */ -public class MercuryServerConfig { - - - private static final Logger LOGGER = LogManager.getLogger(MercuryServerConfig.class); - - private static MercuryServerConfig ourInstance = new MercuryServerConfig(); - - public static MercuryServerConfig getInstance() { - return ourInstance; - } - - - private Properties properties; - private int disruptorBufferSize; - private int port; - private int threadsCount; - - private MercuryServerConfig() { - this.properties = new Properties(); - this.loadConfiguration(); - } - - private void loadConfiguration() { - try { - properties.load(new FileReader("config.properties")); - this.initConfig(); - } catch (IOException e) { - LOGGER.error("Unable to load server configuration. Using default config"); - this.initConfigByDefault(); - } - } - - private void initConfigByDefault() { - this.disruptorBufferSize = 1024; - this.port = 5555; - this.threadsCount = Runtime.getRuntime().availableProcessors() - 1; - } - - private void initConfig() { - this.disruptorBufferSize = Integer.valueOf(properties.getProperty("mercury.disruptor.buffer.size" , "1024")); - this.port = Integer.valueOf(properties.getProperty("mercury.server.port" , "10000")); - this.threadsCount = Integer.valueOf(properties.getProperty("mercury.server.threads.count" , "3")); - } - - - public int disruptorBufferSize() { - return disruptorBufferSize; - } - - public int getThreadsCount() { - return threadsCount; - } - - public int getPort() { - return port; - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/diff/DiffChecker.java b/app-socket-server/src/main/java/com/mercury/platform/diff/DiffChecker.java deleted file mode 100644 index 368edc09..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/diff/DiffChecker.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.mercury.platform.diff; - -import com.mercury.platform.diff.entry.JarEntryComparator; -import com.mercury.platform.diff.entry.JarEntryWrapper; - -import java.util.Collections; -import java.util.List; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import java.util.stream.Collectors; -import java.util.zip.ZipEntry; - -/** - * Created by Frost on 02.01.2017. - */ -public class DiffChecker { - public List calculateDifference(JarFile first, JarFile second) { - - List firstEntries = wrapEntries(Collections.list(first.entries())); - List secondEntries = wrapEntries(Collections.list(second.entries())); - - firstEntries.sort(new JarEntryComparator()); - secondEntries.sort(new JarEntryComparator()); - - List difference; - if (firstEntries.size() > secondEntries.size()) { - firstEntries.removeAll(secondEntries); - difference = firstEntries.stream().map(ZipEntry::toString).collect(Collectors.toList()); - } - else - { - secondEntries.removeAll(firstEntries); - difference = secondEntries.stream().map(ZipEntry::toString).collect(Collectors.toList()); - } - - return difference; - } - - private List wrapEntries(List entries) { - return entries.stream().map(JarEntryWrapper::new).collect(Collectors.toList()); - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/diff/entry/JarEntryComparator.java b/app-socket-server/src/main/java/com/mercury/platform/diff/entry/JarEntryComparator.java deleted file mode 100644 index acca085a..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/diff/entry/JarEntryComparator.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.mercury.platform.diff.entry; - -import org.apache.commons.lang3.ObjectUtils; - -import java.util.Comparator; -import java.util.jar.JarEntry; - -/** - * Created by Frost on 02.01.2017. - */ -public class JarEntryComparator implements Comparator { - public int compare(JarEntry first, JarEntry second) { - return ObjectUtils.compare(first.getName() , second.getName()); - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/diff/entry/JarEntryDescriptor.java b/app-socket-server/src/main/java/com/mercury/platform/diff/entry/JarEntryDescriptor.java deleted file mode 100644 index 97bc6298..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/diff/entry/JarEntryDescriptor.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.mercury.platform.diff.entry; - -/** - * Created by Frost on 03.01.2017. - */ -public class JarEntryDescriptor { - private String fileName; - private long fileSize; - private long creationTime; - - - public JarEntryDescriptor(String fileName, long fileSize, long creationTime) { - this.fileName = fileName; - this.fileSize = fileSize; - this.creationTime = creationTime; - } - - public String getFileName() { - return fileName; - } - - public long getFileSize() { - return fileSize; - } - - public long getCreationTime() { - return creationTime; - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/diff/entry/JarEntryWrapper.java b/app-socket-server/src/main/java/com/mercury/platform/diff/entry/JarEntryWrapper.java deleted file mode 100644 index 2dd6a31f..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/diff/entry/JarEntryWrapper.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.mercury.platform.diff.entry; - -import org.apache.commons.lang3.ObjectUtils; - -import java.util.jar.JarEntry; - -/** - * Created by Frost on 03.01.2017. - */ -public class JarEntryWrapper extends JarEntry{ - - public JarEntryWrapper(JarEntry jarEntry) { - super(jarEntry); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof JarEntry) { - - JarEntry entry = (JarEntry) obj; - - return ObjectUtils.equals(this.getName() , entry.getName()) && - ObjectUtils.equals(this.getSize() , entry.getSize()) && - ObjectUtils.equals(this.getTime() , entry.getTime()); - } - return false; - } - - @Override - public int hashCode() { - return ObjectUtils.hashCodeMulti(this.getName(), this.getSize(), this.getTime()); - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/hash/HashUtils.java b/app-socket-server/src/main/java/com/mercury/platform/hash/HashUtils.java deleted file mode 100644 index 3152d145..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/hash/HashUtils.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.mercury.platform.hash; - -/** - * Created by Frost on 03.01.2017. - */ -public class HashUtils { - -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/holder/UpdateHolder.java b/app-socket-server/src/main/java/com/mercury/platform/holder/UpdateHolder.java deleted file mode 100644 index 56b58867..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/holder/UpdateHolder.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.mercury.platform.holder; - -/** - * Created by Frost on 27.01.2017. - */ -public class UpdateHolder { - - private static volatile UpdateHolder instance; - - public static UpdateHolder getInstance() { - UpdateHolder localInstance = instance; - if (localInstance == null) { - synchronized (UpdateHolder.class) { - localInstance = instance; - if (localInstance == null) { - instance = localInstance = new UpdateHolder(); - } - } - } - return localInstance; - } - - private volatile byte[] update; - private volatile int version; - - private UpdateHolder() { - } - - public synchronized void setUpdate(byte[] update) { - this.update = update; - } - - public byte[] getUpdate() { - return update; - } - - - public void setVersion(int version) { - this.version = version; - } - - public int getVersion() { - return version; - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/server/bus/UpdaterServerAsyncEventBus.java b/app-socket-server/src/main/java/com/mercury/platform/server/bus/UpdaterServerAsyncEventBus.java deleted file mode 100644 index de336e9f..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/server/bus/UpdaterServerAsyncEventBus.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.mercury.platform.server.bus; - -import com.google.common.eventbus.AsyncEventBus; -import com.google.common.eventbus.EventBus; -import com.google.common.eventbus.SubscriberExceptionHandler; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -/** - * Created by Frost on 25.01.2017. - */ -public class UpdaterServerAsyncEventBus extends EventBus { - - private static final UpdaterServerAsyncEventBus instance = new UpdaterServerAsyncEventBus(); - private static final Logger LOGGER = LogManager.getLogger(UpdaterServerAsyncEventBus.class); - - public static UpdaterServerAsyncEventBus getInstance() { - return instance; - } - - private volatile EventBus eventBus; - - - private UpdaterServerAsyncEventBus() { - ExecutorService service = Executors.newCachedThreadPool(); - SubscriberExceptionHandler handler = (throwable, subscriberExceptionContext) -> LOGGER.error(throwable); - this.eventBus = new AsyncEventBus(service, handler); - } - - @Override - public void register(Object object) { - eventBus.register(object); - } - - @Override - public void unregister(Object object) { - eventBus.unregister(object); - } - - @Override - public void post(Object event) { - eventBus.post(event); - } - -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/server/bus/event/ClientActiveEvent.java b/app-socket-server/src/main/java/com/mercury/platform/server/bus/event/ClientActiveEvent.java deleted file mode 100644 index 1766f9ff..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/server/bus/event/ClientActiveEvent.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.mercury.platform.server.bus.event; - -import java.net.InetSocketAddress; - -/** - * Created by Frost on 25.01.2017. - */ -public class ClientActiveEvent { - - private String ipAddress; - - public ClientActiveEvent(InetSocketAddress address) { - this.ipAddress = address.getHostName(); - } - - public String getIpAddress() { - return ipAddress; - } - -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/server/bus/event/ClientUnregisteredEvent.java b/app-socket-server/src/main/java/com/mercury/platform/server/bus/event/ClientUnregisteredEvent.java deleted file mode 100644 index f6cc5fe7..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/server/bus/event/ClientUnregisteredEvent.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.mercury.platform.server.bus.event; - -import java.net.InetSocketAddress; - -/** - * Created by Frost on 28.01.2017. - */ -public class ClientUnregisteredEvent { - private String ipAddress; - - public ClientUnregisteredEvent(InetSocketAddress address) { - this.ipAddress = address.getHostName(); - } - - public String getIpAddress() { - return ipAddress; - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/server/bus/event/ClientUpdatedEvent.java b/app-socket-server/src/main/java/com/mercury/platform/server/bus/event/ClientUpdatedEvent.java deleted file mode 100644 index d9c1143d..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/server/bus/event/ClientUpdatedEvent.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.mercury.platform.server.bus.event; - -import java.net.InetSocketAddress; - -/** - * Created by Frost on 27.01.2017. - */ -public class ClientUpdatedEvent { - private String ipAddress; - - public ClientUpdatedEvent(InetSocketAddress address) { - this.ipAddress = address.getHostName(); - } - - public String getIpAddress() { - return ipAddress; - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/server/bus/handlers/ClientActiveEventHandler.java b/app-socket-server/src/main/java/com/mercury/platform/server/bus/handlers/ClientActiveEventHandler.java deleted file mode 100644 index 28f41e4f..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/server/bus/handlers/ClientActiveEventHandler.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.mercury.platform.server.bus.handlers; - -import com.google.common.eventbus.Subscribe; -import com.mercury.platform.server.bus.event.ClientActiveEvent; - -/** - * Created by Frost on 25.01.2017. - */ -public interface ClientActiveEventHandler { - @Subscribe void onClientConnected(ClientActiveEvent event); -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/server/bus/handlers/ClientUnregisteredEventHandler.java b/app-socket-server/src/main/java/com/mercury/platform/server/bus/handlers/ClientUnregisteredEventHandler.java deleted file mode 100644 index 198c69d1..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/server/bus/handlers/ClientUnregisteredEventHandler.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.mercury.platform.server.bus.handlers; - -import com.google.common.eventbus.Subscribe; -import com.mercury.platform.server.bus.event.ClientUnregisteredEvent; - -/** - * Created by Frost on 28.01.2017. - */ -public interface ClientUnregisteredEventHandler { - @Subscribe - void onClientDisconnected(ClientUnregisteredEvent event); -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/server/bus/handlers/ClientUpdatedEventHandler.java b/app-socket-server/src/main/java/com/mercury/platform/server/bus/handlers/ClientUpdatedEventHandler.java deleted file mode 100644 index abfc018d..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/server/bus/handlers/ClientUpdatedEventHandler.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.mercury.platform.server.bus.handlers; - -import com.google.common.eventbus.Subscribe; -import com.mercury.platform.server.bus.event.ClientUpdatedEvent; - -/** - * Created by Frost on 08.02.2017. - */ -public interface ClientUpdatedEventHandler { - @Subscribe void onClientUpdated(ClientUpdatedEvent event); -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/server/core/UpdaterServer.java b/app-socket-server/src/main/java/com/mercury/platform/server/core/UpdaterServer.java deleted file mode 100644 index 0f883e1e..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/server/core/UpdaterServer.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.mercury.platform.server.core; - -import com.mercury.platform.config.MercuryServerConfig; -import com.mercury.platform.server.init.ServerChannelInitializer; -import io.netty.bootstrap.ServerBootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.EventLoopGroup; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.channel.socket.nio.NioServerSocketChannel; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - - -/** - * Created by Frost on 05.01.2017. - */ -public class UpdaterServer { - - private static final Logger LOGGER = LogManager.getLogger(UpdaterServer.class.getSimpleName()); - private static final int DEFAULT_THREADS_COUNT = MercuryServerConfig.getInstance().getThreadsCount(); - - private int port; - private int nThreads; - private ChannelFuture sync; - private EventLoopGroup bossGroup; - private EventLoopGroup workerGroup; - private volatile boolean started; - - public UpdaterServer(int port) { - this(port, DEFAULT_THREADS_COUNT); - } - - public UpdaterServer(int port, int nThreads) { - this.port = port; - this.nThreads = nThreads; - this.started = false; - } - - public void run() { -// LOGGER.info("Starting server on {} port", port); -// LOGGER.info("Event loop group threads count = {}", nThreads); - this.bossGroup = new NioEventLoopGroup(); - this.workerGroup = new NioEventLoopGroup(nThreads); - - try { -// LOGGER.info("Initializing server bootstrap"); - ServerBootstrap serverBootstrap = new ServerBootstrap(); - serverBootstrap.group(bossGroup, workerGroup) - .channel(NioServerSocketChannel.class) - .childHandler(new ServerChannelInitializer()) - .option(ChannelOption.SO_BACKLOG, 128) - .childOption(ChannelOption.SO_KEEPALIVE, true); - LOGGER.info("Server started"); - this.sync = serverBootstrap.bind(port).sync(); - started = true; - sync.channel().closeFuture().sync(); - - } catch (InterruptedException e) { - LOGGER.error(e); - } finally { - workerGroup.shutdownGracefully(); - bossGroup.shutdownGracefully(); - } - } - - - public void shutdown() { - LOGGER.info("Shutting down updater server..."); - - LOGGER.info("Shutting down worker group = {}", workerGroup.toString()); - workerGroup.shutdownGracefully(); - - LOGGER.info("Shutting down boss group = {}", bossGroup); - bossGroup.shutdownGracefully(); - try { - LOGGER.info("Shutting down channel"); - this.sync.channel().close(); - } catch (Exception e) { - LOGGER.info(e); - } - LOGGER.info("Server is stopped"); - started = false; - } - - public boolean isStarted() { - return started; - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/server/handlers/ServerHandler.java b/app-socket-server/src/main/java/com/mercury/platform/server/handlers/ServerHandler.java deleted file mode 100644 index 2594c3d4..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/server/handlers/ServerHandler.java +++ /dev/null @@ -1,137 +0,0 @@ -package com.mercury.platform.server.handlers; - -import com.mercury.platform.holder.UpdateHolder; -import com.mercury.platform.server.bus.UpdaterServerAsyncEventBus; -import com.mercury.platform.server.bus.event.ClientActiveEvent; -import com.mercury.platform.server.bus.event.ClientUnregisteredEvent; -import com.mercury.platform.server.bus.event.ClientUpdatedEvent; -import com.mercury.platform.update.AlreadyLatestUpdateMessage; -import com.mercury.platform.update.PatchNotesDescriptor; -import com.mercury.platform.update.UpdateDescriptor; -import com.mercury.platform.update.UpdateType; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelInboundHandlerAdapter; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.net.InetSocketAddress; -import java.util.Arrays; - -/** - * Created by Frost on 14.01.2017. - */ -public class ServerHandler extends ChannelInboundHandlerAdapter { - - private String json = "{\n" + - " \"version\":\"1.0.0.3\",\n" + - " \"notes\":[\n" + - " {\n" + - " \"title\" : \"New update\",\n" + - " \"text\" : \"- Added a button to TaskBar - \\\"Travel to hideout\\\".\\n- Added a button to History - \\\"Clear History\\\".\\n- Added a button to History - \\\"Restore notification panel\\\".\\n- Added a checkbox option - \\\"Close Notification panel on Kick\\\".\\n- Added checkboxes for allowing Response buttons to close notification panel on click. See settings.\\n- Increased character limit on \\\"Label\\\" text field: You can now have longer shortcut names.\\n- Fixed a bug with response buttons not being properly removed.\",\n" + - " \"image\" : \"\",\n" + - " \"layout\" : \"VERTICAL\"\n" + - " }\n" + - "]}"; - private static final Logger LOGGER = LogManager.getLogger(ServerHandler.class.getSimpleName()); - private UpdaterServerAsyncEventBus eventBus = UpdaterServerAsyncEventBus.getInstance(); - private UpdateHolder updateHolder = UpdateHolder.getInstance(); - - @Override - public void channelActive(ChannelHandlerContext context) throws Exception { - InetSocketAddress address = (InetSocketAddress) context.channel().remoteAddress(); - eventBus.post(new ClientActiveEvent(address)); - } - - @Override - public void channelRead(ChannelHandlerContext context, Object msg) throws Exception { - - if (msg instanceof UpdateDescriptor) { - UpdateDescriptor descriptor = (UpdateDescriptor) msg; - if (descriptor.getVersion() < updateHolder.getVersion()) { - switch (descriptor.getType()) { - case REQUEST_PATCH_NOTES:{ - PatchNotesDescriptor patchDescriptor = new PatchNotesDescriptor(json); - context.channel().writeAndFlush(patchDescriptor); - break; - } - case REQUEST_INFO: { - UpdateDescriptor updateDescriptor = new UpdateDescriptor(UpdateType.REQUEST_INFO,updateHolder.getVersion()); - context.channel().writeAndFlush(updateDescriptor); - break; - } - case REQUEST_UPDATE: { - byte[] update = UpdateHolder.getInstance().getUpdate(); - context.channel().writeAndFlush(update.length); - int chunkSize = 800 * 1024; - int chunkStart = 0; - int chunkEnd = 0; - - while (chunkStart < update.length) { - if (chunkStart + chunkSize > update.length) { - chunkSize = update.length - chunkStart; - } - - chunkEnd = chunkStart + chunkSize; - - context.channel().writeAndFlush(Arrays.copyOfRange(update, chunkStart, chunkEnd)); - - chunkStart += chunkSize; - } - InetSocketAddress address = (InetSocketAddress) context.channel().remoteAddress(); - eventBus.post(new ClientUpdatedEvent(address)); - break; - } - } - }else { - context.channel().writeAndFlush(new AlreadyLatestUpdateMessage()); - } - }else if(msg instanceof Integer){ - Integer version = (Integer)msg; - if(version < updateHolder.getVersion()) { - byte[] update = UpdateHolder.getInstance().getUpdate(); - context.channel().writeAndFlush(update.length); - int chunkSize = 800 * 1024; - int chunkStart = 0; - int chunkEnd = 0; - - while (chunkStart < update.length) { - if (chunkStart + chunkSize > update.length) { - chunkSize = update.length - chunkStart; - } - - chunkEnd = chunkStart + chunkSize; - - context.channel().writeAndFlush(Arrays.copyOfRange(update, chunkStart, chunkEnd)); - - chunkStart += chunkSize; - } - InetSocketAddress address = (InetSocketAddress) context.channel().remoteAddress(); - eventBus.post(new ClientUpdatedEvent(address)); - } - } - } - - - @Override - public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { - LOGGER.info("Channel {} read complete" , ctx.channel().remoteAddress()); - } - - @Override - public void exceptionCaught(ChannelHandlerContext context, Throwable cause) throws Exception { - } - - - @Override - public void channelInactive(ChannelHandlerContext context) throws Exception { - - } - - - @Override - public void channelUnregistered(ChannelHandlerContext context) throws Exception { - LOGGER.info("{} channel is unregistered" , this); - InetSocketAddress address = (InetSocketAddress) context.channel().remoteAddress(); - eventBus.post(new ClientUnregisteredEvent(address)); - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/server/init/ServerChannelInitializer.java b/app-socket-server/src/main/java/com/mercury/platform/server/init/ServerChannelInitializer.java deleted file mode 100644 index a274f70f..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/server/init/ServerChannelInitializer.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.mercury.platform.server.init; - -import com.mercury.platform.server.handlers.ServerHandler; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; -import io.netty.handler.codec.serialization.ClassResolver; -import io.netty.handler.codec.serialization.ClassResolvers; -import io.netty.handler.codec.serialization.ObjectDecoder; -import io.netty.handler.codec.serialization.ObjectEncoder; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -/** - * Created by Frost on 14.01.2017. - */ -public class ServerChannelInitializer extends ChannelInitializer { - - private static final Logger LOGGER = LogManager.getLogger(ServerChannelInitializer.class.getSimpleName()); - - @Override - protected void initChannel(SocketChannel socketChannel) throws Exception { -// LOGGER.info("Initializing channel for {}" , socketChannel.remoteAddress().getHostName()); - socketChannel.pipeline().addLast(new ObjectEncoder()); - ClassLoader classLoader = this.getClass().getClassLoader(); - ClassResolver classResolver = ClassResolvers.weakCachingResolver(classLoader); - socketChannel.pipeline().addLast(new ObjectDecoder(classResolver)); - socketChannel.pipeline().addLast(new ServerHandler()); - LOGGER.info("Channel for {} was initialized" , socketChannel.remoteAddress().getHostName()); - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/server/main/ServerMain.java b/app-socket-server/src/main/java/com/mercury/platform/server/main/ServerMain.java deleted file mode 100644 index efe5c202..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/server/main/ServerMain.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.mercury.platform.server.main; - -import com.mercury.platform.ui.MercuryUpdaterFrame; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import javax.swing.*; - -/** - * Created by Frost on 02.01.2017. - */ -public class ServerMain { - - private static final Logger LOGGER = LogManager.getLogger(ServerMain.class); - - public static void main(String[] args) { - - SwingUtilities.invokeLater(() -> { - MercuryUpdaterFrame frame = new MercuryUpdaterFrame(); - frame.setVisible(true); - }); - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/ShutdownServerButtonListener.java b/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/ShutdownServerButtonListener.java deleted file mode 100644 index 4ceb3b57..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/ShutdownServerButtonListener.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.mercury.platform.server.main.listeners; - -import com.mercury.platform.server.core.UpdaterServer; -import com.mercury.platform.server.main.listeners.operations.OperationThread; -import com.mercury.platform.ui.MercuryUpdaterFrame; - -import javax.swing.*; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.concurrent.Executors; - -/** - * Created by Frost on 28.01.2017. - */ -public class ShutdownServerButtonListener extends MouseAdapter { - private MercuryUpdaterFrame frame; - - private static class ServerShutdownThread extends OperationThread { - - public ServerShutdownThread(UpdaterServer server) { - super(server); - } - - @Override - public void run() { - if (!server.isStarted()) { - JOptionPane.showMessageDialog(null , "Server is already stopped"); - } - else - this.server.shutdown(); - } - - } - - private ServerShutdownThread thread; - - public ShutdownServerButtonListener(MercuryUpdaterFrame frame,UpdaterServer server) { - this.thread = new ServerShutdownThread(server); - this.frame = frame; - } - - @Override - public void mouseClicked(MouseEvent e) { - Executors.newSingleThreadExecutor().submit(this.thread); - frame.getStatusLabel().setText("Status: Shutdown"); - } -} \ No newline at end of file diff --git a/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/StartServerButtonListener.java b/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/StartServerButtonListener.java deleted file mode 100644 index 09f0e0df..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/StartServerButtonListener.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.mercury.platform.server.main.listeners; - -import com.mercury.platform.holder.UpdateHolder; -import com.mercury.platform.server.core.UpdaterServer; -import com.mercury.platform.server.main.listeners.operations.OperationThread; -import com.mercury.platform.ui.MercuryUpdaterFrame; - -import javax.swing.*; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.concurrent.Executors; - -/** - * Created by Frost on 28.01.2017. - */ -public class StartServerButtonListener extends MouseAdapter { - private MercuryUpdaterFrame frame; //todo - - private static class ServerStarterThread extends OperationThread { - - public ServerStarterThread(UpdaterServer server) { - super(server); - } - - @Override - public void run() { - if (server.isStarted()) { - JOptionPane.showMessageDialog(null , "Server is already started"); - } - else - this.server.run(); - } - } - - private ServerStarterThread thread; - - public StartServerButtonListener(MercuryUpdaterFrame frame, UpdaterServer server) { //todo - this.frame = frame; - this.thread = new ServerStarterThread(server); - } - - @Override - public void mouseClicked(MouseEvent e) { - try { - byte[] bytes = Files.readAllBytes(frame.getPath()); - frame.getStatusLabel().setText("Status: Started"); - UpdateHolder instance = UpdateHolder.getInstance(); - instance.setUpdate(bytes); - instance.setVersion(Integer.valueOf(frame.getVersion().replace("." , "0"))); - } catch (IOException e1) { - e1.printStackTrace(); - } - Executors.newSingleThreadExecutor().submit(this.thread); - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/UIClientActiveListener.java b/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/UIClientActiveListener.java deleted file mode 100644 index aa813dec..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/UIClientActiveListener.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.mercury.platform.server.main.listeners; - -import com.mercury.platform.server.bus.event.ClientActiveEvent; -import com.mercury.platform.server.bus.handlers.ClientActiveEventHandler; - -import javax.swing.JLabel; - -/** - * Created by Frost on 28.01.2017. - */ -public class UIClientActiveListener implements ClientActiveEventHandler { - - private JLabel label; - private int activeUsersCount; - - public UIClientActiveListener(JLabel label) { - this.label = label; - this.activeUsersCount = 0; - } - - @Override - public synchronized void onClientConnected(ClientActiveEvent event) { - this.activeUsersCount = Integer.valueOf(label.getText()); - this.activeUsersCount++; - this.label.setText(String.valueOf(activeUsersCount)); - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/UIClientUnregisteredListener.java b/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/UIClientUnregisteredListener.java deleted file mode 100644 index dd6919c3..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/UIClientUnregisteredListener.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.mercury.platform.server.main.listeners; - -import com.mercury.platform.server.bus.event.ClientUnregisteredEvent; -import com.mercury.platform.server.bus.handlers.ClientUnregisteredEventHandler; - -import javax.swing.*; - -/** - * Created by Frost on 28.01.2017. - */ -public class UIClientUnregisteredListener implements ClientUnregisteredEventHandler { - - private JLabel label; - private int activeUsersCount; - - public UIClientUnregisteredListener(JLabel label) { - this.label = label; - this.activeUsersCount = 0; - } - - @Override - public synchronized void onClientDisconnected(ClientUnregisteredEvent event) { - this.activeUsersCount = Integer.valueOf(label.getText()); - this.activeUsersCount--; - this.label.setText(String.valueOf(activeUsersCount)); - } - -} \ No newline at end of file diff --git a/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/UIClientUpdatedHandler.java b/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/UIClientUpdatedHandler.java deleted file mode 100644 index c26c6dc0..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/UIClientUpdatedHandler.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.mercury.platform.server.main.listeners; - -import com.mercury.platform.server.bus.event.ClientUpdatedEvent; -import com.mercury.platform.server.bus.handlers.ClientUpdatedEventHandler; - -import javax.swing.*; - -/** - * Created by Frost on 08.02.2017. - */ -public class UIClientUpdatedHandler implements ClientUpdatedEventHandler { - - private JLabel label; - private int updatedUsersCount; - - public UIClientUpdatedHandler(JLabel label) { - this.label = label; - this.updatedUsersCount = 0; - } - - @Override - public synchronized void onClientUpdated(ClientUpdatedEvent event) { - this.updatedUsersCount = Integer.valueOf(label.getText()); - this.updatedUsersCount++; - this.label.setText(String.valueOf(updatedUsersCount)); - } -} diff --git a/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/operations/OperationThread.java b/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/operations/OperationThread.java deleted file mode 100644 index 870dbc66..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/server/main/listeners/operations/OperationThread.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.mercury.platform.server.main.listeners.operations; - -import com.mercury.platform.server.core.UpdaterServer; - -/** - * Created by Frost on 28.01.2017. - */ -public abstract class OperationThread extends Thread { - - protected UpdaterServer server; - - - public OperationThread(UpdaterServer server) { - this.server = server; - } - - @Override - public abstract void run(); -} \ No newline at end of file diff --git a/app-socket-server/src/main/java/com/mercury/platform/ui/MercuryUpdaterFrame.java b/app-socket-server/src/main/java/com/mercury/platform/ui/MercuryUpdaterFrame.java deleted file mode 100644 index 67ab58a2..00000000 --- a/app-socket-server/src/main/java/com/mercury/platform/ui/MercuryUpdaterFrame.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.mercury.platform.ui; - -import com.mercury.platform.config.MercuryServerConfig; -import com.mercury.platform.holder.UpdateHolder; -import com.mercury.platform.server.bus.UpdaterServerAsyncEventBus; -import com.mercury.platform.server.bus.handlers.ClientActiveEventHandler; -import com.mercury.platform.server.core.UpdaterServer; -import com.mercury.platform.server.main.listeners.*; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -/** - * Created by Frost on 25.01.2017. - */ -public class MercuryUpdaterFrame extends JFrame { - - private static final Logger LOGGER = LogManager.getLogger(MercuryUpdaterFrame.class.getSimpleName()); - - public static final Dimension DEFAULT_FRAME_SIZE = new Dimension(500, 170); - - private volatile JLabel onlineCountLabel; - private volatile JLabel updateCount; - private volatile JLabel statusLabel; - private volatile JTextField versionField; - private volatile JButton startUpdate; - private UpdaterServer server; - private Path path; - - public MercuryUpdaterFrame(){ - this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - this.setLayout(new BorderLayout()); - this.setLocationRelativeTo(null); - this.setPreferredSize(DEFAULT_FRAME_SIZE); - this.add(getTopPanel(),BorderLayout.PAGE_START); - this.initServer(); - this.add(getLabelsPanel(),BorderLayout.CENTER); - this.add(getBottomPanel(),BorderLayout.PAGE_END); - this.initEvents(); - this.pack(); - - } - - private void initServer() { - MercuryServerConfig serverConfig = MercuryServerConfig.getInstance(); - this.server = new UpdaterServer(serverConfig.getPort()); - } - - private void initEvents() { - UpdaterServerAsyncEventBus asyncEventBus = UpdaterServerAsyncEventBus.getInstance(); - - asyncEventBus.register((ClientActiveEventHandler) event -> - LOGGER.info("Client connected, IP = {}" , event.getIpAddress()) - ); - - asyncEventBus.register(new UIClientActiveListener(onlineCountLabel)); - asyncEventBus.register(new UIClientUnregisteredListener(onlineCountLabel)); - asyncEventBus.register(new UIClientUpdatedHandler(updateCount)); - } - - private JPanel getTopPanel(){ - JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); - JTextField jarPathField = new JTextField(); - jarPathField.setEditable(false); - jarPathField.setPreferredSize(new Dimension(220,24)); - - - FileDialog dialog = new FileDialog(this,"Choose jar", FileDialog.LOAD); - dialog.setDirectory("C:\\"); - - JButton pickJarButton = new JButton("Open"); - pickJarButton.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - dialog.setVisible(true); - path = Paths.get(dialog.getDirectory(), dialog.getFile()); - jarPathField.setText(dialog.getDirectory() + dialog.getFile()); - startUpdate.setEnabled(true); - } - }); - - versionField = new JTextField(); - versionField.setPreferredSize(new Dimension(120,24)); - - - panel.add(jarPathField); - panel.add(pickJarButton); - panel.add(new JLabel("Version: ")); - versionField.setText("1.0.0"); - panel.add(versionField); - return panel; - } - private JPanel getLabelsPanel(){ - JPanel panel = new JPanel(); - panel.setLayout(new BoxLayout(panel,BoxLayout.Y_AXIS)); - - JPanel onlinePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); - JLabel onlineLabel = new JLabel("Online: "); - // - onlineCountLabel = new JLabel("0"); - - onlinePanel.add(onlineLabel); - onlinePanel.add(onlineCountLabel); - - JPanel updatePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); - JLabel updateLabel = new JLabel("Update count: "); - - statusLabel = new JLabel("Status: pending..."); - // - updateCount = new JLabel("0"); - - updatePanel.add(updateLabel); - updatePanel.add(updateCount); - updatePanel.add(statusLabel); - - panel.add(onlinePanel); - panel.add(updatePanel); - return panel; - } - private JPanel getBottomPanel(){ - JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); - - startUpdate = new JButton("Start"); - startUpdate.addMouseListener(new StartServerButtonListener(this,server)); - startUpdate.setEnabled(false); - JButton shutdownUpdate = new JButton("Shut down"); - shutdownUpdate.addMouseListener(new ShutdownServerButtonListener(this,server)); - - panel.add(startUpdate); - panel.add(shutdownUpdate); - return panel; - } - - public Path getPath() { - return path; - } - public String getVersion() { - return versionField.getText(); - } - public JLabel getStatusLabel(){ - return statusLabel; - } -} diff --git a/app-socket-server/src/main/resources/config.properties b/app-socket-server/src/main/resources/config.properties deleted file mode 100644 index dd42376c..00000000 --- a/app-socket-server/src/main/resources/config.properties +++ /dev/null @@ -1,4 +0,0 @@ -#This file contain mercury trader server configuration -mercury.disruptor.buffer.size=1024 -mercury.server.port=10000 -mercury.server.threads.count=3 \ No newline at end of file diff --git a/app-socket-server/src/main/resources/log4j2.xml b/app-socket-server/src/main/resources/log4j2.xml deleted file mode 100644 index 0f34e94e..00000000 --- a/app-socket-server/src/main/resources/log4j2.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app-socket-server/src/test/java/com/mercury/platform/diff/DiffCheckerTest.java b/app-socket-server/src/test/java/com/mercury/platform/diff/DiffCheckerTest.java deleted file mode 100644 index ee13375a..00000000 --- a/app-socket-server/src/test/java/com/mercury/platform/diff/DiffCheckerTest.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.mercury.platform.diff; - -import com.mercury.platform.diff.utils.JarEntryBuilder; -import com.mercury.platform.diff.utils.JarFileMocker; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; -import static org.mockito.Mockito.mock; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - - -import static org.junit.Assert.*; - -/** - * Created by Frost on 02.01.2017. - */ -@RunWith(MockitoJUnitRunner.class) -public class DiffCheckerTest { - - private static final Logger LOGGER = LogManager.getLogger(DiffCheckerTest.class); - - private DiffChecker diffChecker; - - @Before - public void setUp() { - this.diffChecker = new DiffChecker(); - } - - @Test - public void test_diff_by_size() throws IOException { - JarEntry first = new JarEntryBuilder("mercury/framework/First.class").setSize(70).build(); - JarEntry second = new JarEntryBuilder("mercury/framework/Second.class").setSize(50).build(); - String updatedEntryName = "mercury/framework/Third.class"; - JarEntry third = new JarEntryBuilder(updatedEntryName).setSize(50).build(); - JarEntry updatedEntry = new JarEntryBuilder(updatedEntryName).setSize(70).build(); - - List sourceEntries = Arrays.asList(first, second, third); - JarFile sourceJar = JarFileMocker.mockJar(sourceEntries); - - List updatedEntries = Arrays.asList(first, second, updatedEntry); - JarFile updatedJar = JarFileMocker.mockJar(updatedEntries); - - List difference = diffChecker.calculateDifference(sourceJar, updatedJar); - LOGGER.info("Difference = {}" , difference.toString()); - - String format = String.format("difference must contain \"%s\"" , updatedEntryName); - assertTrue(format, difference.size() == 1 && difference.contains(updatedEntryName)); - } - - @Test - public void test_diff_by_time() { - JarEntry first = new JarEntryBuilder("mercury/framework/First.class").setSize(70).build(); - JarEntry second = new JarEntryBuilder("mercury/framework/Second.class").setSize(50).build(); - String updatedEntryName = "mercury/framework/Third.class"; - JarEntry third = new JarEntryBuilder(updatedEntryName).setSize(50).setTime(70).build(); - JarEntry updatedEntry = new JarEntryBuilder(updatedEntryName).setSize(50).setTime(100).build(); - - List sourceEntries = Arrays.asList(first, second, third); - JarFile sourceJar = JarFileMocker.mockJar(sourceEntries); - - - List updatedEntries = Arrays.asList(first, second, updatedEntry); - JarFile updatedJar = JarFileMocker.mockJar(updatedEntries); - - List difference = diffChecker.calculateDifference(sourceJar, updatedJar); - LOGGER.info("Difference = {}" , difference.toString()); - - String format = String.format("difference must contain \"%s\"" , updatedEntryName); - assertTrue(format, difference.size() == 1 && difference.contains(updatedEntryName)); - } - - @Test - public void test_diff_by_file_hash() { - - } - - @After - public void tearDown() { - - - } -} \ No newline at end of file diff --git a/app-socket-server/src/test/java/com/mercury/platform/diff/utils/JarEntryBuilder.java b/app-socket-server/src/test/java/com/mercury/platform/diff/utils/JarEntryBuilder.java deleted file mode 100644 index eb6555f0..00000000 --- a/app-socket-server/src/test/java/com/mercury/platform/diff/utils/JarEntryBuilder.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.mercury.platform.diff.utils; - -import java.util.jar.JarEntry; - -/** - * Created by Frost on 02.01.2017. - */ -public class JarEntryBuilder { - - private JarEntry jarEntry; - - public JarEntryBuilder(String entryName) { - this.jarEntry = new JarEntry(entryName); - } - - public JarEntryBuilder setTime(long time) { - this.jarEntry.setTime(time); - return this; - } - - - public JarEntryBuilder setSize(long size) { - this.jarEntry.setSize(size); - return this; - } - - - public JarEntry build() { - return jarEntry; - } -} \ No newline at end of file diff --git a/app-socket-server/src/test/java/com/mercury/platform/diff/utils/JarFileMocker.java b/app-socket-server/src/test/java/com/mercury/platform/diff/utils/JarFileMocker.java deleted file mode 100644 index 68839b46..00000000 --- a/app-socket-server/src/test/java/com/mercury/platform/diff/utils/JarFileMocker.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.mercury.platform.diff.utils; - -import java.util.Collections; -import java.util.Enumeration; -import java.util.List; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - - -/** - * Created by Frost on 02.01.2017. - */ -public class JarFileMocker { - public static JarFile mockJar(List entries) { - JarFile jarFile = mock(JarFile.class); - Enumeration entryEnumeration = Collections.enumeration(entries); - when(jarFile.entries()).thenReturn(entryEnumeration); - return jarFile; - } -} diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/ComponentsFactory.java b/app-ui/src/main/java/com/mercury/platform/ui/components/ComponentsFactory.java index 04d48980..da3999ec 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/ComponentsFactory.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/ComponentsFactory.java @@ -131,7 +131,7 @@ public JButton getBorderedButton(String text){ return getButton(FontStyle.BOLD, AppThemeColor.BUTTON, compoundBorder, text, 14f); } - public JButton setUpToggleCallbacks(JButton button,ToggleCallback firstState, ToggleCallback secondState, boolean initialState){ + public Component setUpToggleCallbacks(Component button,ToggleCallback firstState, ToggleCallback secondState, boolean initialState){ button.addMouseListener(new MouseAdapter() { private boolean state = initialState; @Override diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/MessagePanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/MessagePanel.java index 7c9738b8..4ce42ca4 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/MessagePanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/MessagePanel.java @@ -25,6 +25,8 @@ import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import java.awt.*; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.StringSelection; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -212,6 +214,13 @@ private JPanel getWhisperPanel(){ inviteButton.addActionListener(e -> { EventRouter.INSTANCE.fireEvent(new ChatCommandEvent("/invite " + whisper)); if(message instanceof ItemMessage) { + Timer timer = new Timer(30, action -> { + StringSelection selection = new StringSelection(((ItemMessage) message).getItemName()); + Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + clipboard.setContents(selection, null); + }); + timer.setRepeats(false); + timer.start(); if (((ItemMessage) message).getTabInfo() != null) { EventRouter.INSTANCE.fireEvent(new ShowItemMeshEvent(message.getWhisperNickname(), ((ItemMessage) message).getTabInfo())); } @@ -221,12 +230,11 @@ private JPanel getWhisperPanel(){ kickButton.addActionListener(e -> { EventRouter.INSTANCE.fireEvent(new ChatCommandEvent("/kick " + whisper)); if(ConfigManager.INSTANCE.isDismissAfterKick()){ - try{ - Thread.sleep(50); + Timer timer = new Timer(30, action -> { EventRouter.INSTANCE.fireEvent(new CloseMessagePanelEvent(MessagePanel.this, message)); - }catch (InterruptedException ex){ - - } + }); + timer.setRepeats(false); + timer.start(); } }); tradeButton = componentsFactory.getIconButton("app/trade.png", 14, AppThemeColor.MSG_HEADER, TooltipConstants.TRADE); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/AboutPanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/AboutPanel.java index c1107c55..ea6294fe 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/AboutPanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/AboutPanel.java @@ -31,7 +31,7 @@ public AboutPanel() { public void createUI() { this.setLayout(new BoxLayout(this,BoxLayout.Y_AXIS)); JPanel imgPanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.CENTER)); - imgPanel.add(componentsFactory.getIconLabel("app/app-icon.png")); + imgPanel.add(componentsFactory.getIconLabel("app/app-icon-big.png")); this.add(imgPanel); JPanel aboutPanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.LEFT)); @@ -93,10 +93,32 @@ public void mouseExited(MouseEvent e) { } }); + JLabel discordButton = componentsFactory.getTextLabel(FontStyle.REGULAR,AppThemeColor.TEXT_MESSAGE, TextAlignment.LEFTOP,16f,"Discord"); + discordButton.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + try { + Desktop.getDesktop().browse(new URI("https://discord.gg/aG9C8XJ")); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + @Override + public void mouseEntered(MouseEvent e) { + setCursor(new Cursor(Cursor.HAND_CURSOR)); + } + + @Override + public void mouseExited(MouseEvent e) { + setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); + } + }); + JPanel feedbackPanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.LEFT)); feedbackPanel.add(componentsFactory.getTextLabel("Feedback & Suggestions: ", FontStyle.REGULAR)); feedbackPanel.add(redditButton); feedbackPanel.add(githubButton); + feedbackPanel.add(discordButton); panel.add(feedbackPanel); return panel; diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/ConfigurationPanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/ConfigurationPanel.java index bbd69eab..dc67ae62 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/ConfigurationPanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/ConfigurationPanel.java @@ -1,6 +1,7 @@ package com.mercury.platform.ui.components.panel.settings; import com.mercury.platform.ui.components.panel.TransparentPanel; +import com.mercury.platform.ui.components.panel.misc.HasUI; import com.mercury.platform.ui.misc.AppThemeColor; import javax.swing.*; @@ -8,7 +9,7 @@ /** * Created by Константин on 05.01.2017. */ -public abstract class ConfigurationPanel extends TransparentPanel{ +public abstract class ConfigurationPanel extends TransparentPanel implements HasUI{ public abstract void processAndSave(); public abstract void restore(); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/CustomButtonSettings.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/CustomButtonSettings.java index 43388ea2..b25aab57 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/CustomButtonSettings.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/CustomButtonSettings.java @@ -23,7 +23,7 @@ /** * Created by Константин on 05.01.2017. */ -public class CustomButtonSettings extends ConfigurationPanel implements HasUI { +public class CustomButtonSettings extends ConfigurationPanel{ private List inputs; private JFrame owner; private JPanel buttonsTable; diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/GeneralSettings.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/GeneralSettings.java index 519f1923..f5c6d3fa 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/GeneralSettings.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/GeneralSettings.java @@ -19,28 +19,17 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -/** - * Created by Константин on 05.01.2017. - */ -public class GeneralSettings extends ConfigurationPanel implements HasUI { +public class GeneralSettings extends ConfigurationPanel{ private JSlider minSlider; private JSlider maxSlider; private JComboBox secondsPicker; private JComboBox notifierStatusPicker; private ComponentFrame owner; - private JButton checkUpdate; private JCheckBox checkEnable; public GeneralSettings(ComponentFrame owner) { super(); this.owner = owner; createUI(); - - EventRouter.INSTANCE.registerHandler(AlertEvent.class, event -> { - checkUpdate.setEnabled(true); - }); - EventRouter.INSTANCE.registerHandler(ClosingPatchNotesEvent.class, event -> { - checkUpdate.setEnabled(true); - }); } @Override @@ -67,16 +56,6 @@ private JPanel getSettingsPanel() { checkEnable = new JCheckBox(); checkEnable.setBackground(AppThemeColor.TRANSPARENT); checkEnable.setSelected(ConfigManager.INSTANCE.isCheckUpdateOnStartUp()); - updatePanel.add(checkEnable); - - JPanel checkUpdatesPanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.CENTER)); - checkUpdate = componentsFactory.getBorderedButton("Check for updates"); - checkUpdate.addActionListener(action -> { - checkUpdate.setEnabled(false); - ApplicationHolder.getInstance().setManualRequest(true); - EventRouter.INSTANCE.fireEvent(new RequestPatchNotesEvent()); - }); - checkUpdatesPanel.add(checkUpdate); JPanel hideSettingsPanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.LEFT)); hideSettingsPanel.add(componentsFactory.getTextLabel("Fade time (seconds). 0 - Always show", FontStyle.REGULAR)); @@ -145,7 +124,7 @@ public void mouseReleased(MouseEvent e) { constraint.gridx = 1; constraint.gridy = 0; constraint.weightx = 0.3f; - root.add(checkUpdatesPanel,constraint); + root.add(checkEnable,constraint); constraint.gridy = 1; root.add(secondsPicker,constraint); constraint.gridy = 2; diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/HelpPanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/HelpPanel.java index 9b84f75d..ebb843a5 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/HelpPanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/HelpPanel.java @@ -52,23 +52,23 @@ public void mouseClicked(MouseEvent e) { } } }); -// JButton patchNotes = componentsFactory.getBorderedButton("Open patch notes"); -// patchNotes.addMouseListener(new MouseAdapter() { -// @Override -// public void mouseClicked(MouseEvent e) { -// if(SwingUtilities.isLeftMouseButton(e)){ -// NotesLoader notesLoader = new NotesLoader(); -// java.util.List patchNotes = notesLoader.getPatchNotes(); -// if(patchNotes.size() != 0){ -// NotesFrame patchNotesFrame = new NotesFrame(patchNotes,NotesFrame.NotesType.PATCH); -// patchNotesFrame.init(); -// patchNotesFrame.showComponent(); -// } -// } -// } -// }); + JButton patchNotes = componentsFactory.getBorderedButton("Open patch notes"); + patchNotes.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + if(SwingUtilities.isLeftMouseButton(e)){ + NotesLoader notesLoader = new NotesLoader(); + java.util.List patchNotes = notesLoader.getPatchNotes(); + if(patchNotes.size() != 0){ + NotesFrame patchNotesFrame = new NotesFrame(patchNotes,NotesFrame.NotesType.PATCH); + patchNotesFrame.init(); + patchNotesFrame.showComponent(); + } + } + } + }); this.add(openTutorial); this.add(openTests); -// this.add(patchNotes); + this.add(patchNotes); } } diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/TaskBarSettingsPanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/TaskBarSettingsPanel.java new file mode 100644 index 00000000..eb3e8f11 --- /dev/null +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/TaskBarSettingsPanel.java @@ -0,0 +1,82 @@ +package com.mercury.platform.ui.components.panel.settings; + +import com.mercury.platform.shared.ConfigManager; +import com.mercury.platform.ui.components.fields.font.FontStyle; +import com.mercury.platform.ui.components.fields.font.TextAlignment; +import com.mercury.platform.ui.misc.AppThemeColor; + +import javax.swing.*; +import javax.swing.border.CompoundBorder; +import java.awt.*; + +/** + * Created by Константин on 09.03.2017. + */ +public class TaskBarSettingsPanel extends ConfigurationPanel{ + private JTextField responseField; + private JCheckBox enableInGameDND; + + public TaskBarSettingsPanel() { + super(); + createUI(); + } + + @Override + public void createUI() { + JPanel root = componentsFactory.getTransparentPanel(new GridLayout(1, 1)); + JPanel dndSettings = componentsFactory.getTransparentPanel(new BorderLayout()); + JLabel dndLabel = componentsFactory.getTextLabel(FontStyle.REGULAR, AppThemeColor.TEXT_DEFAULT, TextAlignment.LEFTOP, 17f, "DND mode"); + dndLabel.setBorder( + new CompoundBorder( + BorderFactory.createMatteBorder(0,0,1,0,AppThemeColor.MSG_HEADER_BORDER), + BorderFactory.createEmptyBorder(3,5,3,5))); + + dndSettings.add(dndLabel,BorderLayout.PAGE_START); + dndSettings.add(getDNDPanel(),BorderLayout.CENTER); + root.add(dndSettings); + this.add(root, BorderLayout.PAGE_START); + } + private JPanel getDNDPanel(){ + JPanel topPanel = componentsFactory.getTransparentPanel(new GridLayout(2,2)); + topPanel.add(componentsFactory.getTextLabel("Enable in-game dnd:", FontStyle.REGULAR), BorderLayout.LINE_START); + enableInGameDND = new JCheckBox(); + enableInGameDND.setBackground(AppThemeColor.TRANSPARENT); + enableInGameDND.setSelected(ConfigManager.INSTANCE.isInGameDnd()); + responseField = componentsFactory.getTextField(ConfigManager.INSTANCE.getDndResponseText(), FontStyle.REGULAR, 16f); + responseField.setEnabled(ConfigManager.INSTANCE.isInGameDnd()); + componentsFactory.setUpToggleCallbacks(enableInGameDND, + () -> { + responseField.setEnabled(false); + }, + () -> { + responseField.setEnabled(true); + },ConfigManager.INSTANCE.isInGameDnd()); + + topPanel.add(enableInGameDND, BorderLayout.CENTER); + + topPanel.add(componentsFactory.getTextLabel("DND response:", FontStyle.REGULAR)); + topPanel.add(responseField); + + topPanel.setBorder(new CompoundBorder( + BorderFactory.createMatteBorder(0,0,1,0,AppThemeColor.MSG_HEADER_BORDER), + BorderFactory.createEmptyBorder(3,0,3,0))); + topPanel.setBackground(AppThemeColor.SETTINGS_BG); + return topPanel; + } + @Override + public void restore() { + this.removeAll(); + createUI(); + } + + @Override + protected LayoutManager getPanelLayout() { + return new BorderLayout(); + } + + @Override + public void processAndSave() { + ConfigManager.INSTANCE.setInGameDnd(enableInGameDND.isSelected()); + ConfigManager.INSTANCE.setDndResponseText(responseField.getText()); + } +} diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/AlertFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/AlertFrame.java index eacbbbe3..300b529b 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/AlertFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/AlertFrame.java @@ -1,6 +1,5 @@ package com.mercury.platform.ui.frame; -import com.mercury.platform.shared.FrameStates; import com.mercury.platform.shared.events.EventRouter; import com.mercury.platform.shared.events.custom.AlertEvent; import com.mercury.platform.ui.misc.AppThemeColor; diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/TitledComponentFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/TitledComponentFrame.java index f0d77339..238cfed4 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/TitledComponentFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/TitledComponentFrame.java @@ -44,8 +44,8 @@ private void initHeaderPanel(){ headerPanel.add(frameTitleLabel, BorderLayout.CENTER); miscPanel.setBackground(AppThemeColor.TRANSPARENT); - hideButton = componentsFactory.getIconButton("app/close.png", 12, AppThemeColor.FRAME_ALPHA, ""); - hideButton.setBorder(BorderFactory.createEmptyBorder(0,10,0,2)); + hideButton = componentsFactory.getIconButton("app/close.png", 14, AppThemeColor.FRAME_ALPHA, ""); + hideButton.setBorder(BorderFactory.createEmptyBorder(0,0,0,2)); hideButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/HistoryFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/HistoryFrame.java index 413786e9..c62112dc 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/HistoryFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/HistoryFrame.java @@ -69,7 +69,7 @@ public void mouseWheelMoved(MouseWheelEvent e) { messagePanel.disableTime(); mainContainer.add(messagePanel); } - this.miscPanel.setBorder(BorderFactory.createEmptyBorder(-2,0,-2,0)); +// this.miscPanel.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); this.miscPanel.add(getClearButton(),0); this.pack(); vBar.setValue(vBar.getMaximum()); @@ -91,7 +91,7 @@ public void mouseWheelMoved(MouseWheelEvent e) { private JButton getClearButton(){ JButton clearHistory = componentsFactory.getIconButton("app/clear-history.png", - 12, + 13, AppThemeColor.TRANSPARENT, "Clear history"); clearHistory.addMouseListener(new MouseAdapter() { @@ -103,6 +103,7 @@ public void mouseClicked(MouseEvent e) { repaint(); } }); + clearHistory.setBorder(BorderFactory.createEmptyBorder(0,0,0,10)); return clearHistory; } diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/SettingsFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/SettingsFrame.java index c9bab827..7f116af1 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/SettingsFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/SettingsFrame.java @@ -1,12 +1,16 @@ package com.mercury.platform.ui.frame.impl; +import com.mercury.platform.core.update.core.holder.ApplicationHolder; import com.mercury.platform.shared.events.EventRouter; import com.mercury.platform.shared.events.custom.AddShowDelayEvent; import com.mercury.platform.shared.events.custom.RepaintEvent; +import com.mercury.platform.shared.events.custom.RequestPatchNotesEvent; import com.mercury.platform.ui.components.fields.MercuryTabbedPane; import com.mercury.platform.ui.components.panel.settings.*; import com.mercury.platform.ui.frame.TitledComponentFrame; +import com.mercury.platform.ui.frame.impl.test.TestCasesFrame; +import com.mercury.platform.ui.manager.FramesManager; import com.mercury.platform.ui.misc.AppThemeColor; import javax.swing.*; @@ -30,7 +34,6 @@ public SettingsFrame(){ setAlwaysOnTop(false); innerPanels = new ArrayList<>(); processingHideEvent = false; - processSEResize = false; } @Override @@ -48,17 +51,52 @@ private void initContainer() { innerPanels.add(generalSettings); ConfigurationPanel cbSettings = new CustomButtonSettings(this); innerPanels.add(cbSettings); + ConfigurationPanel taskBarSettings = new TaskBarSettingsPanel(); + innerPanels.add(taskBarSettings); tabbedPane.addTab("General",generalSettings); tabbedPane.addTab("Notification panel",cbSettings); - tabbedPane.addTab("Help",new HelpPanel()); + tabbedPane.addTab("Task panel",taskBarSettings); +// tabbedPane.addTab("Help",new HelpPanel()); tabbedPane.addTab("Support",new SupportPanel()); tabbedPane.addTab("About",new AboutPanel()); + + JButton openTutorial = + componentsFactory.getIconButton("app/tutorial.png", + 17, + AppThemeColor.TRANSPARENT, + "Open tutorial"); + openTutorial.addActionListener(action -> { + hideComponent(); + FramesManager.INSTANCE.preShowFrame(NotesFrame.class); + }); + JButton checkUpdates = + componentsFactory.getIconButton("app/check-update.png", + 15, + AppThemeColor.TRANSPARENT, + "Check for updates"); + checkUpdates.addActionListener(action -> { + ApplicationHolder.getInstance().setManualRequest(true); + EventRouter.INSTANCE.fireEvent(new RequestPatchNotesEvent()); + }); + JButton openTests = + componentsFactory.getIconButton("app/open-tests.png", + 15, + AppThemeColor.TRANSPARENT, + "Open tests frame"); + openTests.addActionListener(action -> { + hideComponent(); + FramesManager.INSTANCE.preShowFrame(TestCasesFrame.class); + }); + this.miscPanel.add(openTutorial,0); + this.miscPanel.add(checkUpdates,0); + this.miscPanel.add(openTests,0); + this.miscPanel.setBorder(BorderFactory.createEmptyBorder(-4,0,0,0)); + this.add(tabbedPane, BorderLayout.CENTER); this.add(getBottomPanel(), BorderLayout.PAGE_END); } - private JPanel getBottomPanel() { JPanel panel = new JPanel(); panel.setBackground(AppThemeColor.HEADER); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/TaskBarFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/TaskBarFrame.java index 3c29ba50..70dc7543 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/TaskBarFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/impl/TaskBarFrame.java @@ -21,7 +21,7 @@ public class TaskBarFrame extends MovableComponentFrame{ private final Logger logger = LogManager.getLogger(TaskBarFrame.class.getSimpleName()); private Timeline collapseAnimation; - private static final int MAX_WIDTH = 217; + private static final int MAX_WIDTH = 250; private MouseListener collapseListener; public TaskBarFrame() { @@ -177,8 +177,8 @@ public void mousePressed(MouseEvent e) { // taskBarPanel.add(Box.createRigidArea(new Dimension(3, 4))); taskBarPanel.add(historyButton); taskBarPanel.add(Box.createRigidArea(new Dimension(3, 4))); -// taskBarPanel.add(itemGrid); -// taskBarPanel.add(Box.createRigidArea(new Dimension(3, 4))); + taskBarPanel.add(itemGrid); + taskBarPanel.add(Box.createRigidArea(new Dimension(3, 4))); taskBarPanel.add(settingsButton); taskBarPanel.add(Box.createRigidArea(new Dimension(3, 4))); taskBarPanel.add(exitButton); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/manager/FramesManager.java b/app-ui/src/main/java/com/mercury/platform/ui/manager/FramesManager.java index b5ebe25c..58472e0a 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/manager/FramesManager.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/manager/FramesManager.java @@ -50,11 +50,11 @@ public void start(){ OverlaidFrame incMessageFrame = new IncMessageFrame(); framesMap.put(IncMessageFrame.class,incMessageFrame); OverlaidFrame taskBarFrame = new TaskBarFrame(); -// OverlaidFrame itemsMeshFrame = new ItemsGridFrame(); -// framesMap.put(ItemsGridFrame.class,itemsMeshFrame); + OverlaidFrame itemsMeshFrame = new ItemsGridFrame(); + framesMap.put(ItemsGridFrame.class,itemsMeshFrame); locationCommander.addFrame((MovableComponentFrame) incMessageFrame); locationCommander.addFrame((MovableComponentFrame) taskBarFrame); -// locationCommander.addFrame((MovableComponentFrame) itemsMeshFrame); + locationCommander.addFrame((MovableComponentFrame) itemsMeshFrame); NotesLoader notesLoader = new NotesLoader(); List notesOnFirstStart = notesLoader.getNotesOnFirstStart(); diff --git a/app-ui/src/main/resources/app/close.png b/app-ui/src/main/resources/app/close.png index 52f633f0..8eb06de8 100644 Binary files a/app-ui/src/main/resources/app/close.png and b/app-ui/src/main/resources/app/close.png differ diff --git a/app-ui/src/main/resources/notes/first/first-start.json b/app-ui/src/main/resources/notes/first/first-start.json index 6fd241ef..bde33e70 100644 --- a/app-ui/src/main/resources/notes/first/first-start.json +++ b/app-ui/src/main/resources/notes/first/first-start.json @@ -1,7 +1,7 @@ {"notes":[ { "title" : "Overview", - "text" : "MercuryTrade is an overlay application for Path of Exile. It's designed to facilitate all possible trading interactions providing a much better user experience for the players. All the future updates will be available for download from within this application. \n\nThis one minute overview will cover other features as well. \n\nMercuryTrade is 100% legit: no memory manipulations, no injectors!", + "text" : "MercuryTrade is an overlay application for Path of Exile. It's designed to facilitate all possible trading interactions providing a much better user experience for the players. All the future updates will be available for download via this application. \n\nThis one minute overview will cover other features as well. \n\nMercuryTrade is 100% legit: no memory manipulations, no injectors!", "image" : "app/app-icon.png", "layout" : "VERTICAL" }, diff --git a/app-ui/src/main/resources/notes/patch/patch-notes.json b/app-ui/src/main/resources/notes/patch/patch-notes.json index fa4cbf50..161a1de6 100644 --- a/app-ui/src/main/resources/notes/patch/patch-notes.json +++ b/app-ui/src/main/resources/notes/patch/patch-notes.json @@ -1,9 +1,9 @@ { - "version":"1.0.0.3", + "version":"1.0.0.4", "notes":[ { "title" : "New update", - "text" : "- Added a button to TaskBar - \"Travel to hideout\".\n- Added a button to History - \"Clear History\".\n- Added a button to History - \"Restore notification panel\".\n- Added a checkbox option - \"Close Notification panel on Kick\".\n- Added checkboxes for allowing Response buttons to close notification panel on click. See settings.\n- Increased character limit on \"Label\" text field: You can now have longer shortcut names.\n- Fixed a bug with response buttons not being properly removed.", + "text" : "- Now when you Invite a person via notification the item name will be copied to your clipboard.\n- DND mode updated: now there is an option to activate PoE’s in-game /dnd as well. You can set up your own auto-response message in Settings.\n- Some fixes for reported issues.\n- We made a discord server: (See About for the URL). Bug reports, feedback and whatever you want to tell us.\n\nWe are planning a BIG update coming up this weekend - stay tuned! Make sure to tell your friends about MercuryTrade!\nThanks for your feedback and support! Every bit counts!", "image" : "", "layout" : "VERTICAL" } diff --git a/app/pom.xml b/app/pom.xml index 3222a526..489c3a81 100644 --- a/app/pom.xml +++ b/app/pom.xml @@ -25,13 +25,13 @@ com.home.mercury app-shared - ${project.version} + 1.0.0.1 - - lc.kra.system - system-hook - + + + + com.sun.jna jna diff --git a/pom.xml b/pom.xml index ce1e8faf..8d700042 100644 --- a/pom.xml +++ b/pom.xml @@ -12,14 +12,13 @@ app app-ui app-core - app-socket-server app-shared app-local-updater pom - 1.0.0.0 + 1.0.0.4 2.5 3.0.9 @@ -39,11 +38,12 @@ - - lc.kra.system - system-hook - ${systemhook.version} - + + + + + + com.sun.jna jna @@ -122,16 +122,16 @@ - - - system-hook-mvn-repo - https://raw.github.com/kristian/system-hook/mvn-repo/ - - true - always - - - + + + + + + + + + +