Handle missing ManufacturerNameMapping data from settings.json
This commit is contained in:
parent
797f6166a9
commit
70f3b7df68
2 changed files with 7 additions and 5 deletions
|
|
@ -62,15 +62,16 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
string folderName = Path.GetFileName(manufacturerDirectory.TrimEnd(new[] { '/', '\\' }));
|
||||
|
||||
foreach(ManufacturerNameMapping nameMapping in manufacturerNameMappings)
|
||||
// Set manufacturer name to the directory name
|
||||
this.manufacturer = Path.GetFileName(manufacturerDirectory);
|
||||
|
||||
// Override the manufacturer name if a manufacturerNameMappings exists
|
||||
foreach (ManufacturerNameMapping nameMapping in manufacturerNameMappings)
|
||||
{
|
||||
if(nameMapping.NameOnDisk == folderName)
|
||||
{
|
||||
this.manufacturer = nameMapping.NameToDisplay;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.manufacturer = Path.GetFileName(manufacturerDirectory);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ namespace MatterHackers.MatterControl.SettingsManagement
|
|||
string pathToOemSettings = Path.Combine(".", "OEMSettings", "Settings.json");
|
||||
File.WriteAllText(pathToOemSettings, JsonConvert.SerializeObject(this, Formatting.Indented));
|
||||
#endif
|
||||
this.ManufacturerNameMappings = new List<ManufacturerNameMapping>();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue