private string getLaserConfig() { try { using (FromIniOfFile laserConfigFromIniFile = new FromIniOfFile()) { uint pwd; laserConfigFromIniFile.ReadData(); LaserConfig laserConfig = new LaserConfig(); if (laserConfigFromIniFile.FactoryDefault) { laserConfig.SetDefaults(); } else { laserConfig.IPAddress = laserConfigFromIniFile.IpAddress; if ((laserConfigFromIniFile.TriggerOutputChannelNumber > 0) && (laserConfigFromIniFile.TriggerOutputChannelNumber < 7)) { laserConfig.TriggerOutputChannelNumber = laserConfigFromIniFile.TriggerOutputChannelNumber; } else { throw new Exception("Bad Trigger Output Channel Number of laser from 'lms511.ini' file, from 1 to 6!"); } try { pwd = UInt32.Parse(laserConfigFromIniFile.Password_maintenance, NumberStyles.HexNumber); } catch (Exception) { throw new Exception("Bad Password_maintenance of laser from 'lms511.ini' file, not hexa format"); } laserConfig.PWD_maintenance = pwd; try { pwd = UInt32.Parse(laserConfigFromIniFile.Password_authorized_client, NumberStyles.HexNumber); } catch (Exception) { throw new Exception("Bad Password_authorized_client of laser from 'lms511.ini' file, not hexa format"); } laserConfig.PWD_authorized_client = pwd; try { pwd = UInt32.Parse(laserConfigFromIniFile.Password_service, NumberStyles.HexNumber); } catch (Exception) { throw new Exception("Bad Password_service of laser from 'lms511.ini' file, not hexa format"); } laserConfig.PWD_service = pwd; } return(laserConfig.SaveToXml()); } } catch (Exception) { throw; } }
public void BaseTestInit() { _laserCondig.SetDefaults(); _devices = Brace.Shared.DeviceDrivers.LMS511Laser.DriverFactory.CreateDriver(_laserCondig.SaveToXml(), _traceWrapper); Log.AppendLine("TestBase.BaseTestInit()"); }