diff --git a/KPUsage/KPUsagePlugin.cs b/KPUsage/KPUsagePlugin.cs index d87fa85..a97e2b1 100644 --- a/KPUsage/KPUsagePlugin.cs +++ b/KPUsage/KPUsagePlugin.cs @@ -32,6 +32,16 @@ public override bool Initialize(IPluginHost host) return true; } + public override void Terminate() + { + + // Clean up menu items + exportUsageMenuItem.Click -= ExportUsageMenuItem_Click; + var menu = this.host.MainWindow.ToolsMenu.DropDownItems; + menu.Remove(sep); + menu.Remove(exportUsageMenuItem); + } + private void ExportUsageMenuItem_Click(object sender, EventArgs e) { if (!this.host.Database.IsOpen) @@ -40,16 +50,22 @@ private void ExportUsageMenuItem_Click(object sender, EventArgs e) return; } - var sfDialog = new SaveFileDialog(); + var sfDialog = new SaveFileDialog() + { + AddExtension = true, + DefaultExt = "csv", + Filter = "Comma-Separated Values (*.csv)|*.csv", + }; if (sfDialog.ShowDialog() == DialogResult.OK) { var dic = new Dictionary>(); + // Traverse all entries this.host.Database.RootGroup.TraverseTree(TraversalMethod.PreOrder, null, (PwEntry en) => { - + // Add entry to multi-dictionary by usage count if (!dic.ContainsKey(en.UsageCount)) { var tempList = new List(); @@ -61,6 +77,7 @@ private void ExportUsageMenuItem_Click(object sender, EventArgs e) return true; }); + // Write out every entry, unsorted using (var file = new StreamWriter(sfDialog.FileName, false)) { file.WriteLine("Name, Usage Count"); diff --git a/KPUsage/Properties/AssemblyInfo.cs b/KPUsage/Properties/AssemblyInfo.cs index 0226345..8d3292e 100644 --- a/KPUsage/Properties/AssemblyInfo.cs +++ b/KPUsage/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ [assembly: AssemblyTitle("KPUsage")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyCompany("")] [assembly: AssemblyProduct("KeePass Plugin")] [assembly: AssemblyCopyright("Copyright © Drew Brown 2016")] [assembly: AssemblyTrademark("")]