Static string [] fonts (INT strlength)
// Return: string (), a one-dimensional random simplified Chinese character string array of strlength characters ()
Static object [] createregioncode (INT strlength)
// This function randomly creates a hexadecimal byte array containing two elements within the Chinese character encoding range. Each byte array represents a Chinese character and stores four byte arrays in the object array.
Public static object [] createregioncode (INT strlength)
{
String [] strarray = new string [] {"0", "1", "2", "3", "4", "5", "6 ", "7", "8", "9", "A", "B", "C", "D", "E", "F "};
Random random = new random ();
Object [] objarray = new object [strlength];
For (INT I = 0; I <strlength; I ++)
{
Int num3;
Int num5;
Int Index = random. Next (11, 14 );
String STR = strarray [Index]. Trim ();
Random = new random (Index * (INT) datetime. Now. ticks) + I );
If (Index = 13)
{
Num3 = random. Next (0, 7 );
}
Else
{
Num3 = random. Next (0, 0x10 );
}
String str2 = strarray [num3]. Trim ();
Random = new random (num3 * (INT) datetime. Now. ticks) + I );
Int num4 = random. Next (10, 0x10 );
String str3 = strarray [num4]. Trim ();
Random = new random (num4 * (INT) datetime. Now. ticks) + I );
Switch (num4)
{
Case 10:
Num5 = random. Next (1, 0x10 );
Break;
Case 15:
Num5 = random. Next (0, 15 );
Break;
Default:
Num5 = random. Next (0, 0x10 );
Break;
}
String str4 = strarray [num5]. Trim ();
Byte num6 = convert. tobyte (STR + str2, 0x10 );
Byte num7 = convert. tobyte (str3 + str4, 0x10 );
Byte [] buffer = new byte [] {num6, num7 };
Objarray. setvalue (buffer, I );
}
Return objarray;
}
Public static string [] fonts (INT strlength)
{
Encoding encoding = encoding. getencoding ("gb2312 ");
Object [] objarray = createregioncode (strlength );
String [] strarray = new string [strlength];
For (INT I = 0; I <strlength; I ++)
{
Strarray [I] = encoding. getstring (byte []) convert. changetype (objarray [I], typeof (byte []);
}
Return strarray;
}