private void saveData() { String stBuffer = ""; stBuffer = stBuffer + Des.DESEncrypt(password); foreach (KeyValuePair <string, ObservableCollection <BookMarkBean> > dicTemp in dic) { int numCnt = 1; if (dicTemp.Value.Count > 0) { foreach (BookMarkBean bookMarkBeanTemp in dicTemp.Value) { stBuffer = stBuffer + "\n" + Des.DESEncrypt(dicTemp.Key) + "\n"; stBuffer = stBuffer + numCnt + "\n"; stBuffer = stBuffer + Des.DESEncrypt(bookMarkBeanTemp.ShuoMing) + "\n"; stBuffer = stBuffer + Des.DESEncrypt(bookMarkBeanTemp.Url) + "\n"; stBuffer = stBuffer + Des.DESEncrypt(bookMarkBeanTemp.User) + "\n"; stBuffer = stBuffer + Des.DESEncrypt(bookMarkBeanTemp.Psw); numCnt++; } } else { stBuffer = stBuffer + "\n" + Des.DESEncrypt(dicTemp.Key) + "\n"; stBuffer = stBuffer + "" + "\n"; stBuffer = stBuffer + "" + "\n"; stBuffer = stBuffer + "" + "\n"; stBuffer = stBuffer + "" + "\n"; stBuffer = stBuffer + ""; } } System.IO.StreamWriter sw = (new System.IO.StreamWriter(@"const.ini", false)); sw.WriteLine(stBuffer); sw.Close(); }
private void button_Click(object sender, RoutedEventArgs e) { string pwd1 = passwordBox1.Password; string pwd2 = passwordBox2.Password; if (pwd1 == pwd2 && pwd1.Length != 0) { String stBuffer = ""; stBuffer = Des.DESEncrypt(pwd1); System.IO.StreamWriter sw = (new System.IO.StreamWriter(@"const.ini", false)); sw.WriteLine(stBuffer); sw.Close(); MainWindow mainWindow = new MainWindow(); mainWindow.Show(); this.Close(); } }