winform登陆记住密码
来源:互联网 发布:青岛海关数据 编辑:程序博客网 时间:2024/05/15 23:51
[Serializable]
public class User
{
private string username;
private string userpwd;
private string visausername;
private string visauserpwd;
/// <summary>
///
/// </summary>
public string UserName
{
get { return username; }
set { username = value; }
}
/// <summary>
///
/// </summary>
public string UserPwd
{
get { return userpwd; }
set { userpwd = value; }
}
/// <summary>
///
/// </summary>
public string VisaUserName
{
get { return visausername; }
set { visausername = value; }
}
/// <summary>
///
/// </summary>
public string VisaUserPwd
{
get { return visauserpwd; }
set { visauserpwd = value; }
}
}
Dictionary<string, User> users = new Dictionary<string, User>();
//保存User对象
public void SetDatCatch(string FolderName, string DatCatchName)
{
//获取绝对目录
string sURL = System.Web.Hosting.HostingEnvironment.MapPath("\\") + @"Cache\\" + FolderName;
//确定是否有文件目录,没有就添加
if (!System.IO.Directory.Exists(sURL))
{
System.IO.DirectoryInfo di = System.IO.Directory.CreateDirectory(sURL);
}
string sMapPath = sURL + "\\" + DatCatchName + ".dat";
Stream fStream = new FileStream(sMapPath, FileMode.Create, FileAccess.ReadWrite);
BinaryFormatter binFormat = new BinaryFormatter();//创建二进制序列化器
binFormat.Serialize(fStream, users);
fStream.Close();
}
public void GetDatCatch(string FolderName, string DatCatchName)
{
User user = new User();
//获取绝对目录
string sURL = System.Web.Hosting.HostingEnvironment.MapPath("\\") + @"Cache\\" + FolderName;
string sMapPath = sURL + "\\" + DatCatchName + ".dat";
if (File.Exists(sMapPath))
{
//使用二进制反序列化对象
Stream fStream = new FileStream(sMapPath, FileMode.Open);
BinaryFormatter binFormat = new BinaryFormatter();//创建二进制序列化器
if (fStream.Length > 0)
{
users = binFormat.Deserialize(fStream) as Dictionary<string, User>;
//UserInfo = (User)binFormat.Deserialize(fStream);//反序列化对象
if (users.Count > 0)
{
int count = users.Count;
user = users.Values.Last();
if (!string.IsNullOrEmpty(user.UserName))
{
this.txtUserName.Text = user.UserName;
this.chkJZERPName.Checked = true;
if (this.txtUserName.Text != "")
{
this.txtUserPwd.Text = user.UserPwd;
this.chkJZERPwd.Checked = true;
}
}
if (!string.IsNullOrEmpty(user.VisaUserName))
{
this.txtVisaUser.Text = user.VisaUserName;
this.chkJZVisaName.Checked = true;
if (this.txtVisaUser.Text != "")
{
this.txtVisaPwd.Text = user.VisaUserPwd;
this.chkJZVisaPwd.Checked = true;
}
}
}
}
fStream.Close();
}
}
- winform登陆记住密码
- winform--记住密码
- Winform 记住密码
- 网页登陆 记住密码
- 登陆页面记住密码
- 页面登陆-记住密码
- android登陆记住密码
- 登陆界面记住密码
- 模仿登陆,记住密码
- 用户登陆记住密码
- 登陆 记住密码
- 用户登陆记住密码
- 自动登陆记住密码
- PLSQL Developer 登陆记住密码
- 登陆时候记住账号密码
- android 登陆时记住密码
- PLSQL Developer 登陆记住密码
- PHP 记住密码自动登陆
- Linux命令之非交互SSH密码验证-sshpass
- ecshop源码分析——静态缓存
- 欢迎使用CSDN-markdown编辑器
- 仿照kfifo编写一个ring_buffer
- iOS App瘦身注意armv7 armv7s arm64
- winform登陆记住密码
- Response.BinaryWrite()下载时文件名的问题.
- window下安装mongoDB
- 页面自定义弹出输入框
- 大数据实时处理–Spark及BDAS技术应用
- 《创投极客论坛》
- The Art of Application Performance Testing 出了第二版
- 【Oracle】Oracle基础知识1
- PNG数据