├── .gitignore
├── .idea
├── .gitignore
├── .name
├── gradle.xml
├── kotlinc.xml
├── misc.xml
├── uiDesigner.xml
└── vcs.xml
├── .run
└── Run IDE with Plugin.run.xml
├── README.md
├── build.gradle.kts
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle.kts
└── src
└── main
├── java
└── com
│ └── wastingmisaka
│ └── dg_lab_warden
│ ├── Threads
│ ├── StaticCodeChecker.java
│ ├── inspectionPunish.java
│ └── pulse_send.java
│ ├── messageUtils
│ └── MessageSender.java
│ ├── staticVar
│ ├── constVar.java
│ ├── currentVar.java
│ └── statusVar.java
│ ├── swingForms
│ ├── DG_LAB.form
│ ├── DG_LAB.java
│ └── QRCode.java
│ ├── wave
│ └── ws
│ ├── ServerWebSocketServlet.java
│ ├── WebSocketServer.java
│ ├── WebSocketServerMain.java
│ └── wsThread.java
└── resources
├── META-INF
├── plugin.xml
└── pluginIcon.svg
└── wave.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | build/
3 | !gradle/wrapper/gradle-wrapper.jar
4 | !**/src/main/**/build/
5 | !**/src/test/**/build/
6 |
7 | ### IntelliJ IDEA ###
8 | .idea/modules.xml
9 | .idea/jarRepositories.xml
10 | .idea/compiler.xml
11 | .idea/libraries/
12 | *.iws
13 | *.iml
14 | *.ipr
15 | out/
16 | !**/src/main/**/out/
17 | !**/src/test/**/out/
18 |
19 | ### Eclipse ###
20 | .apt_generated
21 | .classpath
22 | .factorypath
23 | .project
24 | .settings
25 | .springBeans
26 | .sts4-cache
27 | bin/
28 | !**/src/main/**/bin/
29 | !**/src/test/**/bin/
30 |
31 | ### NetBeans ###
32 | /nbproject/private/
33 | /nbbuild/
34 | /dist/
35 | /nbdist/
36 | /.nb-gradle/
37 |
38 | ### VS Code ###
39 | .vscode/
40 |
41 | ### Mac OS ###
42 | .DS_Store
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Editor-based HTTP Client requests
5 | /httpRequests/
6 | # Datasource local storage ignored files
7 | /dataSources/
8 | /dataSources.local.xml
9 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | DG_Lab_Warden
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
15 |
16 |
--------------------------------------------------------------------------------
/.idea/kotlinc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/uiDesigner.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | -
6 |
7 |
8 | -
9 |
10 |
11 | -
12 |
13 |
14 | -
15 |
16 |
17 |
18 |
19 |
20 | -
21 |
22 |
23 | -
24 |
25 |
26 |
27 |
28 |
29 | -
30 |
31 |
32 |
33 |
34 |
35 | -
36 |
37 |
38 |
39 |
40 |
41 | -
42 |
43 |
44 |
45 |
46 | -
47 |
48 |
49 |
50 |
51 | -
52 |
53 |
54 |
55 |
56 | -
57 |
58 |
59 |
60 |
61 | -
62 |
63 |
64 |
65 |
66 | -
67 |
68 |
69 |
70 |
71 | -
72 |
73 |
74 | -
75 |
76 |
77 |
78 |
79 | -
80 |
81 |
82 |
83 |
84 | -
85 |
86 |
87 |
88 |
89 | -
90 |
91 |
92 |
93 |
94 | -
95 |
96 |
97 |
98 |
99 | -
100 |
101 |
102 | -
103 |
104 |
105 | -
106 |
107 |
108 | -
109 |
110 |
111 | -
112 |
113 |
114 |
115 |
116 | -
117 |
118 |
119 | -
120 |
121 |
122 |
123 |
124 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.run/Run IDE with Plugin.run.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | true
20 | true
21 | false
22 |
23 |
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 打开 IDE 后点击右上角齿轮,点击**Plugins**(插件)
2 |
3 | 
4 |
5 | 然后点击 Installed右边的 **小齿轮**,在弹出的选项卡中选择从磁盘中安装
6 | 
7 |
8 | 选择 **DG-LAB-Warden.zip 压缩包**(包含所需的jar包),点击ok。
9 | 并在安装第三方插件弹出的警告窗中点击确认即可。
10 |
11 | 如果没能安装成功,则需要再重新安装一次。
12 | **安装完成后重启IDE**
13 |
14 | 在右侧栏可以看到该面板,点击将其打开
15 | 
16 |
17 | 修改**本机ip**和**端口号**后,点击 **开启连接**。
18 |
19 | 
20 |
21 | 当服务器状态为on二维码弹出,用郊狼APPsocket控制扫码即可使用。
22 | (需要连在同一网络中)
23 |
24 | 不想使用时,可以在插件面板将其停用或卸载。
--------------------------------------------------------------------------------
/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("java")
3 | id("org.jetbrains.intellij") version "1.17.3"
4 | }
5 |
6 | group = "com.WastingMisaka"
7 | version = "1.0.3"
8 |
9 | repositories {
10 | mavenCentral()
11 | }
12 |
13 | intellij {
14 | version.set("2023.2.6")
15 | type.set("IC") // Target IDE Platform IC/IU
16 |
17 | plugins.set(listOf(/* Plugin Dependencies */))
18 | }
19 |
20 | tasks {
21 | // Set the JVM compatibility versions
22 | withType {
23 | sourceCompatibility = "17"
24 | targetCompatibility = "17"
25 | }
26 |
27 | patchPluginXml {
28 | sinceBuild.set("232")
29 | untilBuild.set("242.*")
30 | }
31 |
32 | signPlugin {
33 | certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
34 | privateKey.set(System.getenv("PRIVATE_KEY"))
35 | password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
36 | }
37 |
38 | publishPlugin {
39 | token.set(System.getenv("PUBLISH_TOKEN"))
40 | }
41 |
42 | dependencies{
43 | implementation("org.apache.tomcat.embed:tomcat-embed-websocket:10.1.28")
44 | implementation("org.eclipse.jetty:jetty-server:9.4.43.v20210629")
45 | implementation("org.eclipse.jetty.websocket:websocket-server:9.4.43.v20210629")
46 | implementation("org.eclipse.jetty.websocket:javax-websocket-server-impl:9.4.43.v20210629")
47 | implementation("com.google.zxing:core:3.5.1")
48 | implementation("com.google.zxing:javase:3.5.1")
49 | implementation ("org.jetbrains:annotations:23.0.0")
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | kotlin.stdlib.default.dependency=false
2 | org.gradle.configuration-cache=true
3 | org.gradle.caching=true
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WastingMisaka/DG-Lab-Warden/73e839ca27190e11223e8bdcab28a1f52b717df9/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84 |
85 | APP_NAME="Gradle"
86 | APP_BASE_NAME=${0##*/}
87 |
88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90 |
91 | # Use the maximum available, or set MAX_FD != -1 to use that value.
92 | MAX_FD=maximum
93 |
94 | warn () {
95 | echo "$*"
96 | } >&2
97 |
98 | die () {
99 | echo
100 | echo "$*"
101 | echo
102 | exit 1
103 | } >&2
104 |
105 | # OS specific support (must be 'true' or 'false').
106 | cygwin=false
107 | msys=false
108 | darwin=false
109 | nonstop=false
110 | case "$( uname )" in #(
111 | CYGWIN* ) cygwin=true ;; #(
112 | Darwin* ) darwin=true ;; #(
113 | MSYS* | MINGW* ) msys=true ;; #(
114 | NONSTOP* ) nonstop=true ;;
115 | esac
116 |
117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118 |
119 |
120 | # Determine the Java command to use to start the JVM.
121 | if [ -n "$JAVA_HOME" ] ; then
122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 | # IBM's JDK on AIX uses strange locations for the executables
124 | JAVACMD=$JAVA_HOME/jre/sh/java
125 | else
126 | JAVACMD=$JAVA_HOME/bin/java
127 | fi
128 | if [ ! -x "$JAVACMD" ] ; then
129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 |
131 | Please set the JAVA_HOME variable in your environment to match the
132 | location of your Java installation."
133 | fi
134 | else
135 | JAVACMD=java
136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 |
142 | # Increase the maximum file descriptors if we can.
143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144 | case $MAX_FD in #(
145 | max*)
146 | MAX_FD=$( ulimit -H -n ) ||
147 | warn "Could not query maximum file descriptor limit"
148 | esac
149 | case $MAX_FD in #(
150 | '' | soft) :;; #(
151 | *)
152 | ulimit -n "$MAX_FD" ||
153 | warn "Could not set maximum file descriptor limit to $MAX_FD"
154 | esac
155 | fi
156 |
157 | # Collect all arguments for the java command, stacking in reverse order:
158 | # * args from the command line
159 | # * the main class name
160 | # * -classpath
161 | # * -D...appname settings
162 | # * --module-path (only if needed)
163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
164 |
165 | # For Cygwin or MSYS, switch paths to Windows format before running java
166 | if "$cygwin" || "$msys" ; then
167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
169 |
170 | JAVACMD=$( cygpath --unix "$JAVACMD" )
171 |
172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
173 | for arg do
174 | if
175 | case $arg in #(
176 | -*) false ;; # don't mess with options #(
177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
178 | [ -e "$t" ] ;; #(
179 | *) false ;;
180 | esac
181 | then
182 | arg=$( cygpath --path --ignore --mixed "$arg" )
183 | fi
184 | # Roll the args list around exactly as many times as the number of
185 | # args, so each arg winds up back in the position where it started, but
186 | # possibly modified.
187 | #
188 | # NB: a `for` loop captures its iteration list before it begins, so
189 | # changing the positional parameters here affects neither the number of
190 | # iterations, nor the values presented in `arg`.
191 | shift # remove old arg
192 | set -- "$@" "$arg" # push replacement arg
193 | done
194 | fi
195 |
196 | # Collect all arguments for the java command;
197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198 | # shell script including quotes and variable substitutions, so put them in
199 | # double quotes to make sure that they get re-expanded; and
200 | # * put everything else in single quotes, so that it's not re-expanded.
201 |
202 | set -- \
203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
204 | -classpath "$CLASSPATH" \
205 | org.gradle.wrapper.GradleWrapperMain \
206 | "$@"
207 |
208 | # Use "xargs" to parse quoted args.
209 | #
210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
211 | #
212 | # In Bash we could simply go:
213 | #
214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
215 | # set -- "${ARGS[@]}" "$@"
216 | #
217 | # but POSIX shell has neither arrays nor command substitution, so instead we
218 | # post-process each arg (as a line of input to sed) to backslash-escape any
219 | # character that might be a shell metacharacter, then use eval to reverse
220 | # that process (while maintaining the separation between arguments), and wrap
221 | # the whole thing up as a single "set" statement.
222 | #
223 | # This will of course break if any of these variables contains a newline or
224 | # an unmatched quote.
225 | #
226 |
227 | eval "set -- $(
228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
229 | xargs -n1 |
230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
231 | tr '\n' ' '
232 | )" '"$@"'
233 |
234 | exec "$JAVACMD" "$@"
235 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | mavenCentral()
4 | gradlePluginPortal()
5 | }
6 | }
7 |
8 | rootProject.name = "DG_Lab_Warden"
--------------------------------------------------------------------------------
/src/main/java/com/wastingmisaka/dg_lab_warden/Threads/StaticCodeChecker.java:
--------------------------------------------------------------------------------
1 | package com.wastingmisaka.dg_lab_warden.Threads;
2 |
3 | import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl;
4 | import com.intellij.codeInsight.daemon.impl.HighlightInfo;
5 | import com.intellij.lang.annotation.HighlightSeverity;
6 | import com.intellij.openapi.editor.Editor;
7 | import com.intellij.openapi.fileEditor.FileEditorManager;
8 | import com.intellij.openapi.project.Project;
9 | import com.intellij.openapi.project.ProjectManager;
10 | import com.intellij.openapi.vfs.VirtualFile;
11 |
12 | import java.util.List;
13 |
14 | import static com.wastingmisaka.dg_lab_warden.staticVar.statusVar.*;
15 |
16 | public class StaticCodeChecker extends Thread{
17 | @Override
18 | public void run() {
19 | while(true){
20 | try {
21 | Thread.sleep(1000);
22 | } catch (InterruptedException e) {
23 | throw new RuntimeException(e);
24 | }
25 | Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
26 | for (Project p : openProjects) {
27 | Editor editor = FileEditorManager.getInstance(p).getSelectedTextEditor();
28 | if (editor != null) {
29 | // 获取当前文件
30 | VirtualFile[] files = FileEditorManager.getInstance(p).getOpenFiles();
31 | if (files.length > 0) {
32 | List highlightInfos = DaemonCodeAnalyzerImpl.getHighlights(editor.getDocument(), HighlightSeverity.ERROR, p);
33 | List highlightInfos2 = DaemonCodeAnalyzerImpl.getHighlights(editor.getDocument(), HighlightSeverity.WARNING, p);
34 | long warnings = highlightInfos2.stream()
35 | .filter(info -> info.getSeverity() == HighlightSeverity.WARNING)
36 | .count();
37 | long errors = highlightInfos.stream()
38 | .filter(info -> info.getSeverity() == HighlightSeverity.ERROR)
39 | .count();
40 | // 更新当前的错误数和警告数
41 | if(warning_enabled)
42 | warning_count = warnings;
43 | else warning_count = 0;
44 | if(error_enabled)
45 | error_count = errors;
46 | else error_count = 0;
47 | }
48 | }
49 | }
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/wastingmisaka/dg_lab_warden/Threads/inspectionPunish.java:
--------------------------------------------------------------------------------
1 | package com.wastingmisaka.dg_lab_warden.Threads;
2 |
3 | import com.wastingmisaka.dg_lab_warden.messageUtils.MessageSender;
4 |
5 | import java.io.IOException;
6 |
7 | import static com.wastingmisaka.dg_lab_warden.staticVar.currentVar.up_per_error;
8 | import static com.wastingmisaka.dg_lab_warden.staticVar.currentVar.up_per_warning;
9 | import static com.wastingmisaka.dg_lab_warden.staticVar.statusVar.*;
10 |
11 | public class inspectionPunish extends Thread{
12 | long warning_active=0;
13 | long error_active=0;
14 | long warning_weight = 5;
15 | long error_weight = 10;
16 | MessageSender messageSender = new MessageSender();
17 | public void run() {
18 | while(true){
19 | if(progress_session==null){
20 | try {
21 | error_active = 0;
22 | warning_active = 0;
23 | Thread.sleep(1000);
24 | continue;
25 | } catch (InterruptedException e) {
26 | throw new RuntimeException(e);
27 | }
28 | }
29 | // 静态代码检查 警告、错误数变化
30 | if((warning_active!=warning_count)||(error_active!=error_count)){
31 | // 更新本地使用的强度值
32 | error_weight = up_per_error;
33 | warning_weight = up_per_warning;
34 | long modify = (warning_count-warning_active)*warning_weight+(error_count-error_active)*error_weight;
35 | // 增加错误
36 | if(modify>0){
37 | try {
38 | messageSender.message_entry("strength",1,"1",(int)modify);
39 | messageSender.message_entry("strength",2,"1",(int)modify);
40 | } catch (IOException e) {
41 | throw new RuntimeException(e);
42 | }
43 | same();
44 | }
45 | // 解决错误
46 | else{
47 | try {
48 | messageSender.message_entry("strength",1,"0",(int)modify);
49 | messageSender.message_entry("strength",2,"0",(int)modify);
50 | } catch (IOException e) {
51 | throw new RuntimeException(e);
52 | }
53 | same();
54 | }
55 | }
56 | try {
57 | Thread.sleep(2000);
58 | } catch (InterruptedException e) {
59 | throw new RuntimeException(e);
60 | }
61 | }
62 | }
63 |
64 | public void same(){
65 | warning_active = warning_count;
66 | error_active = error_count;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/com/wastingmisaka/dg_lab_warden/Threads/pulse_send.java:
--------------------------------------------------------------------------------
1 | package com.wastingmisaka.dg_lab_warden.Threads;
2 |
3 | import com.wastingmisaka.dg_lab_warden.messageUtils.MessageSender;
4 |
5 | import java.io.IOException;
6 |
7 | import static com.wastingmisaka.dg_lab_warden.staticVar.currentVar.current_pulse;
8 | import static com.wastingmisaka.dg_lab_warden.staticVar.statusVar.*;
9 |
10 | public class pulse_send extends Thread{
11 | boolean green = true;
12 | MessageSender messageSender = new MessageSender();
13 | public void run() {
14 | String sending_pulse = "hso";
15 | while(true){
16 | if(progress_session==null||current_pulse.isEmpty()){
17 | try {
18 | Thread.sleep(500);
19 | } catch (InterruptedException e) {
20 | throw new RuntimeException(e);
21 | }
22 | continue;
23 | }
24 | if(current_pulse.equals("empty")){
25 | try {
26 | messageSender.message_entry("clear",2,"0",0);
27 | messageSender.message_entry("clear",1,"0",0);
28 | } catch (IOException e) {
29 | throw new RuntimeException(e);
30 | }
31 | try {
32 | Thread.sleep(1000);
33 | } catch (InterruptedException e) {
34 | throw new RuntimeException(e);
35 | }
36 | continue;
37 | }
38 | try {
39 | if(sending_pulse!=current_pulse){
40 | messageSender.message_entry("clear",1,"0",0);
41 | messageSender.message_entry("clear",2,"0",0);
42 | sending_pulse = current_pulse;
43 | }
44 | if(a_enabled){
45 | messageSender.message_entry("pulse",1,current_pulse,0);
46 | green = false;
47 | }
48 | if(b_enabled){
49 | messageSender.message_entry("pulse",2,current_pulse,1);
50 | green = false;
51 | }
52 | } catch (IOException e) {
53 | throw new RuntimeException(e);
54 | }
55 | try {
56 | Thread.sleep(1000);
57 | } catch (InterruptedException e) {
58 | throw new RuntimeException(e);
59 | }
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/com/wastingmisaka/dg_lab_warden/messageUtils/MessageSender.java:
--------------------------------------------------------------------------------
1 | package com.wastingmisaka.dg_lab_warden.messageUtils;
2 |
3 | import java.io.IOException;
4 |
5 | import static com.wastingmisaka.dg_lab_warden.staticVar.currentVar.*;
6 | import static com.wastingmisaka.dg_lab_warden.staticVar.statusVar.*;
7 |
8 | public class MessageSender {
9 |
10 | // 消息格式: MSG + msg + MSG_end
11 | String MSG = "{\"clientId\":\"Server\",\"targetId\":\"APP\",\"type\":\"msg\",\"message\":\"";
12 | String MSG_end = "\"}";
13 |
14 | public void send_message(String msg,String type) throws IOException {
15 | progress_session.getRemote().sendString(msg);
16 | }
17 | public void message_entry(String type,int channel,String mode,int num)throws IOException{
18 | if(progress_session==null) return;
19 | if(channel == 1 && !a_enabled) return;
20 | if(channel == 2 && !b_enabled) return;
21 | String back="";
22 |
23 | switch (type) {
24 | case "strength" -> {
25 | // 设定值是否超过上限
26 | if (mode.equals("2") && current_current[channel] + num > current_max[channel]) {
27 | num = current_max[channel];
28 | }
29 | back = "strength-" + channel + "+" + mode + "+" + num;
30 | }
31 | case "pulse" -> {
32 | String Pulse = pulse_data.get(mode);
33 | Pulse = Pulse + "," + Pulse + "," + Pulse;
34 | String pulse_channel;
35 | if (channel == 1)
36 | pulse_channel = "A";
37 | else pulse_channel = "B";
38 | back = "pulse-" + pulse_channel + ":[" + Pulse + "]";
39 | }
40 | // TODO 发送心跳包(5分钟空闲连接会被中断)
41 | case "heartbeat" -> {
42 |
43 | }
44 | case "break" -> {
45 | back = "{\"clientId\":\"Server\",\"targetId\":\"APP\",\"type\":\"break\",\"message\":\"209\"}";
46 | send_message(back, type);
47 | return;
48 | }
49 |
50 | // 清除队列中的波形数据
51 | case "clear" -> back = "clear-" + channel;
52 | }
53 | send_message(qp(back),type);
54 | }
55 | // 补充消息前后部分
56 | public String qp(String t){
57 | return MSG+t+MSG_end;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/com/wastingmisaka/dg_lab_warden/staticVar/constVar.java:
--------------------------------------------------------------------------------
1 | package com.wastingmisaka.dg_lab_warden.staticVar;
2 | // 常量
3 | public class constVar {
4 | // 二维码前缀
5 | public static final String URL_prefix = "https://www.dungeon-lab.com/app-download.php#DGLAB-SOCKET#ws://";
6 | // 二维码后缀
7 | public static final String URL_suffix = "/Server";
8 |
9 | // 软件限制的电流强度上下限
10 | public static final int A_MIN = 0;
11 | public static final int B_MIN = 0;
12 | public static final int A_MAX = 200;
13 | public static final int B_MAX = 200;
14 |
15 | // 默认文本
16 | public static final String[] current_default={"0","当前强度A: 0","当前强度B: 0","当前上限A: 0","当前上限B: 0","unreachable_current_default"};
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/com/wastingmisaka/dg_lab_warden/staticVar/currentVar.java:
--------------------------------------------------------------------------------
1 | package com.wastingmisaka.dg_lab_warden.staticVar;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.IOException;
5 | import java.io.InputStream;
6 | import java.io.InputStreamReader;
7 | import java.util.HashMap;
8 | import java.util.List;
9 | import java.util.Map;
10 | import java.util.stream.Collectors;
11 |
12 | // 存放在堆中,和电流有关的全局变量
13 | public class currentVar {
14 | // 电流信息
15 | public static int[] current_current={0,0,0,0};
16 | public static int[] current_max={0,0,0,0};
17 | public static String current_pulse="";
18 |
19 | // 一键开火记录数值
20 | public static int fire_current = 30;
21 |
22 | // 单个静态错误强度
23 | public static int up_per_error = 10;
24 | public static int up_per_warning = 5;
25 |
26 | // TODO +波形
27 | public static Map pulse_data = new HashMap<>();
28 | public static void wave_init(){
29 | String[] name_list = {"呼吸","潮汐","连击","快速按捏","按捏渐强",
30 | "心跳节奏","压缩","节奏步伐","颗粒摩擦","渐变弹跳","波浪涟漪",
31 | "雨水冲刷","变速敲击","信号灯","挑逗01","挑逗02"
32 | };
33 | String[] pulse_list = {
34 | "\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00050a14\\\",\\\"0a0a0a0a14191e28\\\",\\\"0a0a0a0a282d323c\\\",\\\"0a0a0a0a3c414650\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0000000000000000\\\",\\\"0000000000000000\\\",\\\"0000000000000000\\\"",
35 | "\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00040811\\\",\\\"0a0a0a0a11151921\\\",\\\"0a0a0a0a32323232\\\",\\\"0a0a0a0a32363a43\\\",\\\"0a0a0a0a43474b53\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a6462605c\\\",\\\"0a0a0a0a5c5a5854\\\",\\\"0a0a0a0a5452504c\\\",\\\"0a0a0a0a44444444\\\"",
36 | "\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a645c5443\\\",\\\"0a0a0a0a433a3221\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00000001\\\",\\\"0a0a0a0a02020202\\\"",
37 | "\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a64646464\\\",\\\"0000000000000000\\\"",
38 | "\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a1d1d1d1d\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a34343434\\\",\\\"0a0a0a0a02020202\\\",\\\"0a0a0a0a49494949\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a57575757\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a00000000\\\"",
39 | "\\\"6e6e6e6e64646464\\\",\\\"6e6e6e6e64646464\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a4b4b4b4b\\\",\\\"0a0a0a0a4b4d4f53\\\",\\\"0a0a0a0a5355585c\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00000000\\\"",
40 | "\\\"1919181864646464\\\",\\\"1817171764646464\\\",\\\"1616161564646464\\\",\\\"1515141464646464\\\",\\\"1413131364646464\\\",\\\"1212121164646464\\\",\\\"1110101064646464\\\",\\\"0f0f0f0e64646464\\\",\\\"0e0e0d0d64646464\\\",\\\"0d0c0c0c64646464\\\",\\\"0b0b0b0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\"",
41 | "\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00050a14\\\",\\\"0a0a0a0a14191e28\\\",\\\"0a0a0a0a282d323c\\\",\\\"0a0a0a0a3c414650\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00060c19\\\",\\\"0a0a0a0a191f2632\\\",\\\"0a0a0a0a32383e4b\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00081021\\\",\\\"0a0a0a0a212a3243\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a000c1932\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a64646464\\\"",
42 | "\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a00000000\\\"",
43 | "\\\"0a0a0a0a01010101\\\",\\\"0a0a0a0a01091222\\\",\\\"0a0a0a0a222a3243\\\",\\\"0a0a0a0a64646464\\\",\\\"0000000000000000\\\",\\\"0000000000000000\\\"",
44 | "\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a000c1932\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a49494949\\\"",
45 | "\\\"0a0a0a0a22222222\\\",\\\"0a0a0a0a222a3243\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0000000000000000\\\",\\\"0000000000000000\\\"",
46 | "\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00000000\\\",\\\"6e6e6e6e64646464\\\",\\\"6e6e6e6e64646464\\\",\\\"6e6e6e6e64646464\\\",\\\"6e6e6e6e64646464\\\",\\\"0000000000000000\\\"",
47 | "\\\"c5c5c5c564646464\\\",\\\"c5c5c5c564646464\\\",\\\"c5c5c5c564646464\\\",\\\"c5c5c5c564646464\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00081021\\\",\\\"0a0a0a0a212a3243\\\",\\\"0a0a0a0a64646464\\\"",
48 | "\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00060c19\\\",\\\"0a0a0a0a191f2632\\\",\\\"0a0a0a0a32383e4b\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a00000000\\\",\\\"0a0a0a0a64646464\\\"",
49 | "\\\"0a0a0a0a01010101\\\",\\\"0a0a0a0a0104060c\\\",\\\"0a0a0a0a0c0f1217\\\",\\\"0a0a0a0a171a1c22\\\",\\\"0a0a0a0a2225282d\\\",\\\"0a0a0a0a2d303238\\\",\\\"0a0a0a0a383b3e43\\\",\\\"0a0a0a0a4346484e\\\",\\\"0a0a0a0a4e515459\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a64646464\\\",\\\"0a0a0a0a00000000\\\",\\\"0000000000000000\\\""
50 | };
51 | for(int i=0;i lines = reader.lines().collect(Collectors.toList());
63 | // int cnt = 0;
64 | // cnt = Integer.parseInt(lines.get(0));
65 | // for(int i=1;i<=cnt;i++){
66 | // int sp = lines.get(i).indexOf(":");
67 | // String name = lines.get(i).substring(0,sp);
68 | // String value = lines.get(i).substring(sp+1);
69 | // pulse_data.put(name,value);
70 | // }
71 | // }catch (IOException e){
72 | // e.printStackTrace();
73 | // }
74 | }
75 |
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/src/main/java/com/wastingmisaka/dg_lab_warden/staticVar/statusVar.java:
--------------------------------------------------------------------------------
1 | package com.wastingmisaka.dg_lab_warden.staticVar;
2 |
3 | import org.eclipse.jetty.server.Server;
4 | import org.eclipse.jetty.websocket.api.Session;
5 |
6 | public class statusVar {
7 | // 程序的状态
8 | public static int MainFunction = 0;
9 | // 一键开火状态
10 | public static int firing = 0;
11 | // A通道开关
12 | public static boolean a_enabled = false;
13 | // B通道开关
14 | public static boolean b_enabled = false;
15 | // 警告惩罚
16 | public static boolean warning_enabled = false;
17 | // 错误惩罚
18 | public static boolean error_enabled = false;
19 |
20 |
21 | // 服务器IP
22 | public static String IP = "192.168.8.155";
23 | // 服务器端口号 默认8080
24 | public static String Port = "8080";
25 | // 当前的服务器实例
26 | public static Server progress_server = null;
27 | // 当前和客户端建立的ws会话
28 | public static Session progress_session = null;
29 |
30 | // 当前页面警告数
31 | public static long warning_count = 0;
32 | // 当前页面错误数
33 | public static long error_count = 0;
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/wastingmisaka/dg_lab_warden/swingForms/DG_LAB.form:
--------------------------------------------------------------------------------
1 |
2 |
266 |
--------------------------------------------------------------------------------
/src/main/java/com/wastingmisaka/dg_lab_warden/swingForms/DG_LAB.java:
--------------------------------------------------------------------------------
1 | package com.wastingmisaka.dg_lab_warden.swingForms;
2 |
3 | import com.intellij.openapi.project.Project;
4 | import com.intellij.openapi.wm.ToolWindow;
5 | import com.intellij.openapi.wm.ToolWindowFactory;
6 | import com.intellij.ui.content.Content;
7 | import com.intellij.ui.content.ContentFactory;
8 | import com.wastingmisaka.dg_lab_warden.Threads.StaticCodeChecker;
9 | import com.wastingmisaka.dg_lab_warden.Threads.inspectionPunish;
10 | import com.wastingmisaka.dg_lab_warden.Threads.pulse_send;
11 | import com.wastingmisaka.dg_lab_warden.messageUtils.MessageSender;
12 | import com.wastingmisaka.dg_lab_warden.ws.wsThread;
13 | import org.jetbrains.annotations.NotNull;
14 |
15 | import javax.swing.*;
16 | import javax.swing.event.ChangeEvent;
17 | import javax.swing.event.ChangeListener;
18 | import javax.swing.event.ListSelectionEvent;
19 | import javax.swing.event.ListSelectionListener;
20 |
21 | import java.awt.*;
22 | import java.awt.image.BufferedImage;
23 | import java.io.IOException;
24 |
25 | import static com.wastingmisaka.dg_lab_warden.staticVar.constVar.*;
26 | import static com.wastingmisaka.dg_lab_warden.staticVar.currentVar.*;
27 | import static com.wastingmisaka.dg_lab_warden.staticVar.statusVar.*;
28 |
29 | // 窗体
30 | public class DG_LAB implements ToolWindowFactory {
31 |
32 | private JButton switcher;
33 | private JLabel a_current_show;
34 | private JLabel b_current_show;
35 | private JLabel a_max_show;
36 | private JLabel b_max_show;
37 | private JButton set_zero;
38 | private JButton FIRE;
39 | private JPanel panel1;
40 | private JTextField ip_text;
41 | private JTextField port_text;
42 | private JLabel QRCode_show;
43 | private JLabel server_status;
44 | private JLabel session_status;
45 | private JCheckBox a_checkBox;
46 | private JCheckBox b_checkBox;
47 | private JCheckBox error_checkBox;
48 | private JCheckBox warning_checkBox;
49 | private JList pulse_select;
50 | private JSpinner fire_spinner;
51 | private JPanel MainPanel;
52 | private JPanel Layer1;
53 | private JPanel Layer2;
54 | private JPanel Layer2Data;
55 | private JPanel Layer2QRCode;
56 | private JPanel Layer3;
57 | private JSpinner error_spinner;
58 | private JSpinner warning_spinner;
59 |
60 | MessageSender messageSender = new MessageSender();
61 | public void run(){
62 | new pulse_send().start();
63 | new StaticCodeChecker().start();
64 | new inspectionPunish().start();
65 | init_();
66 | // 启动计时器
67 | update_current.start();
68 | update_connect_status.start();
69 | }
70 | public void init_(){
71 | // 加载wave波形
72 | wave_init();
73 | // 初始化默认值
74 | ip_text.setText(IP);
75 | port_text.setText(Port);
76 | // 初始化窗体标签
77 | a_current_show.setText(current_default[1]);
78 | b_current_show.setText(current_default[2]);
79 | a_max_show.setText(current_default[3]);
80 | b_max_show.setText(current_default[4]);
81 | // 添加按钮监听
82 | // 功能开关
83 | switcher.addActionListener(e ->{
84 | if(MainFunction==0){
85 | IP = ip_text.getText();
86 | Port = port_text.getText();
87 | if(!check_ip_valid(IP)){
88 | JOptionPane.showMessageDialog(null,"IP地址不合法","错误",JOptionPane.ERROR_MESSAGE);
89 | return;
90 | }
91 | if(!check_port_valid(Port)){
92 | JOptionPane.showMessageDialog(null,"端口号不合法","错误",JOptionPane.ERROR_MESSAGE);
93 | return;
94 | }
95 | // 开启 ws
96 | new wsThread().start();
97 | // 生成并显示二维码
98 | control_QRCode();
99 | switcher.setForeground(Color.RED);
100 | switcher.setText("关闭连接");
101 | MainFunction = 1;
102 | }else{
103 | try {
104 | messageSender.message_entry("break",0,"0",0);
105 | } catch (IOException ex) {
106 | throw new RuntimeException(ex);
107 | }
108 | // 关闭当前的会话和服务器
109 | if(progress_session!=null)
110 | progress_session.close();
111 | if(progress_server!=null) {
112 | try {
113 | progress_server.stop();
114 | } catch (Exception ex) {
115 | throw new RuntimeException(ex);
116 | }
117 | }
118 | control_QRCode();
119 | switcher.setForeground(Color.GREEN);
120 | switcher.setText("开启连接");
121 | MainFunction = 0;
122 | }
123 | });
124 | // 归零按钮
125 | set_zero.addActionListener(g ->{
126 | try {
127 | // TODO set zero : checkbox disable auto-increment
128 | error_checkBox.setSelected(false);
129 | warning_checkBox.setSelected(false);
130 | messageSender.message_entry("strength",1,"2",0);
131 | messageSender.message_entry("strength",2,"2",0);
132 | } catch (IOException ex) {
133 | throw new RuntimeException(ex);
134 | }
135 |
136 | });
137 | FIRE.addActionListener(f -> {
138 | if(firing == 0){
139 | fire_current = (int)fire_spinner.getValue();
140 | try {
141 | messageSender.message_entry("strength",1,"1",fire_current);
142 | messageSender.message_entry("strength",2,"1",fire_current);
143 | } catch (IOException ex) {
144 | throw new RuntimeException(ex);
145 | }
146 | firing = 1;
147 | FIRE.setForeground(Color.YELLOW);
148 | FIRE.setText("停止开火");
149 | }else{
150 | try {
151 | messageSender.message_entry("strength",1,"0",fire_current);
152 | messageSender.message_entry("strength",2,"0",fire_current);
153 | } catch (IOException e) {
154 | throw new RuntimeException(e);
155 | }
156 | firing = 0;
157 | FIRE.setForeground(Color.white);
158 | FIRE.setText("一键开火");
159 | }
160 | });
161 |
162 | //波形选择面板
163 | String[] options1 = {"呼吸","潮汐","连击","快速按捏","按捏渐强",
164 | "心跳节奏","压缩","节奏步伐","颗粒摩擦","渐变弹跳","波浪涟漪",
165 | "雨水冲刷","变速敲击","信号灯","挑逗01","挑逗02"
166 | };
167 | pulse_select.setListData(options1);
168 | pulse_select.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
169 | pulse_select.addListSelectionListener(new ListSelectionListener() {
170 | @Override
171 | public void valueChanged(ListSelectionEvent e) {
172 | if(!e.getValueIsAdjusting()){
173 | String selected = (String)pulse_select.getSelectedValue();
174 | if(selected!=null)
175 | current_pulse = selected;
176 | else
177 | current_pulse = "empty";
178 | }
179 | }
180 | });
181 | // Spinner
182 | {
183 | fire_spinner.setModel(new SpinnerNumberModel(30, 0, 200, 5));
184 | error_spinner.setModel(new SpinnerNumberModel(10, 0, 200, 5));
185 | warning_spinner.setModel(new SpinnerNumberModel(5, 0, 200, 5));
186 |
187 | //轮盘Listener
188 | error_spinner.addChangeListener(changeEvent -> {
189 | up_per_error = (int)error_spinner.getValue();
190 | });
191 | warning_spinner.addChangeListener(changeEvent -> {
192 | up_per_warning = (int)warning_spinner.getValue();
193 | });
194 | }
195 | // 复选框Listener
196 | error_checkBox.addChangeListener(changeEvent -> {
197 | if(error_checkBox.isSelected())
198 | error_enabled = true;
199 | else error_enabled = false;
200 | });
201 | warning_checkBox.addChangeListener(new ChangeListener() {
202 | @Override
203 | public void stateChanged(ChangeEvent changeEvent) {
204 | if(warning_checkBox.isSelected())
205 | warning_enabled = true;
206 | else warning_enabled = false;
207 | }
208 | });
209 | a_checkBox.addChangeListener(changeEvent -> {
210 | if(a_checkBox.isSelected())
211 | a_enabled = true;
212 | else{
213 | try {
214 | messageSender.message_entry("strength",1,"2",0);
215 | a_enabled = false;
216 | } catch (IOException e) {
217 | throw new RuntimeException(e);
218 | }
219 | }
220 | });
221 | b_checkBox.addChangeListener(changeEvent -> {
222 | if(b_checkBox.isSelected())
223 | b_enabled = true;
224 | else{
225 | try {
226 | messageSender.message_entry("strength",2,"2",0);
227 | b_enabled = false;
228 | } catch (IOException e) {
229 | throw new RuntimeException(e);
230 | }
231 | }
232 | });
233 | }
234 |
235 |
236 | Timer update_current = new Timer(1000, e -> {
237 | if(progress_session!=null){
238 | a_current_show.setText("A通道强度:"+current_current[1]);
239 | b_current_show.setText("B通道强度:"+current_current[2]);
240 | a_max_show.setText("A通道上限:"+current_max[1]);
241 | b_max_show.setText("B通道上限:"+current_max[2]);
242 | }
243 | });
244 |
245 | Timer update_connect_status = new Timer(1000, e -> {
246 | if(progress_server!=null){
247 | server_status.setForeground(Color.GREEN);
248 | server_status.setText("服务器状态:ON");
249 | }else{
250 | server_status.setForeground(Color.RED);
251 | server_status.setText("服务器状态:OFF");
252 | }
253 | if(progress_session!=null){
254 | session_status.setForeground(Color.GREEN);
255 | session_status.setText("会话状态:ON");
256 | }else{
257 | session_status.setForeground(Color.RED);
258 | session_status.setText("会话状态:OFF");
259 | }
260 | });
261 | @Override
262 | public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
263 | final ContentFactory factory = ContentFactory.getInstance();
264 | {
265 | run();
266 | final Content content1 = factory.createContent(MainPanel, "", false);
267 | toolWindow.getContentManager().addContent(content1);
268 | }
269 | }
270 |
271 | public boolean check_ip_valid(String ip){
272 | if(ip.length()<7||ip.length()>15) return false;
273 | for(int i=0;i3|| temp[i].isEmpty()) return false;
282 | int temp_int = Integer.parseInt(temp[i]);
283 | if(temp_int<0||temp_int>255) return false;
284 | }
285 | return true;
286 | }
287 | public boolean check_port_valid(String port){
288 | if(port.isEmpty()||port.length()>5) return false;
289 | for(int i=0;i'9') return false;
291 | }
292 | int p = Integer.parseInt(port);
293 | return p >= 0 && p <= 65535;
294 | }
295 |
296 | public void control_QRCode(){
297 | if(MainFunction==0){
298 | String qrContent = URL_prefix + IP + ":"+Port+URL_suffix;
299 | BufferedImage qrImage = QRCode.generateQRCodeImage(qrContent,200,200);
300 | QRCode_show.setText("");
301 | QRCode_show.setIcon(new ImageIcon(qrImage));
302 | }else{
303 | QRCode_show.setText("null");
304 | QRCode_show.setIcon(null);
305 | QRCode_show.revalidate();
306 | QRCode_show.repaint();
307 | }
308 | }
309 | }
310 |
--------------------------------------------------------------------------------
/src/main/java/com/wastingmisaka/dg_lab_warden/swingForms/QRCode.java:
--------------------------------------------------------------------------------
1 | package com.wastingmisaka.dg_lab_warden.swingForms;
2 |
3 | import com.google.zxing.BarcodeFormat;
4 | import com.google.zxing.EncodeHintType;
5 | import com.google.zxing.WriterException;
6 | import com.google.zxing.client.j2se.MatrixToImageWriter;
7 | import com.google.zxing.common.BitMatrix;
8 | import com.google.zxing.qrcode.QRCodeWriter;
9 |
10 | import java.awt.image.BufferedImage;
11 | import java.util.HashMap;
12 | import java.util.Map;
13 |
14 | public class QRCode {
15 | public static BufferedImage generateQRCodeImage(String qrContent, int width, int height) {
16 | QRCodeWriter qrCodeWriter = new QRCodeWriter();
17 | Map hints = new HashMap<>();
18 | hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
19 |
20 | try {
21 | BitMatrix bitMatrix = qrCodeWriter.encode(qrContent, BarcodeFormat.QR_CODE, width, height, hints);
22 | return MatrixToImageWriter.toBufferedImage(bitMatrix);
23 | } catch (WriterException e) {
24 | return null;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/com/wastingmisaka/dg_lab_warden/wave:
--------------------------------------------------------------------------------
1 | PULSE_NAME = [
2 | '呼吸',
3 | '潮汐',
4 | '连击',
5 | '快速按捏',
6 | '按捏渐强',
7 | '心跳节奏',
8 | '压缩', #6 发送压缩波形等长波形需要注意不超过单次发送上限 ,比如这组x5会超限
9 | '节奏步伐',
10 | '颗粒摩擦',
11 | '渐变弹跳',
12 | '波浪涟漪',
13 | '雨水冲刷',
14 | '变速敲击',
15 | '信号灯',
16 | '挑逗1',
17 | '挑逗2'
18 | ]
19 |
20 | PULSE_DATA = {
21 | '呼吸': [
22 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (0, 5, 10, 20)),
23 | ((10, 10, 10, 10), (20, 25, 30, 40)), ((10, 10, 10, 10), (40, 45, 50, 60)),
24 | ((10, 10, 10, 10), (60, 65, 70, 80)), ((10, 10, 10, 10), (100, 100, 100, 100)),
25 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (100, 100, 100, 100)),
26 | ((0, 0, 0, 0), (0, 0, 0, 0)), ((0, 0, 0, 0), (0, 0, 0, 0)), ((0, 0, 0, 0), (0, 0, 0, 0))
27 | ],
28 | '潮汐': [
29 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (0, 4, 8, 17)),
30 | ((10, 10, 10, 10), (17, 21, 25, 33)), ((10, 10, 10, 10), (50, 50, 50, 50)),
31 | ((10, 10, 10, 10), (50, 54, 58, 67)), ((10, 10, 10, 10), (67, 71, 75, 83)),
32 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (100, 98, 96, 92)),
33 | ((10, 10, 10, 10), (92, 90, 88, 84)), ((10, 10, 10, 10), (84, 82, 80, 76)),
34 | ((10, 10, 10, 10), (68, 68, 68, 68))
35 | ],
36 | '连击': [
37 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (0, 0, 0, 0)),
38 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (100, 92, 84, 67)),
39 | ((10, 10, 10, 10), (67, 58, 50, 33)), ((10, 10, 10, 10), (0, 0, 0, 0)),
40 | ((10, 10, 10, 10), (0, 0, 0, 1)), ((10, 10, 10, 10), (2, 2, 2, 2))
41 | ],
42 | '快速按捏': [
43 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (100, 100, 100, 100)),
44 | ((0, 0, 0, 0), (0, 0, 0, 0))
45 | ],
46 | '按捏渐强': [
47 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (29, 29, 29, 29)),
48 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (52, 52, 52, 52)),
49 | ((10, 10, 10, 10), (2, 2, 2, 2)), ((10, 10, 10, 10), (73, 73, 73, 73)),
50 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (87, 87, 87, 87)),
51 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (100, 100, 100, 100)),
52 | ((10, 10, 10, 10), (0, 0, 0, 0))
53 | ],
54 | '心跳节奏': [
55 | ((110, 110, 110, 110), (100, 100, 100, 100)), ((110, 110, 110, 110), (100, 100, 100, 100)),
56 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (0, 0, 0, 0)),
57 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (0, 0, 0, 0)),
58 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (75, 75, 75, 75)),
59 | ((10, 10, 10, 10), (75, 77, 79, 83)), ((10, 10, 10, 10), (83, 85, 88, 92)),
60 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (0, 0, 0, 0)),
61 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (0, 0, 0, 0)),
62 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (0, 0, 0, 0))
63 | ],
64 | '压缩': [ #长波形容易超出单次发送的长度
65 | ((25, 25, 24, 24), (100, 100, 100, 100)), ((24, 23, 23, 23), (100, 100, 100, 100)),
66 | ((22, 22, 22, 21), (100, 100, 100, 100)), ((21, 21, 20, 20), (100, 100, 100, 100)),
67 | ((20, 19, 19, 19), (100, 100, 100, 100)), ((18, 18, 18, 17), (100, 100, 100, 100)),
68 | ((17, 16, 16, 16), (100, 100, 100, 100)), ((15, 15, 15, 14), (100, 100, 100, 100)),
69 | ((14, 14, 13, 13), (100, 100, 100, 100)), ((13, 12, 12, 12), (100, 100, 100, 100)),
70 | ((11, 11, 11, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (100, 100, 100, 100)),
71 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (100, 100, 100, 100)),
72 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (100, 100, 100, 100)),
73 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (100, 100, 100, 100)),
74 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (100, 100, 100, 100)),
75 | ((10, 10, 10, 10), (100, 100, 100, 100))
76 | ],
77 | '节奏步伐': [ #长波形容易超出单次发送的长度
78 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (0, 5, 10, 20)),
79 | ((10, 10, 10, 10), (20, 25, 30, 40)), ((10, 10, 10, 10), (40, 45, 50, 60)),
80 | ((10, 10, 10, 10), (60, 65, 70, 80)), ((10, 10, 10, 10), (100, 100, 100, 100)),
81 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (0, 6, 12, 25)),
82 | ((10, 10, 10, 10), (25, 31, 38, 50)), ((10, 10, 10, 10), (50, 56, 62, 75)),
83 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (0, 0, 0, 0)),
84 | ((10, 10, 10, 10), (0, 8, 16, 33)), ((10, 10, 10, 10), (33, 42, 50, 67)),
85 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (0, 0, 0, 0)),
86 | ((10, 10, 10, 10), (0, 12, 25, 50)), ((10, 10, 10, 10), (100, 100, 100, 100)),
87 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (100, 100, 100, 100)),
88 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (100, 100, 100, 100)),
89 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (100, 100, 100, 100)),
90 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (100, 100, 100, 100))
91 | ],
92 | '颗粒摩擦': [
93 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (100, 100, 100, 100)),
94 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (0, 0, 0, 0))
95 | ],
96 | '渐变弹跳': [
97 | ((10, 10, 10, 10), (1, 1, 1, 1)), ((10, 10, 10, 10), (1, 9, 18, 34)),
98 | ((10, 10, 10, 10), (34, 42, 50, 67)), ((10, 10, 10, 10), (100, 100, 100, 100)),
99 | ((0, 0, 0, 0), (0, 0, 0, 0)), ((0, 0, 0, 0), (0, 0, 0, 0))
100 | ],
101 | '波浪涟漪': [
102 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (0, 12, 25, 50)),
103 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (73, 73, 73, 73))
104 | ],
105 | '雨水冲刷': [
106 | ((10, 10, 10, 10), (34, 34, 34, 34)), ((10, 10, 10, 10), (34, 42, 50, 67)),
107 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (100, 100, 100, 100)),
108 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((0, 0, 0, 0), (0, 0, 0, 0)),
109 | ((0, 0, 0, 0), (0, 0, 0, 0))
110 | ],
111 | '变速敲击': [
112 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (100, 100, 100, 100)),
113 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (0, 0, 0, 0)),
114 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (0, 0, 0, 0)),
115 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((110, 110, 110, 110), (100, 100, 100, 100)),
116 | ((110, 110, 110, 110), (100, 100, 100, 100)), ((110, 110, 110, 110), (100, 100, 100, 100)),
117 | ((110, 110, 110, 110), (100, 100, 100, 100)), ((0, 0, 0, 0), (0, 0, 0, 0))
118 | ],
119 | '信号灯': [
120 | ((197, 197, 197, 197), (100, 100, 100, 100)), ((197, 197, 197, 197), (100, 100, 100, 100)),
121 | ((197, 197, 197, 197), (100, 100, 100, 100)), ((197, 197, 197, 197), (100, 100, 100, 100)),
122 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (0, 8, 16, 33)),
123 | ((10, 10, 10, 10), (33, 42, 50, 67)), ((10, 10, 10, 10), (100, 100, 100, 100))
124 | ],
125 | '挑逗1': [
126 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (0, 6, 12, 25)),
127 | ((10, 10, 10, 10), (25, 31, 38, 50)), ((10, 10, 10, 10), (50, 56, 62, 75)),
128 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (100, 100, 100, 100)),
129 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (0, 0, 0, 0)),
130 | ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (0, 0, 0, 0)), ((10, 10, 10, 10), (0, 0, 0, 0)),
131 | ((10, 10, 10, 10), (100, 100, 100, 100))
132 | ],
133 | '挑逗2': [
134 | ((10, 10, 10, 10), (1, 1, 1, 1)), ((10, 10, 10, 10), (1, 4, 6, 12)),
135 | ((10, 10, 10, 10), (12, 15, 18, 23)), ((10, 10, 10, 10), (23, 26, 28, 34)),
136 | ((10, 10, 10, 10), (34, 37, 40, 45)), ((10, 10, 10, 10), (45, 48, 50, 56)),
137 | ((10, 10, 10, 10), (56, 59, 62, 67)), ((10, 10, 10, 10), (67, 70, 72, 78)),
138 | ((10, 10, 10, 10), (78, 81, 84, 89)), ((10, 10, 10, 10), (100, 100, 100, 100)),
139 | ((10, 10, 10, 10), (100, 100, 100, 100)), ((10, 10, 10, 10), (0, 0, 0, 0)),
140 | ((0, 0, 0, 0), (0, 0, 0, 0))
141 | ]
142 | }
143 |
--------------------------------------------------------------------------------
/src/main/java/com/wastingmisaka/dg_lab_warden/ws/ServerWebSocketServlet.java:
--------------------------------------------------------------------------------
1 | package com.wastingmisaka.dg_lab_warden.ws;
2 |
3 | import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
4 | import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
5 |
6 | public class ServerWebSocketServlet extends WebSocketServlet {
7 | @Override
8 | public void configure(WebSocketServletFactory factory){
9 | factory.register(WebSocketServer.class);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/com/wastingmisaka/dg_lab_warden/ws/WebSocketServer.java:
--------------------------------------------------------------------------------
1 | package com.wastingmisaka.dg_lab_warden.ws;
2 |
3 | import org.eclipse.jetty.websocket.api.Session;
4 | import org.eclipse.jetty.websocket.api.WebSocketAdapter;
5 |
6 | import static com.wastingmisaka.dg_lab_warden.staticVar.currentVar.*;
7 | import static com.wastingmisaka.dg_lab_warden.staticVar.statusVar.*;
8 |
9 | import java.io.IOException;
10 |
11 | public class WebSocketServer extends WebSocketAdapter {
12 | @Override
13 | public void onWebSocketConnect(Session session) {
14 | progress_session = session;
15 | super.onWebSocketConnect(session);
16 | try {
17 | getSession().getRemote().sendString("{\"clientId\":\"APP\",\"message\":\"targetId\",\"targetId\":\"\",\"type\":\"bind\"}");
18 | try {
19 | Thread.sleep(1000);
20 | } catch (InterruptedException e) {
21 | throw new RuntimeException(e);
22 | }
23 | getSession().getRemote().sendString("{\"clientId\":\"Server\",\"message\":\"200\",\"targetId\":\"APP\",\"type\":\"bind\"}");
24 | } catch (IOException e) {
25 | throw new RuntimeException(e);
26 | }
27 | }
28 |
29 | @Override
30 | public void onWebSocketText(String message) {
31 | try {
32 | get_data(message);
33 | } catch (Exception e) {
34 | e.printStackTrace();
35 | }
36 | }
37 |
38 | @Override
39 | public void onWebSocketClose(int statusCode, String reason) {
40 | super.onWebSocketClose(statusCode, reason);
41 | System.out.println("WebSocket closed: " + statusCode + " - " + reason);
42 | progress_session = null;
43 | }
44 |
45 | @Override
46 | public void onWebSocketError(Throwable cause) {
47 | super.onWebSocketError(cause);
48 | System.err.println("WebSocket error: " + cause.getMessage());
49 | }
50 |
51 | public void get_data(String msg){
52 | int st = msg.indexOf("th-");
53 | if(st!=-1){
54 | st+=2;
55 | int ed = msg.indexOf("\",\"ta");
56 | String sub_msg = msg.substring(st+1, ed);
57 | String[] split = sub_msg.split("\\+");
58 | current_current[1] = Integer.parseInt(split[0]);
59 | current_current[2] = Integer.parseInt(split[1]);
60 | current_max[1] = Integer.parseInt(split[2]);
61 | current_max[2] = Integer.parseInt(split[3]);
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/com/wastingmisaka/dg_lab_warden/ws/WebSocketServerMain.java:
--------------------------------------------------------------------------------
1 | package com.wastingmisaka.dg_lab_warden.ws;
2 |
3 | import org.eclipse.jetty.server.Server;
4 | import org.eclipse.jetty.servlet.ServletContextHandler;
5 | import org.eclipse.jetty.servlet.ServletHolder;
6 |
7 | import java.net.InetSocketAddress;
8 |
9 | import static com.wastingmisaka.dg_lab_warden.staticVar.statusVar.*;
10 |
11 | public class WebSocketServerMain {
12 | public static void main(String[] args) {
13 | InetSocketAddress addr = new InetSocketAddress(IP, Integer.parseInt(Port));
14 | Server server = new Server(addr);
15 | progress_server = server;
16 |
17 | ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
18 | context.setContextPath("/");
19 | server.setHandler(context);
20 |
21 | // Add the WebSocket servlet
22 | ServletHolder holderEvents = new ServletHolder("ws-events", ServerWebSocketServlet.class);
23 | context.addServlet(holderEvents, "/Server");
24 |
25 | try {
26 | server.start();
27 | server.join();
28 | } catch (Throwable t) {
29 | t.printStackTrace(System.err);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/com/wastingmisaka/dg_lab_warden/ws/wsThread.java:
--------------------------------------------------------------------------------
1 | package com.wastingmisaka.dg_lab_warden.ws;
2 |
3 | import static com.wastingmisaka.dg_lab_warden.staticVar.statusVar.progress_server;
4 | public class wsThread extends Thread{
5 | @Override
6 | public void run() {
7 | WebSocketServerMain.main(null);
8 | progress_server = null;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 | com.WastingMisaka.DG_Lab_Warden
3 |
4 | DG_Lab_Warden
5 |
6 | ForeLink
7 |
8 | A plugin for connecting DG Lab to your IDEA, and punishing you for coding in the wrong way( bad code inspection, compiler errors, etc.) Still WIP
9 |
10 | com.intellij.modules.platform
11 |
12 |
13 |
15 |
16 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/pluginIcon.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/resources/wave.txt:
--------------------------------------------------------------------------------
1 | 16
2 | 呼吸:\"0a0a0a0a00000000\",\"0a0a0a0a00050a14\",\"0a0a0a0a14191e28\",\"0a0a0a0a282d323c\",\"0a0a0a0a3c414650\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0000000000000000\",\"0000000000000000\",\"0000000000000000\"
3 | 潮汐:\"0a0a0a0a00000000\",\"0a0a0a0a00040811\",\"0a0a0a0a11151921\",\"0a0a0a0a32323232\",\"0a0a0a0a32363a43\",\"0a0a0a0a43474b53\",\"0a0a0a0a64646464\",\"0a0a0a0a6462605c\",\"0a0a0a0a5c5a5854\",\"0a0a0a0a5452504c\",\"0a0a0a0a44444444\"
4 | 连击:\"0a0a0a0a64646464\",\"0a0a0a0a00000000\",\"0a0a0a0a64646464\",\"0a0a0a0a645c5443\",\"0a0a0a0a433a3221\",\"0a0a0a0a00000000\",\"0a0a0a0a00000001\",\"0a0a0a0a02020202\"
5 | 快速按捏:\"0a0a0a0a00000000\",\"0a0a0a0a64646464\",\"0000000000000000\"
6 | 按捏渐强:\"0a0a0a0a00000000\",\"0a0a0a0a1d1d1d1d\",\"0a0a0a0a00000000\",\"0a0a0a0a34343434\",\"0a0a0a0a02020202\",\"0a0a0a0a49494949\",\"0a0a0a0a00000000\",\"0a0a0a0a57575757\",\"0a0a0a0a00000000\",\"0a0a0a0a64646464\",\"0a0a0a0a00000000\"
7 | 心跳节奏:\"6e6e6e6e64646464\",\"6e6e6e6e64646464\",\"0a0a0a0a00000000\",\"0a0a0a0a00000000\",\"0a0a0a0a00000000\",\"0a0a0a0a00000000\",\"0a0a0a0a00000000\",\"0a0a0a0a4b4b4b4b\",\"0a0a0a0a4b4d4f53\",\"0a0a0a0a5355585c\",\"0a0a0a0a64646464\",\"0a0a0a0a00000000\",\"0a0a0a0a00000000\",\"0a0a0a0a00000000\",\"0a0a0a0a00000000\",\"0a0a0a0a00000000\"
8 | 压缩:\"1919181864646464\",\"1817171764646464\",\"1616161564646464\",\"1515141464646464\",\"1413131364646464\",\"1212121164646464\",\"1110101064646464\",\"0f0f0f0e64646464\",\"0e0e0d0d64646464\",\"0d0c0c0c64646464\",\"0b0b0b0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\"
9 | 节奏步伐:\"0a0a0a0a00000000\",\"0a0a0a0a00050a14\",\"0a0a0a0a14191e28\",\"0a0a0a0a282d323c\",\"0a0a0a0a3c414650\",\"0a0a0a0a64646464\",\"0a0a0a0a00000000\",\"0a0a0a0a00060c19\",\"0a0a0a0a191f2632\",\"0a0a0a0a32383e4b\",\"0a0a0a0a64646464\",\"0a0a0a0a00000000\",\"0a0a0a0a00081021\",\"0a0a0a0a212a3243\",\"0a0a0a0a64646464\",\"0a0a0a0a00000000\",\"0a0a0a0a000c1932\",\"0a0a0a0a64646464\",\"0a0a0a0a00000000\",\"0a0a0a0a64646464\",\"0a0a0a0a00000000\",\"0a0a0a0a64646464\",\"0a0a0a0a00000000\",\"0a0a0a0a64646464\",\"0a0a0a0a00000000\",\"0a0a0a0a64646464\"
10 | 颗粒摩擦:\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a00000000\"
11 | 渐变弹跳:\"0a0a0a0a01010101\",\"0a0a0a0a01091222\",\"0a0a0a0a222a3243\",\"0a0a0a0a64646464\",\"0000000000000000\",\"0000000000000000\"
12 | 波浪涟漪:\"0a0a0a0a00000000\",\"0a0a0a0a000c1932\",\"0a0a0a0a64646464\",\"0a0a0a0a49494949\"
13 | 雨水冲刷:\"0a0a0a0a22222222\",\"0a0a0a0a222a3243\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0000000000000000\",\"0000000000000000\"
14 | 变速敲击:\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a00000000\",\"0a0a0a0a00000000\",\"0a0a0a0a00000000\",\"0a0a0a0a00000000\",\"6e6e6e6e64646464\",\"6e6e6e6e64646464\",\"6e6e6e6e64646464\",\"6e6e6e6e64646464\",\"0000000000000000\"
15 | 信号灯:\"c5c5c5c564646464\",\"c5c5c5c564646464\",\"c5c5c5c564646464\",\"c5c5c5c564646464\",\"0a0a0a0a00000000\",\"0a0a0a0a00081021\",\"0a0a0a0a212a3243\",\"0a0a0a0a64646464\"
16 | 挑逗01:\"0a0a0a0a00000000\",\"0a0a0a0a00060c19\",\"0a0a0a0a191f2632\",\"0a0a0a0a32383e4b\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a00000000\",\"0a0a0a0a00000000\",\"0a0a0a0a00000000\",\"0a0a0a0a00000000\",\"0a0a0a0a64646464\"
17 | 挑逗02:\"0a0a0a0a01010101\",\"0a0a0a0a0104060c\",\"0a0a0a0a0c0f1217\",\"0a0a0a0a171a1c22\",\"0a0a0a0a2225282d\",\"0a0a0a0a2d303238\",\"0a0a0a0a383b3e43\",\"0a0a0a0a4346484e\",\"0a0a0a0a4e515459\",\"0a0a0a0a64646464\",\"0a0a0a0a64646464\",\"0a0a0a0a00000000\",\"0000000000000000\"
18 |
--------------------------------------------------------------------------------