コード例 #1
0
        public ItemSearch(string name, ISearchEngine searchEngine, Price maximumBuyout, bool autoWhisper, bool ignoreNoBuyout)
        {
            Name           = name;
            SearchEngine   = searchEngine;
            MaximumBuyout  = maximumBuyout;
            AutoWhisper    = autoWhisper;
            IgnoreNoBuyout = ignoreNoBuyout;

            SearchEngine.OfferedItemFound += item => {
                if (Configuration.Current.ItemConfiguration.SeenItemIds.Contains(item.Id))
                {
                    return;
                }
                Configuration.Current.ItemConfiguration.SeenItemIds.Add(item.Id);

                if (IgnoreNoBuyout && item.Buyout.IsEmpty())
                {
                    return;
                }

                if (item.Buyout.IsEmpty() || item.Buyout.ApproximateValue <= MaximumBuyout.ApproximateValue)
                {
                    ItemFound?.Invoke(this, item);
                }
            };
        }
コード例 #2
0
        public List <string> Search(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentException("path to directory is not valid");
            }
            SearchStarted?.Invoke();
            var items = new List <string>();

            try
            {
                foreach (var item in GetFiles(path))
                {
                    var itemFoundArgs = new ItemFoundArgs(item);
                    if (Filter(item))
                    {
                        FilteredItemFound?.Invoke(this, itemFoundArgs);
                    }
                    else
                    {
                        ItemFound?.Invoke(this, itemFoundArgs);
                    }
                    if (itemFoundArgs.RemoveItemFromResult && itemFoundArgs.EndSearch)
                    {
                        break;
                    }
                    if (itemFoundArgs.RemoveItemFromResult)
                    {
                        continue;
                    }
                    items.Add(item);
                    if (itemFoundArgs.EndSearch)
                    {
                        break;
                    }
                }
                return(items);
            }
            finally
            {
                SearchFinished?.Invoke();
            }
        }
コード例 #3
0
ファイル: OctopartAPI.cs プロジェクト: jorticus/Datasheets2
 private void OnItemFound(SearchResult item)
 {
     ItemFound?.Invoke(this, new ItemFoundEventArgs(item));
 }
コード例 #4
0
ファイル: SearchManager.cs プロジェクト: jorticus/Datasheets2
 private void Provider_ItemFound(object sender, ItemFoundEventArgs e)
 {
     numItemsFound++;
     ItemFound?.Invoke(sender, e);
 }
コード例 #5
0
ファイル: FindStrip.cs プロジェクト: Azzammi/Invoice-OTC
 protected virtual void OnItemFound(ItemFoundEventArgs e)
 {
     //Report Find results
     ItemFound?.Invoke(this, e);
 }
コード例 #6
0
 public void TriggerItemFound(long player, long item, int quantity)
 {
     ItemFound?.Invoke(player, item, quantity);
 }