I have never used Foxpro before. Can you convert the following Foxpro code into c# so that I can understand the logic. I am mainly interested in the password logic. Also what is spac()? can_p is the .dbf file where username password is stored. but password is stored in several column ( k1,k2…k12) in numbers. I guess the system calculates this 12 numbers from the password and enters there.
proc can_01
set colo to w/
@10,18 clea to 17,60
@10,18 to 17,60 doub
set colo to n/w
@10,34 say ' LOG IN '
set colo to w/
@12,20 say 'Enter Name.......'
@13,20 say 'Counter..........'
usr=spac(18)
cntr='*'
x=1
do whil .t.
set colo to n/w
@22,0
@22,0 say ;
'Enter user name <CR>-Exit <ESC>-Abort '
set colo to n/w,w+/bg
@12,38 get usr pict '!!!!!!!!!!!!!!!!!'
read
set colo to n/w
if read()=12 .or. usr=' ' .or. x>3
@22,0
@22,0 say 'Log In aborted..Press any key..'
??chr(7)
do can_011
read
quit
endi
x=x+1
use can_p
set exac on
loca for user=trim(usr)
set exac off
@22,0
if eof()
@22,0 say 'User '+usr+' does not exists..Press any key..'
??chr(7)
use
read
else
exit
endi
endd
do whil .t.
@22,0 say ;
'Enter Counter No <CR>-EXIT <ESC>-Abort'
@13,38 get cntr pict '!'
read
@22,0
if read()=12
do can_011
quit
endi
if trim(usr)='BABU M' .and. cntr='*'
exit
endi
if .not. cntr$'ABCD'
@22,0 say 'Incorrect Counter..Re-enter..'
??chr(7)+chr(7)
loop
endi
exit
endd
scntr=cntr
x=1
do whil .t.
set colo to n/w
@22,0
@22,0 say ;
'Enter Password <CR> - Exit <ESC> - Abort '
set colo to w/
@14,20 say 'Enter PASSWORD :-'
set cons off
@14,38 say ''
acce to ps
set cons on
cps=chr(k8+9)+chr(k4+7)+chr(k5-31)+chr(k1+13)+chr(k3-19)+;
chr(k7-35)+chr(k2-27)+chr(k6+1)+chr(k11-6)+chr(k10+6);
+chr(k12+11)+chr(k9-5)
set colo to n/w
@22,0
set exac on
if cps<>ps
@22,0 say 'Incorrect PASSWORD !! Press any key ..'
??chr(7)
read
x=x+1
if read()=12 .or. x>3
do can_011
quit
endi
else
exit
endi
endd
@22,0
@22,0 say 'Please Wait..'
set exac off
if user#'JV'
if .not. (counter=scntr .and. active)
@22,0 say 'Counter not activated...Access denied..Return to system..'
??chr(7)+chr(7)+chr(7)+chr(7)
do can_011
quit
endi
endi
xr=recn()
loca for counter=scntr .and. li .and. recn()<>xr
if found()
@22,0 say 'Counter already Logged-In by User '+user+;
'..Return to system..'
??chr(7)+chr(7)+chr(7)+chr(7)
do can_011
quit
endi
go xr
repl active with .t.,li with .t.,lidt with date(),litm with time()
unlo
do can_011
set colo to w/n,w+/g
retu
although I can write a C# WinForms and WPF to do it, I’ll try to explain all the way through from Foxpro perspective… Mind you… this looks to be a decompiled version of the code as all the foxpro keywords are only showing in 4 characters, not their complete and more understandable commands. Also, this is code that looks like it was written before VFP even existed… much like older DOS days, going back to… 1989 days…