📄 ve-b7.tmp
字号:
//this.dataGrid1.DataSource=data_test;
//int lc_rowcount=data_uid.Rows.Count;
string fname="test.txt";
if (File.Exists(fname))
{
MessageBox.Show("{0} already exists.", fname);
}
using (StreamWriter sw = File.CreateText(fname))
{
sw.WriteLine ("This is my file.");
sw.WriteLine ("This is my file2.");
sw.WriteLine ("This is my file3.");
sw.Close();
}
using(StringReader textID=new StringReader(fname))
{
string line;
while ((line = textID.ReadLine()) != null)
{
MessageBox.Show(line);
}
}
/* if (lc_rowcount==0)
{
//StringReader textID=new StringReader("id.txt");
MessageBox.Show("操作员工号不存在!!");
this.czy_id="wrong";
}
else
{
string pwd_intable=data_uid.Rows[0]["口令"].ToString().Trim();
czy_name=data_uid.Rows[0]["姓名"].ToString().Trim();
//MessageBox.Show(pwd_in.ToString().Trim()+" "+pwd_intable.ToString().Trim());
if (pwd_in.ToString().Trim().ToUpper()==pwd_intable.ToString().Trim().ToUpper() )
{
this.czy_id=in_name.ToString().Trim();
}
else
{
string pwd_code=GetPWD3(in_name.ToString().Trim().ToUpper(),pwd_in.ToString().Trim().ToUpper());
if (pwd_intable.ToString().Trim()==pwd_code.ToString().Trim())
{
}
else
{
this.czy_id="wrong";
MessageBox.Show("密码不正确!!");
}
}
}
*/
}
catch (SqlException ex)
{
MessageBox.Show( "Error connecting to the server: " + ex.Message );
czy_id="wrong";
MessageBox.Show("id.txt读取失败");
}
}
private string GetPWD3(string UID , string InputPWD )
{
int L ;
int i ;
long U ;
long P ;
long C ;
long A ;
string Result="";
string s;
try
{
A = this.NullToInt(UID);
if (A == 0) A = Asc(UID.Substring(0, 1));
for(i = 1;i<=8;i++)
{
s=((string)(UID + "SDEFSEDF")).Substring(i-1, 1);
U = Asc( s) * i + A;
s=((string)(InputPWD + "6fgh5642")).Substring(i-1, 1);
P = Asc(s) * i + Asc(InputPWD.Substring(0, 1));
C = ((long)(U * P * 19 * i)) % 101;
C = C % 10 + Asc("0");
Result = Result + ((char)C).ToString() ;
}
}
catch(Exception e)
{
//MsgWarning("加密版本为:。\n" + e.Message);
}
return Result;
}
public static int Asc(string chr)
{
char r;
r=Convert.ToChar(chr);
return Convert.ToInt32(r);
}
private int NullToInt(object obj)
{
if (obj == null || obj == System.DBNull.Value) //数据库空可以不判断,系统会自动转换为null
{
return 0;
}
else
{
return ToInt32(obj.ToString()) ;
}
}
private int ToInt32(string S)
{
S=S.Trim();
if (S.Trim() == "") return(0);
if (S.IndexOf("-")>=0)
{ //有负号,但不是开头,则转换为0
if ( S.StartsWith("-") ==false ) return (0);
if ( S.StartsWith("--")) return (0);
}
for (int i=0;i<S.Length;i++)
{
switch(S.Substring(i,1))
{
case "0":
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
break;
case "-":
if ( S.Length==1) return (0);
break;
default:
if (i == 0)
return(0);
else
try
{
return(Convert.ToInt32(S.Substring(0,i)));
}
catch
{
return 0;
}
break;
}
}
try
{
return(Convert.ToInt32(S));
}
catch
{
return 0;
}
}
private void name_TextChanged(object sender, System.EventArgs e)
{
if (name.Text.Length>=4)
{
password.Focus();
//textFocus=2;
//password.Select(0,password.Text.Length);
}
}
private void n1_Click(object sender, System.EventArgs e)
{
if (textFocus==2)
{
password.Text=password.Text+"1";
}
if (textFocus==1)
{
name.Text=name.Text+"1";
}
}
private void name_GotFocus(object sender, System.EventArgs e)
{
textFocus=1;
name.BackColor=System.Drawing.SystemColors.InactiveCaptionText;
password.BackColor=System.Drawing.SystemColors.Window;
}
private void password_GotFocus(object sender, System.EventArgs e)
{
textFocus=2;
password.BackColor=System.Drawing.SystemColors.InactiveCaptionText;
name.BackColor=System.Drawing.SystemColors.Window;
}
private void n2_Click(object sender, System.EventArgs e)
{
if (textFocus==2)
{
password.Text=password.Text+"2";
}
if (textFocus==1)
{
name.Text=name.Text+"2";
}
}
private void n3_Click(object sender, System.EventArgs e)
{
if (textFocus==2)
{
password.Text=password.Text+"3";
}
if (textFocus==1)
{
name.Text=name.Text+"3";
}
}
private void n4_Click(object sender, System.EventArgs e)
{
if (textFocus==2)
{
password.Text=password.Text+"4";
}
if (textFocus==1)
{
name.Text=name.Text+"4";
}
}
private void n5_Click(object sender, System.EventArgs e)
{
if (textFocus==2)
{
password.Text=password.Text+"5";
}
if (textFocus==1)
{
name.Text=name.Text+"5";
}
}
private void n6_Click(object sender, System.EventArgs e)
{
if (textFocus==2)
{
password.Text=password.Text+"6";
}
if (textFocus==1)
{
name.Text=name.Text+"6";
}
}
private void n7_Click(object sender, System.EventArgs e)
{
if (textFocus==2)
{
password.Text=password.Text+"7";
}
if (textFocus==1)
{
name.Text=name.Text+"7";
}
}
private void n8_Click(object sender, System.EventArgs e)
{
if (textFocus==2)
{
password.Text=password.Text+"8";
}
if (textFocus==1)
{
name.Text=name.Text+"8";
}
}
private void n9_Click(object sender, System.EventArgs e)
{
if (textFocus==2)
{
password.Text=password.Text+"9";
}
if (textFocus==1)
{
name.Text=name.Text+"9";
}
}
private void n0_Click(object sender, System.EventArgs e)
{
if (textFocus==2)
{
password.Text=password.Text+"0";
}
if (textFocus==1)
{
name.Text=name.Text+"0";
}
}
private void nClear_Click(object sender, System.EventArgs e)
{
name.Text="";
password.Text="";
name.Focus();
textFocus=1;
}
private void nBackSpace_Click(object sender, System.EventArgs e)
{
if (textFocus==1)
{
name.Text=name.Text.Substring(0,name.Text.Length-1);
}
if (textFocus==2)
{
password.Text=password.Text.Substring(0,password.Text.Length-1);
}
}
private void pictureBox1_ParentChanged(object sender, System.EventArgs e)
{
}
private void button1_Click_1(object sender, System.EventArgs e)
{
this.Close();
}
private void button2_Click(object sender, System.EventArgs e)
{
//CreateProcess("fexplore.exe",null,null,null,false,0,null,null,null,null);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -