-
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #395 from PBH-BTN/master
v6.0.4
- Loading branch information
Showing
15 changed files
with
133 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/java/com/ghostchu/peerbanhelper/util/ByteUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.ghostchu.peerbanhelper.util; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
public class ByteUtil { | ||
public static String bytesToHex(byte[] bytes) { | ||
StringBuilder sb = new StringBuilder(); | ||
for (byte aByte : bytes) { | ||
sb.append(String.format("%02x", aByte)); | ||
} | ||
return sb.toString(); | ||
} | ||
|
||
/** | ||
* hex字符串转byte数组 | ||
* | ||
* @param inHex 待转换的Hex字符串 | ||
* @return 转换后的byte数组结果 | ||
*/ | ||
public static byte[] hexToByteArray(String inHex) { | ||
int hexlen = inHex.length(); | ||
byte[] result; | ||
if (hexlen % 2 == 1) { | ||
//奇数 | ||
hexlen++; | ||
result = new byte[(hexlen / 2)]; | ||
inHex = "0" + inHex; | ||
} else { | ||
//偶数 | ||
result = new byte[(hexlen / 2)]; | ||
} | ||
int j = 0; | ||
ByteBuffer buffer = ByteBuffer.wrap(result); | ||
for (int i = 0; i < hexlen; i += 2) { | ||
buffer.put(hexToByte(inHex.substring(i, i + 2))); | ||
} | ||
return result; | ||
} | ||
|
||
/** | ||
* Hex字符串转byte | ||
* | ||
* @param inHex 待转换的Hex字符串 | ||
* @return 转换后的byte | ||
*/ | ||
public static byte hexToByte(String inHex) { | ||
return (byte) Integer.parseInt(inHex, 16); | ||
} | ||
|
||
public static String filterUTF8(String in) { | ||
return in.replace("\u0000", ""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
export default { | ||
'settings.navbar.theme.toLight': '点击切换为亮色模式', | ||
'settings.navbar.theme.toDark': '点击切换为暗黑模式', | ||
'settings.open': '前往设置', | ||
'settings.language': '语言', | ||
'settings.modal.title': '设置', | ||
'settings.modal.endpointTips': '如果你无法访问PBH后端,可以尝试在此设置Endpoint', | ||
'settings.modal.pollInterval': '轮询间隔:', | ||
'settings.endpoint.error': '无法连接到后端,请检查Endpoint设置', | ||
'settings.modal.accessTokenTips': '你可以在{here}填写 Github Access Token', | ||
'settings.modal.accessTokenTips.here': '这里', | ||
'settings.accessToken.error': '连接到 Github 检查 PBH 版本更新出错,可能当前 IP 地址已达到速率限制(此提示可安全忽略)' | ||
'settings.accessToken.error': '检查 PBH 版本更新出错', | ||
'settings.accessToken.error.limit': 'API 访问频率限制,请尝试在设置中填写 Token' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters