public static GetOutputFilePath ( System.DateTime startTime, String networkConfigurationFilePath, String networkFileFolderPath, String fileNamePrefix, String extension ) : String | ||
startTime | System.DateTime | |
networkConfigurationFilePath | String | |
networkFileFolderPath | String | |
fileNamePrefix | String | |
extension | String | |
리턴 | String |
SaveNetworkToGraphML ( DateTime oStartTime, XmlDocument oXmlDocument, String sNetworkConfigurationFilePath, String sNetworkFileFolderPath ) { Debug.Assert(oXmlDocument != null); Debug.Assert(!String.IsNullOrEmpty(sNetworkConfigurationFilePath)); Debug.Assert(!String.IsNullOrEmpty(sNetworkFileFolderPath)); // Sample network file path: // // C:\NetworkConfiguration_2010-06-01_02-00-00.graphml String sNetworkFilePath = FileUtil.GetOutputFilePath(oStartTime, sNetworkConfigurationFilePath, sNetworkFileFolderPath, String.Empty, "graphml"); Console.WriteLine( "Saving the network to the GraphML file \"{0}\"." , sNetworkFilePath ); try { // Don't allow sharing. This is so the GraphMLFileProcessor // program won't be able to process the file while it is still // being written. using (FileStream fileStream = File.Open(sNetworkFilePath, FileMode.Create, FileAccess.Write, FileShare.None)) { oXmlDocument.Save(fileStream); } } catch (IOException oIOException) { Exit(ExitCode.SaveNetworkFileError, "The file couldn't be saved. Details:\r\n\r\n" + oIOException.Message ); } }
OnGetNetworkPartialNetworkException ( DateTime oStartTime, PartialNetworkException oPartialNetworkException, String sNetworkConfigurationFilePath, String sNetworkFileFolderPath, HttpNetworkAnalyzerBase oHttpNetworkAnalyzerBase ) { Debug.Assert(oPartialNetworkException != null); Debug.Assert(!String.IsNullOrEmpty(sNetworkConfigurationFilePath)); Debug.Assert(!String.IsNullOrEmpty(sNetworkFileFolderPath)); Debug.Assert(oHttpNetworkAnalyzerBase != null); // Write a text file to let the user know that a partial network was // obtained. // // Sample file path: // // C:\PartialNetwork_NetworkConfiguration_2010-06-01_02-00-00.txt String sFilePath = FileUtil.GetOutputFilePath(oStartTime, sNetworkConfigurationFilePath, sNetworkFileFolderPath, "PartialNetworkInfo_", "txt"); using (StreamWriter oStreamWriter = new StreamWriter(sFilePath)) { Debug.Assert(oHttpNetworkAnalyzerBase != null); oStreamWriter.WriteLine(oPartialNetworkException.ToMessage( oHttpNetworkAnalyzerBase.ExceptionToMessage( oPartialNetworkException.RequestStatistics. LastUnexpectedException) )); } return(oPartialNetworkException.PartialNetwork); }
OnGetNetworkOtherException ( DateTime oStartTime, Exception oException, String sNetworkConfigurationFilePath, String sNetworkFileFolderPath, HttpNetworkAnalyzerBase oHttpNetworkAnalyzerBase ) { Debug.Assert(oException != null); Debug.Assert(!String.IsNullOrEmpty(sNetworkConfigurationFilePath)); Debug.Assert(!String.IsNullOrEmpty(sNetworkFileFolderPath)); Debug.Assert(oHttpNetworkAnalyzerBase != null); // Sample error file path: // // C:\Error_NetworkConfiguration_2010-06-01_02-00-00.txt String sErrorFilePath = FileUtil.GetOutputFilePath(oStartTime, sNetworkConfigurationFilePath, sNetworkFileFolderPath, "Error_", "txt"); String sErrorMessage = "The network couldn't be obtained. Details:" + "\r\n\r\n" + oHttpNetworkAnalyzerBase.ExceptionToMessage(oException) ; using (StreamWriter oStreamWriter = new StreamWriter(sErrorFilePath)) { Debug.Assert(oHttpNetworkAnalyzerBase != null); oStreamWriter.WriteLine(sErrorMessage); } Exit(ExitCode.CouldNotGetNetwork, sErrorMessage); }