public void Reload() { string empedsPath = Path.Combine(device.ControlPath, EMPEDS_FOLDER.Replace('/', Path.DirectorySeparatorChar)); if (!Directory.Exists(empedsPath)) { // either this iPod hasn't had a Sport Kit attached to it, or // the control files have been nuked sportKits = new SportKit[0]; return; } // TODO: figure out how linkData works, and what bits to read to // get a list of emped ids string[] kitDirs = Directory.GetDirectories(empedsPath); List <SportKit> kits = new List <SportKit> (); foreach (string kitDir in kitDirs) { string kitId = Path.GetFileName(kitDir); SportKit kit = SportKit.Create(kitId, kitDir); if (kit != null) { kits.Add(kit); } } sportKits = kits.ToArray(); }
public static SportKit Create(string id, string sportKitPath) { if (!Directory.Exists (sportKitPath)) return null; if (!File.Exists (System.IO.Path.Combine (sportKitPath, CANARY_FILE))) return null; SportKit kit = null; try { kit = new SportKit (id, sportKitPath); kit.Reload (); } catch { return null; } return kit; }
public static SportKit Create(string id, string sportKitPath) { if (!Directory.Exists(sportKitPath)) { return(null); } if (!File.Exists(System.IO.Path.Combine(sportKitPath, CANARY_FILE))) { return(null); } SportKit kit = null; try { kit = new SportKit(id, sportKitPath); kit.Reload(); } catch { return(null); } return(kit); }