public async Task AddAsync(Profile profile) { ProfileList.Add(profile); await SaveAsync(); }
public async Task AddAsync(ProfileType profileType, string name, System.Version version, string launchArgs = "") { ProfileList.Add(new Profile(profileType, name, version, launchArgs)); await SaveAsync(); }
protected virtual void AddProfile(ProfileBase Profile) { profiles.Add(Profile); }
public bool UpdateProfiles(List <Profile> newset, int poweronindex) // true reload - Current is invalid if true, must reload to new profile { List <Profile> toberemoved = new List <Profile>(); foreach (Profile p in ProfileList) { Profile c = newset.Find(x => x.Id == p.Id); if (c == null) // if newset does not have this profile ID { toberemoved.Add(p); } else { // existing in both, update System.Diagnostics.Debug.WriteLine("Update ID " + p.Id); p.Name = c.Name; // update name and condition p.TripCondition = c.TripCondition; p.BackCondition = c.BackCondition; } } bool removedcurrent = false; foreach (Profile p in toberemoved) { if (Object.ReferenceEquals(Current, p)) { removedcurrent = true; } System.Diagnostics.Debug.WriteLine("Delete ID " + p.Id); EliteDangerousCore.DB.UserDatabase.Instance.DeleteKey(ProfilePrefix(p.Id) + "%"); // all profiles string ProfileList.Remove(p); } foreach (Profile p in newset.Where((p) => p.Id == -1)) { int[] curids = (from x in ProfileList select x.Id).ToArray(); int id = DefaultId + 1; for (; id < 10000; id++) { if (Array.IndexOf(curids, id) == -1) { break; } } System.Diagnostics.Debug.WriteLine("Make ID " + id); p.Id = id; ProfileList.Add(p); } poweronindex = poweronindex >= 0 ? poweronindex : 0; EliteDangerousCore.DB.UserDatabase.Instance.PutSettingInt("ProfilePowerOnID", ProfileList[poweronindex].Id); PowerOn = ProfileList[poweronindex]; SaveProfiles(); History.Clear(); // because an ID may have gone awol return(removedcurrent); }
public void Add(IProfile p) { ProfileList.Add(p); }