/// <summary> /// 删除进程文件复制 /// </summary> /// <param name="processCopyer">进程文件复制</param> /// <param name="type">调用类型</param> internal ProcessCopyerServerCall(ProcessCopyer processCopyer, CallType type) { server = processCopyer.Server; this.processCopyer = processCopyer; this.type = type; processCopyer.Server = null; }
private void guard(ProcessCopyer copyer) { if (copyer.CheckName()) { ProcessCopyer cache; Monitor.Enter(guardLock); try { if (guards.TryGetValue(copyer.ProcessId, out cache)) { if (copyer.Guard(this)) { guards[copyer.ProcessId] = copyer; cache.RemoveGuard(); saveCache(); } } else if (copyer.Guard(this)) { guards.Add(copyer.ProcessId, copyer); saveCache(); } } finally { Monitor.Exit(guardLock); } } }
private void copy(ProcessCopyer copyer) { if (copyer.CheckName()) { if (guards.Remove(copyer.ProcessId)) { trySaveCache(); } AutoCSer.Threading.ThreadPool.TinyBackground.FastStart(copyer.Copy); } }
/// <summary> /// 删除守护进程 /// </summary> /// <param name="copyer">文件信息</param> internal void Remove(ProcessCopyer copyer) { ProcessCopyer cache; if (guards.TryGetValue(copyer.ProcessId, out cache) && cache == copyer) { guards.Remove(copyer.ProcessId); cache.RemoveGuard(); if (Interlocked.CompareExchange(ref saveCacheLock, 1, 0) == 0) { SaveCache(); } } }
private void remove(ProcessCopyer copyer) { if (copyer.CheckName()) { ProcessCopyer cache; if (guards.TryGetValue(copyer.ProcessId, out cache)) { if (cache.ProcessName == copyer.ProcessName) { guards.Remove(copyer.ProcessId); trySaveCache(); } cache.RemoveGuard(); } } }
private void copy(ProcessCopyer copyer) { if (copyer.CheckName()) { bool isGuard; Monitor.Enter(guardLock); try { if (isGuard = guards.Remove(copyer.ProcessId)) { saveCache(); } } finally { Monitor.Exit(guardLock); } AutoCSer.Threading.ThreadPool.TinyBackground.FastStart(copyer, AutoCSer.Threading.Thread.CallType.ProcessCopyer); } }
/// <summary> /// 删除守护进程 /// </summary> /// <param name="copyer">文件信息</param> internal void Remove(ProcessCopyer copyer) { ProcessCopyer cache; Monitor.Enter(guardLock); try { if (guards.TryGetValue(copyer.ProcessId, out cache) && cache == copyer) { guards.Remove(copyer.ProcessId); saveCache(); } } finally { Monitor.Exit(guardLock); } if (cache == copyer) { cache.RemoveGuard(); } }
private void remove(ProcessCopyer copyer) { if (copyer.CheckName()) { ProcessCopyer cache; Monitor.Enter(guardLock); try { if (guards.TryGetValue(copyer.ProcessId, out cache) && cache.ProcessName == copyer.ProcessName) { guards.Remove(copyer.ProcessId); saveCache(); } } finally { Monitor.Exit(guardLock); } if (cache != null) { cache.RemoveGuard(); } } }
private bool guard(ProcessCopyer copyer) { if (copyer.CheckName()) { ProcessCopyer cache; if (guards.TryGetValue(copyer.ProcessId, out cache)) { if (copyer.Guard(this)) { guards[copyer.ProcessId] = copyer; cache.RemoveGuard(); trySaveCache(); return(true); } } else if (copyer.Guard(this)) { guards.Add(copyer.ProcessId, copyer); trySaveCache(); return(true); } } return(false); }