diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..91e2046 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +github: [SebCanet] +patreon: SebCanet +custom: ['https://paypal.me/sebcanet?locale.x=fr_FR'] diff --git a/.gitignore b/.gitignore index ca0e591..0e5ae01 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,8 @@ /BlocklyArduinoUpdater/UpdateApp/build/ /BlocklyArduinoUpdater/UpdateApp/dist/ Thumbs.db +/Blockly@rduinoPlugin/build/ +/Blockly@rduinoPlugin/dist/ +/Blockly@rduinoPlugin/src/blocklyarduinoplugin/target/ +/nbproject/private/ +/Blockly@rduinoPlugin/src/target/ \ No newline at end of file diff --git a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$5.class b/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$5.class deleted file mode 100644 index 62a1d69..0000000 Binary files a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$5.class and /dev/null differ diff --git a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer.class b/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer.class deleted file mode 100644 index 4db8793..0000000 Binary files a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer.class and /dev/null differ diff --git a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser.class b/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser.class deleted file mode 100644 index c56051e..0000000 Binary files a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser.class and /dev/null differ diff --git a/Blockly@rduino_Plugin_Installation.pdf b/Blockly@rduino_Plugin_Installation.pdf new file mode 100644 index 0000000..3efc6ec Binary files /dev/null and b/Blockly@rduino_Plugin_Installation.pdf differ diff --git a/BlocklyArduinoPlugin.7z b/BlocklyArduinoPlugin.7z deleted file mode 100644 index 38ac8bb..0000000 Binary files a/BlocklyArduinoPlugin.7z and /dev/null differ diff --git a/BlocklyArduinoPlugin.zip b/BlocklyArduinoPlugin.zip new file mode 100644 index 0000000..5597d38 Binary files /dev/null and b/BlocklyArduinoPlugin.zip differ diff --git a/Blockly@rduinoPlugin/nbproject/configs/release.properties b/BlocklyArduinoPlugin/tool/Blockly@rduino/COPIER_ICI_BLOCKLY@RDUINO.txt similarity index 100% rename from Blockly@rduinoPlugin/nbproject/configs/release.properties rename to BlocklyArduinoPlugin/tool/Blockly@rduino/COPIER_ICI_BLOCKLY@RDUINO.txt diff --git a/BlocklyArduinoPlugin/tool/BlocklyArduinoPlugin.config b/BlocklyArduinoPlugin/tool/BlocklyArduinoPlugin.config new file mode 100644 index 0000000..70f2b55 --- /dev/null +++ b/BlocklyArduinoPlugin/tool/BlocklyArduinoPlugin.config @@ -0,0 +1 @@ +?lang=fr&card=arduino_uno \ No newline at end of file diff --git a/Blockly@rduinoPlugin/dist/BlocklyArduinoPlugin.jar b/BlocklyArduinoPlugin/tool/BlocklyArduinoPlugin.jar similarity index 66% rename from Blockly@rduinoPlugin/dist/BlocklyArduinoPlugin.jar rename to BlocklyArduinoPlugin/tool/BlocklyArduinoPlugin.jar index 3bf7f2f..a1b4a62 100644 Binary files a/Blockly@rduinoPlugin/dist/BlocklyArduinoPlugin.jar and b/BlocklyArduinoPlugin/tool/BlocklyArduinoPlugin.jar differ diff --git a/BlocklyArduinoUpdater/Update app.jar b/BlocklyArduinoUpdater/Update app.jar deleted file mode 100644 index 843595a..0000000 Binary files a/BlocklyArduinoUpdater/Update app.jar and /dev/null differ diff --git a/BlocklyArduinoUpdater/Update.jar b/BlocklyArduinoUpdater/Update.jar deleted file mode 100644 index 26de1c9..0000000 Binary files a/BlocklyArduinoUpdater/Update.jar and /dev/null differ diff --git a/BlocklyArduinoUpdater/Update/nbproject/project.properties b/BlocklyArduinoUpdater/Update/nbproject/project.properties deleted file mode 100644 index 1bee2eb..0000000 --- a/BlocklyArduinoUpdater/Update/nbproject/project.properties +++ /dev/null @@ -1,83 +0,0 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -application.homepage=http://astuce.technology -application.title=Update -application.vendor=babas -endorsed.classpath= -#Tue Mar 06 23:22:41 CET 2018 -excludes= -jar.archive.disabled=${jnlp.enabled} -jar.index=${jnlp.enabled} -javac.deprecation=false -build.test.results.dir=${build.dir}/test/results -javac.external.vm=false -javac.processorpath=\ - ${javac.classpath} -jnlp.codebase.type=no.codebase -jnlp.descriptor=application -jnlp.enabled=false -jnlp.mixed.code=default -jnlp.offline-allowed=false -jnlp.signed=false -jnlp.signing= -jnlp.signing.alias= -jnlp.signing.keystore= -# Optional override of default Application-Library-Allowable-Codebase attribute identifying the locations where your signed RIA is expected to be found. -manifest.custom.application.library.allowable.codebase= -# Optional override of default Caller-Allowable-Codebase attribute identifying the domains from which JavaScript code can make calls to your RIA without security prompts. -manifest.custom.caller.allowable.codebase= -# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed -manifest.custom.codebase= -# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions) -manifest.custom.permissions= -mkdist.disabled=false -project.license=gpl30 -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javadoc.nonavbar=false -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -javac.target=1.6 -javadoc.noindex=false -javadoc.additionalparam= -includes=** -build.classes.dir=${build.dir}/classes -source.encoding=UTF-8 -javadoc.author=false -test.src.dir=test -build.dir=build -build.test.classes.dir=${build.dir}/test/classes -platform.active=default_platform -javac.compilerargs= -main.class=update.Main_Gui -dist.jar=${dist.dir}/Update.jar -javadoc.use=true -build.sysclasspath=ignore -debug.test.classpath=${run.test.classpath} -dist.dir=dist -build.classes.excludes=**/*.java,**/*.form -javadoc.encoding=${source.encoding} -javadoc.splitindex=true -javac.source=1.6 -junit.selected.version=3 -debug.classpath=${run.classpath} -run.jvmargs= -build.generated.dir=${build.dir}/generated -jar.compress=false -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javadoc.private=false -meta.inf.dir=${src.dir}/META-INF -manifest.file=manifest.mf -dist.javadoc.dir=${dist.dir}/javadoc -src.dir=src -javac.classpath= -build.generated.sources.dir=${build.dir}/generated-sources -javadoc.version=false -javadoc.windowtitle= -javadoc.notree=false diff --git a/BlocklyArduinoUpdater/UpdateApp/nbproject/project.properties b/BlocklyArduinoUpdater/UpdateApp/nbproject/project.properties deleted file mode 100644 index adfaa6d..0000000 --- a/BlocklyArduinoUpdater/UpdateApp/nbproject/project.properties +++ /dev/null @@ -1,86 +0,0 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -application.homepage=http://astuce.technology -application.title=UpdateApp -application.vendor=babas -auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml -endorsed.classpath= -#Tue Mar 06 20:42:33 CET 2018 -excludes= -file.reference.pde.jar=..\\..\\pde.jar -jar.archive.disabled=${jnlp.enabled} -jar.index=${jnlp.enabled} -javac.deprecation=false -build.test.results.dir=${build.dir}/test/results -javac.external.vm=false -javac.processorpath=\ - ${javac.classpath} -jnlp.codebase.type=no.codebase -jnlp.descriptor=application -jnlp.enabled=false -jnlp.mixed.code=default -jnlp.offline-allowed=false -jnlp.signed=false -jnlp.signing= -jnlp.signing.alias= -jnlp.signing.keystore= -# Optional override of default Application-Library-Allowable-Codebase attribute identifying the locations where your signed RIA is expected to be found. -manifest.custom.application.library.allowable.codebase= -# Optional override of default Caller-Allowable-Codebase attribute identifying the domains from which JavaScript code can make calls to your RIA without security prompts. -manifest.custom.caller.allowable.codebase= -# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed -manifest.custom.codebase= -# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions) -manifest.custom.permissions= -mkdist.disabled=false -project.license=gpl30 -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javadoc.nonavbar=false -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -javac.target=1.8 -javadoc.noindex=false -javadoc.additionalparam= -includes=** -build.classes.dir=${build.dir}/classes -source.encoding=UTF-8 -javadoc.author=false -test.src.dir=test -build.dir=build -build.test.classes.dir=${build.dir}/test/classes -platform.active=default_platform -javac.compilerargs= -main.class=updateapp.Main -dist.jar=${dist.dir}/Update app.jar -javadoc.use=true -build.sysclasspath=ignore -debug.test.classpath=${run.test.classpath} -dist.dir=dist -build.classes.excludes=**/*.java,**/*.form -javadoc.encoding=${source.encoding} -javadoc.splitindex=true -javac.source=1.8 -junit.selected.version=3 -debug.classpath=${run.classpath} -run.jvmargs= -build.generated.dir=${build.dir}/generated -jar.compress=false -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javadoc.private=false -meta.inf.dir=${src.dir}/META-INF -manifest.file=manifest.mf -dist.javadoc.dir=${dist.dir}/javadoc -src.dir=src -javac.classpath=\ - ${file.reference.pde.jar} -build.generated.sources.dir=${build.dir}/generated-sources -javadoc.version=false -javadoc.windowtitle= -javadoc.notree=false diff --git a/BlocklyArduinoUpdater/UpdateApp/src/updateapp/Updater.java b/BlocklyArduinoUpdater/UpdateApp/src/updateapp/Updater.java deleted file mode 100644 index 424c74d..0000000 --- a/BlocklyArduinoUpdater/UpdateApp/src/updateapp/Updater.java +++ /dev/null @@ -1,47 +0,0 @@ -package updateapp; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -/** - * - * @author Thomas Otero H3R3T1C - */ -public class Updater { - private final static String versionURL = "http://www.technologiescollege.fr/blockly@rduino/version.txt"; - private final static String historyURL = "http://www.technologiescollege.fr/blockly@rduino/history.txt"; - - public final static String nothingURL = "http://www.technologiescollege.fr/blockly@rduino/nothingNew.txt"; - - public static String getLocalVersion() throws Exception - { - String dataLocal = new String(java.nio.file.Files.readAllBytes(java.nio.file.Paths.get("version.txt"))); - return dataLocal.substring(dataLocal.indexOf("[version]")+9,dataLocal.indexOf("[/version]")); - } - - public static String getLatestVersion() throws Exception - { - String data = getData(versionURL); - return data.substring(data.indexOf("[version]")+9,data.indexOf("[/version]")); - } - - public static String getWhatsNew() throws Exception - { - String data = getData(historyURL); - return data.substring(data.indexOf("[history]")+9,data.indexOf("[/history]")); - } - - public static String getData(String address)throws Exception - { - URL url = new URL(address); - InputStream html = null; - html = url.openStream(); - int c = 0; - StringBuffer buffer = new StringBuffer(""); - while(c != -1) { - c = html.read(); - buffer.append((char)c); - } - return buffer.toString(); - } -} \ No newline at end of file diff --git a/README.md b/README.md index c980dee..83ce135 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,63 @@ # Arduino IDE plugin for Blockly@rduino +## Presentation + *Plugin to unzip inside Arduino\tools\. -It creates a BlocklyArduinoPlugin folder within a jar server file and Blockly@rduino updated (https://github.com/technologiescollege/Blockly-at-rduino).* +It creates a BlocklyArduinoPlugin folder within a jar server file, and you have to add Blockly@rduino (https://github.com/technologiescollege/Blockly-at-rduino).* ![screen capture](https://raw.githubusercontent.com/technologiescollege/BlocklyArduinoIDEPlugin/master/capture_en.jpg) +## Présentation -Blockly@rduino s’intègre complètement au logiciel Arduino pour une utilisation 100% hors ligne. Il suffira de lancer le logiciel Arduino puis de cliquer dans « outils -> Blockly@rduino ». Le greffon (lien de téléchargement en bas) est à décompresser dans le dossier « tools » du logiciel Arduino. Cela va créer un dossier BlocklyArduinoPlugin qui contient le serveur jar et Blockly@rduino mis à jour (https://github.com/technologiescollege/Blockly-at-rduino). +Blockly@rduino s’intègre complètement au logiciel Arduino pour une utilisation 100% hors ligne. Il suffira de lancer le logiciel Arduino puis de cliquer dans « outils -> Blockly@rduino ». Le greffon (lien de téléchargement en bas) est à décompresser dans le dossier « tools » du logiciel Arduino. Cela va créer un dossier BlocklyArduinoPlugin qui contient le serveur jar et dans lequel il faut décompresser Blockly@rduino (https://github.com/technologiescollege/Blockly-at-rduino). ![enter image description here](https://raw.githubusercontent.com/technologiescollege/BlocklyArduinoIDEPlugin/master/capture_fr.jpg) +## Tools folder/dossier 'tools' + ![enter image description here](https://raw.githubusercontent.com/technologiescollege/BlocklyArduinoIDEPlugin/master/arborescence.jpg) +## How to install + +I created jar file just to unzip: + - download plugin zip file: [https://github.com/technologiescollege/BlocklyArduinoIDEPlugin/raw/master/BlocklyArduinoPlugin.zip](https://github.com/technologiescollege/BlocklyArduinoIDEPlugin/raw/master/BlocklyArduinoPlugin.zip) + - unzip it in **tools** folder, like you can see in 'Tools folder picture' + - download Blockl@rduino zip file: [https://github.com/technologiescollege/Blockly-at-rduino/archive/gh-pages.zip](https://github.com/technologiescollege/Blockly-at-rduino/archive/gh-pages.zip) + - unzip it in **plugin** folder, like you can see in 'Tools folder picture' (*beware of folder name!*) + - launch IDE Arduino + - run it from 'tools' menu + +## Comment l'installer + +Je vous ai créé un plugin (fichier jar exécuté) pour lancer Blockly@rduino : + + - télécharger le zip du greffon : [https://github.com/technologiescollege/BlocklyArduinoIDEPlugin/raw/master/BlocklyArduinoPlugin.zip](https://github.com/technologiescollege/BlocklyArduinoIDEPlugin/raw/master/BlocklyArduinoPlugin.zip) + - dézipper dans le dossier '**tools**', comme dans la capture d'écran précédente du 'dossier tools' + - télécharger le zip de Blockly@rduino : [https://github.com/technologiescollege/Blockly-at-rduino/archive/gh-pages.zip](https://github.com/technologiescollege/Blockly-at-rduino/archive/gh-pages.zip) + - dézipper dans le dossier du **plugin**, comme dans la capture d'écran précédente du dossier 'tools' (ATTENTION aux noms de dossier) + - lancer l'EDI Arduino + - lancer depuis le menu 'outils' + - laisser faire... + +## Update Blockly@rduino + + - download Blockl@rduino zip file: [https://github.com/technologiescollege/Blockly-at-rduino/archive/gh-pages.zip](https://github.com/technologiescollege/Blockly-at-rduino/archive/gh-pages.zip) + - unzip it in **tools\BlocklyArduinoPlugin\tool\Blockly@rduino** folder, like you can see in 'Tools folder picture' (*beware of folder name!*) + +## Mise à jour de Blcokly@rduino + + - télécharger le zip de Blockly@rduino : [https://github.com/technologiescollege/Blockly-at-rduino/archive/gh-pages.zip](https://github.com/technologiescollege/Blockly-at-rduino/archive/gh-pages.zip) + - dézipper dans le dossier du **tools\BlocklyArduinoPlugin\tool\Blockly@rduino**, comme dans la capture d'écran précédente du dossier 'tools' (ATTENTION aux noms de dossier) + + +## HELP + +For any help, go on forum: http://blockly.technologiescollege.fr/forum/index.php + Merci par avance des retours via le forum : http://blockly.technologiescollege.fr/forum/index.php +## Thanks + Thanks to Dwenguino, my plugin is totally inspired from their plugin work: https://github.com/dwengovzw/Blockly-for-Dwenguino Merci à Dwenguino, mon plugin se base sur leur code de plugin : https://github.com/dwengovzw/Blockly-for-Dwenguino - - -**Direct download link / Lien de téléchargement direct :** -https://github.com/technologiescollege/BlocklyArduinoIDEPlugin/raw/master/BlocklyArduinoPlugin.7z diff --git a/BlocklyArduinoUpdater/BlocklyArduinoUpdater.java b/dev/BlocklyArduinoUpdater/BlocklyArduinoUpdater.java similarity index 92% rename from BlocklyArduinoUpdater/BlocklyArduinoUpdater.java rename to dev/BlocklyArduinoUpdater/BlocklyArduinoUpdater.java index 30f6077..8529318 100644 --- a/BlocklyArduinoUpdater/BlocklyArduinoUpdater.java +++ b/dev/BlocklyArduinoUpdater/BlocklyArduinoUpdater.java @@ -26,7 +26,7 @@ public void run() { PathToExec += "\\tools\\BlocklyArduinoUpdater\\tool\\"; //System.out.println("Current relative path is: " + PathToExec); Runtime runtime = Runtime.getRuntime(); - runtime.exec(new String[] { PathToExec + "updater.bat" } ); + runtime.exec(new String[] { PathToExec + "server.bat" } ); } catch (IOException e) { e.printStackTrace(); } diff --git a/BlocklyArduinoUpdater/blocklyarduinoupdater/BlocklyArduinoUpdater.class b/dev/BlocklyArduinoUpdater/blocklyarduinoupdater/BlocklyArduinoUpdater.class similarity index 100% rename from BlocklyArduinoUpdater/blocklyarduinoupdater/BlocklyArduinoUpdater.class rename to dev/BlocklyArduinoUpdater/blocklyarduinoupdater/BlocklyArduinoUpdater.class diff --git a/BlocklyArduinoUpdater/pde.jar b/dev/BlocklyArduinoUpdater/pde.jar similarity index 100% rename from BlocklyArduinoUpdater/pde.jar rename to dev/BlocklyArduinoUpdater/pde.jar diff --git a/BlocklyArduinoUpdater/version.xml b/dev/BlocklyArduinoUpdater/version.xml similarity index 100% rename from BlocklyArduinoUpdater/version.xml rename to dev/BlocklyArduinoUpdater/version.xml diff --git a/BlocklyArduinoUpdater/UpdateApp/build.xml b/dev/JavaUpdater/Update app/build.xml similarity index 94% rename from BlocklyArduinoUpdater/UpdateApp/build.xml rename to dev/JavaUpdater/Update app/build.xml index 3b41da2..c0e1284 100644 --- a/BlocklyArduinoUpdater/UpdateApp/build.xml +++ b/dev/JavaUpdater/Update app/build.xml @@ -7,8 +7,8 @@ - - Builds, tests, and runs the project UpdateApp. + + Builds, tests, and runs the project Update app. - + @@ -450,7 +450,7 @@ is divided into following sections: - + @@ -601,7 +601,7 @@ is divided into following sections: - + @@ -893,7 +893,7 @@ is divided into following sections: - + @@ -1378,7 +1378,7 @@ is divided into following sections: - + diff --git a/BlocklyArduinoUpdater/UpdateApp/nbproject/genfiles.properties b/dev/JavaUpdater/Update app/nbproject/genfiles.properties similarity index 67% rename from BlocklyArduinoUpdater/UpdateApp/nbproject/genfiles.properties rename to dev/JavaUpdater/Update app/nbproject/genfiles.properties index eaeec78..c027d14 100644 --- a/BlocklyArduinoUpdater/UpdateApp/nbproject/genfiles.properties +++ b/dev/JavaUpdater/Update app/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=6c9dfcda -build.xml.script.CRC32=c12b9cba +build.xml.data.CRC32=f682ecb6 +build.xml.script.CRC32=38145bc2 build.xml.stylesheet.CRC32=8064a381@1.80.1.48 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=6c9dfcda -nbproject/build-impl.xml.script.CRC32=4c51be95 +nbproject/build-impl.xml.data.CRC32=f682ecb6 +nbproject/build-impl.xml.script.CRC32=1be4d620 nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/BlocklyArduinoUpdater/UpdateApp/nbproject/private/private.properties b/dev/JavaUpdater/Update app/nbproject/private/private.properties similarity index 62% rename from BlocklyArduinoUpdater/UpdateApp/nbproject/private/private.properties rename to dev/JavaUpdater/Update app/nbproject/private/private.properties index fbcb760..60b5a61 100644 --- a/BlocklyArduinoUpdater/UpdateApp/nbproject/private/private.properties +++ b/dev/JavaUpdater/Update app/nbproject/private/private.properties @@ -1,6 +1,2 @@ compile.on.save=true -do.depend=false -do.jar=true -javac.debug=true -javadoc.preview=true user.properties.file=C:\\Users\\babas\\AppData\\Roaming\\NetBeans\\8.2\\build.properties diff --git a/Blockly@rduinoPlugin/nbproject/private/private.xml b/dev/JavaUpdater/Update app/nbproject/private/private.xml similarity index 64% rename from Blockly@rduinoPlugin/nbproject/private/private.xml rename to dev/JavaUpdater/Update app/nbproject/private/private.xml index 236643a..9212ff5 100644 --- a/Blockly@rduinoPlugin/nbproject/private/private.xml +++ b/dev/JavaUpdater/Update app/nbproject/private/private.xml @@ -1,11 +1,12 @@ + - file:/F:/Logiciels/Arduino_graphique/BlocklyArduinoIDEPlugin/Blockly@rduinoPlugin/src/blocklyarduinoplugin/Browser.java - file:/F:/Logiciels/Arduino_graphique/BlocklyArduinoIDEPlugin/Blockly@rduinoPlugin/src/blocklyarduinoplugin/BlocklyArduinoServer.java - file:/F:/Logiciels/Arduino_graphique/BlocklyArduinoIDEPlugin/Blockly@rduinoPlugin/src/blocklyarduinoplugin/BlocklyArduinoPlugin.java + file:/F:/Logiciels/Arduino_graphique/BlocklyArduinoIDEPlugin/JavaUpdater/Update%20app/src/updateapp/UpdateInfo.java + file:/F:/Logiciels/Arduino_graphique/BlocklyArduinoIDEPlugin/JavaUpdater/Update%20app/src/updateapp/Main.java + file:/F:/Logiciels/Arduino_graphique/BlocklyArduinoIDEPlugin/JavaUpdater/Update%20app/src/updateapp/Updater.java diff --git a/dev/JavaUpdater/Update app/nbproject/project.properties b/dev/JavaUpdater/Update app/nbproject/project.properties new file mode 100644 index 0000000..3ca2433 --- /dev/null +++ b/dev/JavaUpdater/Update app/nbproject/project.properties @@ -0,0 +1,45 @@ +#Sun Jun 24 16:42:43 CEST 2018 +excludes= +javac.deprecation=false +build.test.results.dir=${build.dir}/test/results +run.classpath=${javac.classpath}\:${build.classes.dir} +javadoc.nonavbar=false +run.test.classpath=${javac.test.classpath}\:${build.test.classes.dir} +javac.target=1.6 +javadoc.noindex=false +javadoc.additionalparam= +includes=** +build.classes.dir=${build.dir}/classes +source.encoding=UTF-8 +javadoc.author=false +test.src.dir=test +build.dir=build +build.test.classes.dir=${build.dir}/test/classes +platform.active=default_platform +javac.compilerargs= +main.class=updateapp.Main +dist.jar=${dist.dir}/Update app.jar +javadoc.use=true +build.sysclasspath=ignore +debug.test.classpath=${run.test.classpath} +dist.dir=dist +build.classes.excludes=**/*.java,**/*.form +javadoc.encoding=${source.encoding} +javadoc.splitindex=true +javac.source=1.6 +junit.selected.version=3 +debug.classpath=${run.classpath} +run.jvmargs= +build.generated.dir=${build.dir}/generated +jar.compress=false +javac.test.classpath=${javac.classpath}\:${build.classes.dir}\:\:${libs.junit_4.classpath}\:${libs.hamcrest.classpath} +javadoc.private=false +meta.inf.dir=${src.dir}/META-INF +manifest.file=manifest.mf +dist.javadoc.dir=${dist.dir}/javadoc +src.dir=src +javac.classpath= +build.generated.sources.dir=${build.dir}/generated-sources +javadoc.version=false +javadoc.windowtitle= +javadoc.notree=false diff --git a/BlocklyArduinoUpdater/UpdateApp/nbproject/project.xml b/dev/JavaUpdater/Update app/nbproject/project.xml similarity index 92% rename from BlocklyArduinoUpdater/UpdateApp/nbproject/project.xml rename to dev/JavaUpdater/Update app/nbproject/project.xml index f490914..ac8b51b 100644 --- a/BlocklyArduinoUpdater/UpdateApp/nbproject/project.xml +++ b/dev/JavaUpdater/Update app/nbproject/project.xml @@ -3,7 +3,7 @@ org.netbeans.modules.java.j2seproject - UpdateApp + Update app diff --git a/BlocklyArduinoUpdater/UpdateApp/src/updateapp/Main.java b/dev/JavaUpdater/Update app/src/updateapp/Main.java similarity index 54% rename from BlocklyArduinoUpdater/UpdateApp/src/updateapp/Main.java rename to dev/JavaUpdater/Update app/src/updateapp/Main.java index ed27efe..888c1d2 100644 --- a/BlocklyArduinoUpdater/UpdateApp/src/updateapp/Main.java +++ b/dev/JavaUpdater/Update app/src/updateapp/Main.java @@ -1,3 +1,4 @@ + package updateapp; /** @@ -5,16 +6,15 @@ * @author Thomas Otero (H3R3T1C) */ public class Main { - + public static void main(String[] args) { - try { - if (Integer.parseInt(Updater.getLatestVersion()) > Integer.parseInt(Updater.getLocalVersion())) { + try { + if (Integer.parseInt(Updater.getLatestVersion()) > 0) { new UpdateInfo(Updater.getWhatsNew()); - } else { - new UpdateInfo(Updater.getData(Updater.nothingURL)); } } catch (Exception ex) { ex.printStackTrace(); } } -} \ No newline at end of file + +} diff --git a/BlocklyArduinoUpdater/UpdateApp/src/updateapp/UpdateInfo.java b/dev/JavaUpdater/Update app/src/updateapp/UpdateInfo.java similarity index 74% rename from BlocklyArduinoUpdater/UpdateApp/src/updateapp/UpdateInfo.java rename to dev/JavaUpdater/Update app/src/updateapp/UpdateInfo.java index 073c244..8cef9d0 100644 --- a/BlocklyArduinoUpdater/UpdateApp/src/updateapp/UpdateInfo.java +++ b/dev/JavaUpdater/Update app/src/updateapp/UpdateInfo.java @@ -1,3 +1,8 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + package updateapp; import java.awt.BorderLayout; @@ -23,20 +28,15 @@ public class UpdateInfo extends JFrame{ private JPanel pan1; private JPanel pan2; - public UpdateInfo(String info) throws Exception { + public UpdateInfo(String info) { initComponents(); infoPane.setText(info); } - - private void initComponents() throws Exception { + + private void initComponents() { this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - if (Integer.parseInt(Updater.getLatestVersion()) > Integer.parseInt(Updater.getLocalVersion())) { - this.setTitle("New Update Found"); - } else { - this.setTitle("No Update Found"); - } - + this.setTitle("New Update Found"); pan1 = new JPanel(); pan1.setLayout(new BorderLayout()); @@ -51,15 +51,11 @@ private void initComponents() throws Exception { ok = new JButton("Update"); ok.addActionListener( new ActionListener(){ + public void actionPerformed(ActionEvent e) { update(); } }); - /*if (Integer.parseInt(Updater.getLatestVersion()) > Integer.parseInt(Updater.getLocalVersion())) { - ok.setEnabled(true); - } else { - ok.setEnabled(false); - }*/ cancel = new JButton("Cancel"); cancel.addActionListener( new ActionListener(){ @@ -77,9 +73,9 @@ public void actionPerformed(ActionEvent e) { show(); this.setSize(300, 200); } - - private void update() { - String[] run = {"java","-jar","Update.jar"}; + private void update() + { + String[] run = {"java","-jar","updater/update.jar"}; try { Runtime.getRuntime().exec(run); } catch (Exception ex) { @@ -87,4 +83,5 @@ private void update() { } System.exit(0); } -} \ No newline at end of file + +} diff --git a/dev/JavaUpdater/Update app/src/updateapp/Updater.java b/dev/JavaUpdater/Update app/src/updateapp/Updater.java new file mode 100644 index 0000000..0c4bb68 --- /dev/null +++ b/dev/JavaUpdater/Update app/src/updateapp/Updater.java @@ -0,0 +1,41 @@ +package updateapp; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +/** + * + * @author Thomas Otero H3R3T1C + */ +public class Updater { + private final static String versionURL = "http://h3r3t1cupdate.bravehost.com/version.html"; + private final static String historyURL = "http://h3r3t1cupdate.bravehost.com/history.html"; + public static String getLatestVersion() throws Exception + { + String data = getData(versionURL); + return data.substring(data.indexOf("[version]")+9,data.indexOf("[/version]")); + } + public static String getWhatsNew() throws Exception + { + String data = getData(historyURL); + return data.substring(data.indexOf("[history]")+9,data.indexOf("[/history]")); + } + private static String getData(String address)throws Exception + { + URL url = new URL(address); + + InputStream html = null; + + html = url.openStream(); + + int c = 0; + StringBuffer buffer = new StringBuffer(""); + + while(c != -1) { + c = html.read(); + + buffer.append((char)c); + } + return buffer.toString(); + } +} diff --git a/BlocklyArduinoUpdater/Update/build.xml b/dev/JavaUpdater/Update/build.xml similarity index 100% rename from BlocklyArduinoUpdater/Update/build.xml rename to dev/JavaUpdater/Update/build.xml diff --git a/dev/JavaUpdater/Update/build/built-jar.properties b/dev/JavaUpdater/Update/build/built-jar.properties new file mode 100644 index 0000000..d4c6d56 --- /dev/null +++ b/dev/JavaUpdater/Update/build/built-jar.properties @@ -0,0 +1,2 @@ +#Thu Sep 16 21:56:22 MDT 2010 +C\:\\Users\\H3R3T1C\\Desktop\\My\ Folder\\Java\\Update= diff --git a/dev/JavaUpdater/Update/build/classes/.netbeans_automatic_build b/dev/JavaUpdater/Update/build/classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/dev/JavaUpdater/Update/build/classes/.netbeans_update_resources b/dev/JavaUpdater/Update/build/classes/.netbeans_update_resources new file mode 100644 index 0000000..e69de29 diff --git a/dev/JavaUpdater/Update/build/classes/update/Main_Gui$1.class b/dev/JavaUpdater/Update/build/classes/update/Main_Gui$1.class new file mode 100644 index 0000000..63aab10 Binary files /dev/null and b/dev/JavaUpdater/Update/build/classes/update/Main_Gui$1.class differ diff --git a/dev/JavaUpdater/Update/build/classes/update/Main_Gui$2.class b/dev/JavaUpdater/Update/build/classes/update/Main_Gui$2.class new file mode 100644 index 0000000..93023d5 Binary files /dev/null and b/dev/JavaUpdater/Update/build/classes/update/Main_Gui$2.class differ diff --git a/dev/JavaUpdater/Update/build/classes/update/Main_Gui$3.class b/dev/JavaUpdater/Update/build/classes/update/Main_Gui$3.class new file mode 100644 index 0000000..85c8941 Binary files /dev/null and b/dev/JavaUpdater/Update/build/classes/update/Main_Gui$3.class differ diff --git a/dev/JavaUpdater/Update/build/classes/update/Main_Gui$4.class b/dev/JavaUpdater/Update/build/classes/update/Main_Gui$4.class new file mode 100644 index 0000000..e0c0696 Binary files /dev/null and b/dev/JavaUpdater/Update/build/classes/update/Main_Gui$4.class differ diff --git a/dev/JavaUpdater/Update/build/classes/update/Main_Gui.class b/dev/JavaUpdater/Update/build/classes/update/Main_Gui.class new file mode 100644 index 0000000..b4d63fc Binary files /dev/null and b/dev/JavaUpdater/Update/build/classes/update/Main_Gui.class differ diff --git a/BlocklyArduinoUpdater/Update/manifest.mf b/dev/JavaUpdater/Update/manifest.mf similarity index 100% rename from BlocklyArduinoUpdater/Update/manifest.mf rename to dev/JavaUpdater/Update/manifest.mf diff --git a/BlocklyArduinoUpdater/Update/nbproject/build-impl.xml b/dev/JavaUpdater/Update/nbproject/build-impl.xml similarity index 100% rename from BlocklyArduinoUpdater/Update/nbproject/build-impl.xml rename to dev/JavaUpdater/Update/nbproject/build-impl.xml diff --git a/BlocklyArduinoUpdater/Update/nbproject/genfiles.properties b/dev/JavaUpdater/Update/nbproject/genfiles.properties similarity index 100% rename from BlocklyArduinoUpdater/Update/nbproject/genfiles.properties rename to dev/JavaUpdater/Update/nbproject/genfiles.properties diff --git a/dev/JavaUpdater/Update/nbproject/private/private.properties b/dev/JavaUpdater/Update/nbproject/private/private.properties new file mode 100644 index 0000000..60b5a61 --- /dev/null +++ b/dev/JavaUpdater/Update/nbproject/private/private.properties @@ -0,0 +1,2 @@ +compile.on.save=true +user.properties.file=C:\\Users\\babas\\AppData\\Roaming\\NetBeans\\8.2\\build.properties diff --git a/dev/JavaUpdater/Update/nbproject/private/private.xml b/dev/JavaUpdater/Update/nbproject/private/private.xml new file mode 100644 index 0000000..c1f155a --- /dev/null +++ b/dev/JavaUpdater/Update/nbproject/private/private.xml @@ -0,0 +1,4 @@ + + + + diff --git a/dev/JavaUpdater/Update/nbproject/project.properties b/dev/JavaUpdater/Update/nbproject/project.properties new file mode 100644 index 0000000..89a0b8b --- /dev/null +++ b/dev/JavaUpdater/Update/nbproject/project.properties @@ -0,0 +1,45 @@ +#Sun Jun 24 16:42:40 CEST 2018 +excludes= +javac.deprecation=false +build.test.results.dir=${build.dir}/test/results +run.classpath=${javac.classpath}\:${build.classes.dir} +javadoc.nonavbar=false +run.test.classpath=${javac.test.classpath}\:${build.test.classes.dir} +javac.target=1.6 +javadoc.noindex=false +javadoc.additionalparam= +includes=** +build.classes.dir=${build.dir}/classes +source.encoding=UTF-8 +javadoc.author=false +test.src.dir=test +build.dir=build +build.test.classes.dir=${build.dir}/test/classes +platform.active=default_platform +javac.compilerargs= +main.class=update.Main_Gui +dist.jar=${dist.dir}/Update.jar +javadoc.use=true +build.sysclasspath=ignore +debug.test.classpath=${run.test.classpath} +dist.dir=dist +build.classes.excludes=**/*.java,**/*.form +javadoc.encoding=${source.encoding} +javadoc.splitindex=true +javac.source=1.6 +junit.selected.version=3 +debug.classpath=${run.classpath} +run.jvmargs= +build.generated.dir=${build.dir}/generated +jar.compress=false +javac.test.classpath=${javac.classpath}\:${build.classes.dir}\:\:${libs.junit_4.classpath}\:${libs.hamcrest.classpath} +javadoc.private=false +meta.inf.dir=${src.dir}/META-INF +manifest.file=manifest.mf +dist.javadoc.dir=${dist.dir}/javadoc +src.dir=src +javac.classpath= +build.generated.sources.dir=${build.dir}/generated-sources +javadoc.version=false +javadoc.windowtitle= +javadoc.notree=false diff --git a/BlocklyArduinoUpdater/Update/nbproject/project.xml b/dev/JavaUpdater/Update/nbproject/project.xml similarity index 100% rename from BlocklyArduinoUpdater/Update/nbproject/project.xml rename to dev/JavaUpdater/Update/nbproject/project.xml diff --git a/BlocklyArduinoUpdater/Update/src/update/Main_Gui.java b/dev/JavaUpdater/Update/src/update/Main_Gui.java similarity index 92% rename from BlocklyArduinoUpdater/Update/src/update/Main_Gui.java rename to dev/JavaUpdater/Update/src/update/Main_Gui.java index 0693517..b646594 100644 --- a/BlocklyArduinoUpdater/Update/src/update/Main_Gui.java +++ b/dev/JavaUpdater/Update/src/update/Main_Gui.java @@ -1,3 +1,4 @@ + package update; import java.awt.BorderLayout; @@ -34,7 +35,7 @@ public class Main_Gui extends JFrame{ private Thread worker; - private final String root = "/"; + private final String root = "update/"; private JTextArea outText; private JButton cancle; @@ -48,10 +49,11 @@ public Main_Gui() { outText.setText("Contacting Download Server..."); download(); } - private void initComponents() { - setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + + pan1 = new JPanel(); pan1.setLayout(new BorderLayout()); @@ -66,6 +68,7 @@ private void initComponents() { launch = new JButton("Launch App"); launch.setEnabled(false); launch.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { launch(); } @@ -74,6 +77,7 @@ public void actionPerformed(ActionEvent e) { cancle = new JButton("Cancel Update"); cancle.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { System.exit(0); } @@ -108,10 +112,9 @@ public void run() }); worker.start(); } - private void launch() { - String[] run = {"java","-jar","update.jar"}; + String[] run = {"java","-jar","update app.jar"}; try { Runtime.getRuntime().exec(run); } catch (Exception ex) { @@ -119,7 +122,6 @@ private void launch() } System.exit(0); } - private void cleanup() { outText.setText(outText.getText()+"\nPreforming clean up..."); @@ -128,7 +130,6 @@ private void cleanup() remove(new File(root)); new File(root).delete(); } - private void remove(File f) { File[]files = f.listFiles(); @@ -145,7 +146,6 @@ private void remove(File f) } } } - private void copyFiles(File f,String dir) throws IOException { File[]files = f.listFiles(); @@ -159,11 +159,11 @@ private void copyFiles(File f,String dir) throws IOException { copy(ff.getAbsolutePath(),dir+"/"+ff.getName()); } + } } - - public void copy(String srFile, String dtFile) throws FileNotFoundException, IOException - { + public void copy(String srFile, String dtFile) throws FileNotFoundException, IOException{ + File f1 = new File(srFile); File f2 = new File(dtFile); @@ -178,8 +178,7 @@ public void copy(String srFile, String dtFile) throws FileNotFoundException, IOE } in.close(); out.close(); - } - + } private void unzip() throws IOException { int BUFFER = 2048; @@ -200,9 +199,12 @@ private void unzip() throws IOException (zipfile.getInputStream(entry)); int count; byte data[] = new byte[BUFFER]; - FileOutputStream fos = new FileOutputStream(root+entry.getName()); - dest = new BufferedOutputStream(fos, BUFFER); - while ((count = is.read(data, 0, BUFFER)) != -1) { + FileOutputStream fos = new + FileOutputStream(root+entry.getName()); + dest = new + BufferedOutputStream(fos, BUFFER); + while ((count = is.read(data, 0, BUFFER)) + != -1) { dest.write(data, 0, count); } dest.flush(); @@ -210,8 +212,8 @@ private void unzip() throws IOException is.close(); } } + } - private void downloadFile(String link) throws MalformedURLException, IOException { URL url = new URL(link); @@ -233,10 +235,9 @@ private void downloadFile(String link) throws MalformedURLException, IOException outText.setText(outText.getText()+"\nDownload Complete!"); } - private String getDownloadLinkFromHost() throws MalformedURLException, IOException { - String path = "http://www.technologiescollege.fr/blockly@rduino/urlToDownload.txt"; + String path = "http://h3r3t1cupdate.bravehost.com/url.html"; URL url = new URL(path); InputStream html = null; @@ -248,11 +249,11 @@ private String getDownloadLinkFromHost() throws MalformedURLException, IOExcepti while(c != -1) { c = html.read(); - buffer.append((char)c); + buffer.append((char)c); + } return buffer.substring(buffer.indexOf("[url]")+5,buffer.indexOf("[/url]")); } - public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { @@ -260,4 +261,5 @@ public void run() { } }); } -} \ No newline at end of file + +} diff --git a/LedMatrixEditor/build.xml b/dev/LedMatrixEditor/build.xml similarity index 100% rename from LedMatrixEditor/build.xml rename to dev/LedMatrixEditor/build.xml diff --git a/LedMatrixEditor/build/built-jar.properties b/dev/LedMatrixEditor/build/built-jar.properties similarity index 100% rename from LedMatrixEditor/build/built-jar.properties rename to dev/LedMatrixEditor/build/built-jar.properties diff --git a/Blockly@rduinoPlugin/build/classes/META-INF/logo.png b/dev/LedMatrixEditor/build/classes/META-INF/logo.png similarity index 100% rename from Blockly@rduinoPlugin/build/classes/META-INF/logo.png rename to dev/LedMatrixEditor/build/classes/META-INF/logo.png diff --git a/LedMatrixEditor/build/classes/ledmatrixplugin/Browser$1.class b/dev/LedMatrixEditor/build/classes/ledmatrixplugin/Browser$1.class similarity index 100% rename from LedMatrixEditor/build/classes/ledmatrixplugin/Browser$1.class rename to dev/LedMatrixEditor/build/classes/ledmatrixplugin/Browser$1.class diff --git a/LedMatrixEditor/build/classes/ledmatrixplugin/Browser$2.class b/dev/LedMatrixEditor/build/classes/ledmatrixplugin/Browser$2.class similarity index 100% rename from LedMatrixEditor/build/classes/ledmatrixplugin/Browser$2.class rename to dev/LedMatrixEditor/build/classes/ledmatrixplugin/Browser$2.class diff --git a/LedMatrixEditor/build/classes/ledmatrixplugin/Browser.class b/dev/LedMatrixEditor/build/classes/ledmatrixplugin/Browser.class similarity index 100% rename from LedMatrixEditor/build/classes/ledmatrixplugin/Browser.class rename to dev/LedMatrixEditor/build/classes/ledmatrixplugin/Browser.class diff --git a/LedMatrixEditor/build/classes/ledmatrixplugin/LedMatrixPlugin$1.class b/dev/LedMatrixEditor/build/classes/ledmatrixplugin/LedMatrixPlugin$1.class similarity index 100% rename from LedMatrixEditor/build/classes/ledmatrixplugin/LedMatrixPlugin$1.class rename to dev/LedMatrixEditor/build/classes/ledmatrixplugin/LedMatrixPlugin$1.class diff --git a/LedMatrixEditor/build/classes/ledmatrixplugin/LedMatrixPlugin$2.class b/dev/LedMatrixEditor/build/classes/ledmatrixplugin/LedMatrixPlugin$2.class similarity index 100% rename from LedMatrixEditor/build/classes/ledmatrixplugin/LedMatrixPlugin$2.class rename to dev/LedMatrixEditor/build/classes/ledmatrixplugin/LedMatrixPlugin$2.class diff --git a/LedMatrixEditor/build/classes/ledmatrixplugin/LedMatrixPlugin.class b/dev/LedMatrixEditor/build/classes/ledmatrixplugin/LedMatrixPlugin.class similarity index 100% rename from LedMatrixEditor/build/classes/ledmatrixplugin/LedMatrixPlugin.class rename to dev/LedMatrixEditor/build/classes/ledmatrixplugin/LedMatrixPlugin.class diff --git a/LedMatrixEditor/build/classes/ledmatrixplugin/LedMatrixServer.class b/dev/LedMatrixEditor/build/classes/ledmatrixplugin/LedMatrixServer.class similarity index 100% rename from LedMatrixEditor/build/classes/ledmatrixplugin/LedMatrixServer.class rename to dev/LedMatrixEditor/build/classes/ledmatrixplugin/LedMatrixServer.class diff --git a/LedMatrixEditor/build/classes/ledmatrixplugin/StartupApplet$1.class b/dev/LedMatrixEditor/build/classes/ledmatrixplugin/StartupApplet$1.class similarity index 100% rename from LedMatrixEditor/build/classes/ledmatrixplugin/StartupApplet$1.class rename to dev/LedMatrixEditor/build/classes/ledmatrixplugin/StartupApplet$1.class diff --git a/LedMatrixEditor/build/classes/ledmatrixplugin/StartupApplet.class b/dev/LedMatrixEditor/build/classes/ledmatrixplugin/StartupApplet.class similarity index 100% rename from LedMatrixEditor/build/classes/ledmatrixplugin/StartupApplet.class rename to dev/LedMatrixEditor/build/classes/ledmatrixplugin/StartupApplet.class diff --git a/LedMatrixEditor/dist/LedMatrixPlugin.jar b/dev/LedMatrixEditor/dist/LedMatrixPlugin.jar similarity index 100% rename from LedMatrixEditor/dist/LedMatrixPlugin.jar rename to dev/LedMatrixEditor/dist/LedMatrixPlugin.jar diff --git a/LedMatrixEditor/dist/README.TXT b/dev/LedMatrixEditor/dist/README.TXT similarity index 100% rename from LedMatrixEditor/dist/README.TXT rename to dev/LedMatrixEditor/dist/README.TXT diff --git a/Blockly@rduinoPlugin/dist/lib/arduino-core.jar b/dev/LedMatrixEditor/dist/lib/arduino-core.jar similarity index 100% rename from Blockly@rduinoPlugin/dist/lib/arduino-core.jar rename to dev/LedMatrixEditor/dist/lib/arduino-core.jar diff --git a/Blockly@rduinoPlugin/dist/lib/commons-io-2.5.jar b/dev/LedMatrixEditor/dist/lib/commons-io-2.5.jar similarity index 100% rename from Blockly@rduinoPlugin/dist/lib/commons-io-2.5.jar rename to dev/LedMatrixEditor/dist/lib/commons-io-2.5.jar diff --git a/Blockly@rduinoPlugin/dist/lib/jfxrt.jar b/dev/LedMatrixEditor/dist/lib/jfxrt.jar similarity index 100% rename from Blockly@rduinoPlugin/dist/lib/jfxrt.jar rename to dev/LedMatrixEditor/dist/lib/jfxrt.jar diff --git a/Blockly@rduinoPlugin/dist/lib/pde.jar b/dev/LedMatrixEditor/dist/lib/pde.jar similarity index 100% rename from Blockly@rduinoPlugin/dist/lib/pde.jar rename to dev/LedMatrixEditor/dist/lib/pde.jar diff --git a/Blockly@rduinoPlugin/lib/arduino-core.jar b/dev/LedMatrixEditor/lib/arduino-core.jar similarity index 100% rename from Blockly@rduinoPlugin/lib/arduino-core.jar rename to dev/LedMatrixEditor/lib/arduino-core.jar diff --git a/Blockly@rduinoPlugin/lib/commons-io-2.5.jar b/dev/LedMatrixEditor/lib/commons-io-2.5.jar similarity index 100% rename from Blockly@rduinoPlugin/lib/commons-io-2.5.jar rename to dev/LedMatrixEditor/lib/commons-io-2.5.jar diff --git a/Blockly@rduinoPlugin/lib/pde.jar b/dev/LedMatrixEditor/lib/pde.jar similarity index 100% rename from Blockly@rduinoPlugin/lib/pde.jar rename to dev/LedMatrixEditor/lib/pde.jar diff --git a/BlocklyArduinoUpdater/UpdateApp/manifest.mf b/dev/LedMatrixEditor/manifest.mf similarity index 100% rename from BlocklyArduinoUpdater/UpdateApp/manifest.mf rename to dev/LedMatrixEditor/manifest.mf diff --git a/LedMatrixEditor/nbproject/build-impl.xml b/dev/LedMatrixEditor/nbproject/build-impl.xml similarity index 100% rename from LedMatrixEditor/nbproject/build-impl.xml rename to dev/LedMatrixEditor/nbproject/build-impl.xml diff --git a/dev/LedMatrixEditor/nbproject/configs/release.properties b/dev/LedMatrixEditor/nbproject/configs/release.properties new file mode 100644 index 0000000..e69de29 diff --git a/LedMatrixEditor/nbproject/genfiles.properties b/dev/LedMatrixEditor/nbproject/genfiles.properties similarity index 100% rename from LedMatrixEditor/nbproject/genfiles.properties rename to dev/LedMatrixEditor/nbproject/genfiles.properties diff --git a/Blockly@rduinoPlugin/nbproject/private/config.properties b/dev/LedMatrixEditor/nbproject/private/config.properties similarity index 100% rename from Blockly@rduinoPlugin/nbproject/private/config.properties rename to dev/LedMatrixEditor/nbproject/private/config.properties diff --git a/LedMatrixEditor/nbproject/private/private.properties b/dev/LedMatrixEditor/nbproject/private/private.properties similarity index 100% rename from LedMatrixEditor/nbproject/private/private.properties rename to dev/LedMatrixEditor/nbproject/private/private.properties diff --git a/LedMatrixEditor/nbproject/private/private.xml b/dev/LedMatrixEditor/nbproject/private/private.xml similarity index 100% rename from LedMatrixEditor/nbproject/private/private.xml rename to dev/LedMatrixEditor/nbproject/private/private.xml diff --git a/Blockly@rduinoPlugin/nbproject/private/profiler/settings.xml b/dev/LedMatrixEditor/nbproject/private/profiler/settings.xml similarity index 100% rename from Blockly@rduinoPlugin/nbproject/private/profiler/settings.xml rename to dev/LedMatrixEditor/nbproject/private/profiler/settings.xml diff --git a/LedMatrixEditor/nbproject/project.properties b/dev/LedMatrixEditor/nbproject/project.properties similarity index 100% rename from LedMatrixEditor/nbproject/project.properties rename to dev/LedMatrixEditor/nbproject/project.properties diff --git a/LedMatrixEditor/nbproject/project.xml b/dev/LedMatrixEditor/nbproject/project.xml similarity index 100% rename from LedMatrixEditor/nbproject/project.xml rename to dev/LedMatrixEditor/nbproject/project.xml diff --git a/LedMatrixEditor/src/ledmatrixplugin/Browser.java b/dev/LedMatrixEditor/src/ledmatrixplugin/Browser.java similarity index 100% rename from LedMatrixEditor/src/ledmatrixplugin/Browser.java rename to dev/LedMatrixEditor/src/ledmatrixplugin/Browser.java diff --git a/LedMatrixEditor/src/ledmatrixplugin/LedMatrixPlugin.java b/dev/LedMatrixEditor/src/ledmatrixplugin/LedMatrixPlugin.java similarity index 100% rename from LedMatrixEditor/src/ledmatrixplugin/LedMatrixPlugin.java rename to dev/LedMatrixEditor/src/ledmatrixplugin/LedMatrixPlugin.java diff --git a/LedMatrixEditor/src/ledmatrixplugin/LedMatrixServer.java b/dev/LedMatrixEditor/src/ledmatrixplugin/LedMatrixServer.java similarity index 100% rename from LedMatrixEditor/src/ledmatrixplugin/LedMatrixServer.java rename to dev/LedMatrixEditor/src/ledmatrixplugin/LedMatrixServer.java diff --git a/LedMatrixEditor/src/ledmatrixplugin/StartupApplet.java b/dev/LedMatrixEditor/src/ledmatrixplugin/StartupApplet.java similarity index 100% rename from LedMatrixEditor/src/ledmatrixplugin/StartupApplet.java rename to dev/LedMatrixEditor/src/ledmatrixplugin/StartupApplet.java diff --git a/blocklyarduinoexe/BlocklyArduinoExe.java b/dev/blocklyarduinoexe/BlocklyArduinoExe.java similarity index 100% rename from blocklyarduinoexe/BlocklyArduinoExe.java rename to dev/blocklyarduinoexe/BlocklyArduinoExe.java diff --git a/dev/blynkserver/BlynkServer.class b/dev/blynkserver/BlynkServer.class new file mode 100644 index 0000000..a969a1c Binary files /dev/null and b/dev/blynkserver/BlynkServer.class differ diff --git a/dev/blynkserver/BlynkServer.java b/dev/blynkserver/BlynkServer.java new file mode 100644 index 0000000..be25d8b --- /dev/null +++ b/dev/blynkserver/BlynkServer.java @@ -0,0 +1,33 @@ +package blynkserver; + +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.file.Paths; +import processing.app.Editor; +import processing.app.tools.Tool; + + +public class BlynkServer implements Tool { + Editor editor; + + public void init(Editor editor) { + this.editor = editor; + } + + public String getMenuTitle() { + return "Blynk"; + } + + public void run() { + try { + String PathToExec = Paths.get(".").toAbsolutePath().normalize().toString(); + //System.out.println("Current relative path is: " + PathToExec); + Runtime runtime = Runtime.getRuntime(); + Process p = Runtime.getRuntime().exec("cmd /c \"" + PathToExec + "\\tools\\BlynkServer\\tool\\server.bat" + "\""); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/dev/blynkserver/fxlauncher/AbstractLauncher.java b/dev/blynkserver/fxlauncher/AbstractLauncher.java new file mode 100644 index 0000000..144053c --- /dev/null +++ b/dev/blynkserver/fxlauncher/AbstractLauncher.java @@ -0,0 +1,285 @@ +package fxlauncher; + +import javafx.application.Application; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import javax.xml.bind.JAXB; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URI; +import java.net.URL; +import java.net.URLClassLoader; +import java.net.URLConnection; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.Base64; +import java.util.List; +import java.util.Map; +import java.util.logging.FileHandler; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.logging.SimpleFormatter; +import java.util.stream.Collectors; + +@SuppressWarnings("unchecked") +public abstract class AbstractLauncher { + private static final Logger log = Logger.getLogger("AbstractLauncher"); + + protected static FXManifest manifest; + private String phase; + + /** + * Make java.util.logger log to a file. Default it will log to $TMPDIR/fxlauncher.log. This can be overriden by using + * comman line parameter --logfile=logfile + * + * @throws IOException + */ + protected void setupLogFile() throws IOException { + String filename = System.getProperty("java.io.tmpdir") + File.separator + "fxlauncher.log"; + if (getParameters().getNamed().containsKey("logfile")) + filename = getParameters().getNamed().get("logfile"); + System.out.println("logging to " + filename); + FileHandler handler = new FileHandler(filename); + handler.setFormatter(new SimpleFormatter()); + log.addHandler(handler); + } + + /** + * Check if the SSL connection needs to ignore the validity of the ssl certificate. + * + * @throws KeyManagementException + * @throws NoSuchAlgorithmException + */ + protected void checkSSLIgnoreflag() throws KeyManagementException, NoSuchAlgorithmException { + if (getParameters().getUnnamed().contains("--ignoressl")) { + setupIgnoreSSLCertificate(); + } + } + + protected ClassLoader createClassLoader(Path cacheDir) { + List libs = manifest.files.stream().filter(LibraryFile::loadForCurrentPlatform).map(it -> it.toURL(cacheDir)).collect(Collectors.toList()); + + ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader(); + if (systemClassLoader instanceof FxlauncherClassCloader) + { + ((FxlauncherClassCloader) systemClassLoader).addUrls(libs); + return systemClassLoader; + } + else + { + ClassLoader classLoader = new URLClassLoader(libs.toArray(new URL[libs.size()])); + Thread.currentThread().setContextClassLoader(classLoader); + + setupClassLoader(classLoader); + + return classLoader; + } + } + + protected void updateManifest() throws Exception { + phase = "Update Manifest"; + syncManifest(); + } + + /** + * Check if remote files are newer then local files. Return true if files are updated, triggering the whatsnew option else false. + * Also return false and do not check for updates if the --offline commandline argument is set. + * + * @return true if new files have been downloaded, false otherwise. + * @throws Exception + */ + protected boolean syncFiles() throws Exception { + + Path cacheDir = manifest.resolveCacheDir(getParameters().getNamed()); + log.info(String.format("Using cache dir %s", cacheDir)); + + phase = "File Synchronization"; + + if (getParameters().getUnnamed().contains("--offline")) { + log.info("not updating files from remote, offline selected"); + return false; // to signal that nothing has changed. + } + List needsUpdate = manifest.files.stream() + .filter(LibraryFile::loadForCurrentPlatform) + .filter(it -> it.needsUpdate(cacheDir)) + .collect(Collectors.toList()); + + if (needsUpdate.isEmpty()) + return false; + + Long totalBytes = needsUpdate.stream().mapToLong(f -> f.size).sum(); + Long totalWritten = 0L; + + for (LibraryFile lib : needsUpdate) { + Path target = cacheDir.resolve(lib.file).toAbsolutePath(); + Files.createDirectories(target.getParent()); + + URI uri = manifest.uri.resolve(lib.file); + + try (InputStream input = openDownloadStream(uri); OutputStream output = Files.newOutputStream(target)) { + + byte[] buf = new byte[65536]; + + int read; + while ((read = input.read(buf)) > -1) { + output.write(buf, 0, read); + totalWritten += read; + Double progress = totalWritten.doubleValue() / totalBytes.doubleValue(); + updateProgress(progress); + } + } + } + return true; + } + + private InputStream openDownloadStream(URI uri) throws IOException { + if (uri.getScheme().equals("file")) return Files.newInputStream(new File(uri.getPath()).toPath()); + + URLConnection connection = uri.toURL().openConnection(); + if (uri.getUserInfo() != null) { + byte[] payload = uri.getUserInfo().getBytes(StandardCharsets.UTF_8); + String encoded = Base64.getEncoder().encodeToString(payload); + connection.setRequestProperty("Authorization", String.format("Basic %s", encoded)); + } + return connection.getInputStream(); + } + + protected void createApplicationEnvironment() throws Exception { + phase = "Create Application"; + + if (manifest == null) + throw new IllegalArgumentException("Unable to retrieve embedded or remote manifest."); + List preloadLibs = manifest.getPreloadNativeLibraryList(); + for (String preloadLib : preloadLibs) + System.loadLibrary(preloadLib); + + Path cacheDir = manifest.resolveCacheDir(getParameters() != null ? getParameters().getNamed() : null); + + ClassLoader classLoader = createClassLoader(cacheDir); + Class appclass = (Class) classLoader.loadClass(manifest.launchClass); + + createApplication(appclass); + } + + protected void syncManifest() throws Exception { + Map namedParams = getParameters().getNamed(); + + String appStr = null; + + if (namedParams.containsKey("app")) { + // get --app-param + appStr = namedParams.get("app"); + log.info(String.format("Loading manifest from 'app' parameter supplied: %s", appStr)); + } + + if (namedParams.containsKey("uri")) { + // get --uri-param + String uriStr = namedParams.get("uri"); + if (!uriStr.endsWith("/")) { + uriStr = uriStr + "/"; + } + log.info(String.format("Syncing files from 'uri' parameter supplied: %s", uriStr)); + + URI uri = URI.create(uriStr); + // load manifest from --app param if supplied, else default file at supplied uri + URI app = appStr != null ? URI.create(appStr) : uri.resolve("app.xml"); + manifest = FXManifest.load(app); + // set supplied uri in manifest + manifest.uri = uri; + return; + } + + if (appStr != null) { + // --uri was not supplied, but --app was, so load manifest from that + manifest = FXManifest.load(new File(appStr).toURI()); + return; + } + + URL embeddedManifest = AbstractLauncher.class.getResource("/app.xml"); + manifest = JAXB.unmarshal(embeddedManifest, FXManifest.class); + + Path cacheDir = manifest.resolveCacheDir(namedParams); + Path manifestPath = manifest.getPath(cacheDir); + + if (Files.exists(manifestPath)) + manifest = JAXB.unmarshal(manifestPath.toFile(), FXManifest.class); + + if (getParameters().getUnnamed().contains("--offline")) { + log.info("offline selected"); + return; + } + try { + FXManifest remoteManifest = FXManifest.load(manifest.getFXAppURI()); + + if (remoteManifest == null) { + log.info(String.format("No remote manifest at %s", manifest.getFXAppURI())); + } else if (!remoteManifest.equals(manifest)) { + // Update to remote manifest if newer or we specifically accept downgrades + if (remoteManifest.isNewerThan(manifest) || manifest.acceptDowngrade) { + manifest = remoteManifest; + JAXB.marshal(manifest, manifestPath.toFile()); + } + } + } catch (Exception ex) { + log.log(Level.WARNING, String.format("Unable to update manifest from %s", manifest.getFXAppURI()), ex); + } + } + + protected void setupIgnoreSSLCertificate() throws NoSuchAlgorithmException, KeyManagementException { + log.info("starting ssl setup"); + TrustManager[] trustManager = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { + } + + @Override + public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { + + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + }}; + SSLContext sslContext = SSLContext.getInstance("SSL"); + sslContext.init(null, trustManager, new java.security.SecureRandom()); + HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); + + HostnameVerifier hostnameVerifier = (s, sslSession) -> true; + HttpsURLConnection.setDefaultHostnameVerifier(hostnameVerifier); + } + + protected boolean checkIgnoreUpdateErrorSetting() { + return getParameters().getUnnamed().contains("--stopOnUpdateErrors"); + } + public String getPhase() { + return phase; + } + + public void setPhase(String phase) { + this.phase = phase; + } + + public FXManifest getManifest() { + return manifest; + } + + protected abstract Application.Parameters getParameters(); + protected abstract void updateProgress(double progress); + protected abstract void createApplication(Class appClass); + protected abstract void reportError(String title, Throwable error); + protected abstract void setupClassLoader(ClassLoader classLoader); +} diff --git a/dev/blynkserver/fxlauncher/CreateManifest.java b/dev/blynkserver/fxlauncher/CreateManifest.java new file mode 100644 index 0000000..d67ef48 --- /dev/null +++ b/dev/blynkserver/fxlauncher/CreateManifest.java @@ -0,0 +1,168 @@ +package fxlauncher; + +import com.sun.javafx.application.ParametersImpl; + +import javax.xml.bind.JAXB; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.file.*; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public class CreateManifest { + private static ArrayList includeExtensions = new ArrayList<>(); + + static { + includeExtensions.addAll(Arrays.asList("jar", "war")); + } + + public static void main(String[] args) throws IOException, URISyntaxException { + URI baseURI = URI.create(args[0]); + String launchClass = args[1]; + Path appPath = Paths.get(args[2]); + + String cacheDir = null; + Boolean acceptDowngrade = null; + Boolean stopOnUpdateErrors = null; + String parameters = null; + String whatsNew = null; + String preloadNativeLibraries = null; + Boolean lingeringUpdateScreen = false; + Boolean stopOnUpdateErrorsDeprecated = null; + + if (args.length > 3) { + // Parse named parameters + List rawParams = new ArrayList<>(); + rawParams.addAll(Arrays.asList(args).subList(3, args.length)); + ParametersImpl params = new ParametersImpl(rawParams); + Map named = params.getNamed(); + + if (named != null) { + // Configure cacheDir + if (named.containsKey("cache-dir")) + cacheDir = named.get("cache-dir"); + + // Configure acceptDowngrade + if (named.containsKey("accept-downgrade")) + acceptDowngrade = Boolean.valueOf(named.get("accept-downgrade")); + + // Configure stopOnUpdateErrors + if (named.containsKey("stop-on-update-errors")) + stopOnUpdateErrors = Boolean.valueOf(named.get("stop-on-update-errors")); + + // Configure preload native libraries + if (named.containsKey("preload-native-libraries")) + preloadNativeLibraries = named.get("preload-native-libraries"); + + // Should the update screen stay until the primary stage is shown? + if (named.containsKey("lingering-update-screen")) + lingeringUpdateScreen = Boolean.valueOf(named.get("lingering-update-screen")); + + // Configure the whats-new option + if (named.containsKey("whats-new")) + whatsNew = named.get("whats-new"); + + // Add additional files with these extensions to manifest + if (named.containsKey("include-extensions")) + includeExtensions.addAll( + Arrays.stream(named.get("include-extensions").split(",")) + .filter(s -> s != null && !s.isEmpty()) + .collect(Collectors.toList()) + ); + } + + // Append the rest as manifest parameters + StringBuilder rest = new StringBuilder(); + for (String raw : params.getRaw()) { + // Special case for deprecated parameter. + if (raw.equals("--stopOnUpdateErrors")) { + stopOnUpdateErrorsDeprecated = true; + continue; + } + if (raw.startsWith("--cache-dir=")) continue; + if (raw.startsWith("--accept-downgrade=")) continue; + if (raw.startsWith("--stop-on-update-errors=")) continue; + if (raw.startsWith("--include-extensions=")) continue; + if (raw.startsWith("--preload-native-libraries=")) continue; + if (raw.startsWith("--whats-new")) continue; + if (raw.startsWith("--lingering-update-screen")) continue; + if (rest.length() > 0) rest.append(" "); + rest.append(raw); + } + + // Add the raw parameter string to the manifest + if (rest.length() > 0) + parameters = rest.toString(); + } + + FXManifest manifest = create(baseURI, launchClass, appPath); + if (cacheDir != null) manifest.cacheDir = cacheDir; + if (acceptDowngrade != null) manifest.acceptDowngrade = acceptDowngrade; + if (parameters != null) manifest.parameters = parameters; + if (preloadNativeLibraries != null) manifest.preloadNativeLibraries = preloadNativeLibraries; + if (whatsNew != null) manifest.whatsNewPage = whatsNew; + manifest.lingeringUpdateScreen = lingeringUpdateScreen; + + // Use --stop-on-update-errors if it was specified. + if (stopOnUpdateErrors != null) { + manifest.stopOnUpdateErrors = stopOnUpdateErrors; + // If --stopOnUpdateErrors is also present, display warning. + if (stopOnUpdateErrorsDeprecated != null) { + System.out.println("Warning: --stopOnUpdateErrors is deprecated. " + + "Overriding with --stop-on-update-errors."); + } + } + // If --stop-on-update-errors was not specified, + // use --stopOnUpdateError if it was specified. + else if (stopOnUpdateErrorsDeprecated != null){ + manifest.stopOnUpdateErrors = stopOnUpdateErrorsDeprecated; + System.out.println("Warning: --stopOnUpdateErrors is deprecated. " + + "Use --stop-on-update-errors instead."); + } + JAXB.marshal(manifest, appPath.resolve("app.xml").toFile()); + } + + public static FXManifest create(URI baseURI, String launchClass, Path appPath) throws IOException, URISyntaxException { + FXManifest manifest = new FXManifest(); + manifest.ts = System.currentTimeMillis(); + manifest.uri = baseURI; + manifest.launchClass = launchClass; + + if(!manifest.uri.getPath().endsWith("/")) { + manifest.uri = new URI(String.format("%s/", baseURI.toString())); + } + Files.walkFileTree(appPath, new SimpleFileVisitor() { + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + if (!Files.isDirectory(file) && shouldIncludeInManifest(file) && !file.getFileName().toString().startsWith("fxlauncher")) + manifest.files.add(new LibraryFile(appPath, file)); + return FileVisitResult.CONTINUE; + } + }); + + return manifest; + } + + /** + * Add the includeExtensions to the default list of "war" and "jar". + * + * Allthough the method is called setIncludeExtensions, it actually does an addAll. + * @param includeExtensions + */ + public static void setIncludeExtensions(List includeExtensions) { + CreateManifest.includeExtensions.addAll(includeExtensions); + } + + private static boolean shouldIncludeInManifest(Path file) { + String filename = file.getFileName().toString(); + for (String ext : includeExtensions) { + if (filename.toLowerCase().endsWith(String.format(".%s", ext.toLowerCase()))) return true; + } + return false; + } + +} diff --git a/dev/blynkserver/fxlauncher/DefaultUIProvider.java b/dev/blynkserver/fxlauncher/DefaultUIProvider.java new file mode 100644 index 0000000..46dafd4 --- /dev/null +++ b/dev/blynkserver/fxlauncher/DefaultUIProvider.java @@ -0,0 +1,42 @@ +package fxlauncher; + +import javafx.geometry.Insets; +import javafx.scene.Parent; +import javafx.scene.control.Label; +import javafx.scene.control.ProgressBar; +import javafx.scene.control.ProgressIndicator; +import javafx.scene.layout.StackPane; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +public class DefaultUIProvider implements UIProvider { + private ProgressBar progressBar; + + public Parent createLoader() { + StackPane root = new StackPane(new ProgressIndicator()); + root.setPrefSize(200, 80); + root.setPadding(new Insets(10)); + return root; + } + + public Parent createUpdater(FXManifest manifest) { + progressBar = new ProgressBar(); + progressBar.setStyle(manifest.progressBarStyle); + + Label label = new Label(manifest.updateText); + label.setStyle(manifest.updateLabelStyle); + + VBox wrapper = new VBox(label, progressBar); + wrapper.setStyle(manifest.wrapperStyle); + + return wrapper; + } + + public void updateProgress(double progress) { + progressBar.setProgress(progress); + } + + public void init(Stage stage) { + + } +} diff --git a/dev/blynkserver/fxlauncher/FXManifest.java b/dev/blynkserver/fxlauncher/FXManifest.java new file mode 100644 index 0000000..30f18ac --- /dev/null +++ b/dev/blynkserver/fxlauncher/FXManifest.java @@ -0,0 +1,203 @@ +package fxlauncher; + +import javax.xml.bind.JAXB; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.URLConnection; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Base64; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@SuppressWarnings("unchecked") +@XmlRootElement(name = "Application") +public class FXManifest { + @XmlAttribute + public Long ts; + @XmlAttribute + public URI uri; + @XmlAttribute(name = "launch") + public String launchClass; + @XmlElement(name = "lib") + public List files = new ArrayList<>(); + @XmlElement + public String updateText = "Updating..."; + @XmlElement + public String updateLabelStyle = "-fx-font-weight: bold;"; + @XmlElement + public String progressBarStyle = "-fx-pref-width: 200;"; + @XmlElement + public String wrapperStyle = "-fx-spacing: 10; -fx-padding: 25;"; + @XmlElement + public String parameters; + @XmlElement + public String cacheDir; + @XmlElement + public Boolean acceptDowngrade = false; + @XmlElement + public Boolean stopOnUpdateErrors = false; + @XmlElement + public String preloadNativeLibraries; + @XmlElement + public String whatsNewPage; + @XmlElement + public Boolean lingeringUpdateScreen = false; + + public List getPreloadNativeLibraryList() { + if (preloadNativeLibraries == null || preloadNativeLibraries.isEmpty()) return Collections.emptyList(); + return Arrays.asList(preloadNativeLibraries.split(".*,-*")); + } + + public String getFilename() { + return String.format("%s.xml", launchClass); + } + + public URI getFXAppURI() { + if (uri.getPath().endsWith("/")) + return uri.resolve("app.xml"); + + return URI.create(uri.toString() + "/app.xml"); + } + + public Path getPath(Path cacheDir) { + return cacheDir.resolve(getFilename()); + } + + public Path resolveCacheDir(Map namedParams) { + if (namedParams == null) namedParams = Collections.emptyMap(); + + String cacheDir = namedParams.containsKey("cache-dir") ? namedParams.get("cache-dir") : this.cacheDir; + + if (cacheDir == null || cacheDir.isEmpty()) return Paths.get("."); + + Path path; + + if (cacheDir.contains("USERLIB")) { + String replacement; + switch (OS.current) { + case mac: + replacement = Paths.get(System.getProperty("user.home")) + .resolve("Library") + .resolve("Application Support") + .resolve(cacheDir.substring(8)) + .toString(); + break; + case win: + replacement = Paths.get(System.getProperty("user.home")) + .resolve("AppData") + .resolve("Local") + .resolve(cacheDir.substring(8)) + .toString(); + break; + default: + replacement = Paths.get(System.getProperty("user.home")) + .resolve("." + cacheDir.substring(8)) + .toString(); + } + path = Paths.get(replacement); + } else if (cacheDir.startsWith("ALLUSERS")) { + switch (OS.current) { + case mac: + path = Paths.get("/Library/Application Support") + .resolve(cacheDir.substring(9)); + break; + case win: + path = Paths.get(System.getenv("ALLUSERSPROFILE")) + .resolve(cacheDir.substring(9)); + break; + default: + path = Paths.get("/usr/local/share") + .resolve(cacheDir.substring(9)); + } + } else { + path = Paths.get(cacheDir); + } + + if (!Files.exists(path)) { + try { + Files.createDirectories(path); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + return path; + } + + public String getWhatsNewPage() + { + return whatsNewPage; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + FXManifest that = (FXManifest) o; + + if (ts != null ? !ts.equals(that.ts) : that.ts != null) return false; + if (uri != null ? !uri.equals(that.uri) : that.uri != null) return false; + if (launchClass != null ? !launchClass.equals(that.launchClass) : that.launchClass != null) return false; + if (files != null ? !files.equals(that.files) : that.files != null) return false; + if (updateText != null ? !updateText.equals(that.updateText) : that.updateText != null) return false; + if (updateLabelStyle != null ? !updateLabelStyle.equals(that.updateLabelStyle) : that.updateLabelStyle != null) return false; + if (progressBarStyle != null ? !progressBarStyle.equals(that.progressBarStyle) : that.progressBarStyle != null) return false; + if (wrapperStyle != null ? !wrapperStyle.equals(that.wrapperStyle) : that.wrapperStyle != null) return false; + if (parameters != null ? !parameters.equals(that.parameters) : that.parameters != null) return false; + if (cacheDir != null ? !cacheDir.equals(that.cacheDir) : that.cacheDir != null) return false; + if (lingeringUpdateScreen != null ? !lingeringUpdateScreen.equals(that.lingeringUpdateScreen) : that.lingeringUpdateScreen != null) return false; + if (stopOnUpdateErrors != null ? !stopOnUpdateErrors.equals(that.stopOnUpdateErrors) : that.stopOnUpdateErrors != null) return false; + return acceptDowngrade != null ? acceptDowngrade.equals(that.acceptDowngrade) : that.acceptDowngrade == null; + + } + + @Override + public int hashCode() { + int result = ts != null ? ts.hashCode() : 0; + result = 31 * result + (uri != null ? uri.hashCode() : 0); + result = 31 * result + (launchClass != null ? launchClass.hashCode() : 0); + result = 31 * result + (files != null ? files.hashCode() : 0); + result = 31 * result + (updateText != null ? updateText.hashCode() : 0); + result = 31 * result + (updateLabelStyle != null ? updateLabelStyle.hashCode() : 0); + result = 31 * result + (progressBarStyle != null ? progressBarStyle.hashCode() : 0); + result = 31 * result + (wrapperStyle != null ? wrapperStyle.hashCode() : 0); + result = 31 * result + (parameters != null ? parameters.hashCode() : 0); + result = 31 * result + (cacheDir != null ? cacheDir.hashCode() : 0); + result = 31 * result + (acceptDowngrade != null ? acceptDowngrade.hashCode() : 0); + result = 31 * result + (stopOnUpdateErrors != null ? stopOnUpdateErrors.hashCode() : 0); + return result; + } + + public boolean isNewerThan(FXManifest other) { + return ts == null || other.ts == null || ts > other.ts; + } + + static FXManifest load(URI uri) throws IOException { + if (Objects.equals(uri.getScheme(), "file")) { + return JAXB.unmarshal(new File(uri.getPath()), FXManifest.class); + } + URLConnection connection = uri.toURL().openConnection(); + if (uri.getUserInfo() != null) { + byte[] payload = uri.getUserInfo().getBytes(StandardCharsets.UTF_8); + String encoded = Base64.getEncoder().encodeToString(payload); + connection.setRequestProperty("Authorization", String.format("Basic %s", encoded)); + } + try (InputStream input = connection.getInputStream()) { + return JAXB.unmarshal(input, FXManifest.class); + } + } + +} diff --git a/dev/blynkserver/fxlauncher/FxlauncherClassCloader.java b/dev/blynkserver/fxlauncher/FxlauncherClassCloader.java new file mode 100644 index 0000000..fcae265 --- /dev/null +++ b/dev/blynkserver/fxlauncher/FxlauncherClassCloader.java @@ -0,0 +1,68 @@ +package fxlauncher; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by im on 22.02.17. + */ +public class FxlauncherClassCloader extends URLClassLoader +{ + public FxlauncherClassCloader(ClassLoader parentClassLoader) + { + super(buildClasspath(System.getProperty("java.class.path")), parentClassLoader); + } + + void addUrls(List urls) + { + for (URL url : urls) + { + this.addURL(url); + } + } + + private static URL[] buildClasspath(String classPath) + { + if (classPath == null || classPath.trim().length() < 1) + { + return new URL[0]; + } + + List urls = new ArrayList<>(); + + int pos; + while ((pos = classPath.indexOf(File.pathSeparatorChar)) > -1) + { + String part = classPath.substring(0, pos); + + addClasspathPart(urls, part); + + classPath = classPath.substring(pos + 1); + } + + addClasspathPart(urls, classPath); + + return urls.toArray(new URL[urls.size()]); + } + + private static void addClasspathPart(List urls, String part) + { + if (part == null || part.trim().length() < 1) + { + return; + } + + try + { + urls.add(new File(part).toURI().toURL()); + } + catch (MalformedURLException e) + { + throw new RuntimeException(e); + } + } +} diff --git a/dev/blynkserver/fxlauncher/HeadlessMainLauncher.java b/dev/blynkserver/fxlauncher/HeadlessMainLauncher.java new file mode 100644 index 0000000..b534439 --- /dev/null +++ b/dev/blynkserver/fxlauncher/HeadlessMainLauncher.java @@ -0,0 +1,89 @@ +package fxlauncher; + +import javafx.application.Application; + +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@SuppressWarnings("unchecked") +public class HeadlessMainLauncher extends AbstractLauncher +{ + private static final Logger log = Logger.getLogger("HeadlessMainLauncher"); + + private LauncherParams parameters; + + private Class appClass; + + public HeadlessMainLauncher(LauncherParams parameters) + { + this.parameters = parameters; + } + + public static void main(String[] args) throws Exception + { + List mainArgs = Arrays.asList(args); + + LauncherParams parameters = new LauncherParams(mainArgs); + + HeadlessMainLauncher headlessMainLauncher = new HeadlessMainLauncher(parameters); + headlessMainLauncher.process(); + } + + protected void process() throws Exception + { + syncManifest(); + + // replace parameters to deal with manifest settings + parameters = new LauncherParams(parameters, getManifest()); + + setupLogFile(); + checkSSLIgnoreflag(); + + updateManifest(); + + syncFiles(); + + createApplicationEnvironment(); + launchApp(); + } + + public LauncherParams getParameters() + { + return parameters; + } + + @Override + protected void updateProgress(double progress) + { + log.info(String.format("Progress: %d%%", (int) (progress * 100))); + } + + @Override + protected void createApplication(Class appClass) + { + this.appClass = appClass; + } + + private void launchApp() throws Exception + { + setPhase("Application Start"); + + Method mainMethod = appClass.getMethod("main", String[].class); + mainMethod.invoke(null, (Object) new String[0]); + } + + protected void reportError(String title, Throwable error) + { + log.log(Level.SEVERE, title, error); + } + + @Override + protected void setupClassLoader(ClassLoader classLoader) + { + } + +} diff --git a/dev/blynkserver/fxlauncher/Launcher.java b/dev/blynkserver/fxlauncher/Launcher.java new file mode 100644 index 0000000..5e60d60 --- /dev/null +++ b/dev/blynkserver/fxlauncher/Launcher.java @@ -0,0 +1,246 @@ +package fxlauncher; + +import com.sun.javafx.application.ParametersImpl; +import com.sun.javafx.application.PlatformImpl; +import javafx.application.Application; +import javafx.application.Platform; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.scene.control.Alert; +import javafx.scene.control.TextArea; +import javafx.scene.layout.StackPane; +import javafx.scene.web.WebView; +import javafx.stage.Stage; +import javafx.stage.StageStyle; + +import java.io.*; +import java.net.URI; +import java.nio.file.Path; +import java.util.*; +import java.util.logging.Level; +import java.util.logging.Logger; + +@SuppressWarnings("unchecked") +public class Launcher extends Application { + private static final Logger log = Logger.getLogger("Launcher"); + + private Application app; + private Stage primaryStage; + private Stage stage; + private UIProvider uiProvider; + private StackPane root; + + private final AbstractLauncher superLauncher = new AbstractLauncher() { + @Override + protected Parameters getParameters() { + return Launcher.this.getParameters(); + } + + @Override + protected void updateProgress(double progress) { + Platform.runLater(() -> uiProvider.updateProgress(progress)); + } + + @Override + protected void createApplication(Class appClass) { + PlatformImpl.runAndWait(() -> + { + try { + if (Application.class.isAssignableFrom(appClass)) { + app = appClass.newInstance(); + } + } catch (Throwable t) { + reportError("Error creating app class", t); + } + }); + } + + @Override + protected void reportError(String title, Throwable error) { + log.log(Level.WARNING, title, error); + + Platform.runLater(() -> + { + Alert alert = new Alert(Alert.AlertType.ERROR); + alert.setTitle(title); + alert.setHeaderText(String.format("%s\ncheck the logfile 'fxlauncher.log, usually in the %s directory", title, System.getProperty("java.io.tmpdir"))); +// alert.setHeaderText(title+"\nCheck the logfile usually in the "+System.getProperty("java.io.tmpdir") + "directory"); + alert.getDialogPane().setPrefWidth(600); + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(out); + error.printStackTrace(writer); + writer.close(); + TextArea text = new TextArea(out.toString()); + alert.getDialogPane().setContent(text); + + alert.showAndWait(); + Platform.exit(); + }); + } + + @Override + protected void setupClassLoader(ClassLoader classLoader) { + FXMLLoader.setDefaultClassLoader(classLoader); + Platform.runLater(() -> Thread.currentThread().setContextClassLoader(classLoader)); + } + + + }; + + /** + * Check if a new version is available and return the manifest for the new version or null if no update. + *

