Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Exslims committed Aug 13, 2017
2 parents 7bc8b33 + 0b61585 commit 23b0438
Show file tree
Hide file tree
Showing 136 changed files with 2,997 additions and 1,803 deletions.
4 changes: 2 additions & 2 deletions app-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<version>1.0.0.5</version>
</dependency>
<dependency>
<groupId>lc.kra.system</groupId>
<artifactId>system-hook</artifactId>
<groupId>com.1stleg</groupId>
<artifactId>jnativehook</artifactId>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.mercury.platform.core;

public class MercuryConstants {
public static final String APP_VERSION = "1.0.1.6.1";
public static final String APP_VERSION = "1.0.1.7.0";
public static final String SERVER_HOST = "exslims.ddns.net";
public static final int PORT = 5555;
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
package com.mercury.platform.core.misc;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
* Created by Константин on 13.12.2016.
*/
public enum WhisperNotifierStatus {
ALWAYS(0),
ALTAB(1),
NONE(2);

private static final Map<Integer, WhisperNotifierStatus> lookup
= new HashMap<>();
static {
for (WhisperNotifierStatus w : EnumSet.allOf(WhisperNotifierStatus.class)){
lookup.put(w.getCode(),w);
ALWAYS {
@Override
public String asPretty() {
return "Always play a sound";
}
}
private int code;
private WhisperNotifierStatus(int code){
this.code = code;
}
},
ALTAB {
@Override
public String asPretty() {
return "Only when tabbed out";
}
},
NONE {
@Override
public String asPretty() {
return "Never";
}
};

public int getCode() {
return code;
}
public static WhisperNotifierStatus get(int code){
return lookup.get(code);
public abstract String asPretty();
public static WhisperNotifierStatus valueOfPretty(String s){
for (WhisperNotifierStatus status : WhisperNotifierStatus.values()) {
if(status.asPretty().equals(s)){
return status;
}
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
* Created by Frost on 14.01.2017.
*/
public class ClientChannelInitializer extends ChannelInitializer<SocketChannel> {

private static final Logger LOGGER = LogManager.getLogger(ClientChannelInitializer.class.getSimpleName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
import org.apache.logging.log4j.Logger;

import java.net.InetSocketAddress;
import java.util.Random;
import java.util.concurrent.TimeUnit;

/**
* Created by Frost on 14.01.2017.
*/
public class UpdaterClient {

private static final Logger LOGGER = LogManager.getLogger(UpdaterClient.class.getSimpleName());
Expand Down Expand Up @@ -71,7 +69,7 @@ public void operationComplete(ChannelFuture future) throws Exception {
future.channel().close();
future.channel().eventLoop().schedule(() -> {
bootstrap.connect().addListener(this);
},3,TimeUnit.MINUTES);
},new Random().nextInt(5),TimeUnit.MINUTES);
} else {
channel = future.channel();
connectionEstablished = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.util.stream.Collectors;

public class MessageFileHandler implements AsSubscriber {
private static final String dateRGPattern = "^\\n[0-9]{4}\\/(0[1-9]|1[0-2])\\/(0[1-9]|[1-2][0-9]|3[0-1])\\s([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$";
private static final String dateRGPattern = "^\\n?[0-9]{4}\\/(0[1-9]|1[0-2])\\/(0[1-9]|[1-2][0-9]|3[0-1])\\s([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$";
private final Logger logger = LogManager.getLogger(MessageFileHandler.class);
private String logFilePath;
private Date lastMessageDate = new Date();
Expand Down Expand Up @@ -68,9 +68,7 @@ public void parse() {
.collect(Collectors.toList());

List<String> resultMessages = filteredMessages.stream().filter(message -> {
message = StringUtils.substring(message, 0, 20);
Matcher matcher = datePattern.matcher(message);
if(matcher.find()) {
if(message.contains("2017") || message.contains("2018")) { //todo
Date date = new Date(StringUtils.substring(message, 0, 20));
return date.after(lastMessageDate);
}else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package com.mercury.platform.shared.config.configration;


import com.mercury.platform.shared.config.descriptor.adr.AdrTrackerGroupDescriptor;
import com.mercury.platform.shared.config.descriptor.adr.AdrIconDescriptor;
import com.mercury.platform.shared.config.descriptor.adr.AdrProfileDescriptor;
import com.mercury.platform.shared.config.descriptor.adr.AdrProgressBarDescriptor;
import com.mercury.platform.shared.config.descriptor.adr.*;

public interface AdrConfigurationService extends ListConfigurationService<AdrProfileDescriptor>{
AdrIconDescriptor getDefaultIcon();
AdrProgressBarDescriptor getDefaultProgressBar();
AdrTrackerGroupDescriptor getDefaultIconGroup();
AdrTrackerGroupDescriptor getDefaultPBGroup();
AdrCaptureDescriptor getDefaultCapture();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
public interface KeyValueConfigurationService<K, T> {
T get(K key);
Map<K,T> getMap();
void set(Map<K,T> map);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@

public interface PlainConfigurationService<T> {
T get();
void set(T descriptor);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public ApplicationDescriptor get() {
return this.selectedProfile.getApplicationDescriptor();
}

@Override
public void set(ApplicationDescriptor descriptor) {
this.selectedProfile.setApplicationDescriptor(descriptor);
}

@Override
public ApplicationDescriptor getDefault() {
ApplicationDescriptor descriptor = new ApplicationDescriptor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public Map<String, FrameDescriptor> getMap() {
return this.selectedProfile.getFrameDescriptorMap();
}

@Override
public void set(Map<String, FrameDescriptor> map) {
this.selectedProfile.setFrameDescriptorMap(map);
}

@Override
public Map<String, FrameDescriptor> getDefault() {
return defaultFramesSettings;
Expand Down Expand Up @@ -77,7 +82,7 @@ private void initDefaultMap() {
defaultFramesSettings.put("MessageFrame", new FrameDescriptor(new Point(700, 600), new Dimension(315, 0)));
defaultFramesSettings.put("OutMessageFrame", new FrameDescriptor(new Point(200, 500), new Dimension(280, 115)));
defaultFramesSettings.put("TestCasesFrame", new FrameDescriptor(new Point(1400, 500), new Dimension(400, 100)));
defaultFramesSettings.put("SettingsFrame", new FrameDescriptor(new Point(600, 600), new Dimension(600,400)));
defaultFramesSettings.put("SettingsFrame", new FrameDescriptor(new Point(600, 600), new Dimension(800,600)));
defaultFramesSettings.put("HistoryFrame", new FrameDescriptor(new Point(600, 500), new Dimension(280, 400)));
defaultFramesSettings.put("TimerFrame", new FrameDescriptor(new Point(400, 600), new Dimension(240, 102)));
defaultFramesSettings.put("ChatFilterFrame", new FrameDescriptor(new Point(400, 600), new Dimension(500, 300)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.mercury.platform.shared.config.descriptor.HotKeyType;
import com.mercury.platform.shared.config.descriptor.ProfileDescriptor;
import com.mercury.platform.shared.store.MercuryStoreCore;
import lc.kra.system.keyboard.event.GlobalKeyEvent;
import org.jnativehook.keyboard.NativeKeyEvent;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -20,16 +20,11 @@ public HotKeysConfigurationService(ProfileDescriptor selectedProfile) {
@Override
public Map<String, HotKeyDescriptor> getDefault() {
Map<String, HotKeyDescriptor> keyMap = new HashMap<>();
keyMap.put(HotKeyType.INVITE_PLAYER.name(),new HotKeyDescriptor("",GlobalKeyEvent.VK_1,'1',true,false,false,false));
keyMap.put(HotKeyType.TRADE_PLAYER.name(),new HotKeyDescriptor("",GlobalKeyEvent.VK_2,'2',true,false,false,false));
keyMap.put(HotKeyType.KICK_PLAYER.name(),new HotKeyDescriptor("",GlobalKeyEvent.VK_3,'3',true,false,false,false));
keyMap.put(HotKeyType.STILL_INTERESTING.name(),new HotKeyDescriptor("",GlobalKeyEvent.VK_4,'4',true,false,false,false));
keyMap.put(HotKeyType.CLOSE_NOTIFICATION.name(),new HotKeyDescriptor("",GlobalKeyEvent.VK_5,'5',true,false,false,false));
keyMap.put(HotKeyType.EXPAND_ALL.name(),new HotKeyDescriptor("",GlobalKeyEvent.VK_1,'1',false,false,true,false));
keyMap.put("button_1",new HotKeyDescriptor("",GlobalKeyEvent.VK_1,'1',false,true,false,false));
keyMap.put("button_2",new HotKeyDescriptor("",GlobalKeyEvent.VK_1,'2',false,true,false,false));
keyMap.put("button_3",new HotKeyDescriptor("",GlobalKeyEvent.VK_1,'3',false,true,false,false));
keyMap.put("button_4",new HotKeyDescriptor("",GlobalKeyEvent.VK_1,'4',false,true,false,false));
keyMap.put(HotKeyType.INVITE_PLAYER.name(),new HotKeyDescriptor("Alt + 1", NativeKeyEvent.VC_1,'1',true,false,false));
keyMap.put(HotKeyType.TRADE_PLAYER.name(),new HotKeyDescriptor("Alt + 2",NativeKeyEvent.VC_2,'2',true,false,false));
keyMap.put(HotKeyType.KICK_PLAYER.name(),new HotKeyDescriptor("Alt + 3",NativeKeyEvent.VC_3,'3',true,false,false));
keyMap.put(HotKeyType.STILL_INTERESTING.name(),new HotKeyDescriptor("Alt + 4",NativeKeyEvent.VC_4,'4',true,false,false));
keyMap.put(HotKeyType.CLOSE_NOTIFICATION.name(),new HotKeyDescriptor("Alt + 5",NativeKeyEvent.VC_5,'5',true,false,false));
return keyMap;
}

Expand All @@ -52,10 +47,20 @@ public Map<String, HotKeyDescriptor> getMap() {
return this.selectedProfile.getHotKeysDataMap();
}

@Override
public void set(Map<String, HotKeyDescriptor> map) {
this.selectedProfile.setHotKeysDataMap(map);
}

@Override
public void validate() {
if (this.selectedProfile.getHotKeysDataMap() == null){
this.selectedProfile.setHotKeysDataMap(this.getDefault());
}
this.getMap().values().forEach(it -> {
if(it.getTitle().equals("")){
it.setTitle("...");
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.mercury.platform.shared.config.configration.BaseConfigurationService;
import com.mercury.platform.shared.config.configration.PlainConfigurationService;
import com.mercury.platform.shared.config.descriptor.HotKeyDescriptor;
import com.mercury.platform.shared.config.descriptor.NotificationDescriptor;
import com.mercury.platform.shared.config.descriptor.ProfileDescriptor;
import com.mercury.platform.shared.config.descriptor.ResponseButtonDescriptor;
Expand All @@ -20,10 +21,10 @@ public NotificationConfigurationService(ProfileDescriptor selectedProfile) {
public NotificationDescriptor getDefault() {
NotificationDescriptor notificationDescriptor = new NotificationDescriptor();
List<ResponseButtonDescriptor> defaultButtons = new ArrayList<>();
defaultButtons.add(new ResponseButtonDescriptor(0,false,false,"1m","one minute"));
defaultButtons.add(new ResponseButtonDescriptor(1,true,false,"thx","thanks"));
defaultButtons.add(new ResponseButtonDescriptor(2,false,false,"no thx", "no thanks"));
defaultButtons.add(new ResponseButtonDescriptor(3,false,false,"sold", "sold"));
defaultButtons.add(new ResponseButtonDescriptor(0,false,"1m","one minute", new HotKeyDescriptor()));
defaultButtons.add(new ResponseButtonDescriptor(1,true,"thx","thanks",new HotKeyDescriptor()));
defaultButtons.add(new ResponseButtonDescriptor(2,false,"no thx", "no thanks",new HotKeyDescriptor()));
defaultButtons.add(new ResponseButtonDescriptor(3,false,"sold", "sold",new HotKeyDescriptor()));
notificationDescriptor.setButtons(defaultButtons);
notificationDescriptor.setNotificationEnable(true);
notificationDescriptor.setLimitCount(3);
Expand All @@ -44,10 +45,20 @@ public void validate() {
if(this.selectedProfile.getNotificationDescriptor() == null) {
this.selectedProfile.setNotificationDescriptor(this.getDefault());
}
this.get().getButtons().forEach(it -> {
if(it.getHotKeyDescriptor() == null) {
it.setHotKeyDescriptor(new HotKeyDescriptor());
}
});
}

@Override
public NotificationDescriptor get() {
return this.selectedProfile.getNotificationDescriptor();
}

@Override
public void set(NotificationDescriptor descriptor) {
this.selectedProfile.setNotificationDescriptor(descriptor);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,9 @@ public void toDefault() {
public Map<String, Float> getMap() {
return this.selectedProfile.getScaleDataMap();
}

@Override
public void set(Map<String, Float> map) {
this.selectedProfile.setScaleDataMap(map);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ public void validate() {
public ScannerDescriptor get() {
return this.selectedProfile.getScannerDescriptor();
}

@Override
public void set(ScannerDescriptor descriptor) {
this.selectedProfile.setScannerDescriptor(descriptor);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public Map<String, SoundDescriptor> getMap() {
return this.selectedProfile.getSoundDescriptorMap();
}

@Override
public void set(Map<String, SoundDescriptor> map) {
this.selectedProfile.setSoundDescriptorMap(map);
}

@Override
public Map<String, SoundDescriptor> getDefault() {
Map<String,SoundDescriptor> defaultSettings = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@

import com.mercury.platform.shared.config.configration.AdrConfigurationService;
import com.mercury.platform.shared.config.configration.BaseConfigurationService;
import com.mercury.platform.shared.config.descriptor.HotKeyDescriptor;
import com.mercury.platform.shared.config.descriptor.ProfileDescriptor;
import com.mercury.platform.shared.config.descriptor.adr.*;
import com.mercury.platform.shared.config.descriptor.adr.AdrCaptureDescriptor;
import com.mercury.platform.shared.config.json.JSONHelper;

import java.awt.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

public class AdrConfigurationServiceMock extends BaseConfigurationService<List<AdrProfileDescriptor>> implements AdrConfigurationService {
Expand Down Expand Up @@ -100,4 +97,13 @@ private AdrProfileDescriptor getShowCaseProfile(){
profileDescriptor.setContents(jsonHelper.getJsonAsObjectFromFile("notes/showcase-profile.json"));
return profileDescriptor;
}

@Override
public AdrCaptureDescriptor getDefaultCapture() {
AdrCaptureDescriptor descriptor = new AdrCaptureDescriptor();
descriptor.setTitle("Capture");
descriptor.setType(AdrComponentType.CAPTURE);
descriptor.setCaptureLocation(new Point(descriptor.getLocation().x + 80,descriptor.getLocation().y));
return descriptor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import com.mercury.platform.core.misc.WhisperNotifierStatus;
import lombok.Data;

import java.io.Serializable;
import java.util.Map;

@Data
public class ApplicationDescriptor {
public class ApplicationDescriptor implements Serializable{
private WhisperNotifierStatus notifierStatus;
private int minOpacity;
private int maxOpacity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
@AllArgsConstructor
@NoArgsConstructor
public class HotKeyDescriptor implements Serializable{
private String title = "";
private String title = "...";
private int virtualKeyCode;
private char keyChar;
private boolean menuPressed;
private boolean shiftPressed;
private boolean controlPressed;
private boolean extendedKey;
}
Loading

0 comments on commit 23b0438

Please sign in to comment.