diff options
-rw-r--r-- | spedytor/Form1.cs | 25 | ||||
-rw-r--r-- | spedytor/Properties/OptionSettings.Designer.cs | 49 | ||||
-rw-r--r-- | spedytor/Properties/OptionSettings.settings | 12 | ||||
-rw-r--r-- | spedytor/app.config | 6 | ||||
-rw-r--r-- | spedytor/spedytor.csproj | 9 |
5 files changed, 101 insertions, 0 deletions
diff --git a/spedytor/Form1.cs b/spedytor/Form1.cs index 093455b..1b2afe2 100644 --- a/spedytor/Form1.cs +++ b/spedytor/Form1.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; +using System.Linq; using System.Text; using System.Windows.Forms; using MySql.Data.MySqlClient; @@ -33,7 +34,9 @@ namespace spedytor tInterval_Tick(null, null); } } + this.tLogger.Enabled = false; Logger.getLogger(this.tbLog, LOG_FILENAME).cleanup(); + this.saveSettings(); this.Dispose(); } @@ -41,6 +44,7 @@ namespace spedytor { if (!MySQL.getConfigured()) (new MysqlSettings()).ShowDialog(); if (!MySQL.getConfigured()) this.Dispose(); + this.restoreSettings(); this.refreshDatabaseList(); this.checkS3Options(); } @@ -69,9 +73,11 @@ namespace spedytor MySQL c = new MySQL(""); MySqlDataReader dbs = c.select("SELECT TABLE_SCHEMA FROM information_schema.COLUMNS GROUP BY TABLE_SCHEMA;"); int index = 0; + List<string> dbNames = new List<string>(); while (dbs.Read()) { string dbName = dbs.GetString(0); + dbNames.Add(dbName); this.dbSelectionWindow.lbDatabases.Items.Add(dbName); if (this.selectedDBs.IndexOf(dbName) > -1) { @@ -80,6 +86,7 @@ namespace spedytor index++; } dbs.Close(); + this.setSelectedDBs(this.selectedDBs.Intersect(dbNames).ToList()); } private string getBucketID() @@ -323,5 +330,23 @@ namespace spedytor } } + private void restoreSettings() + { + this.setSelectedDBs(Properties.OptionSettings.Default.dbNames.Cast<string>().ToList()); + this.cSend.Checked = Properties.OptionSettings.Default.send; + } + + private void saveSettings() + { + Properties.OptionSettings.Default.send = this.cSend.Checked; + if (Properties.OptionSettings.Default.dbNames == null) + { + Properties.OptionSettings.Default.dbNames = new System.Collections.Specialized.StringCollection(); + } + Properties.OptionSettings.Default.dbNames.Clear(); + Properties.OptionSettings.Default.dbNames.AddRange(this.selectedDBs.ToArray()); + Properties.OptionSettings.Default.Save(); + } + } } diff --git a/spedytor/Properties/OptionSettings.Designer.cs b/spedytor/Properties/OptionSettings.Designer.cs new file mode 100644 index 0000000..73cd018 --- /dev/null +++ b/spedytor/Properties/OptionSettings.Designer.cs @@ -0,0 +1,49 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace spedytor.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + internal sealed partial class OptionSettings : global::System.Configuration.ApplicationSettingsBase { + + private static OptionSettings defaultInstance = ((OptionSettings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new OptionSettings()))); + + public static OptionSettings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public global::System.Collections.Specialized.StringCollection dbNames { + get { + return ((global::System.Collections.Specialized.StringCollection)(this["dbNames"])); + } + set { + this["dbNames"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool send { + get { + return ((bool)(this["send"])); + } + set { + this["send"] = value; + } + } + } +} diff --git a/spedytor/Properties/OptionSettings.settings b/spedytor/Properties/OptionSettings.settings new file mode 100644 index 0000000..3e33106 --- /dev/null +++ b/spedytor/Properties/OptionSettings.settings @@ -0,0 +1,12 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="spedytor" GeneratedClassName="OptionSettings"> + <Profiles /> + <Settings> + <Setting Name="dbNames" Type="System.Collections.Specialized.StringCollection" Scope="User"> + <Value Profile="(Default)" /> + </Setting> + <Setting Name="send" Type="System.Boolean" Scope="User"> + <Value Profile="(Default)">False</Value> + </Setting> + </Settings> +</SettingsFile>
\ No newline at end of file diff --git a/spedytor/app.config b/spedytor/app.config index fe805a1..bf774e4 100644 --- a/spedytor/app.config +++ b/spedytor/app.config @@ -2,12 +2,18 @@ <configuration> <configSections> <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <section name="spedytor.OptionSettings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> <section name="spedytor.Properties.S3Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> <section name="spedytor.S3Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> <section name="spedytor.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/> </sectionGroup> </configSections> <userSettings> + <spedytor.OptionSettings> + <setting name="send" serializeAs="String"> + <value>False</value> + </setting> + </spedytor.OptionSettings> <spedytor.Properties.S3Settings> <setting name="AWS_ACCESS_KEY" serializeAs="String"> <value /> diff --git a/spedytor/spedytor.csproj b/spedytor/spedytor.csproj index 91afa2e..1804199 100644 --- a/spedytor/spedytor.csproj +++ b/spedytor/spedytor.csproj @@ -97,6 +97,11 @@ <Compile Include="MysqlSettings.Designer.cs"> <DependentUpon>MysqlSettings.cs</DependentUpon> </Compile> + <Compile Include="Properties\OptionSettings.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + <DependentUpon>OptionSettings.settings</DependentUpon> + </Compile> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="S3.cs" /> @@ -122,6 +127,10 @@ <None Include="app.config"> <SubType>Designer</SubType> </None> + <None Include="Properties\OptionSettings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>OptionSettings.Designer.cs</LastGenOutput> + </None> <None Include="Properties\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> <LastGenOutput>Settings.Designer.cs</LastGenOutput> |