Exemplo n.º 1
0
 private static void QueueAndChangeFilename(ref string path, PebbleApp app, WatchHardware hardware, string name)
 {
     if (path != null)
     {
         if (path.Length > 2)
         {
             string save   = CreateFilename(name, hardware, app);
             string newUrl = "%rootUrl%files/" + app.id + "/" + hardware.ToString() + "/" + name;
             Program.AddWebAsset(save, path);
             path = newUrl;
         }
     }
 }
Exemplo n.º 2
0
        public static PebbleApp[] GetPage(int offset, WatchHardware hardware, FetchType type, int limit = 100)
        {
            //Create a GET request here and get the data.
            string url = "https://api2.getpebble.com/v2/apps/collection/all/" + type.ToString().Replace('_', '-') + "?platform=all&hardware=" + hardware.ToString() + "&filter_hardware=false&image_ratio=1&limit=" + limit.ToString() + "&offset=" + offset.ToString();
            //Request
            string raw = DoGetRequest(url);

            //Save
            SaveAsset(savePath + "raw_pages\\" + type.ToString() + "_" + hardware.ToString() + "_" + offset.ToString() + ".json", Encoding.UTF8.GetBytes(raw));
            //Deserialize JSON.
            PebbleApp_Page page = (PebbleApp_Page)DeserializeObject(raw, typeof(PebbleApp_Page));

            //Extract data and return it
            return(page.data);
        }
Exemplo n.º 3
0
 private static string CreateFilename(string name, WatchHardware hardware, PebbleApp app)
 {
     return(Program.savePath + "files\\" + app.id + "\\" + hardware.ToString() + "\\" + name);
 }
Exemplo n.º 4
0
        public static void SeekEntireType(FetchType type)
        {
            int platform = 0;

            while (platform < 5)
            {
                //Ran for each platform
                WatchHardware hw = (WatchHardware)platform;
                Console.WriteLine("Getting apps for " + type.ToString() + " on hardware " + hw.ToString());
                //Get apps and add them
                foreach (PebbleApp app in GetAppsForHardware(type, hw))
                {
                    UpdateApp(app, hw);
                }
                platform++;
            }
        }