private void ConfigInit() { if (File.Exists(this.LoginInfoConfigPath)) { try { XmlNode node = XmlAnalysis.GetNode((XmlNode)XmlAnalysis.ReaderXmlFile(this.LoginInfoConfigPath), "LoginInfoConfig"); this.IsRememberPassWord = Convert.ToBoolean(XmlAnalysis.GetNode(node, "IsRememberPassWord").InnerText); this.UserName = XmlAnalysis.GetNode(node, "UserName").InnerText; string innerText = XmlAnalysis.GetNode(node, "UserPassword").InnerText; this.IsAutoLogin = Convert.ToBoolean(XmlAnalysis.GetNode(node, "IsAutoLogin").InnerText); this.UserPassword = LoginEncrypt.Decrypt(innerText, "E99F9354-BC29-48A2-9839-F3D0DD83CCE5", Encoding.Default); } catch (Exception) { this.Init(); File.Delete(this.LoginInfoConfigPath); } } else { this.Init(); } }
public static string Decrypt(string encrypted, string key, Encoding encoding) { byte[] encrypted1 = Convert.FromBase64String(encrypted); byte[] bytes = Encoding.Default.GetBytes(key); return(encoding.GetString(LoginEncrypt.Decrypt(encrypted1, bytes))); }