-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from AngelsCheeseBurgerOrg/develop
For First Release of "makeamove-site-0.0.1-SNAPSHOT-spring-boot"
- Loading branch information
Showing
15 changed files
with
392 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="src" output="target/classes" path="src"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
<classpathentry kind="output" path="bin"/> | ||
<classpathentry kind="output" path="classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning | ||
org.eclipse.jdt.core.compiler.release=disabled | ||
org.eclipse.jdt.core.compiler.source=1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
activeProfiles= | ||
eclipse.preferences.version=1 | ||
resolveWorkspaceProjects=true | ||
version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.angelssoftware</groupId> | ||
<artifactId>makeamove-site</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<name>Make a Move</name> | ||
<description>Dont make your computer Idle</description> | ||
<build> | ||
<sourceDirectory>src</sourceDirectory> | ||
|
||
<!-- Automate to create a bat script that writes runnable jar execution --> | ||
<resources> | ||
<resource> | ||
<directory>resources/build</directory> | ||
<filtering>true</filtering> | ||
<includes> | ||
<include>**/run_make_a_move.bat</include> | ||
</includes> | ||
</resource> | ||
<resource> | ||
<directory>resources/build</directory> | ||
<filtering>false</filtering> | ||
<excludes> | ||
<exclude>**/run_make_a_move.bat</exclude> | ||
</excludes> | ||
</resource> | ||
</resources> | ||
|
||
<plugins> | ||
|
||
<!-- Always clean project first --> | ||
<plugin> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<version>2.4.1</version> | ||
<configuration> | ||
<filesets> | ||
<fileset> | ||
<directory>target</directory> | ||
</fileset> | ||
</filesets> | ||
</configuration> | ||
</plugin> | ||
|
||
<!-- Source code Compiler --> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.7.0</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
|
||
<!-- Create Executable/Runnable Jar file as a release process --> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<version>2.3.4.RELEASE</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>repackage</goal> | ||
</goals> | ||
<configuration> | ||
<classifier>spring-boot</classifier> | ||
<mainClass> | ||
org.angelssoftware.MakeaMove | ||
</mainClass> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
<!-- | ||
Try to Auto generate the script batch file to execute | ||
the Runnable Jar | ||
--> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<version>3.0.2</version> | ||
<executions> | ||
<execution> | ||
<id>copy-resources</id> | ||
<phase>validate</phase> | ||
<goals> | ||
<goal>copy-resources</goal> | ||
</goals> | ||
<configuration> | ||
<outputDirectory>${basedir}/target/</outputDirectory> | ||
<resources> | ||
<resource> | ||
<directory>${basedir}/target/classes/</directory> | ||
<includes> | ||
<include>run_make_a_move.bat</include> | ||
</includes> | ||
<filtering>true</filtering> | ||
</resource> | ||
</resources> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<developers> | ||
<developer> | ||
<id>ryanseth</id> | ||
<name>Ryan Seth Roldan</name> | ||
<email>ryan.s.roldan@gmail.com</email> | ||
<organization>Angels Software</organization> | ||
</developer> | ||
</developers> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>args4j</groupId> | ||
<artifactId>args4j</artifactId> | ||
<version>2.33</version> | ||
</dependency> | ||
</dependencies> | ||
<url>https://github.com/AngelsCheeseBurgerOrg/MakeaMove</url> | ||
<organization> | ||
<name>Angels Software Org</name> | ||
<url>https://github.com/AngelsCheeseBurgerOrg</url> | ||
</organization> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@echo ON | ||
"${java.home}\\bin\java" -jar ${project.build.finalName}-spring-boot.jar -mouse-direction UP -execution-period 20000 -mouse-hop-px 1 | ||
|
||
@pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
src/org/angelssoftware/interfaces/RobotPropertiesInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 84 additions & 2 deletions
86
src/org/angelssoftware/models/ApplicationArgumentModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,96 @@ | ||
package org.angelssoftware.models; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.angelssoftware.structures.MoveDirection; | ||
import org.angelssoftware.utilities.StringUtils; | ||
import org.kohsuke.args4j.Argument; | ||
import org.kohsuke.args4j.CmdLineException; | ||
import org.kohsuke.args4j.CmdLineParser; | ||
import org.kohsuke.args4j.Option; | ||
import org.kohsuke.args4j.OptionHandlerFilter; | ||
|
||
public class ApplicationArgumentModel extends RobotProperties{ | ||
|
||
private String[] originalArguments; | ||
@Argument | ||
private List<String> arguments = new ArrayList<String>(); | ||
|
||
@Option(name="-mouse-direction",aliases="-m-d", | ||
usage="Set the Mouse Direction you want wherein the movement automation will apply. " | ||
+ "Possible values are UP, DOWN, LEFT, RIGHT." | ||
+ "Default is UP") | ||
private String mouseDirectionArg; | ||
|
||
@Option(name="-execution-period",aliases="-e", | ||
usage="Defines the timing of execution in milliseconds. " | ||
+ "System will continously trigger the next execution after the defined period (similar to delay execution)." | ||
+ "Default is 20,000 (20 seconds)") | ||
private int executionPeriodArg; | ||
|
||
@Option(name="-mouse-hop-px",aliases="-mpx", | ||
usage="Defines the number of pixels the mouse will move to in the automation. " | ||
+ "Default is 1 pixel") | ||
private int mouseHopInPxArg; | ||
|
||
public ApplicationArgumentModel(String[] args) { | ||
originalArguments = args.clone(); | ||
CmdLineParser parser = new CmdLineParser(this); | ||
|
||
try { | ||
// parse the arguments. | ||
parser.parseArgument(args); | ||
matchSetTheArguments(); | ||
} catch( CmdLineException e ) { | ||
// if there's a problem in the command line, | ||
// you'll get this exception. this will report | ||
// an error message. | ||
System.err.println(e.getMessage()); | ||
System.err.println("java SampleMain [options...] arguments..."); | ||
// print the list of available options | ||
parser.printUsage(System.err); | ||
System.err.println(); | ||
|
||
// print option sample. This is useful some time | ||
System.err.println(" Example: java SampleMain"+parser.printExample(OptionHandlerFilter.ALL, null)); | ||
|
||
return; | ||
} | ||
} | ||
|
||
private void matchSetTheArguments() { | ||
if(!(executionPeriodArg <=0)) setTimeDelayInMillis(executionPeriodArg); | ||
if(!(mouseHopInPxArg <=0)) setMouseHopInPx(mouseHopInPxArg); | ||
setMoveDirection(getMoveDirection(mouseDirectionArg)); | ||
} | ||
|
||
public MoveDirection getMoveDirection(String mouseDirectionArg) { | ||
if(StringUtils.isNullOrWhiteSpace(mouseDirectionArg)) return MoveDirection.UP; | ||
mouseDirectionArg = mouseDirectionArg.trim().toUpperCase(); | ||
for (MoveDirection direction : MoveDirection.values()) { | ||
if(direction.toString().equalsIgnoreCase(mouseDirectionArg)) { | ||
return direction; | ||
} | ||
} | ||
return MoveDirection.UP; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder sb = new StringBuilder(); | ||
|
||
sb.append("Args mouseDirectionArg: " + mouseDirectionArg); | ||
sb.append(System.lineSeparator()); | ||
sb.append("Args executionPeriodArg: " + executionPeriodArg); | ||
sb.append(System.lineSeparator()); | ||
sb.append("Args mouseHopInPxArg: " + mouseHopInPxArg); | ||
sb.append(System.lineSeparator()); | ||
sb.append("~~~ Other arguments are:"); | ||
sb.append(System.lineSeparator()); | ||
|
||
for( String s : arguments ) { | ||
sb.append(s); | ||
sb.append(System.lineSeparator()); | ||
} | ||
return sb.toString(); | ||
} | ||
} |
Oops, something went wrong.