ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/RomCheater.UserSettingsSupport/SettingSubscriber.cs
(Generate patch)

Comparing trunk/RomCheater.UserSettingsSupport/SettingSubscriber.cs (file contents):
Revision 722 by william, Tue Jun 18 19:18:05 2013 UTC vs.
Revision 724 by william, Tue Jun 18 20:22:08 2013 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines