--- trunk/RomCheater.UserSettingsSupport/SettingSubscriber.cs 2013/06/18 19:18:05 722 +++ trunk/RomCheater.UserSettingsSupport/SettingSubscriber.cs 2013/06/18 20:22:08 724 @@ -1,4 +1,5 @@ -using System; +//#define ENABLE_LOAD_SETTINGS // when present will enable calls to LoadSettings() +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -9,17 +10,13 @@ using System.IO; using System.Collections; using System.Security.Policy; using System.Security.Cryptography; +using System.Windows.Forms; +using System.Diagnostics; namespace RomCheater.UserSettingsSupport { public sealed class SettingSubscriber { - #region t - - - #endregion - - public SettingSubscriber() { } //public void AddSubscriber(System.Configuration.ApplicationSettingsBase settings) { AddSubscriber(null, settings); } public void AddSubscriber(object consumer, System.Configuration.ApplicationSettingsBase ownersettings) @@ -82,49 +79,48 @@ namespace RomCheater.UserSettingsSupport get { return this.ConsumerAssembly == this.OwningAsembly; } } - private Configuration _config = null; + //private Configuration _config = null; #region LoadSettings() + [Conditional("ENABLE_LOAD_SETTINGS")] private void LoadSettings() { - if (!this.IsOwningAssembly) - { - //// we need to read the settings in - ////string ConfigFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath; - ////string ConfigFile = ConfigurationManager.OpenExeConfiguration(SettingsAssmebly.Location).FilePath; - //string path = string.Empty; - //string profile_dir = Environment.GetEnvironmentVariable("LocalAppData"); - //string company_name = ((AssemblyCompanyAttribute)Attribute.GetCustomAttribute(this.OwningAsembly, typeof(AssemblyCompanyAttribute), false)).Company; - //string app_fullname = new FileInfo(this.OwningAsembly.Location).Name; - //string evidence_type = this.OwningAsembly.GetName().GetPublicKey().Length == 0 ? EVIDENCE_URL : EVIDENCE_STRONGNAME; - //string evidence_hash = "<HASH>"; - //string version = this.OwningAsembly.GetName().Version.ToString(); - //string config = "user.config"; - //StringBuilder builder = new StringBuilder(); - //builder.AppendFormat(@"{0}", profile_dir); - //if (company_name != string.Empty) - //{ - // builder.AppendFormat(@"\{0}", company_name.Replace(" ", "_")); - //} - //builder.AppendFormat(@"\{0}", app_fullname); - //builder.AppendFormat(@"_{0}", evidence_type); - //builder.AppendFormat(@"_{0}", evidence_hash); - //builder.AppendFormat(@"\{0}", version); - //builder.AppendFormat(@"\{0}", config); - //path = builder.ToString(); - //#region Hash testing - //Hash owner = new Hash(this.OwningAsembly); - //Hash consumer = new Hash(this.ConsumerAssembly); - //#endregion - - IsolatedStoragePath isp1 = new IsolatedStoragePath(this.OwningAsembly); - IsolatedStoragePath isp2 = new IsolatedStoragePath(this.ConsumerAssembly); - - } - else - { - string ConfigFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath; - } + //if (!this.IsOwningAssembly) + //{ + // //// we need to read the settings in + // ////string ConfigFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath; + // ////string ConfigFile = ConfigurationManager.OpenExeConfiguration(SettingsAssmebly.Location).FilePath; + // //string path = string.Empty; + // //string profile_dir = Environment.GetEnvironmentVariable("LocalAppData"); + // //string company_name = ((AssemblyCompanyAttribute)Attribute.GetCustomAttribute(this.OwningAsembly, typeof(AssemblyCompanyAttribute), false)).Company; + // //string app_fullname = new FileInfo(this.OwningAsembly.Location).Name; + // //string evidence_type = this.OwningAsembly.GetName().GetPublicKey().Length == 0 ? EVIDENCE_URL : EVIDENCE_STRONGNAME; + // //string evidence_hash = "<HASH>"; + // //string version = this.OwningAsembly.GetName().Version.ToString(); + // //string config = "user.config"; + // //StringBuilder builder = new StringBuilder(); + // //builder.AppendFormat(@"{0}", profile_dir); + // //if (company_name != string.Empty) + // //{ + // // builder.AppendFormat(@"\{0}", company_name.Replace(" ", "_")); + // //} + // //builder.AppendFormat(@"\{0}", app_fullname); + // //builder.AppendFormat(@"_{0}", evidence_type); + // //builder.AppendFormat(@"_{0}", evidence_hash); + // //builder.AppendFormat(@"\{0}", version); + // //builder.AppendFormat(@"\{0}", config); + // //path = builder.ToString(); + // //#region Hash testing + // //Hash owner = new Hash(this.OwningAsembly); + // //Hash consumer = new Hash(this.ConsumerAssembly); + // //#endregion + //IsolatedStoragePath isp1 = new IsolatedStoragePath(this.OwningAsembly); + // IsolatedStoragePath isp2 = new IsolatedStoragePath(this.ConsumerAssembly); + //} + //else + //{ + // string ConfigFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath; + //} } #endregion |