private void SaveData() { using (FileStream stream = File.Open(SAVE_FILE, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None)) using (var bw = new BinaryWriter(stream)) { bw.Write(CFG_VERSION); // TODO: Save last OpenFileDialog path bw.Write(true); // App.ExtremeMode bw.Write(inputPath.Text); int confCount = configStack.Children.Count - 1; bw.Write(confCount); if (confCount > 0) { foreach (ColorItemCast cc in ForeachColorItemCast()) { IReadOnlyFilterConfig conf = cc.GetFilterConfig; bw.Write(conf.UseRangeColor); bw.Write(conf.FromColor.R); bw.Write(conf.FromColor.G); bw.Write(conf.FromColor.B); bw.Write(conf.ToColor.R); bw.Write(conf.ToColor.G); bw.Write(conf.ToColor.B); bw.Write(conf.ItemName); } } } }
public void AddFilterConfig(IReadOnlyFilterConfig filter) => filterConfigs.Add(filter);