Skip to content

Commit

Permalink
Merge pull request #31 from SafeGroceryStore/dev
Browse files Browse the repository at this point in the history
更新代码
  • Loading branch information
Ch1ngg authored Dec 1, 2021
2 parents 63f789b + f5a55e1 commit 9cd2899
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 26 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
# 更新日志
> 有空会补补BUG、添添新功能。
## 2021/12/01 - `v2.0.8`
### 核心
* 修复 Mssql 连接 2000 时候的语句兼容性问题
* 设置程序默认编码
* 删除敏感文件(详细说明情况请看文档里的公告一栏)

## 2021/09/14 - `v2.0.7`
### 核心
* 优化内部代码
* 修订设置窗口文字

### PostgreSql
* 增加 Windows UDF 提权支持
* 修订插件命名规则

### 其他
* 文档更新 PostgreSql UDF 插件编写链接 (thx @huahua)
* v2.0.6 之后不再强制要求先下载 v2.0 版,下载即用

## 2021/08/17 - `v2.0.6`
### 核心
* 优化内部代码
Expand Down
7 changes: 7 additions & 0 deletions MDAT-DEV/MDUT-Dev.iml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
<orderEntry type="library" name="Maven: org.json:json:20201115" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.28" level="project" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.20" level="project" />
<orderEntry type="library" name="Maven: org.pegdown:pegdown:1.6.0" level="project" />
<orderEntry type="library" name="Maven: org.parboiled:parboiled-java:1.1.7" level="project" />
<orderEntry type="library" name="Maven: org.parboiled:parboiled-core:1.1.7" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm:5.0.3" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm-tree:5.0.3" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm-analysis:5.0.3" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm-util:5.0.3" level="project" />
<orderEntry type="library" name="Maven: redis.clients:jedis:3.1.0" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.6.2" level="project" />
Expand Down
6 changes: 6 additions & 0 deletions MDAT-DEV/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.pegdown</groupId>
<artifactId>pegdown</artifactId>
<version>1.6.0</version>
</dependency>

<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
Expand Down
Binary file removed MDAT-DEV/src/main/Plugins/Redis/sethc.exe
Binary file not shown.
1 change: 0 additions & 1 deletion MDAT-DEV/src/main/Plugins/Redis/startup.hta

This file was deleted.

2 changes: 1 addition & 1 deletion MDAT-DEV/src/main/java/Controller/MssqlController.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public void initComBoBox(){
"GBK"
);
// 初始化下拉框
ComboBox_EncodeType.setPromptText("编码");
ComboBox_EncodeType.setPromptText("UTF-8");
ComboBox_EncodeType.setItems(mssqlTypeCodeoptions);
}

Expand Down
2 changes: 1 addition & 1 deletion MDAT-DEV/src/main/java/Controller/MysqlController.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void initComboBox() {
"GBK"
);
// 初始化下拉框
MysqlEncode.setPromptText("编码");
MysqlEncode.setPromptText("UTF-8");
MysqlEncode.setItems(OracleTypeCodeoptions);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void initComboBox(){
"GBK"
);
// 初始化下拉框
postgreSqlEncodeCombox.setPromptText("编码");
postgreSqlEncodeCombox.setPromptText("UTF-8");
postgreSqlEncodeCombox.setItems(postgreSqlTypeCodeoptions);
}

