private static bool IsCustomBtAdapter(ActivityCommon.InterfaceType interfaceType) { switch (interfaceType) { case ActivityCommon.InterfaceType.Bluetooth: return(true); } return(false); }
public EdiabasThread(string ecuPath, ActivityCommon.InterfaceType interfaceType) { _stopThread = false; _threadRunning = false; _workerThread = null; Ediabas = new EdiabasNet(); if (interfaceType == ActivityCommon.InterfaceType.Enet) { Ediabas.EdInterfaceClass = new EdInterfaceEnet(); } else { Ediabas.EdInterfaceClass = new EdInterfaceObd(); } Ediabas.AbortJobFunc = AbortEdiabasJob; Ediabas.SetConfigProperty("EcuPath", ecuPath); InitProperties(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetDisplayShowCustomEnabled(true); SetContentView(Resource.Layout.can_adapter_config); _imm = (InputMethodManager)GetSystemService(InputMethodService); _contentView = FindViewById <View>(Android.Resource.Id.Content); _barView = LayoutInflater.Inflate(Resource.Layout.bar_can_adapter, null); ActionBar.LayoutParams barLayoutParams = new ActionBar.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); barLayoutParams.Gravity = barLayoutParams.Gravity & (int)(~(GravityFlags.HorizontalGravityMask | GravityFlags.VerticalGravityMask)) | (int)(GravityFlags.Left | GravityFlags.CenterVertical); SupportActionBar.SetCustomView(_barView, barLayoutParams); SetResult(Android.App.Result.Canceled); _deviceAddress = Intent.GetStringExtra(ExtraDeviceAddress); ActivityCommon.InterfaceType interfaceType = (ActivityCommon.InterfaceType)Intent.GetIntExtra(ExtraInterfaceType, (int)ActivityCommon.InterfaceType.Bluetooth); ViewStates visibility = interfaceType == ActivityCommon.InterfaceType.Bluetooth ? ViewStates.Visible : ViewStates.Gone; _buttonRead = _barView.FindViewById <Button>(Resource.Id.buttonAdapterRead); _buttonRead.SetOnTouchListener(this); _buttonRead.Click += (sender, args) => { PerformRead(); }; _buttonRead.Visibility = visibility; _buttonWrite = _barView.FindViewById <Button>(Resource.Id.buttonAdapterWrite); _buttonWrite.SetOnTouchListener(this); _buttonWrite.Click += (sender, args) => { PerformWrite(); }; _layoutCanAdapter = FindViewById <LinearLayout>(Resource.Id.layoutCanAdapter); _layoutCanAdapter.SetOnTouchListener(this); _spinnerCanAdapterMode = FindViewById <Spinner>(Resource.Id.spinnerCanAdapterMode); _spinnerCanAdapterMode.SetOnTouchListener(this); _spinnerCanAdapterModeAdapter = new StringObjAdapter(this); _spinnerCanAdapterMode.Adapter = _spinnerCanAdapterModeAdapter; _spinnerCanAdapterModeAdapter.Items.Add(new StringObjType(GetString(Resource.String.button_can_adapter_can_500), AdapterMode.Can500)); _spinnerCanAdapterModeAdapter.Items.Add(new StringObjType(GetString(Resource.String.button_can_adapter_can_100), AdapterMode.Can100)); _spinnerCanAdapterModeAdapter.Items.Add(new StringObjType(GetString(Resource.String.button_can_adapter_can_off), AdapterMode.CanOff)); _spinnerCanAdapterModeAdapter.NotifyDataSetChanged(); _textViewCanAdapterSepTimeTitle = FindViewById <TextView>(Resource.Id.textViewCanAdapterSepTimeTitle); _textViewCanAdapterSepTimeTitle.Visibility = visibility; _spinnerCanAdapterSepTime = FindViewById <Spinner>(Resource.Id.spinnerCanAdapterSepTime); _spinnerCanAdapterSepTime.SetOnTouchListener(this); _spinnerCanAdapterSepTimeAdapter = new StringAdapter(this); _spinnerCanAdapterSepTime.Adapter = _spinnerCanAdapterSepTimeAdapter; _spinnerCanAdapterSepTimeAdapter.Items.Add(GetString(Resource.String.can_adapter_text_off)); for (int i = 1; i <= 2; i++) { _spinnerCanAdapterSepTimeAdapter.Items.Add(i.ToString()); } _spinnerCanAdapterSepTimeAdapter.NotifyDataSetChanged(); _spinnerCanAdapterSepTime.Visibility = visibility; _textViewCanAdapterBlockSizeTitle = FindViewById <TextView>(Resource.Id.textViewCanAdapterBlockSizeTitle); _textViewCanAdapterBlockSizeTitle.Visibility = visibility; _spinnerCanAdapterBlockSize = FindViewById <Spinner>(Resource.Id.spinnerCanAdapterBlockSize); _spinnerCanAdapterBlockSize.SetOnTouchListener(this); _spinnerCanAdapterBlockSizeAdapter = new StringAdapter(this); _spinnerCanAdapterBlockSize.Adapter = _spinnerCanAdapterBlockSizeAdapter; _spinnerCanAdapterBlockSizeAdapter.Items.Add(GetString(Resource.String.can_adapter_text_off)); for (int i = 0; i <= 15; i++) { _spinnerCanAdapterBlockSizeAdapter.Items.Add(i.ToString()); } _spinnerCanAdapterBlockSizeAdapter.NotifyDataSetChanged(); _spinnerCanAdapterBlockSize.Visibility = visibility; _textViewBtPinTitle = FindViewById <TextView>(Resource.Id.textViewCanAdapterBtPinTitle); _textViewBtPinTitle.Visibility = visibility; _editTextBtPin = FindViewById <EditText>(Resource.Id.editTextBtPin); _editTextBtPin.Visibility = visibility; _textViewBtNameTitle = FindViewById <TextView>(Resource.Id.textViewCanAdapterBtNameTitle); _textViewBtNameTitle.Visibility = visibility; _editTextBtName = FindViewById <EditText>(Resource.Id.editTextBtName); _editTextBtName.Visibility = visibility; _textViewCanAdapterIgnitionStateTitle = FindViewById <TextView>(Resource.Id.textViewCanAdapterIgnitionStateTitle); _textViewCanAdapterIgnitionStateTitle.Visibility = visibility; _textViewIgnitionState = FindViewById <TextView>(Resource.Id.textViewCanAdapterIgnitionState); _textViewIgnitionState.Visibility = visibility; _textViewBatteryVoltageTitle = FindViewById <TextView>(Resource.Id.textViewCanAdapterBatVoltageTitle); _textViewBatteryVoltageTitle.Visibility = visibility; _textViewBatteryVoltage = FindViewById <TextView>(Resource.Id.textViewCanAdapterBatVoltage); _textViewBatteryVoltage.Visibility = visibility; _textViewFwVersionTitle = FindViewById <TextView>(Resource.Id.textViewCanAdapterFwVersionTitle); _textViewFwVersionTitle.Visibility = visibility; _textViewFwVersion = FindViewById <TextView>(Resource.Id.textViewCanAdapterFwVersion); _textViewFwVersion.Visibility = visibility; _textViewSerNumTitle = FindViewById <TextView>(Resource.Id.textViewCanAdapterSerNumTitle); _textViewSerNum = FindViewById <TextView>(Resource.Id.textViewCanAdapterSerNum); #if DEBUG _textViewSerNumTitle.Visibility = visibility; _textViewSerNum.Visibility = visibility; #else _textViewSerNumTitle.Visibility = ViewStates.Gone; _textViewSerNum.Visibility = ViewStates.Gone; #endif _buttonFwUpdate = FindViewById <Button>(Resource.Id.buttonCanAdapterFwUpdate); _buttonFwUpdate.Visibility = visibility; _buttonFwUpdate.Click += (sender, args) => { PerformUpdateMessage(); }; _checkBoxExpert = FindViewById <CheckBox>(Resource.Id.checkBoxCanAdapterExpert); _checkBoxExpert.Visibility = visibility; _checkBoxExpert.Click += (sender, args) => { UpdateDisplay(); }; _activityCommon = new ActivityCommon(this) { SelectedInterface = interfaceType }; UpdateDisplay(); PerformRead(); }
public bool ReadXml(string xmlName, out string errorMessage) { errorMessage = null; Clear(); if (string.IsNullOrEmpty(xmlName)) { return(false); } if (!File.Exists(xmlName)) { return(false); } string xmlDir = Path.GetDirectoryName(xmlName); try { string prefix = string.Empty; XmlDocument xdocConfig = XmlDocumentLoader.LoadWithIncludes(xmlName); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xdocConfig.NameTable); XPathNavigator xNav = xdocConfig.CreateNavigator(); if (xNav.MoveToFollowing(XPathNodeType.Element)) { IDictionary <string, string> localNamespaces = xNav.GetNamespacesInScope(XmlNamespaceScope.Local); if (localNamespaces.TryGetValue("", out string nameSpace)) { namespaceManager.AddNamespace("carcontrol", nameSpace); prefix = "carcontrol:"; } } XmlAttribute attrib; XmlNode xnodeGlobal = xdocConfig.SelectSingleNode(string.Format("/{0}configuration/{0}global", prefix), namespaceManager); if (xnodeGlobal?.Attributes != null) { attrib = xnodeGlobal.Attributes["ecu_path"]; if (attrib != null) { if (Path.IsPathRooted(attrib.Value)) { _ecuPath = attrib.Value; } else { // ReSharper disable once AssignNullToNotNullAttribute _ecuPath = string.IsNullOrEmpty(xmlDir) ? attrib.Value : Path.Combine(xmlDir, attrib.Value); } } attrib = xnodeGlobal.Attributes["log_path"]; if (attrib != null) { _logPath = attrib.Value; } attrib = xnodeGlobal.Attributes["append_log"]; if (attrib != null) { _appendLog = XmlConvert.ToBoolean(attrib.Value); } attrib = xnodeGlobal.Attributes["manufacturer"]; if (attrib != null) { _manufacturerName = attrib.Value; } attrib = xnodeGlobal.Attributes["interface"]; if (attrib != null) { _interfaceName = attrib.Value; } } if (string.Compare(_manufacturerName, "Audi", StringComparison.OrdinalIgnoreCase) == 0) { _manufacturerType = ActivityCommon.ManufacturerType.Audi; } else if (string.Compare(_manufacturerName, "Seat", StringComparison.OrdinalIgnoreCase) == 0) { _manufacturerType = ActivityCommon.ManufacturerType.Seat; } else if (string.Compare(_manufacturerName, "Skoda", StringComparison.OrdinalIgnoreCase) == 0) { _manufacturerType = ActivityCommon.ManufacturerType.Skoda; } else if (string.Compare(_manufacturerName, "VW", StringComparison.OrdinalIgnoreCase) == 0) { _manufacturerType = ActivityCommon.ManufacturerType.Vw; } else { _manufacturerType = ActivityCommon.ManufacturerType.Bmw; } bool isBmw = _manufacturerType == ActivityCommon.ManufacturerType.Bmw; if (isBmw && string.Compare(_interfaceName, "ENET", StringComparison.OrdinalIgnoreCase) == 0) { _interfaceType = ActivityCommon.InterfaceType.Enet; } else if (isBmw && string.Compare(_interfaceName, "ELMWIFI", StringComparison.OrdinalIgnoreCase) == 0) { _interfaceType = ActivityCommon.InterfaceType.ElmWifi; } else if (string.Compare(_interfaceName, "DEEPOBDWIFI", StringComparison.OrdinalIgnoreCase) == 0) { _interfaceType = ActivityCommon.InterfaceType.DeepObdWifi; } else if (isBmw && string.Compare(_interfaceName, "FTDI", StringComparison.OrdinalIgnoreCase) == 0) { _interfaceType = ActivityCommon.InterfaceType.Ftdi; } else { _interfaceType = ActivityCommon.InterfaceType.Bluetooth; } XmlNode xnodePages = xdocConfig.SelectSingleNode(string.Format("/{0}configuration/{0}pages", prefix), namespaceManager); if (xnodePages?.Attributes != null) { attrib = xnodePages.Attributes["include_filename"]; if (attrib != null) { _xmlFileNamePages = attrib.Value; } } XmlNodeList xnodesPage = xdocConfig.SelectNodes(string.Format("/{0}configuration/{0}pages/{0}page", prefix), namespaceManager); if (xnodesPage != null) { foreach (XmlNode xnodePage in xnodesPage) { string pageName = string.Empty; string xmlFileName = string.Empty; float pageWeight = -1; int textResId = 0; int gaugesPortrait = GaugesPortraitDefault; int gaugesLandscape = GaugesLandscapeDefault; PageInfo.DisplayModeType displayMode = PageInfo.DisplayModeType.List; string logFile = string.Empty; bool jobActivate = false; if (xnodePage.Attributes != null) { attrib = xnodePage.Attributes["include_filename"]; if (attrib != null) { xmlFileName = attrib.Value; } attrib = xnodePage.Attributes["name"]; if (attrib != null) { pageName = attrib.Value; } attrib = xnodePage.Attributes["weight"]; if (attrib != null) { try { pageWeight = XmlConvert.ToSingle(attrib.Value); } catch { // ignored } } attrib = xnodePage.Attributes["display-mode"]; if (attrib != null) { if (!Enum.TryParse(attrib.Value, true, out displayMode)) { displayMode = PageInfo.DisplayModeType.List; } } attrib = xnodePage.Attributes["fontsize"]; if (attrib != null) { string size = attrib.Value.ToLowerInvariant(); switch (size) { case "small": textResId = Android.Resource.Style.TextAppearanceSmall; break; case "medium": textResId = Android.Resource.Style.TextAppearanceMedium; break; case "large": textResId = Android.Resource.Style.TextAppearanceLarge; break; } } attrib = xnodePage.Attributes["gauges-portrait"]; if (attrib != null) { try { int gauges = XmlConvert.ToInt32(attrib.Value); if (gauges >= 1) { gaugesPortrait = gauges; } } catch { // ignored } } attrib = xnodePage.Attributes["gauges-landscape"]; if (attrib != null) { try { int gauges = XmlConvert.ToInt32(attrib.Value); if (gauges >= 1) { gaugesLandscape = gauges; } } catch { // ignored } } attrib = xnodePage.Attributes["logfile"]; if (attrib != null) { logFile = attrib.Value; } attrib = xnodePage.Attributes["activate"]; if (attrib != null) { try { jobActivate = XmlConvert.ToBoolean(attrib.Value); } catch (Exception) { // ignored } } } JobsInfo jobsInfo = null; ErrorsInfo errorsInfo = null; List <DisplayInfo> displayList = new List <DisplayInfo>(); List <StringInfo> stringList = new List <StringInfo>(); bool logEnabled = false; string classCode = null; bool codeShowWarnings = false; foreach (XmlNode xnodePageChild in xnodePage.ChildNodes) { ReadDisplayNode(xnodePageChild, displayList, null, ref logEnabled); if (string.Compare(xnodePageChild.Name, "strings", StringComparison.OrdinalIgnoreCase) == 0) { string lang = null; if (xnodePageChild.Attributes != null) { attrib = xnodePageChild.Attributes["lang"]; if (attrib != null) { lang = attrib.Value; } } Dictionary <string, string> stringDict = new Dictionary <string, string>(); foreach (XmlNode xnodeString in xnodePageChild.ChildNodes) { string text = xnodeString.InnerText; string name = string.Empty; if (xnodeString.Attributes != null) { attrib = xnodeString.Attributes["name"]; if (attrib != null) { name = attrib.Value; } } if (string.IsNullOrEmpty(name)) { continue; } if (!stringDict.ContainsKey(name)) { stringDict.Add(name, text); } } stringList.Add(new StringInfo(lang, stringDict)); } if (string.Compare(xnodePageChild.Name, "jobs", StringComparison.OrdinalIgnoreCase) == 0) { string sgbd = null; string vagDataFileName = null; string vagUdsFileName = null; List <JobInfo> jobList = new List <JobInfo>(); if (xnodePageChild.Attributes != null) { attrib = xnodePageChild.Attributes["sgbd"]; if (attrib != null) { sgbd = attrib.Value; } attrib = xnodePageChild.Attributes["vag_data_file"]; if (attrib != null) { vagDataFileName = attrib.Value; } attrib = xnodePageChild.Attributes["vag_uds_file"]; if (attrib != null) { vagUdsFileName = attrib.Value; } } foreach (XmlNode xnodeJobsChild in xnodePageChild.ChildNodes) { if (string.Compare(xnodeJobsChild.Name, "job", StringComparison.OrdinalIgnoreCase) == 0) { string jobId = string.Empty; string jobSgbd = string.Empty; string jobName = string.Empty; string jobArgsFirst = string.Empty; string jobArgs = string.Empty; string jobResults = string.Empty; if (xnodeJobsChild.Attributes != null) { attrib = xnodeJobsChild.Attributes["id"]; if (attrib != null) { jobId = attrib.Value; } attrib = xnodeJobsChild.Attributes["sgbd"]; if (attrib != null) { jobSgbd = attrib.Value; } attrib = xnodeJobsChild.Attributes["name"]; if (attrib != null) { jobName = attrib.Value; } attrib = xnodeJobsChild.Attributes["args_first"]; if (attrib != null) { jobArgsFirst = attrib.Value; } attrib = xnodeJobsChild.Attributes["args"]; if (attrib != null) { jobArgs = attrib.Value; } attrib = xnodeJobsChild.Attributes["results"]; if (attrib != null) { jobResults = attrib.Value; } } jobList.Add(new JobInfo(jobId, jobSgbd, jobName, jobArgsFirst, jobArgs, jobResults)); foreach (XmlNode xnodeJobChild in xnodeJobsChild.ChildNodes) { ReadDisplayNode(xnodeJobChild, displayList, (string.IsNullOrEmpty(jobId) ? jobName : jobId) + "#", ref logEnabled); } } } jobsInfo = new JobsInfo(sgbd, vagDataFileName, vagUdsFileName, jobList); } if (string.Compare(xnodePageChild.Name, "read_errors", StringComparison.OrdinalIgnoreCase) == 0) { string sgbdFunctional = string.Empty; attrib = xnodePageChild.Attributes["sgbd_functional"]; if (attrib != null) { sgbdFunctional = attrib.Value; } List <EcuInfo> ecuList = new List <EcuInfo>(); foreach (XmlNode xnodeErrorsChild in xnodePageChild.ChildNodes) { if (string.Compare(xnodeErrorsChild.Name, "ecu", StringComparison.OrdinalIgnoreCase) == 0) { string ecuName = string.Empty; string sgbd = string.Empty; string vagDataFileName = null; string vagUdsFileName = null; string results = "F_UW_KM"; if (xnodeErrorsChild.Attributes != null) { attrib = xnodeErrorsChild.Attributes["name"]; if (attrib != null) { ecuName = attrib.Value; } attrib = xnodeErrorsChild.Attributes["sgbd"]; if (attrib != null) { sgbd = attrib.Value; } attrib = xnodeErrorsChild.Attributes["vag_data_file"]; if (attrib != null) { vagDataFileName = attrib.Value; } attrib = xnodeErrorsChild.Attributes["vag_uds_file"]; if (attrib != null) { vagUdsFileName = attrib.Value; } attrib = xnodeErrorsChild.Attributes["results"]; if (attrib != null) { results = attrib.Value; } } ecuList.Add(new EcuInfo(ecuName, sgbd, vagDataFileName, vagUdsFileName, results)); } } errorsInfo = new ErrorsInfo(sgbdFunctional, ecuList); } if (string.Compare(xnodePageChild.Name, "code", StringComparison.OrdinalIgnoreCase) == 0) { classCode = xnodePageChild.InnerText; attrib = xnodePageChild.Attributes["show_warnings"]; // ReSharper disable once ConvertIfStatementToNullCoalescingExpression if (attrib == null) { // for backward compatibility attrib = xnodePageChild.Attributes["show_warnigs"]; } if (attrib != null) { try { codeShowWarnings = XmlConvert.ToBoolean(attrib.Value); } catch (Exception) { // ignored } } } } if (!logEnabled) { logFile = string.Empty; } if (logEnabled) { _logTagsPresent = true; } if (string.IsNullOrEmpty(pageName)) { continue; } if (string.IsNullOrWhiteSpace(classCode)) { classCode = null; } _pageList.Add(new PageInfo(xmlFileName, pageName, pageWeight, displayMode, textResId, gaugesPortrait, gaugesLandscape, logFile, jobActivate, classCode, codeShowWarnings, jobsInfo, errorsInfo, displayList, stringList)); } } return(true); } catch (Exception ex) { errorMessage = string.Empty; string fileName = Path.GetFileName(xmlName); if (!string.IsNullOrEmpty(fileName)) { errorMessage = fileName + ":\r\n"; } errorMessage += EdiabasNet.GetExceptionText(ex) ?? string.Empty; return(false); } }
public bool ReadXml(string xmlName) { _pageList.Clear(); if (string.IsNullOrEmpty(xmlName)) { return(false); } if (!File.Exists(xmlName)) { return(false); } string xmlDir = Path.GetDirectoryName(xmlName); _ecuPath = string.Empty; _logPath = string.Empty; _interfaceName = string.Empty; try { string prefix = string.Empty; XmlDocument xdocConfig = XmlDocumentLoader.LoadWithIncludes(xmlName); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xdocConfig.NameTable); XPathNavigator xNav = xdocConfig.CreateNavigator(); if (xNav.MoveToFollowing(XPathNodeType.Element)) { IDictionary <string, string> localNamespaces = xNav.GetNamespacesInScope(XmlNamespaceScope.Local); string nameSpace; if (localNamespaces.TryGetValue("", out nameSpace)) { namespaceManager.AddNamespace("carcontrol", nameSpace); prefix = "carcontrol:"; } } XmlAttribute attrib; XmlNode xnodeGlobal = xdocConfig.SelectSingleNode(string.Format("/{0}configuration/{0}global", prefix), namespaceManager); if (xnodeGlobal?.Attributes != null) { attrib = xnodeGlobal.Attributes["ecu_path"]; if (attrib != null) { if (Path.IsPathRooted(attrib.Value)) { _ecuPath = attrib.Value; } else { _ecuPath = string.IsNullOrEmpty(xmlDir) ? attrib.Value : Path.Combine(xmlDir, attrib.Value); } } attrib = xnodeGlobal.Attributes["log_path"]; if (attrib != null) { _logPath = attrib.Value; } attrib = xnodeGlobal.Attributes["append_log"]; if (attrib != null) { _appendLog = XmlConvert.ToBoolean(attrib.Value); } attrib = xnodeGlobal.Attributes["interface"]; if (attrib != null) { _interfaceName = attrib.Value; } } if (string.Compare(_interfaceName, "ENET", StringComparison.OrdinalIgnoreCase) == 0) { _interfaceType = ActivityCommon.InterfaceType.Enet; } else if (string.Compare(_interfaceName, "FTDI", StringComparison.OrdinalIgnoreCase) == 0) { _interfaceType = ActivityCommon.InterfaceType.Ftdi; } else { _interfaceType = ActivityCommon.InterfaceType.Bluetooth; } XmlNodeList xnodePages = xdocConfig.SelectNodes(string.Format("/{0}configuration/{0}pages/{0}page", prefix), namespaceManager); if (xnodePages != null) { foreach (XmlNode xnodePage in xnodePages) { string pageName = string.Empty; float pageWeight = -1; string logFile = string.Empty; bool jobActivate = false; if (xnodePage.Attributes != null) { attrib = xnodePage.Attributes["name"]; if (attrib != null) { pageName = attrib.Value; } attrib = xnodePage.Attributes["weight"]; if (attrib != null) { try { pageWeight = XmlConvert.ToSingle(attrib.Value); } catch { // ignored } } attrib = xnodePage.Attributes["logfile"]; if (attrib != null) { logFile = attrib.Value; } attrib = xnodePage.Attributes["activate"]; if (attrib != null) { jobActivate = XmlConvert.ToBoolean(attrib.Value); } } JobsInfo jobsInfo = null; ErrorsInfo errorsInfo = null; List <DisplayInfo> displayList = new List <DisplayInfo>(); List <StringInfo> stringList = new List <StringInfo>(); bool logEnabled = false; string classCode = null; bool codeShowWarnings = false; foreach (XmlNode xnodePageChild in xnodePage.ChildNodes) { ReadDisplayNode(xnodePageChild, displayList, null, ref logEnabled); if (string.Compare(xnodePageChild.Name, "strings", StringComparison.OrdinalIgnoreCase) == 0) { string lang = null; if (xnodePageChild.Attributes != null) { attrib = xnodePageChild.Attributes["lang"]; if (attrib != null) { lang = attrib.Value; } } Dictionary <string, string> stringDict = new Dictionary <string, string>(); foreach (XmlNode xnodeString in xnodePageChild.ChildNodes) { string text = xnodeString.InnerText; string name = string.Empty; if (xnodeString.Attributes != null) { attrib = xnodeString.Attributes["name"]; if (attrib != null) { name = attrib.Value; } } if (string.IsNullOrEmpty(name)) { continue; } if (!stringDict.ContainsKey(name)) { stringDict.Add(name, text); } } stringList.Add(new StringInfo(lang, stringDict)); } if (string.Compare(xnodePageChild.Name, "jobs", StringComparison.OrdinalIgnoreCase) == 0) { string sgbd = null; List <JobInfo> jobList = new List <JobInfo>(); if (xnodePageChild.Attributes != null) { attrib = xnodePageChild.Attributes["sgbd"]; if (attrib != null) { sgbd = attrib.Value; } } foreach (XmlNode xnodeJobsChild in xnodePageChild.ChildNodes) { if (string.Compare(xnodeJobsChild.Name, "job", StringComparison.OrdinalIgnoreCase) == 0) { string jobName = string.Empty; string jobArgsFirst = string.Empty; string jobArgs = string.Empty; string jobResults = string.Empty; if (xnodeJobsChild.Attributes != null) { attrib = xnodeJobsChild.Attributes["name"]; if (attrib != null) { jobName = attrib.Value; } attrib = xnodeJobsChild.Attributes["args_first"]; if (attrib != null) { jobArgsFirst = attrib.Value; } attrib = xnodeJobsChild.Attributes["args"]; if (attrib != null) { jobArgs = attrib.Value; } attrib = xnodeJobsChild.Attributes["results"]; if (attrib != null) { jobResults = attrib.Value; } } jobList.Add(new JobInfo(jobName, jobArgsFirst, jobArgs, jobResults)); foreach (XmlNode xnodeJobChild in xnodeJobsChild.ChildNodes) { ReadDisplayNode(xnodeJobChild, displayList, jobName + "#", ref logEnabled); } } } jobsInfo = new JobsInfo(sgbd, jobList); } if (string.Compare(xnodePageChild.Name, "read_errors", StringComparison.OrdinalIgnoreCase) == 0) { List <EcuInfo> ecuList = new List <EcuInfo>(); foreach (XmlNode xnodeErrorsChild in xnodePageChild.ChildNodes) { if (string.Compare(xnodeErrorsChild.Name, "ecu", StringComparison.OrdinalIgnoreCase) == 0) { string ecuName = string.Empty; string sgbd = string.Empty; string results = "F_UW_KM"; if (xnodeErrorsChild.Attributes != null) { attrib = xnodeErrorsChild.Attributes["name"]; if (attrib != null) { ecuName = attrib.Value; } attrib = xnodeErrorsChild.Attributes["sgbd"]; if (attrib != null) { sgbd = attrib.Value; } attrib = xnodeErrorsChild.Attributes["results"]; if (attrib != null) { results = attrib.Value; } } ecuList.Add(new EcuInfo(ecuName, sgbd, results)); } } errorsInfo = new ErrorsInfo(ecuList); } if (string.Compare(xnodePageChild.Name, "code", StringComparison.OrdinalIgnoreCase) == 0) { classCode = xnodePageChild.InnerText; attrib = xnodePageChild.Attributes["show_warnigs"]; if (attrib != null) { codeShowWarnings = XmlConvert.ToBoolean(attrib.Value); } } } if (!logEnabled) { logFile = string.Empty; } if (string.IsNullOrEmpty(pageName)) { continue; } if (string.IsNullOrWhiteSpace(classCode)) { classCode = null; } _pageList.Add(new PageInfo(pageName, pageWeight, logFile, jobActivate, classCode, codeShowWarnings, jobsInfo, errorsInfo, displayList, stringList)); } } return(true); } catch (Exception) { return(false); } }