mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-12 14:27:00 +08:00
Fix: [ALAS] handle serial like 5555,16384
This commit is contained in:
@@ -279,19 +279,19 @@ def get_serial_pair(serial):
|
||||
serial (str):
|
||||
|
||||
Returns:
|
||||
str, str: `127.0.0.1:5555+{X}` and `emulator-5554+{X}`, 0 <= X <= 32
|
||||
tuple[Optional[str], Optional[str]]: `127.0.0.1:5555+{X}` and `emulator-5554+{X}`, 0 <= X <= 32
|
||||
"""
|
||||
if serial.startswith('127.0.0.1:'):
|
||||
try:
|
||||
port = int(serial[10:])
|
||||
if 5555 <= port <= 5555 + 32:
|
||||
if 5555 <= port <= 5555 + 64:
|
||||
return f'127.0.0.1:{port}', f'emulator-{port - 1}'
|
||||
except (ValueError, IndexError):
|
||||
pass
|
||||
if serial.startswith('emulator-'):
|
||||
try:
|
||||
port = int(serial[9:])
|
||||
if 5554 <= port <= 5554 + 32:
|
||||
if 5554 <= port <= 5554 + 64:
|
||||
return f'127.0.0.1:{port + 1}', f'emulator-{port}'
|
||||
except (ValueError, IndexError):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user