示例#1
0
        public KJBibleCollection GetVerses(string words, TestamentType testament, int limit = 30)
        {
            var col = new KJBibleCollection();

            string[] split    = words.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Distinct().ToArray();
            string   sentence = string.Join(" ", split).Trim();

            if (string.IsNullOrWhiteSpace(sentence))
            {
                return(col);
            }
            foreach (var data in KJBibleHelper.GetBibleDataInfo())
            {
                if (split.All(i => data.Value.StringContains(i, StringComparison.OrdinalIgnoreCase)))
                {
                    var item = CreateBibleItem(data);
                    if (testament.HasFlag(item.Book.Testament))
                    {
                        if (col.Count <= limit)
                        {
                            col.Add(item);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            return(col);
        }
示例#2
0
        public KJBibleCollection GetQuotations(string bookName, int chapterNum, int verseFromNum, int verseToNum)
        {
            var defs = KJBibleHelper.GenerateBookDefs(bookName, chapterNum, verseFromNum, verseToNum);
            var col  = new KJBibleCollection();

            foreach (var data in KJBibleHelper.GetBibleDataInfo())
            {
                foreach (var def in defs)
                {
                    if (def.Key == data.Key)
                    {
                        var item = CreateBibleItem(def.Value, data);
                        col.Add(item);
                    }
                }
            }
            return(col);
        }