Skip to content

Commit b4653c7

Browse files
committed
updated Client to v3.0
1 parent 86cf424 commit b4653c7

File tree

6 files changed

+25
-26
lines changed

6 files changed

+25
-26
lines changed

Aspose.OMR.Client/Aspose.OMR.Client/Aspose.OMR.Client.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
5959
</PropertyGroup>
6060
<ItemGroup>
61-
<Reference Include="Aspose.Omr.Cloud.Sdk, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
62-
<HintPath>..\packages\Aspose.OMR-Cloud.20.2.0\lib\net45\Aspose.Omr.Cloud.Sdk.dll</HintPath>
61+
<Reference Include="Aspose.OMR.Cloud.SDK, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
62+
<HintPath>..\packages\Aspose.OMR-Cloud.20.12.0\lib\netframework4.0\Aspose.OMR.Cloud.SDK.dll</HintPath>
6363
</Reference>
6464
<Reference Include="Aspose.Storage.Cloud.Sdk, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
6565
<HintPath>..\packages\Aspose.Storage-Cloud.18.3.0\lib\net20\Aspose.Storage.Cloud.Sdk.dll</HintPath>
@@ -68,8 +68,8 @@
6868
<HintPath>..\packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\Microsoft.Expression.Interactions.dll</HintPath>
6969
</Reference>
7070
<Reference Include="Microsoft.VisualBasic" />
71-
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
72-
<HintPath>..\packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
71+
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
72+
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
7373
</Reference>
7474
<Reference Include="PresentationFramework.Aero" />
7575
<Reference Include="ReachFramework" />

Aspose.OMR.Client/Aspose.OMR.Client/CoreApi.cs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@
1515
*/
1616
namespace Aspose.OMR.Client
1717
{
18-
using Omr.Cloud.Sdk;
19-
using Omr.Cloud.Sdk.Model;
20-
using Omr.Cloud.Sdk.Model.Requests;
21-
using Storage.Cloud.Sdk;
22-
using Storage.Cloud.Sdk.Api;
23-
using Storage.Cloud.Sdk.Model;
24-
using Storage.Cloud.Sdk.Model.Requests;
2518
using System;
2619
using System.Collections.Generic;
2720
using System.IO;
@@ -30,6 +23,11 @@ namespace Aspose.OMR.Client
3023
using TemplateModel;
3124
using Utility;
3225
using ViewModels;
26+
using FileInfo = Com.Aspose.Omr.Model.FileInfo;
27+
28+
using Com.Aspose.Omr.Api;
29+
using Com.Aspose.Omr.Model;
30+
using Com.Aspose.Omr.Model.Requests;
3331

3432
/// <summary>
3533
/// Provides API to communicate with Omr Core
@@ -39,7 +37,7 @@ public static class CoreApi
3937
/// <summary>
4038
/// The base path to call REST API
4139
/// </summary>
42-
private static readonly string Basepath = "http://api.aspose.cloud/v1.1";
40+
private static readonly string Basepath = "https://api.aspose.cloud/v3.0";
4341

4442
/// <summary>
4543
/// The app key
@@ -195,7 +193,7 @@ public static ImageRecognitionResult RecognizeImage(string imageName, byte[] ima
195193

196194
ImageRecognitionResult recognitionResult = new ImageRecognitionResult();
197195

198-
foreach (Omr.Cloud.Sdk.Model.FileInfo file in responseResult.ResponseFiles)
196+
foreach (FileInfo file in responseResult.ResponseFiles)
199197
{
200198
if (file.Name.Contains(".dat"))
201199
{
@@ -245,11 +243,11 @@ public static OmrResponse RunOmrTask(OmrFunctions action, string fileName, byte[
245243
storageConfiguration.AppKey = AppKey;
246244
storageConfiguration.AppSid = AppSid;
247245
storageConfiguration.ApiBaseUrl = baseHost;
248-
StorageApi storageApi = new StorageApi(storageConfiguration);
246+
FileApi fileApi = new FileApi(storageConfiguration);
249247

250248
using (Stream stream = new MemoryStream(fileData))
251249
{
252-
storageApi.PutCreate(new PutCreateRequest(fileName, stream));
250+
fileApi.UploadFile(new UploadFileRequest(fileName, stream));
253251
}
254252
}
255253
catch (ApiException e)
@@ -309,15 +307,16 @@ public static void StorageCleanUp(List<string> files)
309307
storageConfiguration.AppSid = AppSid;
310308
storageConfiguration.ApiBaseUrl = baseHost;
311309
StorageApi storageApi = new StorageApi(storageConfiguration);
310+
FileApi fileApi = new FileApi(storageConfiguration);
312311

313312
foreach (string file in files)
314313
{
315314
BusyIndicatorManager.UpdateText("Storage clean up...\n Deleting file: " + file);
316315

317-
FileExistResponse existsResponse = storageApi.GetIsExist(new GetIsExistRequest(file));
318-
if (existsResponse.FileExist.IsExist == true)
316+
ObjectExist existsResponse = storageApi.ObjectExists(new ObjectExistsRequest(file));
317+
if (existsResponse.Exists == false)
319318
{
320-
RemoveFileResponse deleteResponse = storageApi.DeleteFile(new DeleteFileRequest(file));
319+
fileApi.DeleteFile(new DeleteFileRequest(file));
321320
}
322321
}
323322
}
@@ -344,11 +343,11 @@ public static void StorageUploadImages(Dictionary<string, byte[]> imagesToUpload
344343
storageConfiguration.AppKey = AppKey;
345344
storageConfiguration.AppSid = AppSid;
346345
storageConfiguration.ApiBaseUrl = baseHost;
347-
StorageApi storageApi = new StorageApi(storageConfiguration);
346+
FileApi fileApi = new FileApi(storageConfiguration);
348347

349348
using (Stream stream = new MemoryStream(item.Value))
350349
{
351-
storageApi.PutCreate(new PutCreateRequest(item.Key, stream));
350+
fileApi.UploadFile(new UploadFileRequest(item.Key, stream));
352351
}
353352
}
354353
}

Aspose.OMR.Client/Aspose.OMR.Client/app.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
1111
<dependentAssembly>
1212
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
13-
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
13+
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
1414
</dependentAssembly>
1515
</assemblyBinding>
1616
</runtime>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Aspose.OMR-Cloud" version="20.2.0" targetFramework="net462" />
3+
<package id="Aspose.OMR-Cloud" version="20.12.0" targetFramework="net462" />
44
<package id="Aspose.Storage-Cloud" version="18.3.0" targetFramework="net462" />
5-
<package id="Newtonsoft.Json" version="11.0.1" targetFramework="net462" />
5+
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net462" />
66
<package id="System.Windows.Interactivity.WPF" version="2.0.20525" targetFramework="net462" />
77
</packages>

SDK/Aspose.OMR.Demo/Aspose.OMR.Demo.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
<WarningLevel>4</WarningLevel>
3232
</PropertyGroup>
3333
<ItemGroup>
34-
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
35-
<HintPath>..\packages\Newtonsoft.Json.11.0.1\lib\net20\Newtonsoft.Json.dll</HintPath>
34+
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
35+
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net20\Newtonsoft.Json.dll</HintPath>
3636
</Reference>
3737
<Reference Include="System" />
3838
<Reference Include="System.Data" />

SDK/Aspose.OMR.Demo/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Newtonsoft.Json" version="11.0.1" targetFramework="net20" />
3+
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net20" />
44
</packages>

0 commit comments

Comments
 (0)