Abstract base class for classes that analyze network information obtained via HTTP Web requests.
This base class implements properties related to HTTP Web requests, a BackgroundWorker instance, and properties, methods, and events related to the BackgroundWorker. The derived class must implement a method to start an analysis and implement the BackgroundWorker_DoWork method.
Inheritance: Object
コード例 #1
0
    //*************************************************************************
    //  Constructor: GraphDataProviderDialogBase()
    //
    /// <summary>
    /// Initializes a new instance of the <see
    /// cref="GraphDataProviderDialogBase" /> class.
    /// </summary>
    ///
    /// <param name="httpNetworkAnalyzer">
    /// Object that does most of the work.
    /// </param>
    //*************************************************************************

    public GraphDataProviderDialogBase
    (
        HttpNetworkAnalyzerBase httpNetworkAnalyzer
    )
    {
        Debug.Assert(httpNetworkAnalyzer != null);

        this.ShowInTaskbar = false;
        m_oGraphMLXmlDocument = null;

        m_oHttpNetworkAnalyzer = httpNetworkAnalyzer;

        m_oHttpNetworkAnalyzer.ProgressChanged +=
            new ProgressChangedEventHandler(
                HttpNetworkAnalyzer_ProgressChanged);

        m_oHttpNetworkAnalyzer.AnalysisCompleted +=
            new RunWorkerCompletedEventHandler(
                HttpNetworkAnalyzer_AnalysisCompleted);

        // AssertValid();
    }
コード例 #2
0
        //*************************************************************************
        //  Constructor: GraphDataProviderDialogBase()
        //
        /// <summary>
        /// Initializes a new instance of the <see
        /// cref="GraphDataProviderDialogBase" /> class.
        /// </summary>
        ///
        /// <param name="httpNetworkAnalyzer">
        /// Object that does most of the work.
        /// </param>
        //*************************************************************************

        public GraphDataProviderDialogBase
        (
            HttpNetworkAnalyzerBase httpNetworkAnalyzer
        )
        {
            Debug.Assert(httpNetworkAnalyzer != null);

            this.ShowInTaskbar    = false;
            m_oGraphMLXmlDocument = null;

            m_oHttpNetworkAnalyzer = httpNetworkAnalyzer;

            m_oHttpNetworkAnalyzer.ProgressChanged +=
                new ProgressChangedEventHandler(
                    HttpNetworkAnalyzer_ProgressChanged);

            m_oHttpNetworkAnalyzer.AnalysisCompleted +=
                new RunWorkerCompletedEventHandler(
                    HttpNetworkAnalyzer_AnalysisCompleted);

            // AssertValid();
        }
コード例 #3
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);
    }
コード例 #4
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);
    }