Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }