/// <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;
 }
Exemplo n.º 2
0
 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); }
     }
 }
Exemplo n.º 3
0
 private void copy(ProcessCopyer copyer)
 {
     if (copyer.CheckName())
     {
         if (guards.Remove(copyer.ProcessId))
         {
             trySaveCache();
         }
         AutoCSer.Threading.ThreadPool.TinyBackground.FastStart(copyer.Copy);
     }
 }
Exemplo n.º 4
0
        /// <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();
                }
            }
        }
Exemplo n.º 5
0
 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();
         }
     }
 }
Exemplo n.º 6
0
 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);
     }
 }
Exemplo n.º 7
0
        /// <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();
            }
        }
Exemplo n.º 8
0
 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();
         }
     }
 }
Exemplo n.º 9
0
 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);
 }