+ * Note that updates will only be detected if the application was actually launched with FXLauncher. + * + * @return The manifest for the new version if available + */ + public static FXManifest checkForUpdate() throws IOException { + // We might be called even when FXLauncher wasn't used to start the application + if (AbstractLauncher.manifest == null) return null; + FXManifest manifest = FXManifest.load(URI.create(AbstractLauncher.manifest.uri + "/app.xml")); + return manifest.equals(AbstractLauncher.manifest) ? null : manifest; + } + + + /** + * Initialize the UI Provider by looking for an UIProvider inside the launcher + * or fallback to the default UI. + *

+ * A custom implementation must be embedded inside the launcher jar, and + * /META-INF/services/fxlauncher.UIProvider must point to the new implementation class. + *

+ * You must do this manually/in your build right around the "embed manifest" step. + */ + public void init() throws Exception { + Iterator providers = ServiceLoader.load(UIProvider.class).iterator(); + uiProvider = providers.hasNext() ? providers.next() : new DefaultUIProvider(); + } + + public void start(Stage primaryStage) throws Exception { + this.primaryStage = primaryStage; + stage = new Stage(StageStyle.UNDECORATED); + root = new StackPane(); + final boolean[] filesUpdated = new boolean[1]; + + Scene scene = new Scene(root); + stage.setScene(scene); + + superLauncher.setupLogFile(); + superLauncher.checkSSLIgnoreflag(); + this.uiProvider.init(stage); + root.getChildren().add(uiProvider.createLoader()); + + stage.show(); + + new Thread(() -> { + Thread.currentThread().setName("FXLauncher-Thread"); + try { + superLauncher.updateManifest(); + createUpdateWrapper(); + filesUpdated[0] = superLauncher.syncFiles(); + } catch (Exception ex) { + log.log(Level.WARNING, String.format("Error during %s phase", superLauncher.getPhase()), ex); + if (superLauncher.checkIgnoreUpdateErrorSetting()) { + superLauncher.reportError(String.format("Error during %s phase", superLauncher.getPhase()), ex); + System.exit(1); + } + } + + try { + superLauncher.createApplicationEnvironment(); + launchAppFromManifest(filesUpdated[0]); + } catch (Exception ex) { + superLauncher.reportError(String.format("Error during %s phase", superLauncher.getPhase()), ex); + } + + }).start(); + } + + private void launchAppFromManifest(boolean showWhatsnew) throws Exception { + superLauncher.setPhase("Application Environment Prepare"); + + try { + initApplication(); + } catch (Throwable ex) { + superLauncher.reportError("Error during app init", ex); + } + superLauncher.setPhase("Application Start"); + log.info("Show whats new dialog? " + showWhatsnew); + + PlatformImpl.runAndWait(() -> + { + try { + if (showWhatsnew && superLauncher.getManifest().whatsNewPage != null) + showWhatsNewDialog(superLauncher.getManifest().whatsNewPage); + + // Lingering update screen will close when primary stage is shown + if (superLauncher.getManifest().lingeringUpdateScreen) { + primaryStage.showingProperty().addListener(observable -> { + if (stage.isShowing()) + stage.close(); + }); + } else { + stage.close(); + } + + startApplication(); + } catch (Throwable ex) { + superLauncher.reportError("Failed to start application", ex); + } + }); + } + + private void showWhatsNewDialog(String whatsNewPage) { + WebView view = new WebView(); + view.getEngine().load(Launcher.class.getResource(whatsNewPage).toExternalForm()); + Alert alert = new Alert(Alert.AlertType.INFORMATION); + alert.setTitle("What's new"); + alert.setHeaderText("New in this update"); + alert.getDialogPane().setContent(view); + alert.showAndWait(); + } + + public static void main(String[] args) { + launch(args); + } + + private void createUpdateWrapper() { + superLauncher.setPhase("Update Wrapper Creation"); + + Platform.runLater(() -> + { + Parent updater = uiProvider.createUpdater(superLauncher.getManifest()); + root.getChildren().clear(); + root.getChildren().add(updater); + }); + } + + public void stop() throws Exception { + if (app != null) + app.stop(); + } + + private void initApplication() throws Exception { + if (app != null) { + app.init(); + } + } + + private void startApplication() throws Exception { + if (app != null) { + ParametersImpl.registerParameters(app, new LauncherParams(getParameters(), superLauncher.getManifest())); + PlatformImpl.setApplicationName(app.getClass()); + superLauncher.setPhase("Application Init"); + app.start(primaryStage); + } else { + // Start any executable jar (i.E. Spring Boot); + List files = superLauncher.getManifest().files; + String cacheDir = superLauncher.getManifest().cacheDir; + String command = String.format("java -jar %s/%s", cacheDir, files.get(0).file); + log.info(String.format("Execute command '%s'", command)); + Runtime.getRuntime().exec(command); + } + } +} diff --git a/dev/blynkserver/fxlauncher/LauncherParams.java b/dev/blynkserver/fxlauncher/LauncherParams.java new file mode 100644 index 0000000..0b32f6f --- /dev/null +++ b/dev/blynkserver/fxlauncher/LauncherParams.java @@ -0,0 +1,111 @@ +package fxlauncher; + +import javafx.application.Application; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * Implementation Application.Parameters that wraps the parameters given to the application + * at startup, and adds any manifest configured parameters unless they were overriden + * by the command line. + */ +public class LauncherParams extends Application.Parameters { + private final List rawArgs = new ArrayList<>(); + private final Map namedParams = new HashMap<>(); + private final List unnamedParams = new ArrayList<>(); + + public LauncherParams(List rawArgs) { + this.rawArgs.addAll(rawArgs); + computeParams(); + } + + public LauncherParams(Application.Parameters delegate, FXManifest manifest) { + // Add all raw args from the parent application + rawArgs.addAll(delegate.getRaw()); + + // Add parameters from the manifest unless they were already specified on the command line + if (manifest.parameters != null) { + for (String arg : manifest.parameters.split("\\s")) { + if (arg != null) { + if (rawArgs.contains(arg)) + continue; + + if (arg.startsWith("--") && arg.contains("=")) { + String argname = arg.substring(0, arg.indexOf("=")); + if (rawArgs.stream().filter(a -> a.startsWith(argname)).findAny().isPresent()) + continue; + } + + rawArgs.add(arg); + } + } + } + + computeParams(); + } + + private void computeParams() { + // Compute named and unnamed parameters + computeNamedParams(); + computeUnnamedParams(); + } + + public List getRaw() { + return rawArgs; + } + + public List getUnnamed() { + return unnamedParams; + } + + public Map getNamed() { + return namedParams; + } + + /** + * Returns true if the specified string is a named parameter of the + * form: --name=value + * + * @param arg the string to check + * @return true if the string matches the pattern for a named parameter. + */ + private boolean isNamedParam(String arg) { + return arg.startsWith("--") && (arg.indexOf('=') > 2 && validFirstChar(arg.charAt(2))); + } + + /** + * This method parses the current array of raw arguments looking for + * name,value pairs. These name,value pairs are then added to the map + * for this parameters object, and are of the form: --name=value. + */ + private void computeNamedParams() { + rawArgs.stream().filter(this::isNamedParam).forEach(arg -> { + final int eqIdx = arg.indexOf('='); + String key = arg.substring(2, eqIdx); + String value = arg.substring(eqIdx + 1); + namedParams.put(key, value); + }); + } + /** + * This method computes the list of unnamed parameters, by filtering the + * list of raw arguments, stripping out the named parameters. + */ + private void computeUnnamedParams() { + unnamedParams.addAll(rawArgs.stream().filter(arg -> !isNamedParam(arg)).collect(Collectors.toList())); + } + + /** + * Validate the first character of a key. It is valid if it is a letter or + * an "_" character. + * + * @param c the first char of a key string + * @return whether or not it is valid + */ + private boolean validFirstChar(char c) { + return Character.isLetter(c) || c == '_'; + } +} diff --git a/dev/blynkserver/fxlauncher/LibraryFile.java b/dev/blynkserver/fxlauncher/LibraryFile.java new file mode 100644 index 0000000..b114791 --- /dev/null +++ b/dev/blynkserver/fxlauncher/LibraryFile.java @@ -0,0 +1,100 @@ +package fxlauncher; + +import javax.xml.bind.annotation.XmlAttribute; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.zip.Adler32; + +public class LibraryFile { + @XmlAttribute + String file; + @XmlAttribute + Long checksum; + @XmlAttribute + Long size; + @XmlAttribute + OS os; + + public boolean needsUpdate(Path cacheDir) { + Path path = cacheDir.resolve(file); + try { + return !Files.exists(path) || Files.size(path) != size || checksum(path) != checksum; + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public LibraryFile() { + } + + public LibraryFile(Path basepath, Path file) throws IOException { + this.file = basepath.relativize(file).toString().replace("\\", "/"); + this.size = Files.size(file); + this.checksum = checksum(file); + + String filename = file.getFileName().toString().toLowerCase(); + Pattern osPattern = Pattern.compile(".+-(linux|win|mac)\\.[^.]+$"); + Matcher osMatcher = osPattern.matcher(filename); + if (osMatcher.matches()) { + this.os = OS.valueOf(osMatcher.group(1)); + } else { + if (filename.endsWith(".dll")) { + this.os = OS.win; + } else if (filename.endsWith(".dylib")) { + this.os = OS.mac; + } else if (filename.endsWith(".so")) { + this.os = OS.linux; + } + } + } + + public boolean loadForCurrentPlatform() { + return os == null || os == OS.current; + } + + public URL toURL(Path cacheDir) { + try { + return cacheDir.resolve(file).toFile().toURI().toURL(); + } catch (MalformedURLException whaat) { + throw new RuntimeException(whaat); + } + } + + private static long checksum(Path path) throws IOException { + try (InputStream input = Files.newInputStream(path)) { + Adler32 checksum = new Adler32(); + byte[] buf = new byte[16384]; + + int read; + while ((read = input.read(buf)) > -1) + checksum.update(buf, 0, read); + + return checksum.getValue(); + } + } + + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + LibraryFile that = (LibraryFile) o; + + if (!file.equals(that.file)) return false; + if (!checksum.equals(that.checksum)) return false; + return size.equals(that.size); + + } + + public int hashCode() { + int result = file.hashCode(); + result = 31 * result + checksum.hashCode(); + result = 31 * result + size.hashCode(); + return result; + } +} diff --git a/dev/blynkserver/fxlauncher/OS.java b/dev/blynkserver/fxlauncher/OS.java new file mode 100644 index 0000000..427169b --- /dev/null +++ b/dev/blynkserver/fxlauncher/OS.java @@ -0,0 +1,20 @@ +package fxlauncher; + +enum OS { + win, mac, linux, other; + + public static final OS current; + + static { + String os = System.getProperty("os.name", "generic").toLowerCase(); + + if ((os.contains("mac")) || (os.contains("darwin"))) + current = mac; + else if (os.contains("win")) + current = win; + else if (os.contains("nux")) + current = linux; + else + current = other; + } +} \ No newline at end of file diff --git a/dev/blynkserver/fxlauncher/UIProvider.java b/dev/blynkserver/fxlauncher/UIProvider.java new file mode 100644 index 0000000..46d649a --- /dev/null +++ b/dev/blynkserver/fxlauncher/UIProvider.java @@ -0,0 +1,66 @@ +package fxlauncher; + +import javafx.scene.Parent; +import javafx.stage.Stage; + +/** + * The UIProvider is responsible for creating the loader screen and the updater screen. + * A default implementation is available in the {@link DefaultUIProvider} class, but you + * can provide a custom implementation to alter the appearance of the loader UI. + * + * Implement this interface and make sure to embed the classes inside the fxlauncher.jar + * right around the "embed manifest" step. You have to do this manually as there is no function + * in the plugin to support this yet. Basically you have to do the following two steps: + * + * 1. Copy the implementation classes into the fxlauncher.jar + * 2. Create META-INF/services/fxlauncher.UIProvider inside the fxlauncher.jar. The content must + * be a string with the fully qualified name of your implementation class. + * + * Typical example: + * + *

+ * # cd into directory with ui sources + * jar uf fxlauncher.jar -C my/package/MyUIProvider.class + * # cd into directory with META-INF folder + * jar uf fxlauncher.jar -C META-INF/services/fxlauncher.UIProvider + *
+ */ +public interface UIProvider { + + /** + * Initialization method called before {@link #createLoader()} + * and {@link #createUpdater(FXManifest)}. This is a good place to add + * stylesheets and perform other configuration. + * + * @param stage The stage that will be used to contain the loader and updater. + */ + void init(Stage stage); + + /** + * Create the Node that will be displayed while the launcher is loading resources, + * before the update process starts. The default implementation is an intdeterminate + * progress indicator, but you can return any arbitrary scene graph. + * + * @return The launcher UI + */ + Parent createLoader(); + + /** + * Create the Node that will be displayed while the launcher is updating resources. + * + * This Node should update it's display whenever the {@link #updateProgress(double)} + * method is called. + * + * @see #updateProgress(double) + * @return The updater Node + */ + Parent createUpdater(FXManifest manifest); + + /** + * Called when the update/download progress is changing. The progress is a value between + * 0 and 1, indicating the completion rate of the update process. + * + * @param progress A number between 0 and 1 + */ + void updateProgress(double progress); +} diff --git a/pde.jar b/dev/blynkserver/pde.jar similarity index 100% rename from pde.jar rename to dev/blynkserver/pde.jar diff --git a/dev/blynkserver/resources/app.xml b/dev/blynkserver/resources/app.xml new file mode 100644 index 0000000..e69de29 diff --git a/topo.txt b/dev/topo.txt similarity index 100% rename from topo.txt rename to dev/topo.txt diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 0000000..bde3826 --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,1421 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/configs/Run_as_WebStart.properties b/nbproject/configs/Run_as_WebStart.properties new file mode 100644 index 0000000..670fff0 --- /dev/null +++ b/nbproject/configs/Run_as_WebStart.properties @@ -0,0 +1,2 @@ +# Do not modify this property in this configuration. It can be re-generated. +$label=Run as WebStart diff --git a/nbproject/configs/Run_in_Browser.properties b/nbproject/configs/Run_in_Browser.properties new file mode 100644 index 0000000..f2a5a65 --- /dev/null +++ b/nbproject/configs/Run_in_Browser.properties @@ -0,0 +1,2 @@ +# Do not modify this property in this configuration. It can be re-generated. +$label=Run in Browser diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 0000000..5c5a9f0 --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=0be22bf3 +build.xml.script.CRC32=1a955ccc +build.xml.stylesheet.CRC32=8064a381@1.80.1.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=0be22bf3 +nbproject/build-impl.xml.script.CRC32=98553a02 +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/nbproject/jfx-impl.xml b/nbproject/jfx-impl.xml new file mode 100644 index 0000000..575cf06 --- /dev/null +++ b/nbproject/jfx-impl.xml @@ -0,0 +1,4049 @@ + + + + + JavaFX-specific Ant calls + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${cssfileslist} + + + + + + + + + + + + + + + + + + + + + + + + self.addMappedName( + (source.indexOf("jfxrt.jar") >= 0) || + (source.indexOf("deploy.jar") >= 0) || + (source.indexOf("javaws.jar") >= 0) || + (source.indexOf("plugin.jar") >= 0) + ? "" : source + ); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..a43f819 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,115 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processor.options= +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=BlocklyArduinoIDEPlugin +application.vendor=babas +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +compile.on.save=true +compile.on.save.unsupported.javafx=true +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/BlocklyArduinoIDEPlugin.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +file.reference.Blockly_rduinoPlugin-src=Blockly@rduinoPlugin/src +file.reference.Blockly_rduinoPlugin-test=Blockly@rduinoPlugin/test +includes=** +# Non-JavaFX jar file creation is deactivated in JavaFX 2.0+ projects +jar.archive.disabled=true +jar.compress=false +javac.classpath=\ + ${javafx.classpath.extension} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +javafx.application.implementation.version=1.0 +javafx.binarycss=false +javafx.classpath.extension=\ + ${java.home}/lib/javaws.jar:\ + ${java.home}/lib/deploy.jar:\ + ${java.home}/lib/plugin.jar +javafx.deploy.allowoffline=true +# If true, application update mode is set to 'background', if false, update mode is set to 'eager' +javafx.deploy.backgroundupdate=false +javafx.deploy.embedJNLP=true +javafx.deploy.includeDT=true +# Set true to prevent creation of temporary copy of deployment artifacts before each run (disables concurrent runs) +javafx.disable.concurrent.runs=false +# Set true to enable multiple concurrent runs of the same WebStart or Run-in-Browser project +javafx.enable.concurrent.external.runs=false +# This is a JavaFX project +javafx.enabled=true +javafx.fallback.class=com.javafx.main.NoJavaFXFallback +# Main class for JavaFX +javafx.main.class= +javafx.preloader.class= +# This project does not use Preloader +javafx.preloader.enabled=false +javafx.preloader.jar.filename= +javafx.preloader.jar.path= +javafx.preloader.project.path= +javafx.preloader.type=none +# Set true for GlassFish only. Rebases manifest classpaths of JARs in lib dir. Not usable with signed JARs. +javafx.rebase.libs=false +javafx.run.height=600 +javafx.run.width=800 +# Pre-JavaFX 2.0 WebStart is deactivated in JavaFX 2.0+ projects +jnlp.enabled=false +# Main class for Java launcher +main.class=com.javafx.main.Main +# For improved security specify narrower Codebase manifest attribute to prevent RIAs from being repurposed +manifest.custom.codebase=* +# Specify Permissions manifest attribute to override default (choices: sandbox, all-permissions) +manifest.custom.permissions= +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +platform.active=default_platform +run.classpath=\ + ${dist.jar}:\ + ${javac.classpath}:\ + ${build.classes.dir} +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=${file.reference.Blockly_rduinoPlugin-src} +test.src.dir=${file.reference.Blockly_rduinoPlugin-test} diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..69b575b --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,25 @@ + + + org.netbeans.modules.java.j2seproject + + + + + + + + + + + + + BlocklyArduinoIDEPlugin + + + + + + + + + diff --git a/Blockly@rduinoPlugin/build.xml b/src/Blockly@rduinoPlugin/build.xml similarity index 100% rename from Blockly@rduinoPlugin/build.xml rename to src/Blockly@rduinoPlugin/build.xml diff --git a/Blockly@rduinoPlugin/build/built-jar.properties b/src/Blockly@rduinoPlugin/build/built-jar.properties similarity index 71% rename from Blockly@rduinoPlugin/build/built-jar.properties rename to src/Blockly@rduinoPlugin/build/built-jar.properties index ca18c95..90f92d3 100644 --- a/Blockly@rduinoPlugin/build/built-jar.properties +++ b/src/Blockly@rduinoPlugin/build/built-jar.properties @@ -1,4 +1,4 @@ -#Mon, 12 Mar 2018 15:04:07 +0100 +#Wed, 24 Oct 2018 17:41:20 +0200 F\:\\Logiciels\\Arduino_graphique\\BlocklyArduinoIDEPlugin\\Blockly@rduinoPlugin= diff --git a/LedMatrixEditor/build/classes/META-INF/logo.png b/src/Blockly@rduinoPlugin/build/classes/META-INF/logo.png similarity index 100% rename from LedMatrixEditor/build/classes/META-INF/logo.png rename to src/Blockly@rduinoPlugin/build/classes/META-INF/logo.png diff --git a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoPlugin$1.class b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoPlugin$1.class similarity index 100% rename from Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoPlugin$1.class rename to src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoPlugin$1.class diff --git a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoPlugin$2.class b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoPlugin$2.class similarity index 100% rename from Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoPlugin$2.class rename to src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoPlugin$2.class diff --git a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoPlugin.class b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoPlugin.class similarity index 100% rename from Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoPlugin.class rename to src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoPlugin.class diff --git a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$1.class b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$1.class similarity index 90% rename from Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$1.class rename to src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$1.class index aac86b0..599baed 100644 Binary files a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$1.class and b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$1.class differ diff --git a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$2.class b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$2.class similarity index 90% rename from Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$2.class rename to src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$2.class index f1c844a..5cc1b11 100644 Binary files a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$2.class and b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$2.class differ diff --git a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$3.class b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$3.class similarity index 91% rename from Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$3.class rename to src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$3.class index 8fdb950..7abd20e 100644 Binary files a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$3.class and b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$3.class differ diff --git a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$4.class b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$4.class similarity index 91% rename from Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$4.class rename to src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$4.class index 9f5b9fc..9a1f28e 100644 Binary files a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$4.class and b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$4.class differ diff --git a/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$5.class b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$5.class new file mode 100644 index 0000000..aaa15c2 Binary files /dev/null and b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer$5.class differ diff --git a/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer.class b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer.class new file mode 100644 index 0000000..235d7fd Binary files /dev/null and b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/BlocklyArduinoServer.class differ diff --git a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser$1.class b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser$1.class similarity index 91% rename from Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser$1.class rename to src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser$1.class index 2c08c69..8aea317 100644 Binary files a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser$1.class and b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser$1.class differ diff --git a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser$2.class b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser$2.class similarity index 89% rename from Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser$2.class rename to src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser$2.class index f96380f..ea342a6 100644 Binary files a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser$2.class and b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser$2.class differ diff --git a/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser.class b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser.class new file mode 100644 index 0000000..c2be125 Binary files /dev/null and b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/Browser.class differ diff --git a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/StartupApplet$1.class b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/StartupApplet$1.class similarity index 100% rename from Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/StartupApplet$1.class rename to src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/StartupApplet$1.class diff --git a/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/StartupApplet.class b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/StartupApplet.class similarity index 100% rename from Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/StartupApplet.class rename to src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/StartupApplet.class diff --git a/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/pom.xml b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/pom.xml new file mode 100644 index 0000000..6bbb63f --- /dev/null +++ b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/pom.xml @@ -0,0 +1,138 @@ + + + 4.0.0 + + no.tornado + fxlauncher + 1.0.18 + jar + FX Launcher + Auto updating launcher for JavaFX Applications + https://github.com/edvin/fxlauncher + + + + sonatype-nexus-staging + Nexus Release Repository + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + SYSE + https://www.syse.no/ + + + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + + Edvin Syse + es@syse.no + SYSE AS + https://www.syse.no + + + + + scm:git:git@github.com:edvin/fxlauncher.git + scm:git:git@github.com:edvin/fxlauncher.git + git@github.com:edvin/fxlauncher.git + + + + + + + org.apache.maven.plugins + maven-release-plugin + 2.1 + + forked-path + false + -Psonatype-oss-release + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.3 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-jar-plugin + 2.6 + + + + fxlauncher.Launcher + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.3 + + + compile + + javadoc + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.4 + + + compile + + aggregate + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.4 + + + sign-artifacts + deploy + + sign + + + + + + + + + UTF-8 + 1.8 + 1.8 + + + \ No newline at end of file diff --git a/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/target/classes/.netbeans_automatic_build b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/target/classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/target/fxlauncher-1.0.18.jar b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/target/fxlauncher-1.0.18.jar new file mode 100644 index 0000000..afbe504 Binary files /dev/null and b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/target/fxlauncher-1.0.18.jar differ diff --git a/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/target/javadoc-bundle-options/javadoc-options-javadoc-resources.xml b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/target/javadoc-bundle-options/javadoc-options-javadoc-resources.xml new file mode 100644 index 0000000..8b89c97 --- /dev/null +++ b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/target/javadoc-bundle-options/javadoc-options-javadoc-resources.xml @@ -0,0 +1,10 @@ + + + + + + + + + src/main/javadoc + diff --git a/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/target/maven-archiver/pom.properties b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/target/maven-archiver/pom.properties new file mode 100644 index 0000000..97f90b2 --- /dev/null +++ b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Apache Maven +#Wed Oct 24 14:29:36 CEST 2018 +version=1.0.18 +groupId=no.tornado +artifactId=fxlauncher diff --git a/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000..e69de29 diff --git a/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/target/test-classes/.netbeans_automatic_build b/src/Blockly@rduinoPlugin/build/classes/blocklyarduinoplugin/target/test-classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/src/Blockly@rduinoPlugin/dist/BlocklyArduinoPlugin.jar b/src/Blockly@rduinoPlugin/dist/BlocklyArduinoPlugin.jar new file mode 100644 index 0000000..a1b4a62 Binary files /dev/null and b/src/Blockly@rduinoPlugin/dist/BlocklyArduinoPlugin.jar differ diff --git a/Blockly@rduinoPlugin/dist/README.TXT b/src/Blockly@rduinoPlugin/dist/README.TXT similarity index 100% rename from Blockly@rduinoPlugin/dist/README.TXT rename to src/Blockly@rduinoPlugin/dist/README.TXT diff --git a/LedMatrixEditor/dist/lib/arduino-core.jar b/src/Blockly@rduinoPlugin/dist/lib/arduino-core.jar similarity index 100% rename from LedMatrixEditor/dist/lib/arduino-core.jar rename to src/Blockly@rduinoPlugin/dist/lib/arduino-core.jar diff --git a/LedMatrixEditor/dist/lib/commons-io-2.5.jar b/src/Blockly@rduinoPlugin/dist/lib/commons-io-2.5.jar similarity index 100% rename from LedMatrixEditor/dist/lib/commons-io-2.5.jar rename to src/Blockly@rduinoPlugin/dist/lib/commons-io-2.5.jar diff --git a/LedMatrixEditor/dist/lib/jfxrt.jar b/src/Blockly@rduinoPlugin/dist/lib/jfxrt.jar similarity index 95% rename from LedMatrixEditor/dist/lib/jfxrt.jar rename to src/Blockly@rduinoPlugin/dist/lib/jfxrt.jar index 469365f..e328e4b 100644 Binary files a/LedMatrixEditor/dist/lib/jfxrt.jar and b/src/Blockly@rduinoPlugin/dist/lib/jfxrt.jar differ diff --git a/LedMatrixEditor/dist/lib/pde.jar b/src/Blockly@rduinoPlugin/dist/lib/pde.jar similarity index 100% rename from LedMatrixEditor/dist/lib/pde.jar rename to src/Blockly@rduinoPlugin/dist/lib/pde.jar diff --git a/LedMatrixEditor/lib/arduino-core.jar b/src/Blockly@rduinoPlugin/lib/arduino-core.jar similarity index 100% rename from LedMatrixEditor/lib/arduino-core.jar rename to src/Blockly@rduinoPlugin/lib/arduino-core.jar diff --git a/LedMatrixEditor/lib/commons-io-2.5.jar b/src/Blockly@rduinoPlugin/lib/commons-io-2.5.jar similarity index 100% rename from LedMatrixEditor/lib/commons-io-2.5.jar rename to src/Blockly@rduinoPlugin/lib/commons-io-2.5.jar diff --git a/LedMatrixEditor/lib/pde.jar b/src/Blockly@rduinoPlugin/lib/pde.jar similarity index 100% rename from LedMatrixEditor/lib/pde.jar rename to src/Blockly@rduinoPlugin/lib/pde.jar diff --git a/LedMatrixEditor/manifest.mf b/src/Blockly@rduinoPlugin/manifest.mf similarity index 100% rename from LedMatrixEditor/manifest.mf rename to src/Blockly@rduinoPlugin/manifest.mf diff --git a/Blockly@rduinoPlugin/nbproject/build-impl.xml b/src/Blockly@rduinoPlugin/nbproject/build-impl.xml similarity index 100% rename from Blockly@rduinoPlugin/nbproject/build-impl.xml rename to src/Blockly@rduinoPlugin/nbproject/build-impl.xml diff --git a/src/Blockly@rduinoPlugin/nbproject/configs/release.properties b/src/Blockly@rduinoPlugin/nbproject/configs/release.properties new file mode 100644 index 0000000..95fe742 --- /dev/null +++ b/src/Blockly@rduinoPlugin/nbproject/configs/release.properties @@ -0,0 +1 @@ +main.class=BlocklyArduinoPlugin diff --git a/Blockly@rduinoPlugin/nbproject/genfiles.properties b/src/Blockly@rduinoPlugin/nbproject/genfiles.properties similarity index 100% rename from Blockly@rduinoPlugin/nbproject/genfiles.properties rename to src/Blockly@rduinoPlugin/nbproject/genfiles.properties diff --git a/LedMatrixEditor/nbproject/private/config.properties b/src/Blockly@rduinoPlugin/nbproject/private/config.properties similarity index 100% rename from LedMatrixEditor/nbproject/private/config.properties rename to src/Blockly@rduinoPlugin/nbproject/private/config.properties diff --git a/Blockly@rduinoPlugin/nbproject/private/private.properties b/src/Blockly@rduinoPlugin/nbproject/private/private.properties similarity index 100% rename from Blockly@rduinoPlugin/nbproject/private/private.properties rename to src/Blockly@rduinoPlugin/nbproject/private/private.properties diff --git a/BlocklyArduinoUpdater/UpdateApp/nbproject/private/private.xml b/src/Blockly@rduinoPlugin/nbproject/private/private.xml similarity index 55% rename from BlocklyArduinoUpdater/UpdateApp/nbproject/private/private.xml rename to src/Blockly@rduinoPlugin/nbproject/private/private.xml index f502bf6..6807a2b 100644 --- a/BlocklyArduinoUpdater/UpdateApp/nbproject/private/private.xml +++ b/src/Blockly@rduinoPlugin/nbproject/private/private.xml @@ -1,10 +1,7 @@ - - - file:/F:/Logiciels/Arduino_graphique/BlocklyArduinoIDEPlugin/BlocklyArduinoUpdater/UpdateApp/src/updateapp/UpdateInfo.java - + diff --git a/LedMatrixEditor/nbproject/private/profiler/settings.xml b/src/Blockly@rduinoPlugin/nbproject/private/profiler/settings.xml similarity index 100% rename from LedMatrixEditor/nbproject/private/profiler/settings.xml rename to src/Blockly@rduinoPlugin/nbproject/private/profiler/settings.xml diff --git a/Blockly@rduinoPlugin/nbproject/project.properties b/src/Blockly@rduinoPlugin/nbproject/project.properties similarity index 98% rename from Blockly@rduinoPlugin/nbproject/project.properties rename to src/Blockly@rduinoPlugin/nbproject/project.properties index a37a2f8..6aa3b79 100644 --- a/Blockly@rduinoPlugin/nbproject/project.properties +++ b/src/Blockly@rduinoPlugin/nbproject/project.properties @@ -60,7 +60,7 @@ javac.test.classpath=\ javac.test.processorpath=\ ${javac.test.classpath} javadoc.additionalparam= -javadoc.author=false +javadoc.author=true javadoc.encoding=${source.encoding} javadoc.noindex=false javadoc.nonavbar=false @@ -68,7 +68,7 @@ javadoc.notree=false javadoc.private=true javadoc.splitindex=true javadoc.use=true -javadoc.version=false +javadoc.version=true javadoc.windowtitle= jnlp.applet.class=blocklyarduinoplugin.StartupApplet jnlp.applet.height=300 diff --git a/Blockly@rduinoPlugin/nbproject/project.xml b/src/Blockly@rduinoPlugin/nbproject/project.xml similarity index 100% rename from Blockly@rduinoPlugin/nbproject/project.xml rename to src/Blockly@rduinoPlugin/nbproject/project.xml diff --git a/Blockly@rduinoPlugin/src/blocklyarduinoplugin/BlocklyArduinoPlugin.java b/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/BlocklyArduinoPlugin.java similarity index 100% rename from Blockly@rduinoPlugin/src/blocklyarduinoplugin/BlocklyArduinoPlugin.java rename to src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/BlocklyArduinoPlugin.java diff --git a/Blockly@rduinoPlugin/src/blocklyarduinoplugin/BlocklyArduinoServer.java b/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/BlocklyArduinoServer.java similarity index 85% rename from Blockly@rduinoPlugin/src/blocklyarduinoplugin/BlocklyArduinoServer.java rename to src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/BlocklyArduinoServer.java index f4079b7..eac84b1 100644 --- a/Blockly@rduinoPlugin/src/blocklyarduinoplugin/BlocklyArduinoServer.java +++ b/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/BlocklyArduinoServer.java @@ -5,6 +5,7 @@ */ package blocklyarduinoplugin; +import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; @@ -12,13 +13,19 @@ import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; +import java.io.OutputStream; import java.io.PrintWriter; import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; import javafx.application.Platform; +import javafx.embed.swing.SwingFXUtils; import javafx.stage.FileChooser; import javafx.stage.Window; +import javafx.scene.Scene; +import javafx.scene.image.Image; +import javafx.stage.Stage; +import javax.imageio.ImageIO; import javax.swing.SwingUtilities; import java.lang.reflect.InvocationTargetException; @@ -230,44 +237,25 @@ public void run() { * @param code Thecode generated from Blockly@rduino. */ public void saveWorkspaceCapture(String code) { - - //System.out.println("uploading code"); - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - //System.out.println("code upload run method started"); - try{ - //System.out.println("make method"); - java.lang.reflect.Method method; - //System.out.println("get BlocklyArduinoPlugin class"); - Class ed = BlocklyArduinoPlugin.editor.getClass(); - //System.out.println("get args"); - Class[] cArg = new Class[1]; - //System.out.println("set first arg as string"); - cArg[0] = String.class; - //System.out.println("get setText method"); - method = ed.getMethod("setText", cArg); - //System.out.println("invoke method"); - method.invoke(editor, code); - }catch(NoSuchMethodException e) { - //System.out.println("nosuchmethod"); - BlocklyArduinoPlugin.editor.getCurrentTab().setText(code); - } catch (IllegalAccessException e) { - //System.out.println("illegalaccess"); - BlocklyArduinoPlugin.editor.getCurrentTab().setText(code); - } catch (SecurityException e) { - //System.out.println("security"); - BlocklyArduinoPlugin.editor.getCurrentTab().setText(code); - } catch (InvocationTargetException e) { - //System.out.println("invocationtarget"); - BlocklyArduinoPlugin.editor.getCurrentTab().setText(code); - } - //System.out.println("handleExport"); - BlocklyArduinoPlugin.editor.handleSaveAs(); - //System.out.println("Done handling export"); - } - }); + + FileChooser fileChooser = new FileChooser(); + fileChooser.setInitialDirectory(new File(lastOpenedLocation)); + fileChooser.setTitle("Capture"); + fileChooser.getExtensionFilters().addAll( + new FileChooser.ExtensionFilter("image", "*.svg") + ); + + File selectedFile = fileChooser.showSaveDialog(ownerWindow); + if (selectedFile != null) { + try{ + FileWriter fileWriter = null; + fileWriter = new FileWriter(selectedFile); + fileWriter.write(code); + fileWriter.close(); + } catch (IOException ex) { + //Logger.getLogger(JavaFX_Text.class.getName()).log(Level.SEVERE, null, ex); + } + } } /** @@ -280,7 +268,7 @@ public String IDEloadXML() { FileChooser fileChooser = new FileChooser(); fileChooser.setInitialDirectory(new File(lastOpenedLocation)); fileChooser.getExtensionFilters().addAll( - new FileChooser.ExtensionFilter("XML files", "*.xml") + new FileChooser.ExtensionFilter("Blockly@rduino", "*.B@") ); File selectedFile = fileChooser.showOpenDialog(ownerWindow); String blockData = ""; @@ -316,14 +304,14 @@ public void IDEsaveXML(String xml) { fileChooser.setInitialDirectory(new File(lastOpenedLocation)); fileChooser.setTitle("Save"); fileChooser.getExtensionFilters().addAll( - new FileChooser.ExtensionFilter("XML files", "*.xml") + new FileChooser.ExtensionFilter("Blockly@rduino", "*.B@") ); File selectedFile = fileChooser.showSaveDialog(ownerWindow); if (selectedFile != null) { - if (selectedFile.getName().matches("^.*\\.xml$")) { + if (selectedFile.getName().matches("^.*\\.B@$")) { // filename is OK as-is } else { - selectedFile = new File(selectedFile.toString() + ".xml"); // append .xml if "foo.jpg.xml" is OK + selectedFile = new File(selectedFile.toString() + ".B@"); // append .B@ if "foo.jpg.xml" is OK } lastOpenedLocation = selectedFile.getParent(); try { diff --git a/Blockly@rduinoPlugin/src/blocklyarduinoplugin/Browser.java b/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/Browser.java similarity index 71% rename from Blockly@rduinoPlugin/src/blocklyarduinoplugin/Browser.java rename to src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/Browser.java index d3983f7..2228aa7 100644 --- a/Blockly@rduinoPlugin/src/blocklyarduinoplugin/Browser.java +++ b/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/Browser.java @@ -6,8 +6,10 @@ package blocklyarduinoplugin; import java.io.File; +import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; +import java.io.BufferedReader; import java.util.Optional; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; @@ -84,15 +86,36 @@ public void handle(WebEvent event) { boolean result = confirm.showAndWait().filter(ButtonType.YES::equals).isPresent(); return result ; }); - - String baseurl = "file:" + getClass().getProtectionDomain().getCodeSource().getLocation().getPath(); - baseurl = baseurl.replace("\\", "/"); - baseurl = baseurl.replace("BlocklyArduinoPlugin.jar", ""); - - webEngine.load(baseurl + "Blockly@rduino/index_light.html?lang=fr&IDE=on"); - - //add the web view to the scene - getChildren().add(browser); + String location = getClass().getProtectionDomain().getCodeSource().getLocation().getPath(); + location = location.replace("BlocklyArduinoPlugin.jar", ""); + File optionFile = new File(location + "BlocklyArduinoPlugin.config"); + if(optionFile.exists() && optionFile.isFile()) { + try{ + FileReader filereading = new FileReader(optionFile); + BufferedReader reader = new BufferedReader(filereading); + String line = reader.readLine(); + reader.close(); + filereading.close(); + //System.out.println(line); + if (line == null) line = ""; + String baseurl = "file:" + getClass().getProtectionDomain().getCodeSource().getLocation().getPath(); + baseurl = baseurl.replace("\\", "/"); + baseurl = baseurl.replace("BlocklyArduinoPlugin.jar", ""); + webEngine.load(baseurl + "Blockly@rduino/index_IDE.html" + line); + getChildren().add(browser); + } + catch (IOException exception){ + System.out.println("error reading"); + } + }else + { + String baseurl = "file:" + getClass().getProtectionDomain().getCodeSource().getLocation().getPath(); + baseurl = baseurl.replace("\\", "/"); + baseurl = baseurl.replace("BlocklyArduinoPlugin.jar", ""); + webEngine.load(baseurl + "Blockly@rduino/index_IDE.html"); + //add the web view to the scene + getChildren().add(browser); + } } private void SaveFile(String content, File file){ diff --git a/Blockly@rduinoPlugin/src/blocklyarduinoplugin/StartupApplet.java b/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/StartupApplet.java similarity index 100% rename from Blockly@rduinoPlugin/src/blocklyarduinoplugin/StartupApplet.java rename to src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/StartupApplet.java diff --git a/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/pom.xml b/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/pom.xml new file mode 100644 index 0000000..6bbb63f --- /dev/null +++ b/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/pom.xml @@ -0,0 +1,138 @@ + + + 4.0.0 + + no.tornado + fxlauncher + 1.0.18 + jar + FX Launcher + Auto updating launcher for JavaFX Applications + https://github.com/edvin/fxlauncher + + + + sonatype-nexus-staging + Nexus Release Repository + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + SYSE + https://www.syse.no/ + + + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + + Edvin Syse + es@syse.no + SYSE AS + https://www.syse.no + + + + + scm:git:git@github.com:edvin/fxlauncher.git + scm:git:git@github.com:edvin/fxlauncher.git + git@github.com:edvin/fxlauncher.git + + + + + + + org.apache.maven.plugins + maven-release-plugin + 2.1 + + forked-path + false + -Psonatype-oss-release + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.3 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-jar-plugin + 2.6 + + + + fxlauncher.Launcher + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.3 + + + compile + + javadoc + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.4 + + + compile + + aggregate + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.4 + + + sign-artifacts + deploy + + sign + + + + + + + + + UTF-8 + 1.8 + 1.8 + + + \ No newline at end of file diff --git a/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/target/classes/.netbeans_automatic_build b/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/target/classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/target/fxlauncher-1.0.18.jar b/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/target/fxlauncher-1.0.18.jar new file mode 100644 index 0000000..afbe504 Binary files /dev/null and b/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/target/fxlauncher-1.0.18.jar differ diff --git a/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/target/javadoc-bundle-options/javadoc-options-javadoc-resources.xml b/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/target/javadoc-bundle-options/javadoc-options-javadoc-resources.xml new file mode 100644 index 0000000..8b89c97 --- /dev/null +++ b/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/target/javadoc-bundle-options/javadoc-options-javadoc-resources.xml @@ -0,0 +1,10 @@ + + + + + + + + + src/main/javadoc + diff --git a/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/target/maven-archiver/pom.properties b/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/target/maven-archiver/pom.properties new file mode 100644 index 0000000..97f90b2 --- /dev/null +++ b/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Apache Maven +#Wed Oct 24 14:29:36 CEST 2018 +version=1.0.18 +groupId=no.tornado +artifactId=fxlauncher diff --git a/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000..e69de29 diff --git a/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/target/test-classes/.netbeans_automatic_build b/src/Blockly@rduinoPlugin/src/blocklyarduinoplugin/target/test-classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/blocklyarduinoweb/BlocklyArduinoWeb.java b/src/blocklyarduinoweb/BlocklyArduinoWeb.java similarity index 100% rename from blocklyarduinoweb/BlocklyArduinoWeb.java rename to src/blocklyarduinoweb/BlocklyArduinoWeb.java diff --git a/src/pde.jar b/src/pde.jar new file mode 100644 index 0000000..259b6d7 Binary files /dev/null and b/src/pde.jar differ