442 lines
16 KiB
C#
442 lines
16 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading;
|
|||
|
|
|
|||
|
|
using CYQ.Data.Tool;
|
|||
|
|
using CYQ.Data.Table;
|
|||
|
|
using CYQ.Data.SQL;
|
|||
|
|
using System.IO;
|
|||
|
|
|
|||
|
|
|
|||
|
|
namespace CYQ.Data.Cache
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// Ϊ<><CEAA><EFBFBD><EFBFBD>.NET Core ȥ<><C8A5>Web.Caching<6E><67><EFBFBD><EFBFBD>д
|
|||
|
|
/// </summary>
|
|||
|
|
internal class LocalCache : CacheManage
|
|||
|
|
{
|
|||
|
|
private MDictionary<string, object> theCache = new MDictionary<string, object>(2048, StringComparer.OrdinalIgnoreCase);//key,cache
|
|||
|
|
private MDictionary<string, DateTime> theKeyTime = new MDictionary<string, DateTime>(2048, StringComparer.OrdinalIgnoreCase);//key,time
|
|||
|
|
private MDictionary<string, string> theFileName = new MDictionary<string, string>();//key,filename
|
|||
|
|
|
|||
|
|
private SortedDictionary<int, MList<string>> theTime = new SortedDictionary<int, MList<string>>();//worktime,keylist
|
|||
|
|
private MDictionary<string, FileSystemWatcher> theFolderWatcher = new MDictionary<string, FileSystemWatcher>();//folderPath,watch
|
|||
|
|
private MDictionary<string, MList<string>> theFolderKeys = new MDictionary<string, MList<string>>();//folderPath,keylist
|
|||
|
|
|
|||
|
|
private static object lockObj = new object();
|
|||
|
|
private DateTime workTime, startTime;
|
|||
|
|
private MDataTable _CacheSchemaTable;
|
|||
|
|
private MDataTable CacheSchemaTable
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
if (_CacheSchemaTable == null || _CacheSchemaTable.Columns.Count == 0)
|
|||
|
|
{
|
|||
|
|
_CacheSchemaTable = new MDataTable(CacheType.ToString());
|
|||
|
|
_CacheSchemaTable.Columns.Add("Key", System.Data.SqlDbType.NVarChar);
|
|||
|
|
_CacheSchemaTable.Columns.Add("Value", System.Data.SqlDbType.NVarChar);
|
|||
|
|
}
|
|||
|
|
return _CacheSchemaTable;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private DateTime getCacheTableTime = DateTime.Now;//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ʱ<EFBFBD>䡣
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public override MDataTable CacheInfo
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
if (CacheSchemaTable.Rows.Count == 0 || getCacheTableTime.AddSeconds(20) < DateTime.Now)
|
|||
|
|
{
|
|||
|
|
getCacheTableTime = DateTime.Now;
|
|||
|
|
CacheSchemaTable.Rows.Clear();
|
|||
|
|
CacheSchemaTable.NewRow(true).Set(0, "CacheCount").Set(1, theCache.Count);
|
|||
|
|
CacheSchemaTable.NewRow(true).Set(0, "TimeCount").Set(1, theTime.Count);
|
|||
|
|
CacheSchemaTable.NewRow(true).Set(0, "FileCount").Set(1, theFileName.Count);
|
|||
|
|
CacheSchemaTable.NewRow(true).Set(0, "KeyTimeCount").Set(1, theKeyTime.Count);
|
|||
|
|
CacheSchemaTable.NewRow(true).Set(0, "FolderWatcherCount").Set(1, theFolderWatcher.Count);
|
|||
|
|
CacheSchemaTable.NewRow(true).Set(0, "TaskStartTime").Set(1, startTime);
|
|||
|
|
CacheSchemaTable.NewRow(true).Set(0, "TaskWorkCount").Set(1, taskCount);
|
|||
|
|
CacheSchemaTable.NewRow(true).Set(0, "ErrorCount").Set(1, errorCount);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
return _CacheSchemaTable;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
internal LocalCache()
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
ThreadBreak.AddGlobalThread(new ParameterizedThreadStart(ClearState));
|
|||
|
|
ThreadBreak.AddGlobalThread(new ParameterizedThreadStart(DalCreate.CheckConnIsOk));//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵļ<D3B5><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ơ<EFBFBD>
|
|||
|
|
if (AppConfig.Cache.IsAutoCache)
|
|||
|
|
{
|
|||
|
|
ThreadBreak.AddGlobalThread(new ParameterizedThreadStart(AutoCache.ClearCache));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception err)
|
|||
|
|
{
|
|||
|
|
errorCount++;
|
|||
|
|
Log.WriteLogToTxt(err);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
int taskCount = 0, taskInterval = 5;//5<><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>λ<EFBFBD><CEBB>档
|
|||
|
|
private static DateTime errTime = DateTime.MinValue;
|
|||
|
|
private void ClearState(object threadID)
|
|||
|
|
{
|
|||
|
|
startTime = DateTime.Now;
|
|||
|
|
while (true)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
workTime = startTime.AddMinutes((taskCount + 1) * taskInterval);
|
|||
|
|
TimeSpan ts = workTime - DateTime.Now;
|
|||
|
|
if (ts.TotalSeconds > 0)
|
|||
|
|
{
|
|||
|
|
Thread.Sleep(ts);//taskInterval * 60 * 1000);//10<31><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
|
}
|
|||
|
|
#region <EFBFBD>µĻ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if (theTime.ContainsKey(taskCount))
|
|||
|
|
{
|
|||
|
|
RemoveList(theTime[taskCount].GetList());
|
|||
|
|
theTime.Remove(taskCount);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (ThreadAbortException e)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
catch (OutOfMemoryException)
|
|||
|
|
{ errorCount++; }
|
|||
|
|
catch (Exception err)
|
|||
|
|
{
|
|||
|
|
errorCount++;
|
|||
|
|
if (errTime == DateTime.MinValue || errTime.AddMinutes(10) < DateTime.Now) // 10<31><30><EFBFBD>Ӽ<EFBFBD>¼һ<C2BC><D2BB>
|
|||
|
|
{
|
|||
|
|
errTime = DateTime.Now;
|
|||
|
|
Log.WriteLogToTxt("LocalCache.ClearState:" + Log.GetExceptionMessage(err));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
finally
|
|||
|
|
{
|
|||
|
|
taskCount++;
|
|||
|
|
if (taskCount % 10 == 9)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (theCache.Count > 100000)// theKey.Count > 100000)
|
|||
|
|
{
|
|||
|
|
NoSqlAction.ResetStaticVar();
|
|||
|
|
GC.Collect();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
errorCount++;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
private int errorCount = 0;//<2F><><EFBFBD>沶<EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD>
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>ڴ湤<DAB4><E6B9A4><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
/// </summary>
|
|||
|
|
public override string WorkInfo
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
JsonHelper js = new JsonHelper(false, false);
|
|||
|
|
js.Add("TaskCount", taskCount.ToString(), true);
|
|||
|
|
js.Add("ErrorCount", errorCount.ToString(), true);
|
|||
|
|
js.Add("NextTaskTime", workTime.ToString());
|
|||
|
|
js.AddBr();
|
|||
|
|
return js.ToString();
|
|||
|
|
// return string.Format("try catch error count:{0}--clear count:{1}--next clear work time at:{2}", errorCount, taskCount, workTime);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public override int Count
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
return theCache.Count;
|
|||
|
|
// return theKey.Count;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Cache<68><65><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="key"><3E><>ʶ</param>
|
|||
|
|
public override object Get(string key)
|
|||
|
|
{
|
|||
|
|
if (Contains(key))
|
|||
|
|
{
|
|||
|
|
return theCache[key];// && theCache.ContainsKey(key) <20>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϺ<D0B6>Lock
|
|||
|
|
}
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="key"><3E><>ʶ</param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public override bool Contains(string key)
|
|||
|
|
{
|
|||
|
|
return theCache.ContainsKey(key) && theKeyTime.ContainsKey(key) && theKeyTime[key] > DateTime.Now;
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Cache<68><65><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="key"><3E><>ʶ</param>
|
|||
|
|
/// <param name="value"><3E><><EFBFBD><EFBFBD>ֵ</param>
|
|||
|
|
public override void Set(string key, object value)
|
|||
|
|
{
|
|||
|
|
Set(key, value, AppConfig.Cache.DefaultCacheTime);
|
|||
|
|
}
|
|||
|
|
/// <param name="cacheMinutes"><3E><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>(<28><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>)</param>
|
|||
|
|
public override void Set(string key, object value, double cacheMinutes)
|
|||
|
|
{
|
|||
|
|
Set(key, value, cacheMinutes, null);
|
|||
|
|
}
|
|||
|
|
/// <param name="fileName"><3E>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7></param>
|
|||
|
|
public override void Set(string key, object value, double cacheMinutes, string fileName)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
lock (lockObj)
|
|||
|
|
{
|
|||
|
|
if (theCache.ContainsKey(key))
|
|||
|
|
{
|
|||
|
|
theCache[key] = value;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
theCache.Add(key, value);//2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>value
|
|||
|
|
}
|
|||
|
|
double cacheTime = cacheMinutes;
|
|||
|
|
if (cacheMinutes <= 0)
|
|||
|
|
{
|
|||
|
|
cacheTime = AppConfig.Cache.DefaultCacheTime;
|
|||
|
|
}
|
|||
|
|
DateTime cTime = DateTime.Now.AddMinutes(cacheTime);
|
|||
|
|
int workCount = GetWorkCount(cTime);
|
|||
|
|
if (theKeyTime.ContainsKey(key))
|
|||
|
|
{
|
|||
|
|
int wc = GetWorkCount(theKeyTime[key]);
|
|||
|
|
if (wc != workCount && theTime.ContainsKey(wc))
|
|||
|
|
{
|
|||
|
|
if (theTime[wc].Contains(key))
|
|||
|
|
{
|
|||
|
|
theTime[wc].Remove(key); //<2F>Ƴ<EFBFBD><C6B3><EFBFBD>ֵ
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
theKeyTime[key] = cTime;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
theKeyTime.Add(key, cTime);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (theTime.ContainsKey(workCount))//3<><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD>time
|
|||
|
|
{
|
|||
|
|
if (!theTime[workCount].Contains(key))
|
|||
|
|
{
|
|||
|
|
theTime[workCount].Add(key);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
MList<string> list = new MList<string>();
|
|||
|
|
list.Add(key);
|
|||
|
|
theTime.Add(workCount, list);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!string.IsNullOrEmpty(fileName))//3<><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD>file
|
|||
|
|
{
|
|||
|
|
if (fileName.IndexOf("\\\\") > -1)
|
|||
|
|
{
|
|||
|
|
fileName = fileName.Replace("\\\\", "\\");
|
|||
|
|
}
|
|||
|
|
if (!theFileName.ContainsKey(key))
|
|||
|
|
{
|
|||
|
|
theFileName.Add(key, fileName);
|
|||
|
|
}
|
|||
|
|
string folder = Path.GetDirectoryName(fileName);
|
|||
|
|
if (!theFolderWatcher.ContainsKey(folder) && Directory.Exists(folder))
|
|||
|
|
{
|
|||
|
|
theFolderWatcher.Add(folder, CreateFileSystemWatcher(folder));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (theFolderKeys.ContainsKey(folder))
|
|||
|
|
{
|
|||
|
|
if (!theFolderKeys[folder].Contains(key))
|
|||
|
|
{
|
|||
|
|
theFolderKeys[folder].Add(key);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
MList<string> list = new MList<string>();
|
|||
|
|
list.Add(key);
|
|||
|
|
theFolderKeys.Add(folder, list);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
errorCount++;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private int GetWorkCount(DateTime cTime)
|
|||
|
|
{
|
|||
|
|
TimeSpan ts = cTime - startTime;
|
|||
|
|
return (int)ts.TotalMinutes / taskInterval;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뿪ʼ<EBBFAA>ж<EFBFBD><D0B6>ٸ<EFBFBD><D9B8><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>䡣
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// ɾ<><C9BE>һ<EFBFBD><D2BB>Cache<68><65><EFBFBD><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="key"><3E><>ʶ</param>
|
|||
|
|
public override void Remove(string key)
|
|||
|
|
{
|
|||
|
|
theCache.Remove(key);//<2F><><EFBFBD><EFBFBD>Cache<68><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD><EFBFBD>Ƴ<EFBFBD>
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>Ƴ<EFBFBD>Key<65><79>Value
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="removeKeys"></param>
|
|||
|
|
private void RemoveList(List<string> removeKeys)
|
|||
|
|
{
|
|||
|
|
if (removeKeys != null && removeKeys.Count > 0)
|
|||
|
|
{
|
|||
|
|
lock (lockObj)
|
|||
|
|
{
|
|||
|
|
foreach (string key in removeKeys)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (theCache.ContainsKey(key))
|
|||
|
|
{
|
|||
|
|
theCache.Remove(key);
|
|||
|
|
}
|
|||
|
|
if (theKeyTime.ContainsKey(key))
|
|||
|
|
{
|
|||
|
|
theKeyTime.Remove(key);
|
|||
|
|
}
|
|||
|
|
if (theFileName.ContainsKey(key))
|
|||
|
|
{
|
|||
|
|
string folder = Path.GetDirectoryName(theFileName[key]);
|
|||
|
|
MList<string> keys = theFolderKeys[folder];
|
|||
|
|
keys.Remove(key);
|
|||
|
|
if (keys.Count == 0)
|
|||
|
|
{
|
|||
|
|
theFolderWatcher[folder].Changed -= new FileSystemEventHandler(fsy_Changed);//ȡ<><C8A1><EFBFBD>¼<EFBFBD>
|
|||
|
|
theFolderWatcher.Remove(folder);//<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>Ҫ<EFBFBD><D2AA><EFBFBD>ӵ<EFBFBD><D3B5>ļ<EFBFBD><C4BC><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>¼<EFBFBD><C2BC>Ͷ<EFBFBD><CDB6><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
theFolderKeys.Remove(folder);//<2F>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
theFileName.Remove(key);//file
|
|||
|
|
}
|
|||
|
|
//file
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
errorCount++;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public override void Clear()
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
lock (lockObj)
|
|||
|
|
{
|
|||
|
|
TableSchema.tableCache.Clear();
|
|||
|
|
TableSchema.columnCache.Clear();
|
|||
|
|
|
|||
|
|
theCache.Clear();
|
|||
|
|
theTime.Clear();
|
|||
|
|
theFileName.Clear();
|
|||
|
|
theKeyTime.Clear();
|
|||
|
|
for (int i = 0; i < theFolderWatcher.Count; i++)
|
|||
|
|
{
|
|||
|
|
theFolderWatcher[i].Changed -= new FileSystemEventHandler(fsy_Changed);
|
|||
|
|
theFolderWatcher[i] = null;
|
|||
|
|
}
|
|||
|
|
theFolderWatcher.Clear();
|
|||
|
|
theFolderKeys.Clear();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
errorCount++;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
public override CacheType CacheType
|
|||
|
|
{
|
|||
|
|
get { return CacheType.LocalCache; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
private FileSystemWatcher CreateFileSystemWatcher(string folderName)
|
|||
|
|
{
|
|||
|
|
FileSystemWatcher fsy = new FileSystemWatcher(folderName, "*.*");
|
|||
|
|
fsy.EnableRaisingEvents = true;
|
|||
|
|
fsy.IncludeSubdirectories = false;
|
|||
|
|
fsy.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Size | NotifyFilters.FileName | NotifyFilters.DirectoryName;
|
|||
|
|
fsy.Changed += new FileSystemEventHandler(fsy_Changed);
|
|||
|
|
return fsy;
|
|||
|
|
}
|
|||
|
|
private static readonly object obj2 = new object();
|
|||
|
|
void fsy_Changed(object sender, FileSystemEventArgs e)
|
|||
|
|
{
|
|||
|
|
lock (obj2)
|
|||
|
|
{
|
|||
|
|
string fileName = e.FullPath;
|
|||
|
|
string folder = Path.GetDirectoryName(fileName);
|
|||
|
|
if (theFolderKeys.ContainsKey(folder))
|
|||
|
|
{
|
|||
|
|
MList<string> keys = theFolderKeys[folder];//.GetList();
|
|||
|
|
int count = keys.Count;
|
|||
|
|
for (int i = 0; i < count; i++)
|
|||
|
|
{
|
|||
|
|
if (i < keys.Count)
|
|||
|
|
{
|
|||
|
|
if (string.Compare(theFileName[keys[i]], fileName, StringComparison.OrdinalIgnoreCase) == 0)
|
|||
|
|
{
|
|||
|
|
Remove(keys[i]);
|
|||
|
|
keys.Remove(keys[i]);
|
|||
|
|
i--;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|