Ejemplo n.º 1
0
        public static List <Framework.Data.LogImage> GetLogImages(Framework.Data.LogImageCollection lCollection, Framework.Data.LogCollection logCollection, string GeocacheCode)
        {
            List <Framework.Data.LogImage> result = new List <Framework.Data.LogImage>();
            List <Framework.Data.Log>      logs   = GetLogs(logCollection, GeocacheCode);

            foreach (Framework.Data.Log l in logs)
            {
                result.AddRange(lCollection.GetLogImages(l.ID));
            }
            return(result);
        }
Ejemplo n.º 2
0
        public static List <Framework.Data.LogImage> GetLogImages(Framework.Data.LogImageCollection lCollection, string logId)
        {
            //grouping
            return(lCollection.GetLogImages(logId));

            /*
             * List<Framework.Data.LogImage> result = null;
             *
             * result = (from Framework.Data.LogImage l in lCollection
             *        where l.LogID == logId
             *        select l).ToList();
             *
             * return result;
             * */
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
 public static Framework.Data.LogImage GetLogImage(Framework.Data.LogImageCollection lCollection, string lId)
 {
     return(lCollection.GetLogImage(lId));
 }
Ejemplo n.º 5
0
        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();
            }
        }