From: Argiris K. <be...@us...> - 2005-12-11 17:42:17
|
Update of /cvsroot/magicajax/magicajax/Core/Configuration In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1579/Core/Configuration Modified Files: MagicAjaxConfiguration.cs Log Message: Fixed a bug of MagicAjaxConfiguration when its properties are changed by code and made a change that reduces the GetState string. Index: MagicAjaxConfiguration.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/Configuration/MagicAjaxConfiguration.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** MagicAjaxConfiguration.cs 10 Dec 2005 02:34:12 -0000 1.10 --- MagicAjaxConfiguration.cs 11 Dec 2005 17:42:03 -0000 1.11 *************** *** 50,56 **** throw new MagicAjaxException("Configuration settings have been locked and cannot change."); if ( value != _origMode ) { - _mode = value; _state["Mode"] = _mode; } --- 50,56 ---- throw new MagicAjaxException("Configuration settings have been locked and cannot change."); + _mode = value; if ( value != _origMode ) { _state["Mode"] = _mode; } *************** *** 70,76 **** throw new MagicAjaxException("Configuration settings have been locked and cannot change."); if ( value != _origUnloadStoredPage ) { - _unloadStoredPage = value; _state["UnloadStoredPage"] = _unloadStoredPage; } --- 70,76 ---- throw new MagicAjaxException("Configuration settings have been locked and cannot change."); + _unloadStoredPage = value; if ( value != _origUnloadStoredPage ) { _state["UnloadStoredPage"] = _unloadStoredPage; } *************** *** 90,96 **** throw new MagicAjaxException("Configuration settings have been locked and cannot change."); if ( value != _origCacheTimeout ) { - _cacheTimeout = value; _state["CacheTimeout"] = _cacheTimeout; } --- 90,96 ---- throw new MagicAjaxException("Configuration settings have been locked and cannot change."); + _cacheTimeout = value; if ( value != _origCacheTimeout ) { _state["CacheTimeout"] = _cacheTimeout; } *************** *** 110,116 **** throw new MagicAjaxException("Configuration settings have been locked and cannot change."); if ( value != _origMaxConcurrentPages ) { - _maxConcurrentPages = value; _state["MaxConcurrentPages"] = _maxConcurrentPages; } --- 110,116 ---- throw new MagicAjaxException("Configuration settings have been locked and cannot change."); + _maxConcurrentPages = value; if ( value != _origMaxConcurrentPages ) { _state["MaxConcurrentPages"] = _maxConcurrentPages; } *************** *** 130,136 **** throw new MagicAjaxException("Configuration settings have been locked and cannot change."); if ( value != _origMaxPagesLimitAlert ) { - _maxPagesLimitAlert = value; _state["MaxPagesLimitAlert"] = _maxPagesLimitAlert; } --- 130,136 ---- throw new MagicAjaxException("Configuration settings have been locked and cannot change."); + _maxPagesLimitAlert = value; if ( value != _origMaxPagesLimitAlert ) { _state["MaxPagesLimitAlert"] = _maxPagesLimitAlert; } *************** *** 148,195 **** } ! internal bool IsLocked ! { ! get { return _isLocked; } ! set { _isLocked = value; } ! } ! ! internal string GetState() ! { ! if ( ! IsDirty ) ! return null; ! ! System.IO.StringWriter writer = new System.IO.StringWriter(); ! new LosFormatter().Serialize(writer, _state); ! return writer.ToString(); ! } ! ! internal void LoadState(string stateString) { ! Hashtable state = new LosFormatter().Deserialize(stateString) as Hashtable; ! foreach (string key in state.Keys) { ! switch (key) { ! case "Mode": ! Mode = (PageStoreMode) state[key]; ! break; ! case "CacheTimeout": ! CacheTimeout = (int) state[key]; ! break; ! case "MaxConcurrentPages": ! MaxConcurrentPages = (int) state[key]; ! break; ! case "MaxPagesLimitAlert": ! MaxPagesLimitAlert = (bool) state[key]; ! break; ! case "UnloadStoredPage": ! UnloadStoredPage = (bool) state[key]; ! break; ! default: ! throw new MagicAjaxException(String.Format("PageStore.LoadState: Unknown property '{0}'.", key)); } } } public PageStore(PageStoreMode mode, bool unloadStoredPage, int cacheTimeout, int maxConcurrentPages, bool maxPagesLimitAlert) { --- 148,189 ---- } ! internal Hashtable State { ! get { return _state; } ! set { ! Hashtable state = value; ! foreach (string key in state.Keys) { ! switch (key) ! { ! case "Mode": ! Mode = (PageStoreMode) state[key]; ! break; ! case "CacheTimeout": ! CacheTimeout = (int) state[key]; ! break; ! case "MaxConcurrentPages": ! MaxConcurrentPages = (int) state[key]; ! break; ! case "MaxPagesLimitAlert": ! MaxPagesLimitAlert = (bool) state[key]; ! break; ! case "UnloadStoredPage": ! UnloadStoredPage = (bool) state[key]; ! break; ! default: ! throw new MagicAjaxException(String.Format("PageStore.State: Unknown property '{0}'.", key)); ! } } } } + internal bool IsLocked + { + get { return _isLocked; } + set { _isLocked = value; } + } + public PageStore(PageStoreMode mode, bool unloadStoredPage, int cacheTimeout, int maxConcurrentPages, bool maxPagesLimitAlert) { *************** *** 233,239 **** throw new MagicAjaxException("Configuration settings have been locked and cannot change."); if ( value != _origScriptPath ) { - _scriptPath = value; _state["ScriptPath"] = _scriptPath; } --- 227,233 ---- throw new MagicAjaxException("Configuration settings have been locked and cannot change."); + _scriptPath = value; if ( value != _origScriptPath ) { _state["ScriptPath"] = _scriptPath; } *************** *** 253,259 **** throw new MagicAjaxException("Configuration settings have been locked and cannot change."); if ( value != _origCompareMode ) { - _compareMode = value; _state["CompareMode"] = _compareMode; } --- 247,253 ---- throw new MagicAjaxException("Configuration settings have been locked and cannot change."); + _compareMode = value; if ( value != _origCompareMode ) { _state["CompareMode"] = _compareMode; } *************** *** 273,279 **** throw new MagicAjaxException("Configuration settings have been locked and cannot change."); if ( value != _origTracing ) { - _tracing = value; _state["Tracing"] = _tracing; } --- 267,273 ---- throw new MagicAjaxException("Configuration settings have been locked and cannot change."); + _tracing = value; if ( value != _origTracing ) { _state["Tracing"] = _tracing; } *************** *** 312,316 **** if ( _pageStore.IsDirty ) ! _state["PageStoreState"] = _pageStore.GetState(); System.IO.StringWriter writer = new System.IO.StringWriter(); --- 306,310 ---- if ( _pageStore.IsDirty ) ! _state["PageStoreState"] = _pageStore.State; System.IO.StringWriter writer = new System.IO.StringWriter(); *************** *** 338,342 **** break; case "PageStoreState": ! _pageStore.LoadState((string)state[key]); break; default: --- 332,336 ---- break; case "PageStoreState": ! _pageStore.State = (Hashtable) state[key]; break; default: |