public static void DeleteProfile(ProfileModel prof)
{
// Remove from datastore
lock (Profiles)
{
// Get the profile from the datastore instead of just the provided value, to be certain it is removed
var dsProfile = Profiles.FirstOrDefault(p => p.GameName == prof.GameName &&
p.Name == prof.Name &&
p.KeyboardSlug == prof.KeyboardSlug);
if (dsProfile != null)
Profiles.Remove(dsProfile);
}
// Remove the file
var path = ProfileFolder + $@"\{prof.KeyboardSlug}\{prof.GameName}\{prof.Name}.json";
if (File.Exists(path))
File.Delete(path);
}
}