From f3ae83afb51b4ee7bdb9dcd7c756035c7fa19b37 Mon Sep 17 00:00:00 2001 From: stulzq Date: Sun, 19 Aug 2018 16:47:01 +0800 Subject: [PATCH] add use stream method --- binding/c#/IP2Region/DBSearcher.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/binding/c#/IP2Region/DBSearcher.cs b/binding/c#/IP2Region/DBSearcher.cs index b99dba8..72b2566 100644 --- a/binding/c#/IP2Region/DBSearcher.cs +++ b/binding/c#/IP2Region/DBSearcher.cs @@ -23,7 +23,7 @@ namespace IP2Region /// /// db file access handler /// - private FileStream _raf = null; + private Stream _raf = null; /// /// header blocks buffer @@ -75,6 +75,18 @@ namespace IP2Region public DbSearcher(string dbFile) : this(null, dbFile) { } + public DbSearcher(DbConfig dbConfig, Stream dbFileStream) + { + if (_dbConfig == null) + { + _dbConfig = dbConfig; + } + + _raf = dbFileStream; + } + + public DbSearcher(Stream dbFileStream) : this(null, dbFileStream) { } + #region Sync Methods /// /// Get the region with a int ip address with memory binary search algorithm.