public FileStream GetHandle() { timeoutTimer?.Stop(); ActionFileStream stream = new ActionFileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, new Action <ActionFileStream>((str) => { OnHandleClosed(str); })); handles.Add(stream); return(stream); }
public void OnHandleClosed(ActionFileStream stream) { if (handles.Contains(stream)) { handles.Remove(stream); if (handles.Count == 0) { SetTimeout(); } } }