public bool ChangeToId(int id)
        {
            int indexof = ProfileList.FindIndex(x => x.Id == id);

            if (indexof >= 0 && id != Current.Id)
            {
                Current = ProfileList[indexof];
                History.Push(Current.Id);
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public void LoadProfiles(string selectprofile)
        {
            string     profiles    = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingString("ProfileIDs", "0");
            List <int> profileints = profiles.RestoreIntListFromString(1, 0); // default is length 1, value 0

            foreach (int profileid in profileints)
            {
                StringParser sp = new StringParser(EliteDangerousCore.DB.UserDatabase.Instance.GetSettingString(ProfilePrefix(profileid) + "Settings", ""));

                string name          = sp.NextQuotedWordComma();
                string tripcondition = sp.NextQuotedWordComma();
                string backcondition = sp.NextQuotedWord();

                if (name != null && tripcondition != null && backcondition != null)
                {
                    Profile p = new Profile(profileid, name, tripcondition, backcondition);
                    System.Diagnostics.Debug.WriteLine("Profile {0} {1} {2}", name, tripcondition, backcondition);
                    ProfileList.Add(p);
                }
            }

            if (ProfileList.Count == 0)
            {
                ProfileList.Add(new Profile(DefaultId, "Default", "Condition AlwaysFalse", "Condition AlwaysFalse"));
            }

            int curid = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingInt("ProfilePowerOnID", DefaultId);

            if (selectprofile != null)
            {
                int found = ProfileList.FindIndex(x => x.Name.Equals(selectprofile, StringComparison.InvariantCultureIgnoreCase));
                if (found >= 0)
                {
                    curid = ProfileList[found].Id;
                }
            }

            PowerOn = Current = ProfileList.Find(x => x.Id == curid) ?? ProfileList[0];
            History.Push(Current.Id);
        }
 public int IndexOf(int id)
 {
     return(ProfileList.FindIndex(x => x.Id == id));
 }