コード例 #1
0
        public virtual bool MatchesSearch(Dictionary <string, string> properties)
        {
            foreach (KeyValuePair <string, string> property in properties.ToArray())
            {
                properties.Remove(property.Key);
                switch (property.Key)
                {
                case "name":
                    if (!SearchComparator.CompareString(name, property.Value))
                    {
                        return(false);
                    }
                    break;

                case "description":
                    if (!description.Contains(property.Value))
                    {
                        return(false);
                    }
                    break;

                case "tags":
                    foreach (string tag in property.Value.Split(',', ' '))
                    {
                        if (string.IsNullOrEmpty(tag))
                        {
                            continue;
                        }

                        if (!tags.Contains(tag))
                        {
                            return(false);
                        }
                    }
                    break;

                // XXX: Add Verbs
                default:
                    properties[property.Key] = property.Value;
                    break;
                }
            }

            return(properties.Count == 0);
        }
コード例 #2
0
ファイル: Container.cs プロジェクト: qdoyonnas/AdventureDemo
        public override bool MatchesSearch(Dictionary <string, string> properties)
        {
            foreach (KeyValuePair <string, string> property in properties.ToArray())
            {
                properties.Remove(property.Key);
                switch (property.Key)
                {
                case "innerVolume":
                    if (!SearchComparator.CompareNumber(innerVolume, property.Value))
                    {
                        return(false);
                    }
                    break;

                case "filledVolume":
                    if (!SearchComparator.CompareNumber(filledVolume, property.Value))
                    {
                        return(false);
                    }
                    break;

                case "remainingVolume":
                    if (!SearchComparator.CompareNumber(remainingVolume, property.Value))
                    {
                        return(false);
                    }
                    break;

                case "contentCount":
                    if (!SearchComparator.CompareNumber(GetContentCount(), property.Value))
                    {
                        return(false);
                    }
                    break;

                default:
                    properties[property.Key] = property.Value;
                    break;
                }
            }

            return(base.MatchesSearch(properties));
        }
コード例 #3
0
        public override bool MatchesSearch(Dictionary <string, string> properties)
        {
            foreach (KeyValuePair <string, string> property in properties.ToArray())
            {
                properties.Remove(property.Key);
                switch (property.Key)
                {
                case "partCount":
                    if (!SearchComparator.CompareNumber(GetPartsCount(), property.Value))
                    {
                        return(false);
                    }
                    break;

                default:
                    properties[property.Key] = property.Value;
                    break;
                }
            }

            return(base.MatchesSearch(properties));
        }
コード例 #4
0
        public override bool MatchesSearch(Dictionary <string, string> properties)
        {
            foreach (KeyValuePair <string, string> property in properties.ToArray())
            {
                properties.Remove(property.Key);
                switch (property.Key)
                {
                case "volume":
                    if (!SearchComparator.CompareNumber(volume, property.Value))
                    {
                        return(false);
                    }
                    break;

                case "weight":
                    if (!SearchComparator.CompareNumber(weight, property.Value))
                    {
                        return(false);
                    }
                    break;

                case "totalWeight":
                    if (!SearchComparator.CompareNumber(GetWeight(true), property.Value))
                    {
                        return(false);
                    }
                    break;

                // XXX: Add Materials, Attachment Points
                default:
                    properties[property.Key] = property.Value;
                    break;
                }
            }

            return(base.MatchesSearch(properties));
        }