private bool DetectShareInfo(FSDetector detector) { logWriter.AddLog(LogLevel.Information, "===== Fetch Share Info ====="); try { detectionInfo.shareInfo = detector.FetchShareInfo(detectionInfo); } catch (Exception ex) { logWriter.AddLog(LogLevel.Warning, "Failed", false, LogStyle.StepFailed); logWriter.AddLineToLog(LogLevel.Information); logWriter.AddLog(LogLevel.Information, string.Format("FetchShareInfo failed, reason: {0}", ex.Message)); logWriter.AddLog(LogLevel.Error, string.Format("Detect share info failed. Cannot do further detection.", ex.Message)); } logWriter.AddLog(LogLevel.Warning, "Finished", false, LogStyle.StepPassed); logWriter.AddLineToLog(LogLevel.Information); if (detectionInfo.shareInfo != null) { logWriter.AddLog(LogLevel.Information, "Target SUT Share Info:"); foreach (var item in detectionInfo.shareInfo) { logWriter.AddLog(LogLevel.Information, string.Format("Share Name: {0}", item.ShareName)); logWriter.AddLog(LogLevel.Information, string.Format("\tShare Type: {0}", item.ShareType)); logWriter.AddLog(LogLevel.Information, string.Format("\tShare Flags: {0}", item.ShareFlags)); logWriter.AddLog(LogLevel.Information, string.Format("\tShare Capabilities: {0}", item.ShareCapabilities)); } logWriter.AddLineToLog(LogLevel.Information); } return true; }
private bool DetectShareInfo(FSDetector detector) { logWriter.AddLog(LogLevel.Information, "===== Fetch Share Info ====="); try { detectionInfo.shareInfo = detector.FetchShareInfo(detectionInfo); } catch (Exception ex) { logWriter.AddLog(LogLevel.Warning, "Failed", false, LogStyle.StepFailed); logWriter.AddLineToLog(LogLevel.Information); logWriter.AddLog(LogLevel.Information, string.Format("FetchShareInfo failed, reason: {0}", ex.Message)); logWriter.AddLog(LogLevel.Error, string.Format("Detect share info failed. Cannot do further detection.", ex.Message)); } logWriter.AddLog(LogLevel.Warning, "Finished", false, LogStyle.StepPassed); logWriter.AddLineToLog(LogLevel.Information); if (detectionInfo.shareInfo != null) { logWriter.AddLog(LogLevel.Information, "Target SUT Share Info:"); foreach (var item in detectionInfo.shareInfo) { logWriter.AddLog(LogLevel.Information, string.Format("Share Name: {0}", item.ShareName)); logWriter.AddLog(LogLevel.Information, string.Format("\tShare Type: {0}", item.ShareType)); logWriter.AddLog(LogLevel.Information, string.Format("\tShare Flags: {0}", item.ShareFlags)); logWriter.AddLog(LogLevel.Information, string.Format("\tShare Capabilities: {0}", item.ShareCapabilities)); if (item.ShareType != ShareType_Values.SHARE_TYPE_DISK || item.ShareName.Contains("$")) continue; // Identify the shares for Oplock model if (item.ShareFlags.HasFlag(ShareFlags_Values.SHAREFLAG_FORCE_LEVELII_OPLOCK)) { if (item.ShareCapabilities.HasFlag(Share_Capabilities_Values.SHARE_CAP_SCALEOUT)) { detectionInfo.shareListWithForceLevel2AndSOFS.Add(item.ShareName); } else { detectionInfo.shareListWithForceLevel2WithoutSOFS.Add(item.ShareName); } } else { if (item.ShareCapabilities.HasFlag(Share_Capabilities_Values.SHARE_CAP_SCALEOUT)) { detectionInfo.shareListWithoutForceLevel2WithSOFS.Add(item.ShareName); } else { detectionInfo.shareListWithoutForceLevel2OrSOFS.Add(item.ShareName); } } } logWriter.AddLineToLog(LogLevel.Information); } return true; }