add edge addon publish scripts

This commit is contained in:
jianxin committed 2023-11-04 07:13:35 +08:00
1 parent 5c3f15c70e
commit 5dba81e4a4
27 files changed
+889 -792

No files matched your search

+49 -49
View File
@@ -1,49 +1,49 @@
import win32pipe
import win32file
import struct
class HostClient:
def __init__(self):
self.pipe_name = r"\\.\pipe\BotExtPipe"
self.pipe = None
def connect(self):
self.pipe = win32file.CreateFile(
self.pipe_name,
win32file.GENERIC_READ | win32file.GENERIC_WRITE,
0,
None,
win32file.OPEN_EXISTING,
0,
None,
)
def write(self, data):
if not self.pipe:
self.connect()
length = len(data)
length_bytes = struct.pack("I", length)
win32file.WriteFile(self.pipe, length_bytes)
win32file.WriteFile(self.pipe, data)
def read(self):
if not self.pipe:
self.connect()
length_bytes = win32file.ReadFile(self.pipe, 4)[1]
length = struct.unpack("I", length_bytes)[0]
data = win32file.ReadFile(self.pipe, length)[1]
return data
def close(self):
if self.pipe:
win32file.CloseHandle(self.pipe)
self.pipe = None
if __name__ == "__main__":
client = HostClient()
client.connect()
client.write(b"Hello, World!")
print(client.read())
client.close()
import win32pipe
import win32file
import struct
class HostClient:
def __init__(self):
self.pipe_name = r"\\.\pipe\BotExtPipe"
self.pipe = None
def connect(self):
self.pipe = win32file.CreateFile(
self.pipe_name,
win32file.GENERIC_READ | win32file.GENERIC_WRITE,
0,
None,
win32file.OPEN_EXISTING,
0,
None,
)
def write(self, data):
if not self.pipe:
self.connect()
length = len(data)
length_bytes = struct.pack("I", length)
win32file.WriteFile(self.pipe, length_bytes)
win32file.WriteFile(self.pipe, data)
def read(self):
if not self.pipe:
self.connect()
length_bytes = win32file.ReadFile(self.pipe, 4)[1]
length = struct.unpack("I", length_bytes)[0]
data = win32file.ReadFile(self.pipe, length)[1]
return data
def close(self):
if self.pipe:
win32file.CloseHandle(self.pipe)
self.pipe = None
if __name__ == "__main__":
client = HostClient()
client.connect()
client.write(b"Hello, World!")
print(client.read())
client.close()
+7 -7
View File
@@ -1,7 +1,7 @@
:: Copyright 2014 The Chromium Authors. All rights reserved.
:: Use of this source code is governed by a BSD-style license that can be
:: found in the LICENSE file.
:: Change HKCU to HKLM if you want to install globally.
:: %~dp0 is the directory containing this bat script and ends with a backslash.
REG ADD "HKCU\Software\Google\Chrome\NativeMessagingHosts\com.woni.botext" /ve /t REG_SZ /d "%~dp0com.google.chrome.botext.json" /f
:: Copyright 2014 The Chromium Authors. All rights reserved.
:: Use of this source code is governed by a BSD-style license that can be
:: found in the LICENSE file.
:: Change HKCU to HKLM if you want to install globally.
:: %~dp0 is the directory containing this bat script and ends with a backslash.
REG ADD "HKCU\Software\Google\Chrome\NativeMessagingHosts\com.woni.botext" /ve /t REG_SZ /d "%~dp0com.google.chrome.botext.json" /f
+21 -21
View File
@@ -1,21 +1,21 @@
import os
# 在下载文件夹创建test目录
# 获取windows 下载文件夹路径
def get_download_folder():
home_dir = os.path.expanduser("~")
download_folder = os.path.join(home_dir, "Downloads")
return download_folder
def main():
# download_path = get_download_folder()
# test = os.path.join(download_path, "test")
# if not os.path.exists(test):
# os.mkdir(test)
print("install_host.bat")
# os.system("install_host.bat")
if __name__ == '__main__':
main()
import os
# 在下载文件夹创建test目录
# 获取windows 下载文件夹路径
def get_download_folder():
home_dir = os.path.expanduser("~")
download_folder = os.path.join(home_dir, "Downloads")
return download_folder
def main():
# download_path = get_download_folder()
# test = os.path.join(download_path, "test")
# if not os.path.exists(test):
# os.mkdir(test)
print("install_host.bat")
# os.system("install_host.bat")
if __name__ == '__main__':
main()