internal static NativeMethods.WIN32_FIND_DATA GetExtendedNonRootDirectoryInfo(string path, out Exception exception) { exception = null; NativeMethods.WIN32_FIND_DATA win32_FIND_DATA = default(NativeMethods.WIN32_FIND_DATA); DirectoryInfo di = null; exception = MountPointUtil.HandleIOExceptions(delegate { di = new DirectoryInfo(path); }); if (exception != null) { return(win32_FIND_DATA); } if (!di.Exists) { exception = new DirectoryNotFoundException(); return(win32_FIND_DATA); } if (di.Parent == null) { DiagCore.RetailAssert(false, "An invalid root path was passed in: {0}", new object[] { path }); exception = new IOException(string.Format("An invalid root path was passed in: {0}", path)); return(win32_FIND_DATA); } NativeMethods.WIN32_FIND_DATA result; using (DirectoryEnumerator dirEnum = new DirectoryEnumerator(di.Parent, false, false)) { bool foundNext = false; NativeMethods.WIN32_FIND_DATA tempFindData = default(NativeMethods.WIN32_FIND_DATA); string dirName; exception = MountPointUtil.HandleIOExceptions(delegate { foundNext = dirEnum.GetNextDirectoryExtendedInfo(di.Name, out dirName, out tempFindData); }); if (exception != null) { result = win32_FIND_DATA; } else if (!foundNext) { exception = new DirectoryNotFoundException(); result = win32_FIND_DATA; } else { exception = null; result = tempFindData; } } return(result); }
protected override Exception RunServerRpc(AmServerName node, out object result) { result = null; Exception ex = null; CopyStatusClientCachedEntry[] key = null; RpcHealthStateInfo[] value = null; bool flag = this.TryGetCopyStatus(node, this.m_mdbGuids, out key, out value, out ex); DiagCore.AssertOrWatson(flag || ex != null, "ex cannot be null when TryGetCopyStatus() returns false!", new object[0]); DiagCore.AssertOrWatson(!flag || ex == null, "ex has to be null when TryGetCopyStatus() returns true! Actual: {0}", new object[] { ex }); result = new KeyValuePair <CopyStatusClientCachedEntry[], RpcHealthStateInfo[]>(key, value); return(ex); }