Expand Down
2 changes: 1 addition & 1 deletion MDAT-DEV/src/main/java/Controller/RedisController.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void initComboBox() {
"GBK"
);
// 初始化下拉框
redisEncodeCombox.setPromptText("编码");
redisEncodeCombox.setPromptText("UTF-8");
redisEncodeCombox.setItems(postgreSqlTypeCodeoptions);
}
}
10 changes: 7 additions & 3 deletions MDAT-DEV/src/main/java/Controller/UpdateController.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import Util.Utils;
Expand All @@ -25,7 +26,7 @@
public class UpdateController implements Initializable {

@FXML
private TextArea updateLogTextArea;
private WebView updateLogWebView;

@FXML
private Label currentVersionLabel;
Expand Down Expand Up @@ -102,7 +103,10 @@ void checkVersion(ActionEvent event) {
Platform.runLater(() -> {
newVersionLabel.setText("最新版本: " + versionData.getString("version"));
updateMsgLabel.setText("新版本已发布!请点击下载按钮下载更新");
updateLogTextArea.setText(versionData.getString("body"));
try {
String body = Utils.generateHtml(versionData.getString("body"));
updateLogWebView.getEngine().loadContent(body);
} catch (IOException e) { }
downloadBtn.setDisable(false);
});
}else {
Expand Down
8 changes: 4 additions & 4 deletions MDAT-DEV/src/main/java/Dao/MssqlDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public void clearHistory(){
excute("if OBJECT_ID(N'oashellresult',N'U') is not null\n" +
"\tDROP TABLE oashellresult;","");
mssqlController.mssqlLogTextArea.appendText(Utils.log("oashellresult 表删除成功!"));
excute("if (exists (select * from sys.objects where name = 'kitmain'))drop proc kitmain;\n" +
excute("if (exists (select * from dbo.sysobjects where name = 'kitmain'))drop proc kitmain;\n" +
"if (exists (select * from sys.assemblies where name='MDATKit'))drop assembly MDATKit;\n","");
mssqlController.mssqlLogTextArea.appendText(Utils.log("CLR 删除成功!"));
} catch (SQLException e) {
Expand Down Expand Up @@ -329,7 +329,7 @@ public void activateCLR(){
*/
public void initCLR(){
try {
String checksql = "if (exists (select * from sys.objects where name = 'kitmain'))drop proc kitmain;\n" +
String checksql = "if (exists (select * from dbo.sysobjects where name = 'kitmain'))drop proc kitmain;\n" +
"if (exists (select * from sys.assemblies where name='MDATKit'))drop assembly MDATKit;\n";
excute(checksql,"");
// 获取插件目录
Expand All @@ -355,7 +355,7 @@ public void initCLR(){
*/
public boolean checkCLR(){
try {
String checksql1 = "if (exists (select * from sys.objects where name = 'kitmain')) select '1' as res;" ;
String checksql1 = "if (exists (select * from dbo.sysobjects where name = 'kitmain')) select '1' as res;" ;
//String checksql2 = "if (exists (select * from sys.assemblies where name='MDATKit')) select '1' as res;" ;
String c1 = excute(checksql1,"");
//String c2 = excute(checksql2,"");
Expand Down Expand Up @@ -483,7 +483,7 @@ public ArrayList<String> getFiles(String path){
String filesql = String.format("if OBJECT_ID(N'DirectoryTree',N'U') is not null\n" +
" DROP TABLE DirectoryTree;\n" +
"CREATE TABLE DirectoryTree (subdirectory varchar(8000),depth int,isfile bit);\n" +
"INSERT DirectoryTree (subdirectory,depth,isfile) EXEC master.sys.xp_dirtree N'%s',1,1;",path);
"INSERT DirectoryTree (subdirectory,depth,isfile) EXEC master.dbo.xp_dirtree N'%s',1,1;",path);
String selectfile = "SELECT * FROM DirectoryTree";
ArrayList<String> res = new ArrayList<>();
try {
Expand Down
22 changes: 21 additions & 1 deletion MDAT-DEV/src/main/java/Util/Utils.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package Util;

import com.alibaba.fastjson.JSONObject;
import org.pegdown.PegDownProcessor;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.sql.Driver;
import java.sql.SQLException;
import java.text.DateFormat;
Expand All @@ -21,7 +23,7 @@ public class Utils {
* @return
*/
public static String getCurrentVersion() {
return "v2.0.7";
return "v2.0.8";
}

/**
Expand Down Expand Up @@ -411,4 +413,22 @@ public static int compareVersion(String curVer, String newVer) {
}
}

/**
* 解析 MarkDown 语法,转换成 HTML 语法
* @param markdownString
* @throws IOException
*/
public static String generateHtml(String markdownString) throws IOException {
InputStream is = new ByteArrayInputStream(markdownString.getBytes(StandardCharsets.UTF_8));
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = null;
String mdContent = "";
while ((line = br.readLine()) != null) {
mdContent += line + "\n";
}
PegDownProcessor pdp = new PegDownProcessor(Integer.MAX_VALUE);
String htmlContent = pdp.markdownToHtml(mdContent);
return htmlContent;
}

}
2 changes: 0 additions & 2 deletions MDAT-DEV/src/main/java/main.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import javafx.scene.image.Image;
import javafx.stage.Stage;

import java.util.Properties;

public class main extends Application {

@Override
Expand Down
21 changes: 10 additions & 11 deletions MDAT-DEV/src/main/resources/update.fxml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.web.WebView?>

<AnchorPane prefHeight="260.0" prefWidth="340.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Controller.UpdateController">
<AnchorPane prefHeight="389.0" prefWidth="514.0" xmlns="http://javafx.com/javafx/16" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Controller.UpdateController">
<children>
<Button fx:id="downloadBtn" layoutX="229.0" layoutY="219.0" mnemonicParsing="false" onAction="#downloadAction" text="下载" />
<Button fx:id="cancelBtn" layoutX="283.0" layoutY="219.0" mnemonicParsing="false" onAction="#cancelAction" text="取消" />
<Label fx:id="updateMsgLabel" layoutX="13.0" layoutY="199.0" prefHeight="17.0" prefWidth="314.0" />
<Button fx:id="downloadBtn" layoutX="402.0" layoutY="350.0" mnemonicParsing="false" onAction="#downloadAction" text="下载" />
<Button fx:id="cancelBtn" layoutX="456.0" layoutY="350.0" mnemonicParsing="false" onAction="#cancelAction" text="取消" />
<Label fx:id="updateMsgLabel" layoutX="14.0" layoutY="320.0" prefHeight="17.0" prefWidth="314.0" />
<Label fx:id="currentVersionLabel" layoutX="14.0" layoutY="14.0" prefHeight="17.0" prefWidth="249.0" text="当前版本: " />
<Label fx:id="newVersionLabel" layoutX="14.0" layoutY="40.0" prefHeight="17.0" prefWidth="249.0" text="最新版本: " />
<Button fx:id="checkVersionBtn" layoutX="149.0" layoutY="219.0" mnemonicParsing="false" onAction="#checkVersion" text="检查更新" />
<TextArea fx:id="updateLogTextArea" layoutX="13.0" layoutY="90.0" prefHeight="103.0" prefWidth="314.0" wrapText="true" />
<Button fx:id="checkVersionBtn" layoutX="322.0" layoutY="350.0" mnemonicParsing="false" onAction="#checkVersion" text="检查更新" />
<Label fx:id="newVersionLabel1" layoutX="14.0" layoutY="66.0" prefHeight="17.0" prefWidth="70.0" text="更新详情:" />
<WebView fx:id="updateLogWebView" layoutX="15.0" layoutY="89.0" prefHeight="219.0" prefWidth="485.0" />
</children>
</AnchorPane>

0 comments on commit 9cd2899

Please sign in to comment.