async void LoadConfig(string FileName) { FI SaveConfigs = new FI(); SaveConfigs.LoadFile(FileName); FI.CategoryData CurrentCategory = new FI.CategoryData("MainWindow Data", 0); this.Left = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, "Location X"); this.Top = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, "Location Y"); AudioSourceCombobox.SelectedIndex = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, "Audio Source Index"); RefreshRateCombobox.SelectedIndex = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, "Refresh rate Index"); var tasks = new List <Task>(); int Count = VisualizerStack.Count; for (int i = 0; i < Count; i++) { var task = VisualizerStack[i].PerformClose(); tasks.Add(task); } await Task.WhenAll(tasks); CurrentCategory = new FI.CategoryData("Visualizer Window", 0); while (SaveConfigs.IsAnyMoreInCat(CurrentCategory)) { VisualizerControl NewWindow = new VisualizerControl(this); NewWindow.Left = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, "Location X"); NewWindow.Top = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, "Location Y"); NewWindow.Width = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, "Width"); NewWindow.Height = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, "Height"); NewWindow.VisualSamples = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, "Visual Samples"); NewWindow.Smoothness = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, "Smoothness"); NewWindow.Sensitivity = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, "Sensitivity"); NewWindow.BeatZoneFrom = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, "BeatZone From"); NewWindow.BeatZoneTo = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, "BeatZone To"); NewWindow.VisualizationIndex = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, "Visualization type index"); NewWindow.Forecolor = SaveConfigs.FindtItemInItemstack_BRS(CurrentCategory, "Forecolor"); NewWindow.BackColor = SaveConfigs.FindtItemInItemstack_BRS(CurrentCategory, "Backcolor"); NewWindow.TopMost = SaveConfigs.FindtItemInItemstack_BOL(CurrentCategory, "TopMost"); NewWindow.Initialize(); VisualizerStack.Add(NewWindow); NewWindow.Show(); CurrentCategory.Offset++; } }
void SaveConfig(string FileName) { FI SaveConfigs = new FI(); SaveConfigs.ItemStack.Add( new FI.ValueCategory("MainWindow Data", new List <FI.FIItems>() { new FI.IntValue("Location X", (int)this.Left), new FI.IntValue("Location Y", (int)this.Top), new FI.IntValue("Audio Source Index", AudioSourceCombobox.SelectedIndex), new FI.IntValue("Refresh rate Index", RefreshRateCombobox.SelectedIndex) })); for (int i = 0; i < VisualizerStack.Count; i++) { SaveConfigs.ItemStack.Add( new FI.ValueCategory("Visualizer Window", new List <FI.FIItems>() { new FI.IntValue("Location X", (int)VisualizerStack[i].Left), new FI.IntValue("Location Y", (int)VisualizerStack[i].Top), new FI.IntValue("Width", (int)VisualizerStack[i].Width), new FI.IntValue("Height", (int)VisualizerStack[i].Height), new FI.IntValue("Visual Samples", VisualizerStack[i].VisualSamples), new FI.IntValue("Smoothness", VisualizerStack[i].Smoothness), new FI.IntValue("Sensitivity", VisualizerStack[i].Sensitivity), new FI.IntValue("BeatZone From", VisualizerStack[i].BeatZoneFrom), new FI.IntValue("BeatZone To", VisualizerStack[i].BeatZoneTo), new FI.IntValue("Visualization type index", VisualizerStack[i].VisualizationIndex), new FI.BrushValue("Forecolor", VisualizerStack[i].Forecolor), new FI.BrushValue("Backcolor", VisualizerStack[i].BackColor), new FI.BoolValue("TopMost", VisualizerStack[i].TopMost) })); } SaveConfigs.SaveFile(FileName); }