當前位置: 首頁>>代碼示例>>C#>>正文


C# Uri.GetHashCode方法代碼示例

本文整理匯總了C#中System.Uri.GetHashCode方法的典型用法代碼示例。如果您正苦於以下問題:C# Uri.GetHashCode方法的具體用法?C# Uri.GetHashCode怎麽用?C# Uri.GetHashCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Uri的用法示例。


在下文中一共展示了Uri.GetHashCode方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Test22URL

        public virtual void Test22URL()
        {
            DeleteBase("test.url.odb");

            var url1 = new Uri("http://google.com");
            var url2 = new Uri("http://nprogramming.wordpress.com");

            var h1 = url1.GetHashCode();
            var h2 = url2.GetHashCode();
            Println(h1 + " - " + h2);
            Println(url1.Host + " - " + url1.Port);
            Println(url2.Host + " - " + url2.Port);

            var odb = Open("test.url.odb");

            odb.Store(url1);
            odb.Store(url2);
            odb.Close();
            odb = Open("test.url.odb");
            var query = odb.Query<Uri>();
            var l = query.Execute<Uri>();

            var first = l.FirstOrDefault(x => x.AbsoluteUri == "http://google.com/");
            Assert.That(first, Is.Not.Null);

            var second = l.FirstOrDefault(x => x.AbsoluteUri == "http://nprogramming.wordpress.com/");
            Assert.That(second, Is.Not.Null);

            odb.Close();

            AssertEquals("Same HashCode Problem", 2, l.Count());
        }
開發者ID:danfma,項目名稱:NDB,代碼行數:32,代碼來源:TestDotNetObjects.cs

示例2: Db4oHistoryService

 public Db4oHistoryService(Uri baseUri, bool resume)
 {
     m_Resume = resume;
     m_Db = Db4oEmbedded.OpenFile(Db4oEmbedded.NewConfiguration(),
         "NCrawlerHist_{0}.Yap".FormatWith(baseUri.GetHashCode()));
     ClearHistory();
 }
開發者ID:osamede,項目名稱:social_listen,代碼行數:7,代碼來源:Db4oHistoryService.cs

示例3: EsentCrawlQueueService

        public EsentCrawlQueueService(Uri baseUri, bool resume)
        {
            m_DatabaseFileName = Path.GetFullPath("NCrawlQueue{0}\\Queue.edb".FormatWith(baseUri.GetHashCode()));

            if (!resume && File.Exists(m_DatabaseFileName))
            {
                ClearQueue();
            }

            m_EsentInstance = new EsentInstance(m_DatabaseFileName, (session, dbid) =>
                {
                    EsentTableDefinitions.CreateGlobalsTable(session, dbid);
                    EsentTableDefinitions.CreateQueueTable(session, dbid);
                });

            // Get columns
            m_EsentInstance.Cursor((session, dbid) =>
                {
                    Api.JetGetColumnInfo(session, dbid, EsentTableDefinitions.GlobalsTableName,
                        EsentTableDefinitions.GlobalsCountColumnName,
                        out queueCountColumn);
                    Api.JetGetColumnInfo(session, dbid, EsentTableDefinitions.QueueTableName,
                        EsentTableDefinitions.QueueTableDataColumnName,
                        out dataColumn);
                });
        }
開發者ID:osamede,項目名稱:social_listen,代碼行數:26,代碼來源:EsentCrawlQueueService.cs

示例4: EsentCrawlerHistoryService

		public EsentCrawlerHistoryService(Uri baseUri, bool resume)
		{
			m_Resume = resume;
			m_DatabaseFileName = Path.GetFullPath("NCrawlHist{0}\\Hist.edb".FormatWith(baseUri.GetHashCode()));

			if (!resume)
			{
				ClearHistory();
			}

			m_EsentInstance = new EsentInstance(m_DatabaseFileName, (session, dbid) =>
				{
					EsentTableDefinitions.CreateGlobalsTable(session, dbid);
					EsentTableDefinitions.CreateHistoryTable(session, dbid);
				});

			// Get columns
			m_EsentInstance.Cursor((session, dbid) =>
				{
					Api.JetGetColumnInfo(session, dbid, EsentTableDefinitions.GlobalsTableName,
						EsentTableDefinitions.GlobalsCountColumnName, out historyCountColumn);
					Api.JetGetColumnInfo(session, dbid, EsentTableDefinitions.HistoryTableName,
						EsentTableDefinitions.HistoryTableUrlColumnName, out historyUrlColumn);
				});
		}
