public ItemStack(SerializationInfo info, StreamingContext context) { bool b = info.GetBoolean("is_produced"); if (Main.saveVersionFromDisk >= 14) { string i = info.GetString("item_id"); if (b) { industry = GameRegistry.GetIndustryByID(i); item = industry.industryItem; } else { item = GameRegistry.GetItemByID(i); } } else { int i = info.GetInt32("item_id"); if (b) { #pragma warning disable CS0612 // Type or member is obsolete industry = GameRegistry.GetIndustryByID(i); #pragma warning restore CS0612 // Type or member is obsolete item = industry.industryItem; } else { #pragma warning disable CS0612 // Type or member is obsolete item = GameRegistry.GetItemByID(i); #pragma warning restore CS0612 // Type or member is obsolete } } stackSize = info.GetInt32("stacksize"); int num; if (info.GetBoolean("relic")) { num = info.GetInt32("relicDataSize"); relicData = new List <RelicInfo>(); for (int o = 0; o < num; o++) { relicData.Add((RelicInfo)info.GetValue("relicData_" + o, typeof(RelicInfo))); } } antiquity = info.GetInt32("antiquity"); numTimesUsedOnQuest = info.GetInt32("numTimesUsedOnQuest"); isIDedByPlayer = info.GetBoolean("isIDedByPlayer"); num = info.GetInt32("enchantsSize"); enchants = new List <Enchantment>(); for (int o = 0; o < num; o++) { if (Main.saveVersionFromDisk >= 15) { enchants.Add(GameRegistry.GetEnchantmentByID(info.GetString("enchants_" + o))); } else { enchants.Add(GameRegistry.GetEnchantmentByID(info.GetInt32("enchants_" + o))); } } enchants.RemoveAll(x => x == null); if (Main.saveVersionFromDisk >= 6) { wasAddedByJourneyman = info.GetBoolean("wasAddedByJourneyman"); } if (Main.saveVersionFromDisk >= 21) { addedToInvenTime = DateTime.Parse(info.GetString("addedToInvenTime")); } }