public async Task <IResponse> getDomainMetadata(string name, string kind) { try { bool removeTrailingDot = _configRoot.GetValue <bool>("RemoveTrailingDot"); if (removeTrailingDot && name.EndsWith(".")) { name = name.Remove(name.Length - 1); } using (QueryResult queryResult = await _rqliteService.QueryAsync($"SELECT content FROM domains,domainmetadata WHERE domains.id=domainmetadata.domain_id AND LOWER(domains.name)='{name.ToLower()}' AND LOWER(domainmetadata.kind)='{kind.ToLower()}'")) { return(StringArrayResponse.FromValues(queryResult.Results.FirstOrDefault().Values)); } } catch (NoValuesException) { _logger.LogDebug($"No metadata record '{kind}' found for domain '{name}'"); return(new BoolResponse { result = false }); } catch (Exception ex) { _logger.LogError(ex.Message); return(new BoolResponse { Log = new List <string>() { $"Failed to get DomainMetaData for domain '{name}' with kind '{kind}'" }, result = false }); } }
private void BackgroundWorkerDoWork(object sender, DoWorkEventArgs e) { BackgroundOperationType backgroundOperationType = (BackgroundOperationType)e.Argument; try { if (backgroundOperationType == BackgroundOperationType.CheckNewVersionAvailable) { _newVersionAvailable = PassportPDFApplicationUpdateUtilities.IsNewVersionAvailable(_appId, _appVersion, out string latestVersion); _latestVersionNumber = latestVersion; } else if (backgroundOperationType == BackgroundOperationType.CheckCurrentAppVersionIsSupported) { _currentAppVersionIsSupported = PassportPDFApplicationUpdateUtilities.IsCurrentApplicationVersionSupported(_appId, _appVersion); } else if (backgroundOperationType == BackgroundOperationType.FetchPassportInfo) { PassportPDFPassport passportPdfPassport = PassportPDFRequestsUtilities.GetPassportInfo(_passportToBeFetchedId); if (passportPdfPassport != null) { _fetchedPassportInfo = new PassportInfo { PassportNumber = passportPdfPassport.PassportId, IsActive = passportPdfPassport.IsActive, SubscriptionDate = passportPdfPassport.SubscriptionDate ?? default, TokensUsed = passportPdfPassport.CurrentTokensUsed, RemainingTokens = passportPdfPassport.RemainingTokens, }; } } else if (backgroundOperationType == BackgroundOperationType.FetchConfiguration) { FrameworkGlobals.FetchPassportPDFConfigurationEx(_appId); } else if (backgroundOperationType == BackgroundOperationType.FetchOCRSupportedLanguages) { _getAvailableOCRLanguagesResponse = PassportPDFRequestsUtilities.GetAvailableOCRLanguages(); } } catch (Exception exception) { _apiCallException = exception; } }
public ActionResult <StringArrayResponse> Get(int ClientID, int ClientTransactionID) { try { string[] names = Program.Simulator.Names; string namesList = string.Join(" ", names); Program.TraceLogger.LogMessage(methodName + " Get", namesList); return(new StringArrayResponse(ClientTransactionID, ClientID, methodName, names)); } catch (Exception ex) { Program.TraceLogger.LogMessage(methodName + " Get", string.Format("Exception: {0}", ex.ToString())); string[] names = new string[1]; StringArrayResponse response = new StringArrayResponse(ClientTransactionID, ClientID, methodName, names); response.ErrorMessage = ex.Message; response.ErrorNumber = ex.HResult - Program.ASCOM_ERROR_NUMBER_OFFSET; return(response); } }