開發者ID:senzacionale,項目名稱:ncrawler,代碼行數:25,代碼來源:EsentCrawlerHistoryService.cs

示例5: DbCrawlQueueService

		public DbCrawlQueueService(Uri baseUri, bool resume)
		{
			m_GroupId = baseUri.GetHashCode();
			if (!resume)
			{
				Clean();
			}
		}
開發者ID:peisheng,項目名稱:EASYFRAMEWORK,代碼行數:8,代碼來源:DbCrawlQueueService.cs

示例6: SqLiteCrawlerHistoryService

 public SqLiteCrawlerHistoryService(Uri uri, bool resume)
 {
     m_GroupId = uri.GetHashCode();
     if (!resume)
     {
         Clean();
     }
 }
開發者ID:bormaxi,項目名稱:NCrawler,代碼行數:8,代碼來源:SqLiteCrawlerHistoryService.cs

示例7: EfCrawlQueueService

 /// <summary>
 /// Initializes a new instance of the <see cref="EfCrawlQueueService"/> class.
 /// </summary>
 /// <param name="baseUri">Uri from which work is started.</param>
 /// <param name="resume">True to resume work, false otherwise.</param>
 public EfCrawlQueueService(Uri baseUri, bool resume)
 {
     this.groupId = baseUri.GetHashCode();
     if (!resume)
     {
         this.CleanQueue();
     }
 }
開發者ID:senzacionale,項目名稱:ncrawler,代碼行數:13,代碼來源:EfCrawlQueueService.cs

示例8: Db4oHistoryService

 public Db4oHistoryService(Uri baseUri, bool resume)
 {
     m_Db = Db4oEmbedded.OpenFile(Db4oEmbedded.NewConfiguration(),
         "NCrawlerHist_{0}.Yap".FormatWith(baseUri.GetHashCode()));
     if (!resume)
     {
         m_Db.Query<StringWrapper>().ForEach(entry => m_Db.Delete(entry));
     }
 }
開發者ID:fzhenmei,項目名稱:study,代碼行數:9,代碼來源:Db4oHistoryService.cs

示例9: EfCrawlerHistoryService

        /// <summary>
        /// Initializes a new instance of the <see cref="EfCrawlerHistoryService"/> class.
        /// </summary>
        /// <param name="uri">Uri from which work is started.</param>
        /// <param name="resume">True to resume work, false otherwise.</param>
        public EfCrawlerHistoryService(Uri uri, bool resume)
        {
            this.resume = resume;
            this.groupId = uri.GetHashCode();

            if (!this.resume)
            {
                this.CleanHistory();
            }
        }
開發者ID:senzacionale,項目名稱:ncrawler,代碼行數:15,代碼來源:EfCrawlerHistoryService.cs

示例10: Db4oQueueService

        public Db4oQueueService(Uri baseUri, bool resume)
        {
            string fileName = Path.GetFullPath("NCrawlerQueue_{0}.Yap".FormatWith(baseUri.GetHashCode()));
            m_Db = Db4oEmbedded.OpenFile(Db4oEmbedded.NewConfiguration(), fileName);

            if (!resume)
            {
                ClearQueue();
            }
        }
開發者ID:osamede,項目名稱:social_listen,代碼行數:10,代碼來源:Db4oQueueService.cs

示例11: Db4oQueueService

        public Db4oQueueService(Uri baseUri, bool resume)
        {
            m_Db = Db4oEmbedded.OpenFile(Db4oEmbedded.NewConfiguration(),
                "NCrawlerQueue_{0}.Yap".FormatWith(baseUri.GetHashCode()));

            if (!resume)
            {
                m_Db.Query<CrawlerQueueEntry>().ForEach(entry => m_Db.Delete(entry));
            }
        }
開發者ID:fzhenmei,項目名稱:study,代碼行數:10,代碼來源:Db4oQueueService.cs

