private VisionService service;
private string _JsonPath = @"C:\BOTS\fcatsbot\json.json";
private VisionService CreateAuthorizedClient(string JsonPath)
{
GoogleCredential credential =
GoogleCredential.FromStream(new FileStream(JsonPath, FileMode.Open));
if (credential.IsCreateScopedRequired)
{
credential = credential.CreateScoped(new[]
{
VisionService.Scope.CloudPlatform
});
}
var res = new VisionService(new BaseClientService.Initializer
{
HttpClientInitializer = credential,
GZipEnabled = false
});
return res;
}