Bart-Rouan
asked on
C# to foxpro
One of my clients have got a application that I think is developed in C# and has asked if I can create a tool that will encrypt a file and has the code that currently encrypts it in C#, I am not the best C# developer and not sure how to convert it to VFP 9.
Any help or guidance would be great.
Thanks!
Any help or guidance would be great.
Thanks!
private string encrypt(string sSource)
{
int nLength = sSource.Length;
byte[] dataByte = StrToByteArray(sSource);
System.Text.StringBuilder encryptData = new System.Text.StringBuilder();
for (int i = 0; i < dataByte.Length; i++)
{
int asciiValue = (int)dataByte[i];
if (asciiValue < 0)
{
asciiValue = asciiValue + 256;
}
asciiValue++;
if (asciiValue == 256)
{
asciiValue = 0;
}
switch (asciiValue.ToString().Length)
{
case 0:
break;
case 1:
encryptData.Append("00" + asciiValue.ToString());
break;
case 2:
encryptData.Append("0" + asciiValue.ToString());
break;
case 3:
encryptData.Append(asciiValue.ToString());
break;
}
}
return encryptData.ToString();
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a mill, I didn't even gave it a look but thanks anyway.