Ejemplo n.º 1
0
 static FiddlerApplication()
 {
     FiddlerApplication.Counters      = new DataPoints();
     FiddlerApplication._Log          = new Logger(false);
     FiddlerApplication.Janitor       = new PeriodicWorker();
     FiddlerApplication._Prefs        = null;
     FiddlerApplication.oTranscoders  = new FiddlerTranscoders();
     FiddlerApplication.slLeakedFiles = new List <string>();
     FiddlerApplication._SetXceedLicenseKeys();
     FiddlerApplication._Prefs = new PreferenceBag(null);
 }
Ejemplo n.º 2
0
 public void RemoveWatcher(PreferenceBag.PrefWatcher wliToRemove)
 {
     PreferenceBag.GetWriterLock(this._RWLockWatchers);
     try
     {
         this._listWatchers.Remove(wliToRemove);
     }
     finally
     {
         PreferenceBag.FreeWriterLock(this._RWLockWatchers);
     }
 }
Ejemplo n.º 3
0
 private void _clearWatchers()
 {
     PreferenceBag.GetWriterLock(this._RWLockWatchers);
     try
     {
         this._listWatchers.Clear();
     }
     finally
     {
         PreferenceBag.FreeWriterLock(this._RWLockWatchers);
     }
 }
Ejemplo n.º 4
0
 public PreferenceBag.PrefWatcher AddWatcher(string sPrefixFilter, EventHandler <PrefChangeEventArgs> pcehHandler)
 {
     PreferenceBag.PrefWatcher prefWatcher = new PreferenceBag.PrefWatcher(sPrefixFilter.ToLower(), pcehHandler);
     PreferenceBag.GetWriterLock(this._RWLockWatchers);
     try
     {
         this._listWatchers.Add(prefWatcher);
     }
     finally
     {
         PreferenceBag.FreeWriterLock(this._RWLockWatchers);
     }
     return(prefWatcher);
 }
Ejemplo n.º 5
0
 public string this[string sPrefName]
 {
     get
     {
         string result;
         try
         {
             PreferenceBag.GetReaderLock(this._RWLockPrefs);
             result = this._dictPrefs[sPrefName];
         }
         finally
         {
             PreferenceBag.FreeReaderLock(this._RWLockPrefs);
         }
         return(result);
     }
     set
     {
         if (!PreferenceBag.isValidName(sPrefName))
         {
             throw new ArgumentException(string.Format("Preference name must contain 1 to 255 characters from the set A-z0-9-_ and may not contain the word Internal.\n\nCaller tried to set: \"{0}\"", sPrefName));
         }
         if (value == null)
         {
             this.RemovePref(sPrefName);
             return;
         }
         bool flag = false;
         try
         {
             PreferenceBag.GetWriterLock(this._RWLockPrefs);
             if (value != this._dictPrefs[sPrefName])
             {
                 flag = true;
                 this._dictPrefs[sPrefName] = value;
             }
         }
         finally
         {
             PreferenceBag.FreeWriterLock(this._RWLockPrefs);
         }
         if (flag)
         {
             PrefChangeEventArgs oNotifyArgs = new PrefChangeEventArgs(sPrefName, value);
             this.AsyncNotifyWatchers(oNotifyArgs);
         }
     }
 }
Ejemplo n.º 6
0
 public string[] GetPrefArray()
 {
     string[] result;
     try
     {
         PreferenceBag.GetReaderLock(this._RWLockPrefs);
         string[] array = new string[this._dictPrefs.Count];
         this._dictPrefs.Keys.CopyTo(array, 0);
         result = array;
     }
     finally
     {
         PreferenceBag.FreeReaderLock(this._RWLockPrefs);
     }
     return(result);
 }
Ejemplo n.º 7
0
        private void _NotifyThreadExecute(object objThreadState)
        {
            PrefChangeEventArgs prefChangeEventArgs = (PrefChangeEventArgs)objThreadState;
            string prefName = prefChangeEventArgs.PrefName;
            List <EventHandler <PrefChangeEventArgs> > list = null;

            try
            {
                PreferenceBag.GetReaderLock(this._RWLockWatchers);
                try
                {
                    foreach (PreferenceBag.PrefWatcher current in this._listWatchers)
                    {
                        if (prefName.OICStartsWith(current.sPrefixToWatch))
                        {
                            if (list == null)
                            {
                                list = new List <EventHandler <PrefChangeEventArgs> >();
                            }
                            list.Add(current.fnToNotify);
                        }
                    }
                }
                finally
                {
                    PreferenceBag.FreeReaderLock(this._RWLockWatchers);
                }
                if (list != null)
                {
                    foreach (EventHandler <PrefChangeEventArgs> current2 in list)
                    {
                        try
                        {
                            current2(this, prefChangeEventArgs);
                        }
                        catch (Exception eX)
                        {
                            FiddlerApplication.ReportException(eX);
                        }
                    }
                }
            }
            catch (Exception eX2)
            {
                FiddlerApplication.ReportException(eX2);
            }
        }
