python写计算机模拟器_【Python】雷电模拟器说明[附代码]

[Python] 纯文本查看 复制代码class Dnconsole:

# 请根据自己电脑配置

console = 'D:\\Changzhi\\dnplayer2\\dnconsole.exe '

ld = 'D:\\Changzhi\\dnplayer2\\ld.exe '

share_path = 'F:/share/Pictures'

#获取模拟器列表

@staticmethod

def get_list():

cmd = os.popen(Dnconsole.console + 'list2')

text = cmd.read()

cmd.close()

info = text.split('\n')

result = list()

for line in info:

if len(line) > 1:

dnplayer = line.split(',')

result.append(DnPlayer(dnplayer))

return result

#获取正在运行的模拟器列表

@staticmethod

def list_running() -> list:

result = list()

all = Dnconsole.get_list()

for dn in all:

if dn.is_running() is True:

result.append(dn)

return result

#检测指定序号的模拟器是否正在运行

@staticmethod

def is_running(index: int) -> bool:

all = Dnconsole.get_list()

if index >= len(all):

raise IndexError('%d is not exist' % index)

return all[index].is_running()

#执行shell命令

@staticmethod

def dnld(index: int, command: str, silence: bool = True):

cmd = Dnconsole.ld + '-s %d %s' % (index, command)

if silence:

os.system(cmd)

return ''

process = os.popen(cmd)

result = process.read()

process.close()

return result

#执行adb命令,不建议使用,容易失控

@staticmethod

def adb(index: int, command: str, silence: bool = False) -> str:

cmd = Dnconsole.console + 'adb --index %d --command "%s"' % (index, command)

if silence:

os.system(cmd)

return ''

process = os.popen(cmd)

result = process.read()

process.close()

return result

#安装apk 指定模拟器必须已经启动

@staticmethod

def install(index: int, path: str):

shutil.copy(pat

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值