public override void SetVisaAddr(string visaAddr) { try { //根据visa地址初始化CurrentVisaAddress string[] textArray = visaAddr.Split(new char[] { ':' }); if (textArray.Length > 1) { if (textArray[0].IndexOf(LanAddr.AddrFlag) >= 0) { //LanAddr CurrentVisaAddress = VisaAddressCollection[LanAddr.AddrFlag]; } else if (textArray[0].IndexOf(SerialPortAddr.AddrFlag) >= 0) { //SerialPortAddr CurrentVisaAddress = VisaAddressCollection[SerialPortAddr.AddrFlag]; } else if (textArray[0].IndexOf(GPIBAddr.AddrFlag) >= 0) { //GPIBAddr CurrentVisaAddress = VisaAddressCollection[GPIBAddr.AddrFlag]; } //else if (textArray[0].IndexOf(USBAddr.AddrFlag) >= 0) //{ // //USB // CurrentVisaAddress = VisaAddressCollection[USBAddr.AddrFlag]; //} } else { //自定义 // CurrentVisaAddress = VisaAddressCollection[UserDefineAddr.AddrFlag]; } } catch { //自定义 //CurrentVisaAddress = VisaAddressCollection[UserDefineAddr.AddrFlag]; } CurrentVisaAddress.SetVisaAddr(visaAddr); }
public override string GetVisaAddr() { return(CurrentVisaAddress.GetVisaAddr()); }