Ejemplo n.º 8
0
        public void RemovePref(string sPrefName)
        {
            bool flag = false;

            try
            {
                PreferenceBag.GetWriterLock(this._RWLockPrefs);
                flag = this._dictPrefs.ContainsKey(sPrefName);
                this._dictPrefs.Remove(sPrefName);
            }
            finally
            {
                PreferenceBag.FreeWriterLock(this._RWLockPrefs);
            }
            if (flag)
            {
                PrefChangeEventArgs oNotifyArgs = new PrefChangeEventArgs(sPrefName, null);
                this.AsyncNotifyWatchers(oNotifyArgs);
            }
        }
Ejemplo n.º 9
0
        internal string FindMatches(string sFilter)
        {
            StringBuilder stringBuilder = new StringBuilder(128);

            try
            {
                PreferenceBag.GetReaderLock(this._RWLockPrefs);
                foreach (DictionaryEntry dictionaryEntry in this._dictPrefs)
                {
                    if (((string)dictionaryEntry.Key).OICContains(sFilter))
                    {
                        stringBuilder.AppendFormat("{0}:\t{1}\r\n", dictionaryEntry.Key, dictionaryEntry.Value);
                    }
                }
            }
            finally
            {
                PreferenceBag.FreeReaderLock(this._RWLockPrefs);
            }
            return(stringBuilder.ToString());
        }
Ejemplo n.º 10
0
        private void WriteRegistry()
        {
            if (CONFIG.bIsViewOnly)
            {
                return;
            }
            if (this._sRegistryPath == null)
            {
                return;
            }
            RegistryKey registryKey = Registry.CurrentUser.CreateSubKey(this._sRegistryPath, RegistryKeyPermissionCheck.ReadWriteSubTree);

            if (registryKey == null)
            {
                return;
            }
            try
            {
                PreferenceBag.GetReaderLock(this._RWLockPrefs);
                registryKey.DeleteSubKey(this._sCurrentProfile, false);
                if (this._dictPrefs.Count >= 1)
                {
                    registryKey = registryKey.CreateSubKey(this._sCurrentProfile, RegistryKeyPermissionCheck.ReadWriteSubTree);
                    foreach (DictionaryEntry dictionaryEntry in this._dictPrefs)
                    {
                        string text = (string)dictionaryEntry.Key;
                        if (!text.OICContains("ephemeral"))
                        {
                            registryKey.SetValue(text, dictionaryEntry.Value);
                        }
                    }
                }
            }
            finally
            {
                PreferenceBag.FreeReaderLock(this._RWLockPrefs);
                registryKey.Close();
            }
        }
Ejemplo n.º 11
0
        private void ReadRegistry()
        {
            if (this._sRegistryPath == null)
            {
                return;
            }
            RegistryKey registryKey = Registry.CurrentUser.OpenSubKey(this._sRegistryPath + "\\" + this._sCurrentProfile, RegistryKeyPermissionCheck.ReadSubTree, RegistryRights.ExecuteKey);

            if (registryKey == null)
            {
                return;
            }
            string[] valueNames = registryKey.GetValueNames();
            try
            {
                PreferenceBag.GetWriterLock(this._RWLockPrefs);
                string[] array = valueNames;
                for (int i = 0; i < array.Length; i++)
                {
                    string text = array[i];
                    if (text.Length >= 1 && !text.OICContains("ephemeral"))
                    {
                        try
                        {
                            this._dictPrefs[text] = (string)registryKey.GetValue(text, string.Empty);
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
            }
            finally
            {
                PreferenceBag.FreeWriterLock(this._RWLockPrefs);
                registryKey.Close();
            }
        }
Ejemplo n.º 12
0
        public string ToString(bool bVerbose)
        {
            StringBuilder stringBuilder = new StringBuilder(128);

            try
            {
                PreferenceBag.GetReaderLock(this._RWLockPrefs);
                stringBuilder.AppendFormat("PreferenceBag [{0} Preferences. {1} Watchers.]", this._dictPrefs.Count, this._listWatchers.Count);
                if (bVerbose)
                {
                    stringBuilder.Append("\n");
                    foreach (DictionaryEntry dictionaryEntry in this._dictPrefs)
                    {
                        stringBuilder.AppendFormat("{0}:\t{1}\n", dictionaryEntry.Key, dictionaryEntry.Value);
                    }
                }
            }
            finally
            {
                PreferenceBag.FreeReaderLock(this._RWLockPrefs);
            }
            return(stringBuilder.ToString());
        }
Ejemplo n.º 13
0
 static FiddlerApplication()
 {
     _SetXceedLicenseKeys();
     _Prefs = new PreferenceBag(null);
 }
Ejemplo n.º 14
0
 public void RemoveWatcher(PreferenceBag.PrefWatcher wliToRemove)
 {
 }