public ProbePreset(ProbePreset copy) { ProbeId = copy.ProbeId; ApplicationId = copy.ApplicationId; SettingsFamilyId = copy.SettingsFamilyId; ProbeDefaultEnum = copy.ProbeDefaultEnum; PresetFolder = copy.PresetFolder; PresetFileNameFrontal = copy.PresetFileNameFrontal; PresetFileNameLateral = copy.PresetFileNameLateral; }
// reads probe preset name and location for the current application private static List <ProbePreset> createProbeApps(ProbeBind probeBind, probeInfo currentProbeInfo, DBBuffer _buffer) { List <ProbePreset> resultProbeApp = new List <ProbePreset>(); foreach (var app in currentProbeInfo.appNodes) { Application application = _buffer.p_applications.SingleOrDefault(a => a.ProbeDescrName == app.Element("eApplication").Value.ToString()); ProbePreset baseProbeApp = new ProbePreset() { ProbeId = probeBind.probe.Id, ApplicationId = application.Id, SettingsFamilyId = currentProbeInfo.settingsFam.Id }; resultProbeApp.AddRange(createPresetProbeApps(baseProbeApp, app)); } return(resultProbeApp); }
private static IEnumerable <ProbePreset> createPresetProbeApps(ProbePreset baseProbeApp, XElement app) { var Presets = app.Element("sFactoryDefault").Descendants("element").Where(p => p.Element("sProbeDefaultFileNameFrontal").Value.ToString() != "NULLFILE" || p.Element("sProbeDefaultFileNameLateral").Value.ToString() != "NULLFILE").ToList(); ProbePreset tmpProbeApp; foreach (var preset in Presets) { String PresetFileNameFrontal = preset.Element("sProbeDefaultFileNameFrontal").Value.ToString() == "NULLFILE" ? null : preset.Element("sProbeDefaultFileNameFrontal").Value.ToString(); String PresetFileNameLateral = preset.Element("sProbeDefaultFileNameLateral").Value.ToString() == "NULLFILE" ? null : preset.Element("sProbeDefaultFileNameLateral").Value.ToString(); String probeDir; if (PresetFileNameFrontal != null) { probeDir = Path.GetDirectoryName(PresetFileNameFrontal); } else { probeDir = Path.GetDirectoryName(PresetFileNameLateral); } if (probeDir == "") { probeDir = null; } // probe application association tmpProbeApp = new ProbePreset(baseProbeApp); tmpProbeApp.PresetFolder = probeDir; tmpProbeApp.PresetFileNameFrontal = Path.GetFileName(PresetFileNameFrontal); tmpProbeApp.PresetFileNameLateral = Path.GetFileName(PresetFileNameLateral); tmpProbeApp.ProbeDefaultEnum = preset.Element("eProbeDefaultId").Value.ToString(); yield return(tmpProbeApp); } }