save
This commit is contained in:
Binary file not shown.
+59
-9
@@ -76,6 +76,10 @@
|
||||
<a href="#" name="tab_pin">PIN 管理</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#" name="tab_active">驱动程序</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
@@ -116,12 +120,13 @@
|
||||
|
||||
|
||||
<input id="filepath" style="width: 300px; height: 1.06rem" type="text" value="\root\mana\name"
|
||||
maxlength="6" placeholder="文件">
|
||||
placeholder="文件">
|
||||
<button id="btn_read" style="margin-right: 0.5rem">读</button>
|
||||
<button id="btn_write" style="margin-right: 1rem">写</button>
|
||||
<button id="btn_delete" style="margin-right: 1rem">删</button>
|
||||
|
||||
<textarea id="ta_txt" style="display: block; margin: 1rem 0; width: 375px; height: 100px;"
|
||||
readonly></textarea>
|
||||
></textarea>
|
||||
|
||||
|
||||
</div>
|
||||
@@ -149,6 +154,17 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab tab_active" style="padding-top: 1rem">
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<h4 style="color: var(--mainColor);"><span>【2023年01月01日】</span> V1.0.1 <a href="./Setup_V1.0.1.exe" style="text-decoration:none; font-size: 0.5rem; font-weight: normal; cursor: pointer">(点击下载)</a> </h4>
|
||||
<p>渔翁 UKey</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -256,17 +272,51 @@
|
||||
})
|
||||
|
||||
$("#btn_read").click(function () {
|
||||
try {
|
||||
var filepath = $("#filepath").val()
|
||||
var idx = filepath.lastIndexOf("\\")
|
||||
var folder = filepath.substr(0, idx)
|
||||
var file = filepath.substr(idx + 1)
|
||||
var txt = window.UKey.readFile(folder, file);
|
||||
txt = JSON.stringify(txt, null, 4)
|
||||
|
||||
var filepath = $("#filepath").val()
|
||||
var idx = filepath.lastIndexOf("\\")
|
||||
var folder = filepath.substr(0, idx)
|
||||
var file = filepath.substr(idx + 1)
|
||||
var txt = window.UKey.readFile(folder, file);
|
||||
$("#ta_txt").text(JSON.stringify(txt, null, 4))
|
||||
$("#ta_txt").val( txt )
|
||||
success("读取成功")
|
||||
} catch (e) {
|
||||
alert("读取失败:" + e.message)
|
||||
}
|
||||
})
|
||||
|
||||
$("#btn_write").click(function () {
|
||||
alert("暂不开放")
|
||||
// alert("暂不开放")
|
||||
try {
|
||||
var filepath = $("#filepath").val()
|
||||
var idx = filepath.lastIndexOf("\\")
|
||||
var folder = filepath.substr(0, idx)
|
||||
var file = filepath.substr(idx + 1)
|
||||
|
||||
|
||||
var txt = $("#ta_txt").val();
|
||||
window.UKey.de(folder, file, txt);
|
||||
success("写入成功")
|
||||
} catch (e) {
|
||||
alert("写入失败:" + e.message)
|
||||
}
|
||||
})
|
||||
|
||||
$("#btn_delete").click(function () {
|
||||
// alert("暂不开放")
|
||||
try {
|
||||
var filepath = $("#filepath").val()
|
||||
var idx = filepath.lastIndexOf("\\")
|
||||
var folder = filepath.substr(0, idx)
|
||||
var file = filepath.substr(idx + 1)
|
||||
|
||||
window.UKey.deleteFile(folder, file);
|
||||
success("删除成功")
|
||||
} catch (e) {
|
||||
alert("删除失败:" + e.message)
|
||||
}
|
||||
})
|
||||
|
||||
$("#btn_nameplate_tmp_load").click(function () {
|
||||
|
||||
+33
-10
@@ -1,6 +1,6 @@
|
||||
(function( root ){
|
||||
|
||||
var DIR = DIRR
|
||||
var DIR = "\\root\\mana"
|
||||
var FISECKEY = root.FISECKEY;
|
||||
var hDevice = undefined;
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
function stringToHex(str){
|
||||
var val = "";
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
if (val == "")
|
||||
val = str.charCodeAt(i).toString(16);
|
||||
else
|
||||
val += str.charCodeAt(i).toString(16);
|
||||
var v = str.charCodeAt(i).toString(16);
|
||||
if ( v.length < 2 ) {
|
||||
v = "0" + v;
|
||||
}
|
||||
val += v;
|
||||
}
|
||||
val += ""
|
||||
return val
|
||||
}
|
||||
|
||||
@@ -88,6 +88,14 @@
|
||||
|
||||
}
|
||||
|
||||
function deleteFile(dir, file){
|
||||
if ( ! hDevice ) {
|
||||
throw new Error("设备未登录")
|
||||
}
|
||||
|
||||
FISECKEY.FILE_DeleteFile(hDevice, dir, file);
|
||||
}
|
||||
|
||||
function readFile(dir, file) {
|
||||
if ( ! hDevice ) {
|
||||
throw new Error("设备未登录")
|
||||
@@ -102,7 +110,9 @@
|
||||
var hash = FISECKEY.FILE_ReadFile(hDevice, dir, file, 2 + len, 2);
|
||||
if ( sum === hash ) {
|
||||
|
||||
return JSON.parse(hexToString(data));
|
||||
var str = hexToString(data);
|
||||
console.log( "read", data )
|
||||
return JSON.parse(str);
|
||||
}
|
||||
throw new Error("文件读取失败")
|
||||
}
|
||||
@@ -112,12 +122,24 @@
|
||||
throw new Error("设备未登录")
|
||||
}
|
||||
|
||||
try {
|
||||
FISECKEY.FILE_DeleteFile(hDevice, dir, file);
|
||||
}catch (e) {
|
||||
|
||||
}
|
||||
|
||||
FISECKEY.FILE_CreateFile(hDevice, dir, file, 2048, 0);
|
||||
|
||||
console.log( "write", data )
|
||||
console.log( "data.length" , data.length )
|
||||
data = stringToHex( data ).toUpperCase()
|
||||
|
||||
|
||||
var len = data.length / 2
|
||||
len = "0000" + len;
|
||||
len = len.substr( len.length -4 );
|
||||
FISECKEY.FILE_WriteFile(hDevice, DIR, "name", 0, 2, len);
|
||||
FISECKEY.FILE_WriteFile(hDevice, DIR, "name", 2, data.length/2, data);
|
||||
FISECKEY.FILE_WriteFile(hDevice, dir, file, 0, 2, len);
|
||||
FISECKEY.FILE_WriteFile(hDevice, dir, file, 2, data.length/2, data);
|
||||
|
||||
// console.log( "writeFile=" + len )
|
||||
// console.log( "writeFile=" + data )
|
||||
@@ -125,7 +147,7 @@
|
||||
|
||||
var hash = sumHash(data);
|
||||
// console.log( "writeFile hash=" + hash )
|
||||
FISECKEY.FILE_WriteFile(hDevice, DIR, "name", 2 + (data.length/2), 2, hash);
|
||||
FISECKEY.FILE_WriteFile(hDevice, dir, file, 2 + (data.length/2), 2, hash);
|
||||
}
|
||||
|
||||
// 枚举序列号与名称
|
||||
@@ -260,6 +282,7 @@
|
||||
catRelease : catRelease,
|
||||
readFile: readFile,
|
||||
writeFile : writeFile,
|
||||
deleteFile : deleteFile,
|
||||
login : login,
|
||||
logout : logout,
|
||||
updatePin : updatePin,
|
||||
|
||||
Reference in New Issue
Block a user