private bool LoadFile() { EncryptManager manager = new EncryptManager(); manager.EncryptKey = System.Environment.UserName; string password2 = manager.DecryptText(Properties.Settings.Default.EncryptKey); var configNew = new ConfigAccess(); configNew.EncryptKey = password2; bool success = false; FilePath = Path.Combine(ConfigFolder, "Default.xml"); if (File.Exists(FilePath)) { if (!configNew.Load(FilePath)) { MessageBox.Show("ファイルの読み込みに失敗しました。"); return(false); } else { success = true; } } if (!success) { configNew.Create(); } Config = configNew; TreeNode rootNode = FolderTree.Nodes.Add("Default"); MakeTree(rootNode, "/"); rootNode.Expand(); FolderTree.SelectedNode = rootNode; IsLoaded = true; return(true); }
private bool InitPassword() { PasswordForm passwordForm = new PasswordForm(); if (passwordForm.ShowDialog(this) != System.Windows.Forms.DialogResult.OK) { return(false); } string password = passwordForm.Password; EncryptManager manager = new EncryptManager(); manager.EncryptKey = System.Environment.UserName; string password2 = manager.EncryptText(password); Properties.Settings.Default.EncryptKey = password2; Properties.Settings.Default.Save(); return(true); }