private RuntimeData Load() { lock (_commandLockObject) { string configFile = Path.Combine(_folderService.GetAppDataFolder(), RUNTIMEDATA_FILE); RuntimeData runtimeData = new RuntimeData() { Version = _tlVersion }; try { if (File.Exists(configFile)) { XDocument doc = XDocument.Load(configFile); XElement runtimeDataEl = doc.Root; if (runtimeDataEl != null) { XAttribute rtVersionAttr = runtimeDataEl.Attribute(RUNTIMEDATA_VERSION_ATTR); if (rtVersionAttr != null && Version.TryParse(rtVersionAttr.Value, out Version rtVersion)) { runtimeData.Version = rtVersion; } else { runtimeData.Version = new Version(1, 0); } XElement authenticationEl = runtimeDataEl.Element(AuthInfo.AUTHENTICATION_EL); if (authenticationEl != null) { try { runtimeData.AuthInfo = AuthInfo.GetFromXml(authenticationEl); } catch { // Value from config file could not be loaded, use default value } } XElement applicationEl = runtimeDataEl.Element(APP_EL); if (applicationEl != null) { XElement mainWindowInfoEl = applicationEl.Element(MainWindowInfo.MAINWINDOW_EL); if (mainWindowInfoEl != null) { try { runtimeData.MainWindowInfo = MainWindowInfo.GetFromXml(mainWindowInfoEl); } catch { // Value from config file could not be loaded, use default value } } } } } } catch { // For whatever reason, the runtime.xml could not be loaded } return(runtimeData); } }