GetTwitterSearchNetworkConfiguration
        (
            out String searchTerm,
            out TwitterSearchNetworkAnalyzer.WhatToInclude whatToInclude,
            out Int32 maximumPeoplePerRequest,
            out String networkFileFolderPath,
            out NetworkFileFormats networkFileFormats,
            out Boolean automateNodeXLWorkbook
        )
        {
            AssertValid();
            Debug.Assert(m_oNetworkConfigurationXmlDocument != null);
            Debug.Assert(GetNetworkType() == NetworkType.TwitterSearch);

            XmlNode oTwitterSearchNetworkConfigurationNode =
                XmlUtil2.SelectRequiredSingleNode(
                    m_oNetworkConfigurationXmlDocument,
                    "/NetworkConfiguration/TwitterSearchNetworkConfiguration",
                    null);

            searchTerm = XmlUtil2.SelectRequiredSingleNodeAsString(
                oTwitterSearchNetworkConfigurationNode, "SearchTerm/text()", null);

            whatToInclude =
                GetRequiredEnumValue <TwitterSearchNetworkAnalyzer.WhatToInclude>(
                    oTwitterSearchNetworkConfigurationNode, "WhatToInclude/text()",
                    "WhatToInclude");

            GetTwitterCommonConfiguration(oTwitterSearchNetworkConfigurationNode,
                                          out maximumPeoplePerRequest, out networkFileFolderPath,
                                          out networkFileFormats, out automateNodeXLWorkbook);
        }
        StartAnalysis()
        {
            AssertValid();

            m_oGraphMLXmlDocument = null;

            Debug.Assert(m_oHttpNetworkAnalyzer is TwitterSearchNetworkAnalyzer);

            TwitterSearchNetworkAnalyzer.WhatToInclude eWhatToInclude =

                (m_bIncludeStatuses ?
                 TwitterSearchNetworkAnalyzer.WhatToInclude.Statuses : 0)
                |
                (m_bIncludeStatistics ?
                 TwitterSearchNetworkAnalyzer.WhatToInclude.Statistics : 0)
                |
                (m_bIncludeFollowedEdges ?
                 TwitterSearchNetworkAnalyzer.WhatToInclude.FollowedEdges : 0)
                |
                (m_bIncludeRepliesToEdges ?
                 TwitterSearchNetworkAnalyzer.WhatToInclude.RepliesToEdges : 0)
                |
                (m_bIncludeMentionsEdges ?
                 TwitterSearchNetworkAnalyzer.WhatToInclude.MentionsEdges : 0)
            ;

            ((TwitterSearchNetworkAnalyzer)m_oHttpNetworkAnalyzer).
            GetNetworkAsync(m_sSearchTerm, eWhatToInclude,
                            m_iMaximumPeoplePerRequest);
        }
        StartAnalysis()
        {
            AssertValid();

            m_oGraphMLXmlDocument = null;

            Debug.Assert(m_oHttpNetworkAnalyzer is TwitterSearchNetworkAnalyzer);

            TwitterSearchNetworkAnalyzer.WhatToInclude eWhatToInclude =

                (m_bExpandStatusUrls ?
                 TwitterSearchNetworkAnalyzer
                 .WhatToInclude.ExpandedStatusUrls : 0)
                |
                (m_bIncludeFriendEdges ?
                 TwitterSearchNetworkAnalyzer.WhatToInclude.FollowedEdges : 0)
            ;

            ((TwitterSearchNetworkAnalyzer)m_oHttpNetworkAnalyzer).
            GetNetworkAsync(m_sSearchTerm, eWhatToInclude, m_iMaximumStatuses);
        }
