public void Save() { chocoExecutor.SaveSettings(Settings); if (ChocolateyFeatures.Count != origionalChocolateyFeatures.Length) { throw new NotSupportedException(); } for (int i = 0; i < ChocolateyFeatures.Count; i++) { if (origionalChocolateyFeatures[i] != ChocolateyFeatures[i].IsEnabled) { chocoExecutor.SaveFeature(ChocolateyFeatures[i]); } } origionalChocolateyFeatures = ChocolateyFeatures.Select(f => f.IsEnabled).ToArray(); for (int i = 0; i < HotChocolateyFeatures.Count; i++) { if (origionalHotChocolateyFeatures[i] != HotChocolateyFeatures[i].IsEnabled) { hotChocolateyFeatures.SaveFeature(HotChocolateyFeatures[i]); } } origionalHotChocolateyFeatures = HotChocolateyFeatures.Select(f => f.IsEnabled).ToArray(); }
public void Load() { Settings = chocoExecutor.LoadSettings(); var chocolateyFeatures = chocoExecutor.LoadFeatures(); origionalChocolateyFeatures = chocolateyFeatures.Select(f => f.IsEnabled).ToArray(); ChocolateyFeatures.ClearAndAddRange(chocolateyFeatures); var loadedHotChocolateyFeatures = hotChocolateyFeatures.LoadFeatures(); origionalHotChocolateyFeatures = loadedHotChocolateyFeatures.Select(f => f.IsEnabled).ToArray(); HotChocolateyFeatures.ClearAndAddRange(loadedHotChocolateyFeatures); }