Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: VB to Cobol conversion

$
0
0

The following is about as close as I can come to a COBOL conversion without actually having the DPUruNet class available to me:
I am sure there are some mistakes but it is a starting point for you anyway...

 

      $set ilusing"System.Threading"
      $set ilusing"System.IO"
      $set ilusing"DPUruNet"
      $set ilusing"System.Drawing"
      $set ilusing"System.Drawing.Imaging"
      $set ilusing"System.Text"
             
       class-id Verify.Verify.
       
       working-storage section.
       01 _readers type ReaderCollection.
       01 _reader type Reader.
       01 _readerResult type Constants.ResultCode.
       01 FmdToVerify type List[Fmd] value New List[Fmd].
       01 fReset condition-value value false.
       01 nThread type Thread.
       01 enrolledFmdStr string.
       *>01 strsplit() As String
       01 callsw string property.
       01 callsw1 string property.
       01 callOutputFileName string property.
       
       method-id CaptureAndExtractFMD.
       local-storage section.
       01 capResult type CaptureResult.
       01 vResult type IdentifyResult value "".
       procedure division returning mystring as string.
           perform until Freset
              declare result as type Constants::ResultCode = _reader::GetStatus()
              if _reader::Status::Status = type Constants::ReaderStatuses::DP_STATUS_BUSY
                 invoke type Thread::Sleep(50)
                 exit perform cycle
              end-if
              if _reader::Status::Status = type Constants::ReaderStatuses::DP_STATUS_READY 
                 set capResult to _reader::Capture(type Constants::Formats::Fid::ANSI, type Constants::CaptureProcessing::DP_IMG_PROC_DEFAULT, 5000, type _reader::Capabilities::Resolutions(0))
                 if capResult::Quality = type Constants::CaptureQuality::DP_QUALITY_GOOD 
                    declare mycount as binary-long
                    declare str as string
                    perform varying mycount from 0 by 1 until mycount = 20
                       try
                          set str to type strsplit(mycount)::Trim(" ")
                       catch ex as type Exception
                          set str to ""
                       end-try
                       if not str = "" 
                          declare fs as type FileStream = type File::OpenRead(str)
                          declare sr as type StreamReader = New StreamReader(fs)
                          invoke FmdToVerify::Clear()
                          invoke FmdToVerify::Add(Fmd::DeserializeXml(sr::ReadLine()::ToString()))
                          invoke sr::Close()
                          declare result3 as type DataResult[Fmd] = type FeatureExtraction::CreateFmdFromFid(capResult::Data, type Constants::Formats::Fmd::DP_VERIFICATION)
                          if result3::ResultCode <> type Constants::ResultCode::DP_SUCCESS
                             invoke type SendMessage("Could not successfully create Fmd")
                          else
                             set vResult to type Comparison::Identify(result3::Data, 0, type getFmdToVerify, 21474, 5)
                             if vResult::ResultCode = type Constants::ResultCode::DP_SUCCESS
                                if vResult::Indexes::Length > 0 
                                   invoke type SendMessage("User Authorized!")
                                   set callsw1 to str
                                   set callsw to "EXIT"
                                   *>'btnMatchFound.Visible = True
                                   exit method
                               else
                                   invoke type SendMessage("User Unauthorized!")
                               end-if
                             else
                                 invoke type SendMessage("Error occured on verification")
                             end-if
                             declare FPBitmap as type Bitmap = CreateBitmap(capResult::Data::Views(0)::RawImage, capResult::Data::Views(0)::Width, capResult::Data::Views(0)::Height)
                             set VerifyPictureBox::Image to new Bitmap(FPBitmap)
                          end-if
                       end-if
                    end-perform
                 end-if
              end-if
           end-perform


           goback.
       end method.

       end class.

Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>