GetNetworkInternal ( StatusCriteria oStatusCriteria, Boolean bExpandStatusUrls, String sGraphServerUserName, String sGraphServerPassword, RequestStatistics oRequestStatistics ) { Debug.Assert(oStatusCriteria != null); Debug.Assert(!String.IsNullOrEmpty(sGraphServerUserName)); Debug.Assert(!String.IsNullOrEmpty(sGraphServerPassword)); Debug.Assert(oRequestStatistics != null); AssertValid(); GraphServiceClient oClient = new GraphServiceClient( GetWcfServiceBinding(), new EndpointAddress(GraphServiceUrl)); Byte [] abtZippedGraphML; // There are two ways to get the network: With a maximum status date, // and with a maximum number of statuses. if (oStatusCriteria.HasDateRange) { abtZippedGraphML = oClient.GetTwitterSearchNetworkAsZippedGraphML( oStatusCriteria.SearchTerm, oStatusCriteria.MinimumStatusDateUtc, oStatusCriteria.MaximumStatusDateUtc, bExpandStatusUrls, sGraphServerUserName, sGraphServerPassword ); } else { abtZippedGraphML = oClient.GetTwitterSearchNetworkAsZippedGraphML2( oStatusCriteria.SearchTerm, oStatusCriteria.MaximumStatusDateUtc, oStatusCriteria.MaximumStatusesGoingBackward, bExpandStatusUrls, sGraphServerUserName, sGraphServerPassword ); } String sGraphML = ZipUtil.UnzipOneTextFile(abtZippedGraphML); abtZippedGraphML = null; XmlDocument oXmlDocument = new XmlDocument(); // Note: When the DotNetZip library used by ZipUtil unzips the GraphML, // it includes a BOM as the first character. Remove that character. oXmlDocument.LoadXml(sGraphML.Substring(1)); return(oXmlDocument); }
GetNetworkInternal ( String sSearchTerm, DateTime oMinimumStatusDateUtc, DateTime oMaximumStatusDateUtc, Boolean bExpandStatusUrls, String sGraphServerUserName, String sGraphServerPassword, RequestStatistics oRequestStatistics ) { Debug.Assert( !String.IsNullOrEmpty(sSearchTerm) ); Debug.Assert(oMaximumStatusDateUtc >= oMinimumStatusDateUtc); Debug.Assert( !String.IsNullOrEmpty(sGraphServerUserName) ); Debug.Assert( !String.IsNullOrEmpty(sGraphServerPassword) ); Debug.Assert(oRequestStatistics != null); AssertValid(); GraphServiceClient oClient = new GraphServiceClient( GetWcfServiceBinding(), new EndpointAddress(GraphServiceUrl) ); Byte [] abtZippedGraphML = oClient.GetTwitterSearchNetworkAsZippedGraphML( sSearchTerm, oMinimumStatusDateUtc, oMaximumStatusDateUtc, bExpandStatusUrls, sGraphServerUserName, sGraphServerPassword); String sGraphML = ZipUtil.UnzipOneTextFile(abtZippedGraphML); abtZippedGraphML = null; XmlDocument oXmlDocument = new XmlDocument(); // Note: When the DotNetZip library used by ZipUtil unzips the GraphML, // it includes a BOM as the first character. Remove that character. oXmlDocument.LoadXml( sGraphML.Substring(1) ); return (oXmlDocument); }