Trying to debug a nasty problem with fingrprint scanner, I would like to use FILE:WriteAllBytes... but haven't found syntax to acomplish.
It shows an error 14823:
Extent of array parameter to method or function <name> does not match what is expected. (14823)
The extent of array parameters must match exactly if neither is indeterminate. " " "
Have you used it before?
[quote user="OctavioOlguin"]
Trying to debug a nasty problem with fingrprint scanner, I would like to use FILE:WriteAllBytes... but haven't found syntax to acomplish.
[/quote]
A word of warning: When referencing .NET class names, always use the exact casing. "File" in this case, not "FILE". .NET class names are case sensitive. Progress can't change this. Progress did relax the case sensitiveness in the way, that the first usage in a compile unit is case-sensitive and from there on it's assumed that it's unlikely to use two class names that only differ in case in one program. But I'd never rely on that.
Calrifiying information.
1) Got a Byte[] from a .NET call to a fingerprint reader.
2) used
METHOD PUBLIC STATIC MEMPTR ByteArrayToMemptr (poBytes AS "System.Byte[]":U):
DEFINE VARIABLE myMemptr AS MEMPTR NO-UNDO .
DEFINE VARIABLE oIntPointer AS System.IntPtr NO-UNDO .
SET-SIZE (myMemptr) = poBytes:Length .
oIntPointer = NEW System.IntPtr (GET-POINTER-VALUE (myMemptr)).
System.Runtime.InteropServices.Marshal:Copy (poBytes, 0, oIntPointer, poBytes:Length).
RETURN myMemptr.
FINALLY:
DELETE OBJECT oIntPointer.
END FINALLY.
END METHOD .
to get a value to be stored on ad BLOB field.
3) A day later, need to use another scanner function to verify match to a given fingerprint, with:
Matcher:Verify(CurrentTemplate, currentTemplate_size, TemplateToMatch, TemplateSizeToMatch, OUTPUT bool1)
So, the stored value is moved to a memptr again and then converted to a BYTE[] with:
METHOD PUBLIC STATIC "System.Byte[]" MemptrToByteArray( pmptr AS MEMPTR ):
DEFINE VARIABLE nPtr AS System.IntPtr NO-UNDO.
DEFINE VARIABLE vInt AS INTEGER NO-UNDO.
DEFINE VARIABLE nBytes AS "System.Byte[]".
vInt = GET-SIZE(pmPtr).
nBytes = NEW "System.Byte[]"(vInt).
nPtr = NEW System.IntPtr(GET-POINTER-VALUE(pmPtr)).
System.Runtime.InteropServices.Marshal:Copy(nPtr, nBytes, 0, vInt).
RETURN nBytes.
FINALLY:
nPtr = ?.
set-size(pmPtr) = 0.
nBytes = ?.
END.
END METHOD.
But somewhere in the process, (and I bet it has to do with codepages and stuff) I get different data than what origianlly captured the scanner.
That's why I would like to debug and see the data when it's inside the BYTE[] array...
Should be something like System.IO.File:WriteAllBytes("foo.bin",MyByteArray).
Resolved my problem (mixed content on db -comparing one finger to another-)
I think this should be finished with the solution to original question, so future visitors (and me) got solution, don't you think?
Yes @ tbergman, I also wrote that... but pdsoe throw the error 14823
[quote user="OctavioOlguin"]
Trying to debug a nasty problem with fingrprint scanner, I would like to use FILE:WriteAllBytes... but haven't found syntax to acomplish.
[/quote]
A word of warning: When referencing .NET class names, always use the exact casing. "File" in this case, not "FILE". .NET class names are case sensitive. Progress can't change this. Progress did relax the case sensitiveness in the way, that the first usage in a compile unit is case-sensitive and from there on it's assumed that it's unlikely to use two class names that only differ in case in one program. But I'd never rely on that.
Thanks...
Once again, you all guys got it... (I was using *.io.*)...