/// <summary> /// Helper that performs our asynchronous FileExists. /// </summary> private void DoFileExistsAsync(object asyncState) { // set our processor affinity SetProcessorAffinity(); FileOperationState state = asyncState as FileOperationState; Exception error = null; bool result = false; // perform the FileExists operation try { result = FileExists(state.Container, state.File); } catch (Exception e) { error = e; } // construct our event arguments FileExistsCompletedEventArgs args = new FileExistsCompletedEventArgs(error, result, state.UserState); // fire our completion event if (FileExistsCompleted != null) { FileExistsCompleted(this, args); } // recycle our state object ReturnFileOperationState(state); // decrement our pending operation count PendingOperationsDecrement(); }
/// <summary> /// Helper that performs our asynchronous FileExists. /// </summary> private void DoFileExistsAsync(Object asyncState) { FileOperationState state = asyncState as FileOperationState; Exception error = null; bool result = false; // perform the FileExists operation try { result = FileExists(state.Container, state.File, state.Location); } catch (Exception e) { error = e; } // construct our event arguments FileExistsCompletedEventArgs args = new FileExistsCompletedEventArgs(error, result, state.UserState); // fire our completion event FileExistsCompleted(this, args); // recycle our state Object ReturnFileOperationState(state); // decrement our pending operation count PendingOperationsDecrement(); }