コード例 #1
0
ファイル: PoiType.cs プロジェクト: richardhyy/Charlotte
        public PoiType(string csvContent)
        {
            string[] lines = csvContent.Replace("\r", "").Split('\n');
            foreach (string line in lines)
            {
                if (line == "")
                {
                    continue;
                }

                string[] categories = line.Split(',');
                if (categories.Length != 4)
                {
                    continue;
                }

                if (!_typeCategoryDict.ContainsKey(categories[0]))
                {
                    PoiCategory category = new PoiCategory();
                    category.BigCategory = categories[1];
                    category.MidCategory = categories[2];
                    category.SubCategory = categories[3];
                    _typeCategoryDict.Add(categories[0], category);
                }
            }
        }
コード例 #2
0
ファイル: PoiType.cs プロジェクト: richardhyy/Charlotte
        public Dictionary <string, PoiCategory> GetTypeByCategoryKeyword(string keyword)
        {
            Dictionary <string, PoiCategory> result = new Dictionary <string, PoiCategory>();

            foreach (KeyValuePair <string, PoiCategory> keyValuePair in _typeCategoryDict)
            {
                PoiCategory category = keyValuePair.Value;
                if (category.BigCategory.Contains(keyword) || category.MidCategory.Contains(keyword) ||
                    category.SubCategory.Contains(keyword))
                {
                    result.Add(keyValuePair.Key, keyValuePair.Value);
                }
            }

            return(result);
        }