static unsafe void Main(string[] args) { Console.WriteLine("Hello World!"); var del = new OnErrorRet(OnErrorRetFun); set_call_back_fun(del); var msg = "CTP:登录成功。您的密码为弱密码,密码长度不可少于6位"; var utf8bytes = Encoding.UTF8.GetBytes(msg); Console.WriteLine("CTP:登录成功。您的密码为弱密码,密码长度不可少于6位".Length); Console.WriteLine(utf8bytes.Length); // var encoding = Encoding.GetEncoding("gb2312"); var gbBytes = encoding.GetBytes(msg); Console.WriteLine("gb" + gbBytes.Length); PrintByte(gbBytes); fixed(byte *p = gbBytes) { Console.WriteLine("net pointer = " + (int)p); test_call_back_fun(gbBytes.Length, p); } return; // test_base_valuetype.test(); fun_input_char_username("username:dogvane"); // 超过定义的长度 fun_input_char_username("username:dogvane_123456789123456789123456789"); fun_input_char_username("username:dogvane_dogvane"); // 两个字符串输入 fun_input_char_username2("username:dogvane_123456789123456789123456789", "username:dogvane_dogvane"); // 测试结构体的登录信息 var s1 = new struct_login_1(); s1.username = "******"; s1.password = "******"; s1.logintype = 10086; Console.WriteLine("test login!"); fun_input_char_login1(s1); fun_input_char_login1_ref(ref s1); var s2 = new struct_login_2(); s2.username = "******"; s2.password = "******"; s2.logintype = 10086; Console.WriteLine("test login 2!"); fun_input_char_login2(s2); fun_input_char_login2_ref(ref s2); }
public static extern IntPtr set_call_back_fun(OnErrorRet fun);