import re
from DeviceManage import Device

def importProject():
	curSlave = 0
	startAddress = 0
	protocolType = None
	devices = []
	with open('program.txt', 'r') as f:
		lines = f.readlines()
		for line in lines:
			if "协议类型选择" in line:
				if line[-3:-2] == '0':
					protocolType = "DP主站"
			elif "-Slave [" in line:
				device = Device()
				pattern = r'\d+'
				slaveIndex = re.findall(pattern, line)[0]
				deviceName = protocolType + slaveIndex
				if slaveIndex == "0":
					device.startAddress = 0


			

importProject()