예제 #1
0
        public static List<ProductInfo> CreateFromCollection(JArray coll)
        {
            List<ProductInfo> infos = new List<ProductInfo>();

            foreach (JArray o in coll)
            {
                ProductInfo info = new ProductInfo();
                if (string.IsNullOrEmpty((string)o[24]))
                {
                    Console.Error.WriteLine("Game {0} ({1}) does not have branch ID, skipping", o[0], o[1]);
                    continue;
                }
                info.GameId = (int)o[0];
                info.BranchId = (int)o[24];
                info.Name = (string)o[1];
                info.Slug = (string)o[2];
                infos.Add(info);
            }

            return infos;
        }
예제 #2
0
파일: Program.cs 프로젝트: gab/DesuraDumper
 static void RefreshProductWithDownloads(ProductInfo product, WebClient wc)
 {
     var downloads = GetDownloads (product.Slug, product.BranchId, wc);
     foreach (var info in downloads) {
         NamePlatformStringTuple existing = product.Downloads.Find (t => t.Name == info.Item1 && t.Platform == info.Item2);
         if (existing != null)
             product.Downloads.Remove (existing);
         product.Downloads.Add (new NamePlatformStringTuple (info.Item1, info.Item2));
     }
 }
예제 #3
0
파일: Program.cs 프로젝트: gab/DesuraDumper
        static void AddKeysToProduct(ProductInfo product, WebClient wc)
        {
            // Get keys
            string keysPage = wc.DownloadString (string.Format ("http://www.desura.com/games/{0}/keys", product.Slug));
            CQ csqKeys = keysPage;
            CQ kSearch = csqKeys ["span.price:contains(Select),span.price:contains(Get)"];
            foreach (var kSpanE in kSearch) {
                CQ kSpan = kSpanE.Cq ();
                CQ parentSpan = kSpan.Closest ("span.buy.clear");
                // Get key name
                string keyType = kSpan.Parent ().Find (".action").Text ();
                CQ infoBlock = parentSpan.Find (".buycontent .heading.clear");
                string keyName = infoBlock.Children ().Eq (0).Text ();
                string name = string.Format ("{0} ({1})", keyName, keyType);
                // Get key
                string key = kSpan.Text () == "Select" ? parentSpan.Find (".summary [name=\"key\"]").Attr ("value") : string.Format ("Reveal key at http://www.desura.com/games/{0}/keys", product.Slug);

                product.Keys.Add (new NameKeyStringTuple (name, key));
            }
        }