protected void addCacheAttribute(int id, string name) { Framework.Data.GeocacheAttribute attr = new Framework.Data.GeocacheAttribute(); attr.ID = id; attr.Name = name; Core.GeocacheAttributes.Add(attr); }
public static Framework.Data.GeocacheAttribute GetGeocacheAttribute(Framework.Data.GeocacheAttributeCollection ltCollection, int typeId) { Framework.Data.GeocacheAttribute result = null; result = (from gt in ltCollection where gt.ID == (int)Math.Abs(typeId) select gt).FirstOrDefault(); if (result == null) { //take special ID result = (from gt in ltCollection where gt.ID == 0 select gt).FirstOrDefault(); } return(result); }
public string GetImagePath(Framework.Data.ImageSize imageSize, Framework.Data.GeocacheAttribute attr, Framework.Data.GeocacheAttribute.State state) { string result; string fn; string ext; if (attr.ID < 100) { ext = "gif"; } else { //above 100 = opencaching.de ext = "png"; } if (state == Framework.Data.GeocacheAttribute.State.Yes) { fn = string.Format("{0}.{1}", attr.ID, ext); } else if (state == Framework.Data.GeocacheAttribute.State.No) { fn = string.Format("_{0}.{1}", attr.ID, ext); } else { return(null); } result = Path.Combine(new string[] { _baseImagePath, imageSize.ToString(), "attributes", fn }); if (!File.Exists(result)) { if (imageSize != Framework.Data.ImageSize.Default) { result = Path.Combine(new string[] { _baseImagePath, imageSize.ToString(), "attributes", fn }); if (!File.Exists(result)) { result = null; } } else { result = null; } } return(result); }
public string GetImagePath(Framework.Interfaces.ICore core, Framework.Data.ImageSize imageSize, Framework.Data.GeocacheAttribute attr, Framework.Data.GeocacheAttribute.State state) { string result = null; foreach (Framework.Interfaces.IImageResource ir in _imageResourcePlugins) { result = ir.GetImagePath(imageSize, attr, state); if (!string.IsNullOrEmpty(result)) { break; } } if (result == null && imageSize != Framework.Data.ImageSize.Default) { result = GetImagePath(core, Framework.Data.ImageSize.Default, attr, state); } else if (string.IsNullOrEmpty(result)) { //select default result = GetDefaultImagePath(imageSize); } return(result); }
public Engine() { try { _settingsProvider = new SettingsProvider(null); string[] args = Environment.GetCommandLineArgs(); if (EnablePluginDataPathAtStartup || (args != null && args.Contains("/f"))) { using (SelectSettingsForm dlg = new SelectSettingsForm(this)) { _pluginDataFolderSelected = dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK; } } else { _pluginDataFolderSelected = true; } if (_pluginDataFolderSelected) { _geocachingAccountNames = new Framework.Data.GeocachingAccountNames(); var p = _settingsProvider.GetSettingsValueStringCollection("Core.GeocachingAccountNames", null); if (p != null) { foreach (string s in p) { string[] parts = s.Split("|".ToArray(), 2); if (parts.Length == 2) { _geocachingAccountNames.SetAccountName(parts[0], parts[1]); } } } _geocachingAccountNames.Changed += new Framework.EventArguments.GeocachingAccountNamesEventHandler(_geocachingAccountNames_Changed); _geocachingComAccount = new Framework.Data.GeocachingComAccountInfo(); _geocachingComAccount.AccountName = _settingsProvider.GetSettingsValue("Core.GCComAccountName", null); _geocachingComAccount.APIToken = _settingsProvider.GetSettingsValue("Core.GCComAccountToken", null); _geocachingComAccount.APITokenStaging = _settingsProvider.GetSettingsValue("Core.GCComAccountTokenStaging", null); _geocachingComAccount.MemberType = _settingsProvider.GetSettingsValue("Core.GCComAccountMemberType", null); _geocachingComAccount.MemberTypeId = _settingsProvider.GetSettingsValueInt("Core.GCComAccountMemberTypeId", 0); _geocachingComAccount.Changed += new Framework.EventArguments.GeocacheComAccountEventHandler(_geocachingComAccount_Changed); GeocachingAccountNames.SetAccountName("GC", _settingsProvider.GetSettingsValue("Core.GCComAccountName", null) ?? ""); _logs = new Framework.Data.LogCollection(); _userWaypoints = new Framework.Data.UserWaypointCollection(); _waypoints = new Framework.Data.WaypointCollection(); _geocaches = new Framework.Data.GeocacheCollection(this); _logImages = new Framework.Data.LogImageCollection(); _geocacheImages = new Framework.Data.GeocacheImageCollection(); _geocacheAttributes = new Framework.Data.GeocacheAttributeCollection(); _geocacheTypes = new Framework.Data.GeocacheTypeCollection(); _geocacheContainers = new Framework.Data.GeocacheContainerCollection(); _logTypes = new Framework.Data.LogTypeCollection(); _waypointTypes = new Framework.Data.WaypointTypeCollection(); _homeLocation = new Framework.Data.Location(); _centerLocation = new Framework.Data.Location(); _gpsLocation = new Framework.Data.GPSLocation(); _languageItems = new Framework.Data.LanguageItemCollection(); _detectedPlugins = new List<string>(); _internalStoragePlugins = new List<string>(); _selectedLanguage = System.Globalization.CultureInfo.CurrentCulture; _plugins = new List<Framework.Interfaces.IPlugin>(); _currentDomain = AppDomain.CurrentDomain; _currentDomain.AssemblyResolve += new ResolveEventHandler(LoadFromSameFolder); //set initial data //default location settings _centerLocation.SetLocation(_settingsProvider.GetSettingsValueDouble("Core.CenterLat", 51.5), _settingsProvider.GetSettingsValueDouble("Core.CenterLon", 5.5)); _centerLocation.Changed += new Framework.EventArguments.LocationEventHandler(_centerLocation_Changed); _homeLocation.SetLocation(_settingsProvider.GetSettingsValueDouble("Core.HomeLat", 51.5), _settingsProvider.GetSettingsValueDouble("Core.HomeLon", 5.5)); _homeLocation.Changed += new Framework.EventArguments.LocationEventHandler(_homeLocation_Changed); //default (unknown) cache- ,container etc. types. Position 0 means unknown Framework.Data.GeocacheType ct = new Framework.Data.GeocacheType(); ct.ID = 0; ct.Name = "Not present"; _geocacheTypes.Add(ct); Framework.Data.GeocacheAttribute attr = new Framework.Data.GeocacheAttribute(); attr.ID = 0; attr.Name = "Unknown"; _geocacheAttributes.Add(attr); Framework.Data.GeocacheContainer cont = new Framework.Data.GeocacheContainer(); cont.ID = 0; cont.Name = "Unknown"; _geocacheContainers.Add(cont); Framework.Data.LogType lt = new Framework.Data.LogType(); lt.ID = 0; lt.Name = "Unknown"; lt.AsFound = false; _logTypes.Add(lt); Framework.Data.WaypointType wpt = new Framework.Data.WaypointType(); wpt.ID = 0; wpt.Name = "Unknown"; _waypointTypes.Add(wpt); _shortcuts = new List<Framework.Data.ShortcutInfo>(); } } catch { RestoreDefaultSettings(); } }
public string GetImagePath(Framework.Data.ImageSize imageSize, Framework.Data.GeocacheAttribute attr, Framework.Data.GeocacheAttribute.State state) { return(null); }
public Engine() { try { _settingsProvider = new SettingsProvider(null); string[] args = Environment.GetCommandLineArgs(); if (EnablePluginDataPathAtStartup || (args != null && args.Contains("/f"))) { using (SelectSettingsForm dlg = new SelectSettingsForm(this)) { _pluginDataFolderSelected = dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK; } } else { _pluginDataFolderSelected = true; } if (_pluginDataFolderSelected) { _geocachingAccountNames = new Framework.Data.GeocachingAccountNames(); var p = _settingsProvider.GetSettingsValueStringCollection("Core.GeocachingAccountNames", null); if (p != null) { foreach (string s in p) { string[] parts = s.Split("|".ToArray(), 2); if (parts.Length == 2) { _geocachingAccountNames.SetAccountName(parts[0], parts[1]); } } } _geocachingAccountNames.Changed += new Framework.EventArguments.GeocachingAccountNamesEventHandler(_geocachingAccountNames_Changed); _geocachingComAccount = new Framework.Data.GeocachingComAccountInfo(); _geocachingComAccount.AccountName = _settingsProvider.GetSettingsValue("Core.GCComAccountName", null); _geocachingComAccount.APIToken = _settingsProvider.GetSettingsValue("Core.GCComAccountToken", null); _geocachingComAccount.APITokenStaging = _settingsProvider.GetSettingsValue("Core.GCComAccountTokenStaging", null); _geocachingComAccount.MemberType = _settingsProvider.GetSettingsValue("Core.GCComAccountMemberType", null); _geocachingComAccount.MemberTypeId = _settingsProvider.GetSettingsValueInt("Core.GCComAccountMemberTypeId", 0); _geocachingComAccount.Changed += new Framework.EventArguments.GeocacheComAccountEventHandler(_geocachingComAccount_Changed); GeocachingAccountNames.SetAccountName("GC", _settingsProvider.GetSettingsValue("Core.GCComAccountName", null) ?? ""); _logs = new Framework.Data.LogCollection(); _userWaypoints = new Framework.Data.UserWaypointCollection(); _waypoints = new Framework.Data.WaypointCollection(); _geocaches = new Framework.Data.GeocacheCollection(this); _logImages = new Framework.Data.LogImageCollection(); _geocacheImages = new Framework.Data.GeocacheImageCollection(); _geocacheAttributes = new Framework.Data.GeocacheAttributeCollection(); _geocacheTypes = new Framework.Data.GeocacheTypeCollection(); _geocacheContainers = new Framework.Data.GeocacheContainerCollection(); _logTypes = new Framework.Data.LogTypeCollection(); _waypointTypes = new Framework.Data.WaypointTypeCollection(); _homeLocation = new Framework.Data.Location(); _centerLocation = new Framework.Data.Location(); _gpsLocation = new Framework.Data.GPSLocation(); _languageItems = new Framework.Data.LanguageItemCollection(); _detectedPlugins = new List <string>(); _internalStoragePlugins = new List <string>(); _selectedLanguage = System.Globalization.CultureInfo.CurrentCulture; _plugins = new List <Framework.Interfaces.IPlugin>(); _currentDomain = AppDomain.CurrentDomain; _currentDomain.AssemblyResolve += new ResolveEventHandler(LoadFromSameFolder); //set initial data //default location settings _centerLocation.SetLocation(_settingsProvider.GetSettingsValueDouble("Core.CenterLat", 51.5), _settingsProvider.GetSettingsValueDouble("Core.CenterLon", 5.5)); _centerLocation.Changed += new Framework.EventArguments.LocationEventHandler(_centerLocation_Changed); _homeLocation.SetLocation(_settingsProvider.GetSettingsValueDouble("Core.HomeLat", 51.5), _settingsProvider.GetSettingsValueDouble("Core.HomeLon", 5.5)); _homeLocation.Changed += new Framework.EventArguments.LocationEventHandler(_homeLocation_Changed); //default (unknown) cache- ,container etc. types. Position 0 means unknown Framework.Data.GeocacheType ct = new Framework.Data.GeocacheType(); ct.ID = 0; ct.Name = "Not present"; _geocacheTypes.Add(ct); Framework.Data.GeocacheAttribute attr = new Framework.Data.GeocacheAttribute(); attr.ID = 0; attr.Name = "Unknown"; _geocacheAttributes.Add(attr); Framework.Data.GeocacheContainer cont = new Framework.Data.GeocacheContainer(); cont.ID = 0; cont.Name = "Unknown"; _geocacheContainers.Add(cont); Framework.Data.LogType lt = new Framework.Data.LogType(); lt.ID = 0; lt.Name = "Unknown"; lt.AsFound = false; _logTypes.Add(lt); Framework.Data.WaypointType wpt = new Framework.Data.WaypointType(); wpt.ID = 0; wpt.Name = "Unknown"; _waypointTypes.Add(wpt); _shortcuts = new List <Framework.Data.ShortcutInfo>(); } } catch { RestoreDefaultSettings(); } }