Beispiel #1
0
        public JobInfo Execute(Guid sessionID, string webServiceUrl, JobInfo job)
        {
            sessionID_ = sessionID;
            webServiceUrl_ = webServiceUrl;
            //
            string localFile = exeInfo.workingFolder_+"\\"+ job.RemoteFilePath;
            download(job.RemoteFilePath, localFile);

            string outputFile = localFile + ".txt";

            int result = ocrExecute(localFile, outputFile);
            job.Result = result;

            if (result == 0)
            {//success
                string rFile = job.RemoteFilePath + ".txt";
                upload(rFile, outputFile);
                job.ResultRemoteFilePath = rFile;
            }
            else
            {//error
            }
            //
            return job;
        }
        public static IMessageHandler findHandler(string message, out JobInfo job)
        {
            job = null;
            if (message == null)
                return null;
            //
            JobInfo j = decodeJobInfo(message);
            if (j == null)
                return null;
            job = j;

            string appKey = buildAppID(j);
            if (appKey == null)
                return null;

            if (s_services.ContainsKey(appKey))
                return s_services[appKey];
            return null;
        }
 public static string buildAppID(JobInfo j)
 {
     if (j == null)
         return null;
     return j.AppID + "-" + j.Version;
 }