.config file not included in decompilation but .Default. used instead
The folder from which I decompiled contains a .config file, but the .config file was not included in the new project that I saved from decompiling.
<configSections> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > <section name="PhoneDialerAPI.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </sectionGroup> </configSections> <applicationSettings> <PhoneDialerAPI.Properties.Settings> <setting name="DbConnection" serializeAs="String"> <value>SQLDATABASEINSTANCE::PhoneDialerAPI</value> </setting>
So the program is using custom config section, but all of the settings seem to have been "sucked into" a Settings.cs class and Programs.cs uses ".Default." exclusively.
Snippet
[CompilerGenerated] [GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] internal sealed class Settings : ApplicationSettingsBase { private static Settings defaultInstance = (Settings) SettingsBase.Synchronized((SettingsBase) new Settings()); private void SettingChangingEventHandler(object sender, SettingChangingEventArgs e) { } private void SettingsSavingEventHandler(object sender, CancelEventArgs e) { } public static Settings Default { get { return Settings.defaultInstance; } } [DebuggerNonUserCode] [ApplicationScopedSetting] [DefaultSettingValue("SOMESERVER::PhoneDialerAPI")] public string DbConnection { get { return (string) this[nameof (DbConnection)]; } }
When I bring the .config file into the project Program.cs ignores the config file, because all settings are retrieving from ".Default":
int dbType = Settings.Default.DbType;
string dbConnection = Settings.Default.DbConnection; string dbUser = Settings.Default.DbUser; string dbPassword = Settings.Default.DbPassword; string table = Settings.Default.Table; string serviceId = Settings.Default.ServiceId;
It's pretty clear that this isn't how the program (.EXE that I decompiled) actually operates and instead retrieves settings from the .config file, not from hard-coded settings in the .cs file.
Is this a setting in dotPeek? A bug?
I can manually edit all of this of course, but I'm wondering if there's something I could do in dotPeek to INCLUDE the .config file and generate code that will actually use the .config file.
Thanks!
Please sign in to leave a comment.