当前位置: 首页>>代码示例>>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;未经允许,请勿转载。