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); } }
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); } }
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); }