/// <summary> /// 切记:引用完类组件后,一定要调用此方法来释放! /// </summary> public static void Dispose() { if (upLoadTimer == null) { } else { upLoadTimer.Stop(); upLoadTimer = null; } if (downLoadTimer == null) { } else { downLoadTimer.Stop(); downLoadTimer = null; } _upLoadReceiveFileId = null; DownLoadFilesBlocksQueue.Dispose(); DownLoadFilesQueue.Dispose(); FilesBlocksQueue.Dispose(); FilesQueue.Dispose(); GlobalStaticObj.Dispose(); Dispose(true); }
/// <summary> /// 清理所有正在使用的资源。 /// </summary> /// <param name="isDisposing">如果应释放托管资源,为 true;否则为 false</param> protected static void Dispose(bool isDisposing) { if (_alreadyDisposed) { return; } if (isDisposing) { if (sendFileThread == null) { } else { sendFileThread.Abort(); sendFileThread = null; } _pCClientFilesBlocksQueue = null; _instance = null; //GC.SuppressFinalize(this); } _alreadyDisposed = true; }
/// <summary> /// 清理所有正在使用的资源。 /// </summary> /// <param name="isDisposing">如果应释放托管资源,为 true;否则为 false</param> protected static void Dispose(bool isDisposing) { if (_alreadyDisposed) return; if (isDisposing) { if (sendFileThread == null) { } else { sendFileThread.Abort(); sendFileThread = null; } _pCClientFilesBlocksQueue = null; _instance = null; //GC.SuppressFinalize(this); } _alreadyDisposed = true; }