Пример #4
0
        GetTwitterSearchNetwork
        (
            DateTime oStartTime,
            String sNetworkConfigurationFilePath,
            NetworkConfigurationFileParser oNetworkConfigurationFileParser,
            out XmlDocument oXmlDocument,
            out String sNetworkFileFolderPath,
            out NetworkFileFormats eNetworkFileFormats,
            out Boolean bAutomateNodeXLWorkbook
        )
        {
            Debug.Assert(!String.IsNullOrEmpty(sNetworkConfigurationFilePath));
            Debug.Assert(oNetworkConfigurationFileParser != null);

            oXmlDocument            = null;
            sNetworkFileFolderPath  = null;
            eNetworkFileFormats     = NetworkFileFormats.None;
            bAutomateNodeXLWorkbook = false;

            String sSearchTerm = null;

            TwitterSearchNetworkAnalyzer.WhatToInclude eWhatToInclude =
                TwitterSearchNetworkAnalyzer.WhatToInclude.None;

            Int32 iMaximumPeoplePerRequest = Int32.MaxValue;

            try
            {
                oNetworkConfigurationFileParser.
                GetTwitterSearchNetworkConfiguration(out sSearchTerm,
                                                     out eWhatToInclude, out iMaximumPeoplePerRequest,
                                                     out sNetworkFileFolderPath, out eNetworkFileFormats,
                                                     out bAutomateNodeXLWorkbook);
            }
            catch (XmlException oXmlException)
            {
                // (This call exits the program.)

                OnNetworkConfigurationFileException(oXmlException);
            }

            TwitterSearchNetworkAnalyzer oTwitterSearchNetworkAnalyzer =
                new TwitterSearchNetworkAnalyzer();

            oTwitterSearchNetworkAnalyzer.ProgressChanged +=
                new ProgressChangedEventHandler(
                    HttpNetworkAnalyzer_ProgressChanged);

            Console.WriteLine(
                "Getting the Twitter Search network specified in \"{0}\".  The"
                + " search term is \"{1}\"."
                ,
                sNetworkConfigurationFilePath,
                sSearchTerm
                );

            try
            {
                oXmlDocument = oTwitterSearchNetworkAnalyzer.GetNetwork(
                    sSearchTerm, eWhatToInclude, iMaximumPeoplePerRequest);
            }
            catch (PartialNetworkException oPartialNetworkException)
            {
                oXmlDocument = OnGetNetworkPartialNetworkException(
                    oStartTime, oPartialNetworkException,
                    sNetworkConfigurationFilePath, sNetworkFileFolderPath,
                    oTwitterSearchNetworkAnalyzer);
            }
            catch (Exception oException)
            {
                // (This call exits the program.)

                OnGetNetworkOtherException(oStartTime, oException,
                                           sNetworkConfigurationFilePath, sNetworkFileFolderPath,
                                           oTwitterSearchNetworkAnalyzer);
            }
        }
        GetTwitterSearchNetworkConfiguration
        (
            out String searchTerm,
            out TwitterSearchNetworkAnalyzer.WhatToInclude whatToInclude,
            out Int32 maximumStatuses,
            out String networkFileFolderPath
        )
        {
            AssertValid();
            Debug.Assert(m_oNetworkConfigurationXmlDocument != null);
            Debug.Assert(GetNetworkType() == NetworkType.TwitterSearch);

            XmlNode oTwitterSearchNetworkConfigurationNode =
                XmlUtil2.SelectRequiredSingleNode(
                    m_oNetworkConfigurationXmlDocument,
                    "/NetworkConfiguration/TwitterSearchNetworkConfiguration",
                    null);

            searchTerm = XmlUtil2.SelectRequiredSingleNodeAsString(
                oTwitterSearchNetworkConfigurationNode, "SearchTerm/text()", null);

            if (!XmlUtil2.TrySelectSingleNodeAsInt32(
                    oTwitterSearchNetworkConfigurationNode,
                    "MaximumStatuses/text()", null, out maximumStatuses))
            {
                // Older versions of NodeXL used a MaximumPeoplePerRequest value,
                // which has been replaced with MaximumStatuses.  To avoid breaking
                // older configuration files, accept either one.

                try
                {
                    maximumStatuses = XmlUtil2.SelectRequiredSingleNodeAsInt32(
                        oTwitterSearchNetworkConfigurationNode,
                        "MaximumPeoplePerRequest/text()", null);
                }
                catch
                {
                    throw new XmlException(
                              "There must be a MaximumStatuses value.  (This was called"
                              + " MaximumPeoplePerRequest in previous versions of"
                              + " NodeXL.)"
                              );
                }
            }

            whatToInclude =
                GetRequiredEnumValue <TwitterSearchNetworkAnalyzer.WhatToInclude>(

                    oTwitterSearchNetworkConfigurationNode,
                    "WhatToInclude/text()",

                    // These WhatToInclude values were removed in version
                    // 1.0.1.328.  They are now automatically included in the
                    // network.   Old configuration files might still specify them,
                    // so they need to be ignored.

                    new String[] {
                "Statuses",
                "Statistics",
                "RepliesToEdges",
                "MentionsEdges",
                "NonRepliesToNonMentionsEdges",
            },

                    "None",
                    "WhatToInclude"
                    );

            GetCommonConfiguration(oTwitterSearchNetworkConfigurationNode,
                                   out networkFileFolderPath);
        }
Пример #6
0
        GetTwitterSearchNetwork
        (
            DateTime oStartTime,
            String sNetworkConfigurationFilePath,
            NetworkConfigurationFileParser oNetworkConfigurationFileParser,
            out XmlDocument oXmlDocument,
            out String sNetworkFileFolderPath
        )
        {
            Debug.Assert(!String.IsNullOrEmpty(sNetworkConfigurationFilePath));
            Debug.Assert(oNetworkConfigurationFileParser != null);

            oXmlDocument           = null;
            sNetworkFileFolderPath = null;

            String sSearchTerm = null;

            TwitterSearchNetworkAnalyzer.WhatToInclude eWhatToInclude =
                TwitterSearchNetworkAnalyzer.WhatToInclude.None;

            Int32 iMaximumTweets = Int32.MinValue;

            try
            {
                oNetworkConfigurationFileParser.
                GetTwitterSearchNetworkConfiguration(out sSearchTerm,
                                                     out eWhatToInclude, out iMaximumTweets,
                                                     out sNetworkFileFolderPath);
            }
            catch (XmlException oXmlException)
            {
                // (This call exits the program.)

                OnNetworkConfigurationFileException(oXmlException);
            }

            TwitterSearchNetworkAnalyzer oTwitterSearchNetworkAnalyzer =
                new TwitterSearchNetworkAnalyzer();

            SubscribeToProgressChangedEvent(oTwitterSearchNetworkAnalyzer);

            Console.WriteLine(
                "Getting the Twitter search network specified in \"{0}\".  The"
                + " search term is \"{1}\"."
                ,
                sNetworkConfigurationFilePath,
                sSearchTerm
                );

            try
            {
                oXmlDocument = oTwitterSearchNetworkAnalyzer.GetNetwork(
                    sSearchTerm, eWhatToInclude, iMaximumTweets);
            }
            catch (Exception oException)
            {
                // Note that this call might exit the program.

                oXmlDocument = OnGetNetworkException(oStartTime, oException,
                                                     sNetworkConfigurationFilePath, sNetworkFileFolderPath,
                                                     oTwitterSearchNetworkAnalyzer);
            }
        }