public override void Print(System.IO.StreamWriter writer)
 {
     Section.WriteTitle(writer, "Strange Hats");
     int cnt = 0;
     foreach (Item i in OrderedList)
     {
         double percent = Math.Round(((double)cnt) * 100 / ((double)Items.Keys.Count));
         Console.WriteLine("Progress: Item {0} of {1} (" + percent + "%)", cnt + 1, Items.Keys.Count);
         List<String> attribs = new List<string>();
         attribs.AddIfNotNull(i.PaintName);
         attribs.AddRangeIfNotNull(i.StrangeParts);
         if (i.IsGifted)
             attribs.Add("Gifted");
         //pretty print the item
         String item = TF2PricerMain.FormatItem(i, true, Items[i], attribs.ToArray());
         Price paint = null;
         Price[] parts = new Price[3] { null, null, null };
         if (i.PaintName != null)
             paint = TF2PricerMain.PriceSchema.GetPaintPrice(i[Item.Paint]);
         if (i.StrangeParts != null)
         {
             for(int partCount = 0; partCount < 3; ++partCount)
             {
                 parts[partCount] = TF2PricerMain.PriceSchema.GetPartPrice(i[Item.StrangePart1 + partCount]);
             }
         }
         Price p = TF2PricerMain.PriceSchema.GetPrice(i);
         //so write the item, then follow up with the bp.tf prices
         Console.WriteLine(item + "\n");
         if(paint != null || i.StrangeParts != null)
             Console.WriteLine("Original: " + p.ToString());
         if (paint != null)
         {
             Console.WriteLine("Paint: " + paint.ToString());
             p += paint;
         }
         if (i.StrangeParts != null)
         {
             int partNo = 0;
             foreach (String part in i.StrangeParts)
             {
                 Console.WriteLine(part + ": " + parts[partNo].ToString());
                 p += parts[partNo];
                 ++partNo;
             }
         }
         Console.WriteLine("Price: " + p.ToString());
         TF2PricerMain.GetInputPrice(item, writer, p.LowPrice, p.HighPrice);
         cnt++;
     }
 }
        public void BuildPriceList()
        {
            /*WebRequest request = WebRequest.Create("http://backpack.tf/api/IGetPrices/v3/?format=json&key="+TF2PricerMain.GetBackpackTFKey());
            WebResponse response = request.GetResponse();
            Stream data = response.GetResponseStream();*/
            string returnedJSON = String.Empty;
            String data = "bptf.txt";
            using (StreamReader sr = new StreamReader(data))
            {
                returnedJSON = sr.ReadToEnd();
            }

            JObject bptfRaw = JObject.Parse(returnedJSON);
            JObject itemPriceListRaw = bptfRaw["response"]["prices"].Value<JObject>();
            foreach (KeyValuePair<String, JToken> itemEntry in itemPriceListRaw)
            {
                int defIndex = Convert.ToInt32(itemEntry.Key);
                foreach (JProperty qualityEntry in itemEntry.Value)
                {
                    if (qualityEntry.Name == "alt_defindex") //no idea what the hell this does
                        continue;
                    Quality quality = (Quality)Enum.Parse(typeof(Quality), qualityEntry.Name);

                    //now we view each effect.
                    //normal stuff appears as 0, some weird stuff like 4 like the sparkle lugers, unusuals have their own ones
                    foreach (JProperty effectItem in qualityEntry.Value)
                    {
                        ItemPricingTemplate priceTemplate = new ItemPricingTemplate();
                        priceTemplate.DefIndex = defIndex;
                        priceTemplate.Quality = quality;
                        priceTemplate.Effect = Convert.ToInt32(effectItem.Name);
                        Price p = new Price();
                        double low = effectItem.Value["current"]["value"].Value<double>();
                        double high = low;
                        if (effectItem.Value["current"]["value_high"] != null)
                            high = effectItem.Value["current"]["value_high"].Value<double>();

                        //now convert into ref
                        String currType = effectItem.Value["current"]["currency"].Value<String>();
                        switch (currType)
                        {
                            case "keys":
                                p.LowRefinedPrice = low * Price.KeyPrice;
                                p.HighRefinedPrice = high * Price.KeyPrice;
                                break;
                            case "metal":
                                p.LowRefinedPrice = low;
                                p.HighRefinedPrice = high;
                                break;
                            case "earbuds":
                                p.LowRefinedPrice = low * Price.KeyPrice * Price.BudsPrice;
                                p.HighRefinedPrice = high * Price.KeyPrice * Price.BudsPrice;
                                break;
                            case "usd": //seems to be both unusuals and refined
                                p.LowRefinedPrice = low / Price.RefPrice;
                                p.HighRefinedPrice = high / Price.RefPrice;
                                break;
                            default:
                                System.Diagnostics.Debugger.Break();
                                break;
                        }
                        PriceList.Add(priceTemplate.ToString(), p);
                    }
                }
                //System.Diagnostics.Debugger.Break();
            }
            //try struct
            string json = JsonConvert.SerializeObject(this, Formatting.Indented);
            /*new
            {
                ItemSchema = Schema.ItemSchema,
                UnusualNames = Schema.UnusualNames,
                PaintIDs = Schema.PaintIDs,
                PaintNames = Schema.PaintNames,
                StrangePartNames = Schema.StrangePartNames,
                DefaultVintageLevels = Schema.DefaultVintageLevels
            });*/

            using (StreamWriter writer = new StreamWriter(TF2PricerMain.PriceLocation))
                writer.Write(json);
        }