Better convey that ChangeID expects a deviceToken param

- Avoid recovery - use PrinterSettings.LoadFile rather than ProfileManager.LoadProfile
This commit is contained in:
John Lewin 2016-08-10 09:38:36 -07:00
parent 893b9db70e
commit 72deb94de3

View file

@ -444,23 +444,23 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public bool MarkedForDelete { get; set; } = false; public bool MarkedForDelete { get; set; } = false;
public string SHA1 { get; set; } public string SHA1 { get; set; }
public void ChangeID(string newID) public void ChangeID(string deviceToken)
{ {
if (ActiveSliceSettings.Instance.ID == this.ID) if (ActiveSliceSettings.Instance.ID == this.ID)
{ {
ActiveSliceSettings.Instance.ID = newID; ActiveSliceSettings.Instance.ID = deviceToken;
} }
string existingProfile = ProfilePath; string existingProfile = ProfilePath;
if (File.Exists(existingProfile)) if (File.Exists(existingProfile))
{ {
this.ID = newID; this.ID = deviceToken;
File.Move(existingProfile, ProfilePath); File.Move(existingProfile, ProfilePath);
} }
var profile = ProfileManager.LoadProfile(newID); var profile = PrinterSettings.LoadFile(ProfilePath);
profile.ID = newID; profile.ID = deviceToken;
profile.SetValue(SettingsKey.device_token, newID); profile.SetValue(SettingsKey.device_token, deviceToken);
ProfileManager.Instance.Save(); ProfileManager.Instance.Save();
} }