/// <summary> /// Get text from XML file /// </summary> /// <param name="languageenglish">Language type,true is English, false is Chinese</param> /// <param name="myDisplayText">Store text</param> /// <returns>If the operation correct, return true, else return false</returns> public byte GetText(ref DisplayText myDisplayText) { bool languageenglish = false; XmlDocument xml = new XmlDocument(); try { xml.Load("config/Language Config.xml"); } catch { return((byte)eErrNumber.URLErr); } try { //get Text content XmlNode mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/LanguageSelect"); if (mcunodelist.InnerText == "0") { languageenglish = false; myDisplayText.LanguageSelect = true; } else if (mcunodelist.InnerText == "1") { languageenglish = true; myDisplayText.LanguageSelect = false; } else { languageenglish = false; myDisplayText.LanguageSelect = true; } } catch { return((byte)eErrNumber.FileFormatErr); } string str = ""; if (true == languageenglish) { str = "English"; ChineseLanguage = false; } else { str = "Chinese"; ChineseLanguage = true; } try { //get Text content XmlNode mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/MenuFileText"); myDisplayText.MenuFileText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/MenuSaveText"); myDisplayText.MenuSaveText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/MenuLanguageText"); myDisplayText.MenuLanguageText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/MenuChineseText"); myDisplayText.MenuChineseText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/MenuEnglishText"); myDisplayText.MenuEnglishText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/MenuExitText"); myDisplayText.MenuExitText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/MenuHelpText"); myDisplayText.MenuHelpText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/MenuSubHelpText"); myDisplayText.MenuSubHelpText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/GroupMCUSettingText"); myDisplayText.GroupMCUSettingText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/TargetMCUText"); myDisplayText.TargetMCUText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/CrystalFrequencyText"); myDisplayText.CrystalFrequencyText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/HexFileText"); myDisplayText.HexFileText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/COMSettingText"); myDisplayText.COMSettingText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/ConnectText"); myDisplayText.ConnectText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/DisconnectText"); myDisplayText.DisconnectText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/MCUFlashInfoText"); myDisplayText.MCUFlashInfoText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/StartAddressText"); myDisplayText.StartAddressText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/PageSizeText"); myDisplayText.PageSizeText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/PageCountText"); myDisplayText.PageCountText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/ResultsText"); myDisplayText.ResultsText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/PassCountText"); myDisplayText.PassCountText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/FailCountText"); myDisplayText.FailCountText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/TotalCountText"); myDisplayText.TotalCountText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/ClearText"); myDisplayText.ClearText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/OperationText"); myDisplayText.OperationText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/ChipEraseText"); myDisplayText.ChipEraseText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/PageEraseText"); myDisplayText.PageEraseText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/EraseText"); myDisplayText.EraseText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/BlankCheckText"); myDisplayText.BlankCheckText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/ProgramText"); myDisplayText.ProgramText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/VerifyText"); myDisplayText.VerifyText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/CheckBlankCheckText"); myDisplayText.CheckBlankCheckText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/CHeckVerifyText"); myDisplayText.CHeckVerifyText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/CheckProgramText"); myDisplayText.CheckProgramText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/CheckEncryptText"); myDisplayText.CheckEncryptText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/ExecuteText"); myDisplayText.ExecuteText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/UploadText"); myDisplayText.UploadText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/ChecksumText"); myDisplayText.ChecksumText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/Frequency/FrequencyText"); myDisplayText.FrequencyText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/AutoNumber"); myDisplayText.AutoNumber = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/NumberAddress"); myDisplayText.NumberAddress = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/StartNumber"); myDisplayText.StartNumber = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/NumberLength"); myDisplayText.NumberLength = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/NumberInterval"); myDisplayText.NumberInterval = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/CurrentNumber"); myDisplayText.CurrentNumber = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/HistoryNumber"); myDisplayText.HistoryNumber = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/AutoNumberOpen"); myDisplayText.AutoNumberOpen = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/AutoNumberClose"); myDisplayText.AutoNumberClose = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/Frequency/Items"); myDisplayText.Items = Convert.ToByte(mcunodelist.InnerText, 10); myDisplayText.Item = new string[myDisplayText.Items]; for (int i = 0; i < myDisplayText.Items; i++) { mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/Frequency/Item" + i.ToString()); myDisplayText.Item[i] = mcunodelist.InnerText; } mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/Version"); myDisplayText.Version = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/Text/EraseCheck"); myDisplayText.EraseCheck = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/ConnectSuccessful"); myDisplayText.ConnectSuccessful = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/WarningInformationText"); myDisplayText.WarningInformationText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/DisconnectSuccessful"); myDisplayText.DisconnectSuccessful = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/OperationBusy"); myDisplayText.OperationBusy = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/ChipEraseSuccessful"); myDisplayText.ChipEraseSuccessful = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/PageEraseSuccessful"); myDisplayText.PageEraseSuccessful = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/BlankCheckSuccessful"); myDisplayText.BlankCheckSuccessful = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/ResultBlank"); myDisplayText.ResultBlank = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/ResultNotBlank"); myDisplayText.ResultNotBlank = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/ProgramSuccessful"); myDisplayText.ProgramSuccessful = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/VerifySuccessful"); myDisplayText.VerifySuccessful = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/VerifyMatch"); myDisplayText.VerifyMatch = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/VerifyNotMatch"); myDisplayText.VerifyNotMatch = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/StartChipErase"); myDisplayText.StartChipErase = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/StartPageErase"); myDisplayText.StartPageErase = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/StartBlankCheck"); myDisplayText.StartBlankCheck = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/BlankCheckFail"); myDisplayText.BlankCheckFail = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/StartProgram"); myDisplayText.StartProgram = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/ProgramFail"); myDisplayText.ProgramFail = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/StartVerify"); myDisplayText.StartVerify = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/StartUpload"); myDisplayText.StartUpload = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/UploadSuccessful"); myDisplayText.UploadSuccessful = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/UploadFail"); myDisplayText.UploadFail = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/StartEncrypt"); myDisplayText.StartEncrypt = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/EncryptFail"); myDisplayText.EncryptFail = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/EncryptedSuccessful"); myDisplayText.EncryptedSuccessful = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/OverHexData"); myDisplayText.OverHexData = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/AutoNumberFinsh"); myDisplayText.AutoNumberFinsh = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/WarningInformation/ComPortConflict"); myDisplayText.ComPortConflict = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/ErrorInformationText"); myDisplayText.ErrorInformationText = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/SelectTargetMCUEmpty"); myDisplayText.SelectTargetMCUEmpty = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/SelectFrequencyEmpty"); myDisplayText.SelectFrequencyEmpty = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/SelectHexFileEmpty"); myDisplayText.SelectHexFileEmpty = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/URLError"); myDisplayText.URLError = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/FileFormatError"); myDisplayText.FileFormatError = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/SelectHexFileCOM"); myDisplayText.SelectHexFileCOM = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/FrameErr"); myDisplayText.FrameErr = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/FrameNotDef"); myDisplayText.FrameNotDef = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/ReadFail"); myDisplayText.ReadFail = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/MassEraseFail"); myDisplayText.MassEraseFail = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/PageEraseFail"); myDisplayText.PageEraseFail = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/TimeOut"); myDisplayText.TimeOut = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/VerifyFail"); myDisplayText.VerifyFail = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/WriteFail"); myDisplayText.WriteFail = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/Encrypted"); myDisplayText.Encrypted = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/FlashAddressOF"); myDisplayText.FlashAddressOF = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/FrameLenghtOF"); myDisplayText.FrameLenghtOF = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/DataLenghtOF"); myDisplayText.DataLenghtOF = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/BaudrateOF"); myDisplayText.BaudrateOF = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/Encrypted"); myDisplayText.Encrypted = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/SerialPortErr"); myDisplayText.SerialPortErr = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/EmptyFill"); myDisplayText.EmptyFill = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/FormatErr"); myDisplayText.FormatErr = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/AddressInvalid"); myDisplayText.AddressInvalid = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ErrorInformation/OpenAutoNumber"); myDisplayText.OpenAutoNumber = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/MCUSelected"); myDisplayText.MCUSelected = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/CrystalSelected"); myDisplayText.CrystalSelected = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/HexFileURL"); myDisplayText.HexFileURL = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/COMSelect1"); myDisplayText.COMSelect1 = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/COMSelect2"); myDisplayText.COMSelect2 = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/COMSelect3"); myDisplayText.COMSelect3 = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/COMSelect4"); myDisplayText.COMSelect4 = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/COMSelect5"); myDisplayText.COMSelect5 = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/COMSelect6"); myDisplayText.COMSelect6 = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/COMSelect7"); myDisplayText.COMSelect7 = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/COMSelect8"); myDisplayText.COMSelect8 = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/EraseMode"); myDisplayText.EraseMode = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/EraseEnb"); myDisplayText.EraseEnb = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/BankEnb"); myDisplayText.BankEnb = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/ProEnb"); myDisplayText.ProEnb = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/VerifyEnb"); myDisplayText.VerifyEnb = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/EncryptEnb"); myDisplayText.EncryptEnb = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/ModBusEnb"); myDisplayText.ModBustEnb = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/IPAddr"); myDisplayText.IPAddr = mcunodelist.InnerText; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + str + "/ConfigSave/Port"); myDisplayText.Port = mcunodelist.InnerText; //myDisplayText.OK = xml.DocumentElement.SelectSingleNode("/PrinterSetting/Text/" + str + "/UARTSet/OK").InnerText; //myDisplayText.OK = mcunodelist; return((byte)eErrNumber.LoadSuccessful); } catch { return((byte)eErrNumber.FileFormatErr); } }
public byte SaveConfig(DisplayText myDisplayText) { XmlDocument xml = new XmlDocument(); try { xml.Load("config/Language Config.xml"); } catch { return((byte)eErrNumber.URLErr); } try { XmlNode mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/MCUSelected"); mcunodelist.InnerText = myDisplayText.MCUSelected; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/CrystalSelected"); mcunodelist.InnerText = myDisplayText.CrystalSelected; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/HexFileURL"); mcunodelist.InnerText = myDisplayText.HexFileURL; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/COMSelect1"); mcunodelist.InnerText = myDisplayText.COMSelect1; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/COMSelect2"); mcunodelist.InnerText = myDisplayText.COMSelect2; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/COMSelect3"); mcunodelist.InnerText = myDisplayText.COMSelect3; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/COMSelect4"); mcunodelist.InnerText = myDisplayText.COMSelect4; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/COMSelect5"); mcunodelist.InnerText = myDisplayText.COMSelect5; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/COMSelect6"); mcunodelist.InnerText = myDisplayText.COMSelect6; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/COMSelect7"); mcunodelist.InnerText = myDisplayText.COMSelect7; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/COMSelect8"); mcunodelist.InnerText = myDisplayText.COMSelect8; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/EraseMode"); mcunodelist.InnerText = myDisplayText.EraseMode; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/EraseEnb"); mcunodelist.InnerText = myDisplayText.EraseEnb; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/BankEnb"); mcunodelist.InnerText = myDisplayText.BankEnb; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/ProEnb"); mcunodelist.InnerText = myDisplayText.ProEnb; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/VerifyEnb"); mcunodelist.InnerText = myDisplayText.VerifyEnb; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/EncryptEnb"); mcunodelist.InnerText = myDisplayText.EncryptEnb; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/ModBusEnb"); mcunodelist.InnerText = myDisplayText.ModBustEnb; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/IPAddr"); mcunodelist.InnerText = myDisplayText.IPAddr; mcunodelist = xml.DocumentElement.SelectSingleNode("/Language/" + "Chinese" + "/ConfigSave/Port"); mcunodelist.InnerText = myDisplayText.Port; xml.Save("config/Language Config.xml"); } catch { } return((byte)eErrNumber.Succesful); }