15
15
*/
16
16
namespace Aspose . OMR . Client
17
17
{
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 ;
18
25
using System ;
19
26
using System . Collections . Generic ;
20
27
using System . IO ;
21
28
using System . Linq ;
22
29
using System . Text ;
23
- using Storage . Cloud . Sdk . Api ;
24
- using Storage . Cloud . Sdk . Model ;
25
- using Storage . Cloud . Sdk ;
26
- using Storage . Cloud . Sdk . Model . Requests ;
27
- using Com . Aspose . Omr . Model ;
28
- using Com . Aspose . Omr . Api ;
29
30
using TemplateModel ;
30
31
using Utility ;
31
32
using ViewModels ;
@@ -98,7 +99,7 @@ public static TemplateGenerationContent GenerateTemplate(string descriptionFileN
98
99
{
99
100
imagesPath = @"{ ""ExtraStoragePath"":""" + imagesPath + @"""}" ;
100
101
101
- OMRResponse response = RunOmrTask ( OmrFunctions . GenerateTemplate , descriptionFileName , descriptionData ,
102
+ OmrResponse response = RunOmrTask ( OmrFunctions . GenerateTemplate , descriptionFileName , descriptionData ,
102
103
imagesPath , false , false , additionalParams ) ;
103
104
104
105
OmrResponseContent responseResult = response . Payload . Result ;
@@ -130,7 +131,7 @@ public static TemplateViewModel CorrectTemplate(string imageName, byte[] imageDa
130
131
{
131
132
string packedTemplate = PackTemplate ( imageName , templateData ) ;
132
133
133
- OMRResponse response = RunOmrTask ( OmrFunctions . CorrectTemplate , imageName , imageData , packedTemplate ,
134
+ OmrResponse response = RunOmrTask ( OmrFunctions . CorrectTemplate , imageName , imageData , packedTemplate ,
134
135
wasUploaded , false , additionalParams ) ;
135
136
136
137
OmrResponseContent responseResult = response . Payload . Result ;
@@ -156,7 +157,7 @@ public static TemplateViewModel CorrectTemplate(string imageName, byte[] imageDa
156
157
/// <returns>Finalization data containing warnings</returns>
157
158
public static FinalizationData FinalizeTemplate ( string templateName , byte [ ] templateData , string templateId , string additionalParams )
158
159
{
159
- OMRResponse response = RunOmrTask ( OmrFunctions . FinalizeTemplate , templateName , templateData , templateId , false , false , additionalParams ) ;
160
+ OmrResponse response = RunOmrTask ( OmrFunctions . FinalizeTemplate , templateName , templateData , templateId , false , false , additionalParams ) ;
160
161
OmrResponseContent responseResult = response . Payload . Result ;
161
162
CheckTaskResult ( response . Payload . Result ) ;
162
163
@@ -177,7 +178,7 @@ public static FinalizationData FinalizeTemplate(string templateName, byte[] temp
177
178
/// <returns>Recognition results</returns>
178
179
public static ImageRecognitionResult RecognizeImage ( string imageName , byte [ ] imageData , string templateId , bool wasUploaded , string additionalParams )
179
180
{
180
- OMRResponse response = RunOmrTask ( OmrFunctions . RecognizeImage , imageName , imageData , templateId , wasUploaded , true , additionalParams ) ;
181
+ OmrResponse response = RunOmrTask ( OmrFunctions . RecognizeImage , imageName , imageData , templateId , wasUploaded , true , additionalParams ) ;
181
182
182
183
OmrResponseContent responseResult = response . Payload . Result ;
183
184
if ( responseResult . Info . SuccessfulTasksCount < 1 || responseResult . Info . Details . RecognitionStatistics [ 0 ] . TaskResult != "Pass" )
@@ -194,7 +195,7 @@ public static ImageRecognitionResult RecognizeImage(string imageName, byte[] ima
194
195
195
196
ImageRecognitionResult recognitionResult = new ImageRecognitionResult ( ) ;
196
197
197
- foreach ( Com . Aspose . Omr . Model . FileInfo file in responseResult . ResponseFiles )
198
+ foreach ( Omr . Cloud . Sdk . Model . FileInfo file in responseResult . ResponseFiles )
198
199
{
199
200
if ( file . Name . Contains ( ".dat" ) )
200
201
{
@@ -221,7 +222,7 @@ public static ImageRecognitionResult RecognizeImage(string imageName, byte[] ima
221
222
/// <param name="trackFile">Track file so that it can be deleted from cloud</param>
222
223
/// <param name="additionalParam">The additional (debug) parameters</param>
223
224
/// <returns>Task response</returns>
224
- public static OMRResponse RunOmrTask ( OmrFunctions action , string fileName , byte [ ] fileData , string functionParam , bool wasUploaded , bool trackFile , string additionalParam )
225
+ public static OmrResponse RunOmrTask ( OmrFunctions action , string fileName , byte [ ] fileData , string functionParam , bool wasUploaded , bool trackFile , string additionalParam )
225
226
{
226
227
if ( string . IsNullOrEmpty ( AppKey ) || string . IsNullOrEmpty ( AppSid ) )
227
228
{
@@ -263,9 +264,9 @@ public static OMRResponse RunOmrTask(OmrFunctions action, string fileName, byte[
263
264
}
264
265
}
265
266
266
- OmrApi omrApi = new OmrApi ( AppKey , AppSid , Basepath ) ;
267
+ OmrApi omrApi = new OmrApi ( AppKey , AppSid ) ;
267
268
268
- OMRFunctionParam param = new OMRFunctionParam ( ) ;
269
+ OmrFunctionParam param = new OmrFunctionParam ( ) ;
269
270
param . FunctionParam = functionParam ;
270
271
param . AdditionalParam = additionalParam ;
271
272
@@ -288,7 +289,10 @@ public static OMRResponse RunOmrTask(OmrFunctions action, string fileName, byte[
288
289
}
289
290
290
291
BusyIndicatorManager . UpdateText ( busyMessage ) ;
291
- OMRResponse response = omrApi . PostRunOmrTask ( fileName , action . ToString ( ) , param , null , null ) ;
292
+
293
+ var request = new PostRunOmrTaskRequest ( fileName , action . ToString ( ) , param ) ;
294
+ OmrResponse response = omrApi . PostRunOmrTask ( request ) ;
295
+
292
296
CheckForError ( response ) ;
293
297
return response ;
294
298
}
@@ -403,9 +407,9 @@ private static void CheckTaskResult(OmrResponseContent responseResult)
403
407
/// Check response for error
404
408
/// </summary>
405
409
/// <param name="response">Response to check</param>
406
- private static void CheckForError ( OMRResponse response )
410
+ private static void CheckForError ( OmrResponse response )
407
411
{
408
- if ( response . ErrorCode != 0 )
412
+ if ( response . ErrorCode != 0 )
409
413
{
410
414
throw new Exception ( response . ErrorText ) ;
411
415
}
0 commit comments