예제 #1
0
        /// <summary>
        /// Get a list of exchanges that are available to make this item
        /// </summary>
        public InventoryRecipe[] GetRecipes()
        {
            if (string.IsNullOrEmpty(this.ExchangeSchema))
            {
                return(null);
            }

            var parts = this.ExchangeSchema.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            return(parts.Select(x => InventoryRecipe.FromString(x, this)).ToArray());
        }
        internal static InventoryRecipe FromString(string part, InventoryDef Result)
        {
            var r = new InventoryRecipe
            {
                Result = Result
            };

            var parts = part.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            r.Ingredients = parts.Select(x => Ingredient.FromString(x)).Where(x => x.DefinitionId != 0).ToArray();
            return(r);
        }
예제 #3
0
 public InventoryRecipe[] GetRecipes()
 {
     InventoryRecipe[] array;
     if (!String.IsNullOrEmpty(this.ExchangeSchema))
     {
         string[] strArray = this.ExchangeSchema.Split(new Char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
         array = (
             from x in strArray
             select InventoryRecipe.FromString(x, this)).ToArray <InventoryRecipe>();
     }
     else
     {
         array = null;
     }
     return(array);
 }