예제 #1
0
    public static AlchemyItemInstance[] Craft(IEnumerable <AlchemyItemInstance> inputItems, AlchemyItemInstance RejectItem)
    {
        foreach (var s in all.Where(x => x.output == null).ToArray())
        {
            _all.Remove(s);
        }
        var satisfy = all.Where(r =>
                                r.input.Length == inputItems.Count() &&
                                r.input.Intersect(inputItems.Select(i => i.type)).Count() == r.input.Count()
                                );
        int count = satisfy.Count();

        if (count > 0)
        {
            var complexity = satisfy.Max(i => i.input.Length);

            TagBag b = new TagBag();
            foreach (var input in inputItems)
            {
                b.UnionWith(input.tags);
                b.UnionWith(input.type.Tags);
            }
            foreach (var s in satisfy.Where(x => x.output == null))
            {
                Debug.LogError(s, s);
            }
            return(satisfy.Where(i => i.input.Length == complexity).Select(i => new AlchemyItemInstance()
            {
                type = i.output, tags = b
            }).ToArray());
        }
        return(new AlchemyItemInstance[] { RejectItem });
    }
예제 #2
0
 public void IndexedByUri()
 {
     var english = LanguageTag.English;
     var tags = new TagBag();
     tags.Add(english);
     Assert.AreEqual(english, tags[english.Uri]);
     Assert.AreEqual(english, tags[english.Uri.ToUpperInvariant()]);
     Assert.AreEqual(english, tags[english.Uri.ToLowerInvariant()]);
 }
예제 #3
0
 /// <summary>
 ///   Creates a new instance of the <see cref="VEvent"/> class with the default
 ///   values.
 /// </summary>
 public VEvent()
 {
     Id = Guid.NewGuid().ToString();
     Classification = AccessClassification.Public;
     RecurrenceDates = new List<Date>(0);
     ExcludedDates = new List<Date>(0);
     Categories = new TagBag();
     RequestStatuses = new List<RequestStatus>(0);
     Attendees = new List<Attendee>();
     Contacts = new List<Contact>(0);
     Resources = new List<Text>(0);
     Attachments = new List<CalendarAttachment>(0);
     Relationships = new List<RelationshipReference>(0);
 }
예제 #4
0
    public bool ResolveQuery(TagBag tags)
    {
        var B = oporations[_oporator].Invoke(tags.GetAmount(tag), value);

        return(!invert && B || invert && !B);
    }