diff --git a/Aop/InterAop.cs b/Aop/InterAop.cs index ad9f8776..862367e7 100644 --- a/Aop/InterAop.cs +++ b/Aop/InterAop.cs @@ -72,10 +72,10 @@ public AopResult Begin(AopEnum action) } if (aopOp == AopOp.OpenAll || aopOp == AopOp.OnlyInner) { - //if (AppConfig.Cache.IsAutoCache && !IsTxtDataBase) // 只要不是直接返回,------调整机制,由Aop参数控制。 - //{ - isHasCache = AutoCache.GetCache(action, Para); //找看有没有Cache - // } + if (!IsTxtDataBase) // 只要不是直接返回,------调整机制,由Aop参数控制。 + { + isHasCache = AutoCache.GetCache(action, Para); //找看有没有Cache + } if (isHasCache) //找到Cache { diff --git a/DAL/NoSql/NoSqlAction.cs b/DAL/NoSql/NoSqlAction.cs index 2b1b91c8..04fc2328 100644 --- a/DAL/NoSql/NoSqlAction.cs +++ b/DAL/NoSql/NoSqlAction.cs @@ -81,10 +81,10 @@ private MDataTable Table Error.Throw("MDataTable can't load data from file : " + _FileFullName); } - DateTime _lastWriteTimeUtc = new IOInfo(_FileFullName).LastWriteTimeUtc; + DateTime lastWriteTime = new IOInfo(_FileFullName).LastWriteTime; if (!_lastWriteTimeList.ContainsKey(_FileFullName)) { - _lastWriteTimeList.Add(_FileFullName, _lastWriteTimeUtc); + _lastWriteTimeList.Add(_FileFullName, lastWriteTime); } if (_Table.Rows.Count > 0) { @@ -486,9 +486,11 @@ public void Dispose() { Save();//失败,则重新尝试写入! } + else + { + needToSaveState = 0; + } } - needToSaveState = 0;//重置为0 - CheckFileChanged(false);//通过检测重置最后修改时间。 } } /// @@ -497,13 +499,13 @@ public void Dispose() /// private void CheckFileChanged(bool isNeedToReloadTable) { - if (isNeedToReloadTable && !_isDeleteAll.Contains(_FileFullName)) + if (!_isDeleteAll.Contains(_FileFullName)) { - DateTime _lastWriteTimeUtc = _lastWriteTimeList[_FileFullName]; - if (IOHelper.IsLastFileWriteTimeChanged(_FileFullName, ref _lastWriteTimeUtc)) + DateTime lastWriteTime = _lastWriteTimeList[_FileFullName]; + if (IOHelper.IsLastFileWriteTimeChanged(_FileFullName, ref lastWriteTime)) { - _lastWriteTimeList[_FileFullName] = _lastWriteTimeUtc; - if (_tableList.ContainsKey(_FileFullName)) + _lastWriteTimeList[_FileFullName] = lastWriteTime; + if (isNeedToReloadTable && _tableList.ContainsKey(_FileFullName)) { try { @@ -514,8 +516,9 @@ private void CheckFileChanged(bool isNeedToReloadTable) { } + _Table = null;//需要重新加载数据。 } - _Table = null;//需要重新加载数据。 + } } @@ -538,6 +541,13 @@ private void Save() { IOHelper.Write(_FileFullName, text, _DalType == DataBaseType.Txt ? IOHelper.DefaultEncoding : Encoding.UTF8); + needToSaveState = 0;//重置为0 + DateTime lastWriteTime = _lastWriteTimeList[_FileFullName]; + if (IOHelper.IsLastFileWriteTimeChanged(_FileFullName, ref lastWriteTime)) + { + //更新最后文件时间 + _lastWriteTimeList[_FileFullName] = lastWriteTime; + } tryAgainCount = 0; if (_isDeleteAll.Contains(_FileFullName)) { diff --git a/Tool/IOHelper.cs b/Tool/IOHelper.cs index 1d5ff07d..fb51e48e 100644 --- a/Tool/IOHelper.cs +++ b/Tool/IOHelper.cs @@ -269,14 +269,14 @@ public static bool Delete(string fileName) return false; } - internal static bool IsLastFileWriteTimeChanged(string fileName, ref DateTime compareTimeUtc) + internal static bool IsLastFileWriteTimeChanged(string fileName, ref DateTime compareTime) { bool isChanged = false; IOInfo info = new IOInfo(fileName); - if (info.Exists && info.LastWriteTimeUtc != compareTimeUtc) + if (info.Exists && info.LastWriteTime != compareTime) { isChanged = true; - compareTimeUtc = info.LastWriteTimeUtc; + compareTime = info.LastWriteTime; } return isChanged; } diff --git a/Xml/XHtmlAction.cs b/Xml/XHtmlAction.cs index 081bf123..7a481af9 100644 --- a/Xml/XHtmlAction.cs +++ b/Xml/XHtmlAction.cs @@ -669,12 +669,18 @@ public void Set(XmlNode node, SetType setType, params string[] values) } else { + string lowerValue = values[0].ToLower(); foreach (XmlNode option in node.ChildNodes) { - if (option.Attributes["value"] != null && (option.Attributes["value"].Value == values[0] || option.Attributes["value"].Value.Split(',')[0] == values[0])) + if (option.Attributes["value"] != null) { - SetAttrValue(option, "selected", "selected"); - break; + string opValue = option.Attributes["value"].Value.Split(',')[0].ToLower(); + if (opValue == lowerValue || opValue == (lowerValue == "true" ? "1" : (lowerValue == "false" ? "0" : lowerValue))) + { + SetAttrValue(option, "selected", "selected"); + break; + } + } } }