Better convey that ChangeID expects a deviceToken param
- Avoid recovery - use PrinterSettings.LoadFile rather than ProfileManager.LoadProfile
This commit is contained in:
parent
893b9db70e
commit
72deb94de3
1 changed files with 6 additions and 6 deletions
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue