public void CheckForDefaultGPS(GPSProfileList list, MainWindow win) { string defName = this.GPSProf; string defType = this.Get("/apps/ocm/gps/type", null) as string; if (defName == null && defType != null) { // Check for legacy GPS Config (pre 0.23) or use Garmin GPX as // default config. GPSProfile profile = new GPSProfile(); profile.Name = "Default"; profile.CacheLimit = (int) this.Get("/apps/ocm/gps/limit", -1); profile.BabelFormat = this.Get("/apps/ocm/gps/type", "OCM_GPX") as string; string nm = this.Get("/apps/ocm/gps/namemode", WaypointNameMode.CODE.ToString()) as string; profile.NameMode = (WaypointNameMode) Enum.Parse(typeof(WaypointNameMode), nm); string dm = this.Get("/apps/ocm/gps/descmode", WaypointDescMode.DESC.ToString()) as string; profile.DescMode = (WaypointDescMode) Enum.Parse(typeof(WaypointDescMode), dm); profile.LogLimit = (int) this.Get("/apps/ocm/gps/loglimit", -1); profile.IncludeAttributes = (bool) this.Get("/apps/ocm/gps/incattr", false); profile.OutputFile = this.Get("/apps/ocm/gps/file", "/media/GARMIN/Garmin/GPX/geocaches.gpx") as string; if (profile.BabelFormat == "delgpx") profile.FieldNotesFile = "/media/EM_USERMAPS/FieldNotes.txt"; else if (profile.BabelFormat == "OCM_GPX") profile.FieldNotesFile = "/media/GARMIN/Garmin/geocache_visits.txt"; UpgradeWaypointMappings(profile); list.AddProfile(profile); GPSProf = profile.Name; win.RebuildProfEditMenu(list); win.RebuildProfilesMenu(list); //Cleanup legacy keys UnsetKey("/apps/ocm/gps/limit"); UnsetKey("/apps/ocm/gps/type"); UnsetKey("/apps/ocm/gps/namemode"); UnsetKey("/apps/ocm/gps/descmode"); UnsetKey("/apps/ocm/gps/loglimit"); UnsetKey("/apps/ocm/gps/incattr"); UnsetKey("/apps/ocm/gps/file"); } }