از کلاس و متد زیر می تونین برای تبدیل کدهای قدیمی DOS به ویندوز استفاده کنین. البته این کلاس مربوط به تبدیل کدهایی میشه که در برنامه ورود و خروج PW تحت داس استفاده میشه. این برنامه ورود و خروج پرسنل که به دستگاه PW کارت ساعت زن پرسنل وصل میشه قابلیت این رو داره که ورود و خروجهای پرسنل رو به صورت فایل DBF یا همون Fox pro database (فایل پایگاه داده فاکس پرو) منتشر بکنه. با این کلاس می تونین دیتای اون نوع فایل رو تبدیل کنین. ورودی به صورت Int16 و خروجی هم به صورت استرینگ.
کد:
using System;
using System.Collections.Generic;
using System.Text;
namespace PwConvertor
{
sealed class Class_ConverToWin
{
Int16 Int16_InputCahr;
String Str_OutputChar;
public Class_ConverToWin(Int16 Int16_InputCharacter)
{
this.Int16_InputCahr = Int16_InputCharacter;
}
public String UDF_ReturnChar1()
{
switch (this.Int16_InputCahr)
{
case 1617:
this.Str_OutputChar = "ا";
break;
case 144:
this.Str_OutputChar = "ا";
break;
case 141:
this.Str_OutputChar = "آ";
break;
case 1618:
this.Str_OutputChar = "ب";
break;
case 244:
this.Str_OutputChar = "ب";
break;
case 164:
this.Str_OutputChar = "پ";
break;
case 1600:
this.Str_OutputChar = "پ";
break;
case 251:
this.Str_OutputChar = "ت";
break;
case 249:
this.Str_OutputChar = "ت";
break;
case 1569:
this.Str_OutputChar = "ث";
break;
case 1570:
this.Str_OutputChar = "ث";
break;
case 1571:
this.Str_OutputChar = "ج";
break;
case 1572:
this.Str_OutputChar = "ج";
break;
case 163:
this.Str_OutputChar = "چ";
break;
case 1573:
this.Str_OutputChar = "چ";
break;
case 1574:
this.Str_OutputChar = "ح";
break;
case 1575:
this.Str_OutputChar = "ح";
break;
case 1576:
this.Str_OutputChar = "خ";
break;
case 1577:
this.Str_OutputChar = "خ";
break;
case 1578:
this.Str_OutputChar = "د";
break;
case 1579:
this.Str_OutputChar = "ذ";
break;
case 1580:
this.Str_OutputChar = "ر";
break;
case 1581:
this.Str_OutputChar = "ز";
break;
case 1582:
this.Str_OutputChar = "ژ";
break;
case 1583:
this.Str_OutputChar = "س";
break;
case 1584:
this.Str_OutputChar = "س";
break;
case 1585:
this.Str_OutputChar = "ش";
break;
case 1586:
this.Str_OutputChar = "ش";
break;
case 1587:
this.Str_OutputChar = "ص";
break;
case 1588:
this.Str_OutputChar = "ص";
break;
case 1589:
this.Str_OutputChar = "ض";
break;
case 171:
this.Str_OutputChar = "ض";
break;
case 187:
this.Str_OutputChar = "ط";
break;
case 1590:
this.Str_OutputChar = "ظ";
break;
case 1591:
this.Str_OutputChar = "ع";
break;
case 1594:
this.Str_OutputChar = "ع";
break;
case 1592:
this.Str_OutputChar = "ع";
break;
case 1593:
this.Str_OutputChar = "ع";
break;
case 1601:
this.Str_OutputChar = "غ";
break;
case 181:
this.Str_OutputChar = "غ";
break;
case 1602:
this.Str_OutputChar = "غ";
break;
case 1603:
this.Str_OutputChar = "غ";
break;
case 1604:
this.Str_OutputChar = "ف";
break;
case 1605:
this.Str_OutputChar = "ف";
break;
case 1606:
this.Str_OutputChar = "ق";
break;
case 1607:
this.Str_OutputChar = "ق";
break;
case 1608:
this.Str_OutputChar = "ک";
break;
case 1609:
this.Str_OutputChar = "ک";
break;
case 1610:
this.Str_OutputChar = "گ";
break;
case 8801:
this.Str_OutputChar = "گ";
break;
case 1611:
this.Str_OutputChar = "ل";
break;
case 1612:
this.Str_OutputChar = "لا";
break;
case 1613:
this.Str_OutputChar = "ل";
break;
case 1614:
this.Str_OutputChar = "م";
break;
case 1615:
this.Str_OutputChar = "م";
break;
case 1616:
this.Str_OutputChar = "ن";
break;
case 8776:
this.Str_OutputChar = "ن";
break;
case 176:
this.Str_OutputChar = "و";
break;
case 8729:
this.Str_OutputChar = "ه";
break;
case 8730:
this.Str_OutputChar = "ه";
break;
case 183:
this.Str_OutputChar = "ه";
break;
case 8319:
this.Str_OutputChar = "ی";
break;
case 9632:
this.Str_OutputChar = "ی";
break;
case 178:
this.Str_OutputChar = "ی";
break;
case 128:
this.Str_OutputChar = "0";
break;
case 129:
this.Str_OutputChar = "1";
break;
case 233:
this.Str_OutputChar = "2";
break;
case 226:
this.Str_OutputChar = "3";
break;
case 132:
this.Str_OutputChar = "4";
break;
case 224:
this.Str_OutputChar = "5";
break;
case 134:
this.Str_OutputChar = "6";
break;
case 231:
this.Str_OutputChar = "7";
break;
case 234:
this.Str_OutputChar = "8";
break;
case 235:
this.Str_OutputChar = "9";
break;
case 47:
this.Str_OutputChar = "\\";
break;
case 142:
this.Str_OutputChar = "ئ";
break;
case 143:
this.Str_OutputChar = "ء";
break;
case 239:
this.Str_OutputChar = "-";
break;
case 45:
this.Str_OutputChar = "_";
break;
case 232:
this.Str_OutputChar = "،";
break;
case 33:
this.Str_OutputChar = "!";
break;
case 96:
this.Str_OutputChar = "'";
break;
case 238:
this.Str_OutputChar = "؟";
break;
default:
this.Str_OutputChar = ((Char)this.Int16_InputCahr).ToString();
break;
}
return Str_OutputChar;
}
public String UDF_ReturnChar()
{
switch (this.Int16_InputCahr)
{
case 8216:
this.Str_OutputChar = "ا";
break;
case 1711:
this.Str_OutputChar = "ا";
break;
case 1670:
this.Str_OutputChar = "آ";
break;
case 8220:
this.Str_OutputChar = "ب";
break;
case 8217:
this.Str_OutputChar = "ب";
break;
case 8221:
this.Str_OutputChar = "پ";
break;
case 8226:
this.Str_OutputChar = "پ";
break;
case 8211:
this.Str_OutputChar = "ت";
break;
case 8212:
this.Str_OutputChar = "ت";
break;
case 1705:
this.Str_OutputChar = "ث";
break;
case 8482:
this.Str_OutputChar = "ث";
break;
case 1681:
this.Str_OutputChar = "ج";
break;
case 8250:
this.Str_OutputChar = "ج";
break;
case 339:
this.Str_OutputChar = "چ";
break;
case 8204:
this.Str_OutputChar = "چ";
break;
case 8205:
this.Str_OutputChar = "ح";
break;
case 1722:
this.Str_OutputChar = "ح";
break;
case 1548:
this.Str_OutputChar = "خ";
break;
case 1577:
this.Str_OutputChar = "خ";
break;
case 162:
this.Str_OutputChar = "د";
break;
case 163:
this.Str_OutputChar = "ذ";
break;
case 164:
this.Str_OutputChar = "ر";
break;
case 165:
this.Str_OutputChar = "ز";
break;
case 166:
this.Str_OutputChar = "ژ";
break;
case 167:
this.Str_OutputChar = "س";
break;
case 168:
this.Str_OutputChar = "س";
break;
case 169:
this.Str_OutputChar = "ش";
break;
case 1726:
this.Str_OutputChar = "ش";
break;
case 171:
this.Str_OutputChar = "ص";
break;
case 172:
this.Str_OutputChar = "ص";
break;
case 173:
this.Str_OutputChar = "ض";
break;
case 174:
this.Str_OutputChar = "ض";
break;
case 175:
this.Str_OutputChar = "ط";
break;
case 224:
this.Str_OutputChar = "ظ";
break;
case 1604:
this.Str_OutputChar = "ع";
break;
case 226:
this.Str_OutputChar = "ع";
break;
case 1605:
this.Str_OutputChar = "ع";
break;
case 1606:
this.Str_OutputChar = "ع";
break;
case 1607:
this.Str_OutputChar = "غ";
break;
case 232:
this.Str_OutputChar = "غ";
break;
case 1608:
this.Str_OutputChar = "غ";
break;
case 231:
this.Str_OutputChar = "غ";
break;
case 233:
this.Str_OutputChar = "ف";
break;
case 234:
this.Str_OutputChar = "ف";
break;
case 235:
this.Str_OutputChar = "ق";
break;
case 1609:
this.Str_OutputChar = "ق";
break;
case 1610:
this.Str_OutputChar = "ک";
break;
case 238:
this.Str_OutputChar = "ک";
break;
case 239:
this.Str_OutputChar = "گ";
break;
case 1611:
this.Str_OutputChar = "گ";
break;
case 1614:
this.Str_OutputChar = "ل";
break;
case 1613:
this.Str_OutputChar = "لا";
break;
case 1612:
this.Str_OutputChar = "ل";
break;
case 244:
this.Str_OutputChar = "م";
break;
case 1615:
this.Str_OutputChar = "م";
break;
case 1616:
this.Str_OutputChar = "ن";
break;
case 247:
this.Str_OutputChar = "ن";
break;
case 1617:
this.Str_OutputChar = "و";
break;
case 1618:
this.Str_OutputChar = "ه";
break;
case 249:
this.Str_OutputChar = "ه";
break;
case 251:
this.Str_OutputChar = "ه";
break;
case 8206:
this.Str_OutputChar = "ی";
break;
case 8207:
this.Str_OutputChar = "ی";
break;
case 252:
this.Str_OutputChar = "ی";
break;
case 8364:
this.Str_OutputChar = "0";
break;
case 1662:
this.Str_OutputChar = "1";
break;
case 8218:
this.Str_OutputChar = "2";
break;
case 402:
this.Str_OutputChar = "3";
break;
case 8222:
this.Str_OutputChar = "4";
break;
case 8230:
this.Str_OutputChar = "5";
break;
case 8224:
this.Str_OutputChar = "6";
break;
case 8225:
this.Str_OutputChar = "7";
break;
case 710:
this.Str_OutputChar = "8";
break;
case 8240:
this.Str_OutputChar = "9";
break;
case 47:
this.Str_OutputChar = "\\";
break;
case 1688:
this.Str_OutputChar = "ئ";
break;
case 1672:
this.Str_OutputChar = "ء";
break;
//case 239:
// this.Str_OutputChar = "-";
// break;
case 45:
this.Str_OutputChar = "_";
break;
//case 232:
// this.Str_OutputChar = "،";
// break;
case 33:
this.Str_OutputChar = "!";
break;
case 96:
this.Str_OutputChar = "'";
break;
case 338:
this.Str_OutputChar = "؟";
break;
default:
this.Str_OutputChar = ((Char)this.Int16_InputCahr).ToString();
break;
}
return Str_OutputChar;
}
}
}
DOS TO WINDOWS CONVERTOR