示例12: Run

        public static void Run()
        {
            Console.Out.WriteLine("Simple crawl demo using local database a storage");

            var targetToCrawl = ConfigurationManager.AppSettings["CrawlTargetUrl"];
            var maximumThreadCount = int.Parse(ConfigurationManager.AppSettings["MaximumThreadCount"]);
            var maximumCrawlDepth = int.Parse(ConfigurationManager.AppSettings["MaximumCrawlDepth"]);

            // Setup crawler to crawl http://ncrawler.codeplex.com
            // with 1 thread adhering to robot rules, and maximum depth
            // of 2 with 4 pipeline steps:
            //	* Step 1 - The Html Processor, parses and extracts links, text and more from html
            //  * Step 2 - Processes PDF files, extracting text
            //  * Step 3 - Try to determine language based on page, based on text extraction, using google language detection
            //  * Step 4 - Dump the information to the console, this is a custom step, see the DumperStep class
            DbServicesModule.Setup(true);
            using (Crawler c = new Crawler(new Uri(targetToCrawl),
                new WholeHtmlProcessor(), // Process html
                new DumperStep())
            {
                // Custom step to visualize crawl
                MaximumThreadCount = maximumThreadCount,
                MaximumCrawlDepth = maximumCrawlDepth,
                ExcludeFilter = Program.ExtensionsToSkip,
            })
            {
                AspectF.Define.Do<NCrawlerEntitiesDbServices>(e =>
                {
                    if (e.CrawlQueue.Any())
                    {
                        var uri = new Uri(targetToCrawl);
                        
                        var groupId = uri.GetHashCode();
                        Console.Out.WriteLine("GroupId=" + groupId);
                        e.ExecuteStoreCommand("Update CrawlQueue set Exclusion='false' where GroupId={0} and Exclusion='true'", groupId);
                        //var exclusion = e.CrawlQueue.Where(m => m.Exclusion && m.GroupId == groupId).ToList();
                        //if (exclusion.Any())
                        //{
                        //    Console.Out.WriteLine("Count with Exclusion=" + exclusion.Count);
                        //    exclusion.ForEach(m => m.Exclusion = false);
                        //}
                        ////foreach (var crawlQueue in e.CrawlQueue)
                        ////{
                        ////    crawlQueue.Exclusion = false;
                        ////}
                        //e.SaveChanges();
                    }
                });
                // Begin crawl
                Console.Out.WriteLine(" Begin crawl");
                c.Crawl();
            }
        }
開發者ID:GBmono,項目名稱:GBmonoV1.0,代碼行數:53,代碼來源:CrawlUsingDbStorage.cs

示例13: CouchbaseNode

        public CouchbaseNode(CouchbaseRestConfiguration config, Uri uri)
        {
            _config = config;
            Id = uri.GetHashCode();
            Uri = uri;
            _builder = new UrlBuilder(uri);
            ErrorAge = DateTime.UtcNow;

            //The first time a request is made to a URI, the ServicePointManager
            //will create a ServicePoint to manage connections to a particular host
            ServicePointManager.FindServicePoint(Uri).SetTcpKeepAlive(true, 300, 30);
        }
開發者ID:Jroland,項目名稱:couchbase-net-rest,代碼行數:12,代碼來源:CouchbaseNode.cs

示例14: GetBackTXRequest

 protected BackgroundTransferRequest GetBackTXRequest(string src,string tag)
 {
     Uri src_uri = new Uri(src, UriKind.Absolute);
     Uri dst_uri = new Uri("shared\\transfers\\temp"+src_uri.GetHashCode()+".mp3", UriKind.Relative);
     BackgroundTransferRequest back_req = new BackgroundTransferRequest(src_uri, dst_uri);
     back_req.Tag = tag;
     bool use_cellular = false;
     IsolatedStorageSettings.ApplicationSettings.TryGetValue("use_cellular", out use_cellular);
     if (use_cellular)
         back_req.TransferPreferences = TransferPreferences.AllowCellularAndBattery;
     else
         back_req.TransferPreferences = TransferPreferences.AllowBattery;
     return back_req;
 }
開發者ID:ahmeda8,項目名稱:audio-youtube-wp7,代碼行數:14,代碼來源:FileDownloader.cs

示例15: GetImage

        public void GetImage(Uri uri, Action<byte[]> callback)
        {
            var fileName = cachePath + "Smeedee_img" + uri.GetHashCode();

            if (File.Exists(fileName))
            {
                var bytes = fileReader.ReadAllBytes(fileName);
                if (IsMissingImagePlaceholder(bytes))
                    bytes = null;
                callback(bytes);
            } else
            {
                serviceToCache.GetImage(uri, bytes => SaveAndCallback(bytes, fileName, callback));
            }
        }
開發者ID:Smeedee,項目名稱:Smeedee-Mobile,代碼行數:15,代碼來源:DiskCachedImageService.cs


注:本文中的System.Uri.GetHashCode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。