コード例 #1
0
ファイル: MainForm.cs プロジェクト: VenomsLust/SkyrimAlchemy
 /// <summary>
 /// Gets a list of Ingredients that have a matching effect to the supplied Effect, lees the supplied Ingredient
 /// </summary>
 /// <param name="ingredient">Ingredient to exclude from the search results</param>
 /// <param name="effect">Effect to match</param>
 /// <returns>A List of matching Ingredients</returns>
 private List<Ingredient> GetMatchingIngredients( Ingredient ingredient, Effect effect )
 {
     List<Ingredient> ingredients = ( from i in _skyDB.Ingredients
                                      where i != ingredient &&
                                      ( i.Effect1 == effect ||
                                      i.Effect2 == effect ||
                                      i.Effect3 == effect ||
                                      i.Effect4 == effect )
                                      orderby i.Name
                                      select i ).ToList();
     return ingredients;
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: VenomsLust/SkyrimAlchemy
 /// <summary>
 /// Finds a matching Ingredient in the supplied ListBox
 /// </summary>
 /// <param name="lst">ListBox to scan</param>
 /// <param name="ingredient">Ingredient to check against</param>
 /// <returns>Matching Index, -1 if none</returns>
 private int FindMatch( ListBox lst, Ingredient ingredient )
 {
     for( int i = 0; lst.Items.Count > i; ++i ) {
         if( (Ingredient)lst.Items[i] == ingredient ) {
             return i;
         }
     }
     return -1;
 }