Validate settings against properties.json rather than BaseLayer

- Fixes #699
This commit is contained in:
John Lewin 2016-04-30 18:18:15 -07:00
parent c0c21a065e
commit fa0e3e3107
2 changed files with 19 additions and 7 deletions

View file

@ -48,6 +48,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
using SettingsDictionary = Dictionary<string, string>;
using DataStorage;
using Agg.PlatformAbstract;
using Newtonsoft.Json.Linq;
public class SettingsProfile
{
private static string configFileExtension = "slice";
@ -94,12 +95,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
}
}
public bool InBaseConfig(string name)
{
//Check whether the default settings (layer 0) contain a settings definition
return BaseLayer.ContainsKey(name);
}
internal void RunInTransaction(Action<SettingsProfile> action)
{
// TODO: Implement RunInTransaction
@ -911,6 +906,23 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public string Model => layeredProfile.GetValue("MatterControl.Model");
HashSet<string> knownSettings = null;
public HashSet<string> KnownSettings
{
get
{
if (knownSettings == null)
{
string propertiesJson = StaticData.Instance.ReadAllText(Path.Combine("SliceSettings", "Properties.json"));
var settingsData = JArray.Parse(propertiesJson);
knownSettings = new HashSet<string>(settingsData.Select(s => s["SlicerConfigName"].Value<string>()));
}
return knownSettings;
}
}
public string ManualMovementSpeeds()
{
return layeredProfile.GetValue("MatterControl.ManualMovementSpeeds");