コード例 #1
0
ファイル: KJBibleBookDef.cs プロジェクト: prince272/biblenet
 public KJBibleBookDef(string bookName, string abbreviation1, string abbreviation2, TestamentType testamentType)
 {
     this.bookName      = bookName;
     this.abbreviation1 = abbreviation1;
     this.abbreviation2 = abbreviation2;
     this.testamentType = testamentType;
 }
コード例 #2
0
ファイル: KJBible.cs プロジェクト: prince272/biblenet
        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);
        }