/[RomCheater]/trunk/RomCheater.UserSettingsSupport/SettingSubscriber.cs
ViewVC logotype

Diff of /trunk/RomCheater.UserSettingsSupport/SettingSubscriber.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 722 by william, Tue Jun 18 19:18:05 2013 UTC revision 724 by william, Tue Jun 18 20:22:08 2013 UTC
# Line 1  Line 1 
1  ´╗┐using System;  ´╗┐//#define ENABLE_LOAD_SETTINGS // when present will enable calls to LoadSettings()
2    using System;
3  using System.Collections.Generic;  using System.Collections.Generic;
4  using System.Linq;  using System.Linq;
5  using System.Text;  using System.Text;
# Line 9  using System.IO; Line 10  using System.IO;
10  using System.Collections;  using System.Collections;
11  using System.Security.Policy;  using System.Security.Policy;
12  using System.Security.Cryptography;  using System.Security.Cryptography;
13    using System.Windows.Forms;
14    using System.Diagnostics;
15    
16  namespace RomCheater.UserSettingsSupport  namespace RomCheater.UserSettingsSupport
17  {  {
18      public sealed class SettingSubscriber      public sealed class SettingSubscriber
19      {      {
         #region t  
   
           
         #endregion  
         
   
20          public SettingSubscriber() { }                    public SettingSubscriber() { }          
21          //public void AddSubscriber(System.Configuration.ApplicationSettingsBase settings) { AddSubscriber(null, settings); }          //public void AddSubscriber(System.Configuration.ApplicationSettingsBase settings) { AddSubscriber(null, settings); }
22          public void AddSubscriber(object consumer, System.Configuration.ApplicationSettingsBase ownersettings)          public void AddSubscriber(object consumer, System.Configuration.ApplicationSettingsBase ownersettings)
# Line 82  namespace RomCheater.UserSettingsSupport Line 79  namespace RomCheater.UserSettingsSupport
79              get { return this.ConsumerAssembly == this.OwningAsembly; }              get { return this.ConsumerAssembly == this.OwningAsembly; }
80          }          }
81    
82          private Configuration _config = null;          //private Configuration _config = null;
83    
84          #region LoadSettings()          #region LoadSettings()
85            [Conditional("ENABLE_LOAD_SETTINGS")]
86          private void LoadSettings()          private void LoadSettings()
87          {          {
88              if (!this.IsOwningAssembly)              //if (!this.IsOwningAssembly)
89              {              //{
90                  //// we need to read the settings in              //    //// we need to read the settings in
91                  ////string ConfigFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath;              //    ////string ConfigFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath;
92                  ////string ConfigFile = ConfigurationManager.OpenExeConfiguration(SettingsAssmebly.Location).FilePath;              //    ////string ConfigFile = ConfigurationManager.OpenExeConfiguration(SettingsAssmebly.Location).FilePath;
93                  //string path = string.Empty;              //    //string path = string.Empty;
94                  //string profile_dir = Environment.GetEnvironmentVariable("LocalAppData");              //    //string profile_dir = Environment.GetEnvironmentVariable("LocalAppData");
95                  //string company_name = ((AssemblyCompanyAttribute)Attribute.GetCustomAttribute(this.OwningAsembly, typeof(AssemblyCompanyAttribute), false)).Company;              //    //string company_name = ((AssemblyCompanyAttribute)Attribute.GetCustomAttribute(this.OwningAsembly, typeof(AssemblyCompanyAttribute), false)).Company;
96                  //string app_fullname = new FileInfo(this.OwningAsembly.Location).Name;              //    //string app_fullname = new FileInfo(this.OwningAsembly.Location).Name;
97                  //string evidence_type = this.OwningAsembly.GetName().GetPublicKey().Length == 0 ? EVIDENCE_URL : EVIDENCE_STRONGNAME;              //    //string evidence_type = this.OwningAsembly.GetName().GetPublicKey().Length == 0 ? EVIDENCE_URL : EVIDENCE_STRONGNAME;
98                  //string evidence_hash = "<HASH>";              //    //string evidence_hash = "<HASH>";
99                  //string version = this.OwningAsembly.GetName().Version.ToString();              //    //string version = this.OwningAsembly.GetName().Version.ToString();
100                  //string config = "user.config";              //    //string config = "user.config";
101                  //StringBuilder builder = new StringBuilder();              //    //StringBuilder builder = new StringBuilder();
102                  //builder.AppendFormat(@"{0}", profile_dir);              //    //builder.AppendFormat(@"{0}", profile_dir);
103                  //if (company_name != string.Empty)              //    //if (company_name != string.Empty)
104                  //{              //    //{
105                  //    builder.AppendFormat(@"\{0}", company_name.Replace(" ", "_"));              //    //    builder.AppendFormat(@"\{0}", company_name.Replace(" ", "_"));
106                  //}              //    //}
107                  //builder.AppendFormat(@"\{0}", app_fullname);              //    //builder.AppendFormat(@"\{0}", app_fullname);
108                  //builder.AppendFormat(@"_{0}", evidence_type);              //    //builder.AppendFormat(@"_{0}", evidence_type);
109                  //builder.AppendFormat(@"_{0}", evidence_hash);              //    //builder.AppendFormat(@"_{0}", evidence_hash);
110                  //builder.AppendFormat(@"\{0}", version);              //    //builder.AppendFormat(@"\{0}", version);
111                  //builder.AppendFormat(@"\{0}", config);              //    //builder.AppendFormat(@"\{0}", config);
112                  //path = builder.ToString();              //    //path = builder.ToString();
113                  //#region Hash testing              //    //#region Hash testing
114                  //Hash owner = new Hash(this.OwningAsembly);              //    //Hash owner = new Hash(this.OwningAsembly);
115                  //Hash consumer = new Hash(this.ConsumerAssembly);                              //    //Hash consumer = new Hash(this.ConsumerAssembly);                
116                  //#endregion              //    //#endregion
117                //IsolatedStoragePath isp1 = new IsolatedStoragePath(this.OwningAsembly);
118                  IsolatedStoragePath isp1 = new IsolatedStoragePath(this.OwningAsembly);              //    IsolatedStoragePath isp2 = new IsolatedStoragePath(this.ConsumerAssembly);
119                  IsolatedStoragePath isp2 = new IsolatedStoragePath(this.ConsumerAssembly);              //}
120                //else
121              }              //{
122              else              //    string ConfigFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath;
123              {              //}
                 string ConfigFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath;  
             }  
124          }          }
125          #endregion          #endregion
126    

Legend:
Removed from v.722  
changed lines
  Added in v.724

  ViewVC Help
Powered by ViewVC 1.1.22