internal static InventoryRecipe.Ingredient FromString(string part) { InventoryRecipe.Ingredient ingredient; InventoryRecipe.Ingredient ingredient1 = new InventoryRecipe.Ingredient() { Count = 1 }; try { if (part.Contains("x")) { int num = part.IndexOf('x'); int num1 = 0; if (Int32.TryParse(part.Substring(num + 1), out num1)) { ingredient1.Count = num1; } part = part.Substring(0, num); } ingredient1.DefinitionId = Int32.Parse(part); ingredient1.Definition = SteamInventory.FindDefinition(ingredient1.DefinitionId); } catch (Exception exception) { ingredient = ingredient1; return(ingredient); } ingredient = ingredient1; return(ingredient); }
internal static Ingredient FromString(string part) { var i = new Ingredient(); i.Count = 1; try { if (part.Contains("x")) { var idx = part.IndexOf('x'); int count = 0; if (int.TryParse(part.Substring(idx + 1), out count)) { i.Count = count; } part = part.Substring(0, idx); } i.DefinitionId = int.Parse(part); i.Definition = SteamInventory.FindDefinition(i.DefinitionId); } catch (System.Exception) { return(i); } return(i); }