// Happends when the program is loading #region Program Setup public MainScreen() { InitializeComponent(); _move = new Draggable(this, FormBorder.Size.Height); // enables screen to be draggable _move.SetMovable(FormBorder, ProjectNameLabel); refreshCheckJsonFile(); // Check Preferences.json to fit the customization PopulateMainTableLayout(); // Main category buttons are spawned PopulateSubTableLayout(); // the sub buttons(the features) are spawned. // List <List <Control> > TempLists = new List <List <Control> >() { ButtonList1, ButtonList2, ButtonList3, ButtonList4 }; List <List <Control> > EditedLists = new List <List <Control> >() { Edited1, Edited2, Edited3, Edited4 }; for (int i = 0; i < TempLists.Count; i = i + 1) { foreach (var item in TempLists[i]) { if (item.Tag == null) { EditedLists[i].Add(item); } } } // For assigning the "edited" Variables, so only the sub buttons can be selected ConfigAppearance config = new ConfigAppearance(); config.SetTheme(this, ColorArrayToken, this, Orientation, FormBorder, InfoButton, CloseButton, MinimiseButton, PreferencesButton); config.ApplyTheme(); config.SetChildFormTheme(ColorArrayToken); config.ApplyOrientation(); ChildFormConfig.SetMainInterface(Interface); }
private void MergerForm_Load(object sender, EventArgs e) { try { MapsetSelect.Items.Clear(); string[] files = Directory.GetFiles(ChildFormConfig.GetMapsetPath()); foreach (string file in files) { if (file.Contains(".osu")) { MapsetSelect.Items.Add(Path.GetFileName(file)); } } Exceptions.CheckNumOfFiles(MapsetSelect.Items.Count); } catch (Exception ex) { MessageBox.Show(ex.Message); } SetColor(ChildFormConfig.GetBackColor(), this); SetColor(ChildFormConfig.GetMainButtonColor(), MergeButton, Reload); }
public void SetChildFormTheme(Color[] inputTheme) { ChildFormConfig.SetColorToken(inputTheme); }
private void StartMerge(List <List <string> > HitObjects, List <List <string> > TimingPoints) { List <string> FinalHitObjects = mergeLists(HitObjects, false); List <string> FinalTimingPoints = mergeLists(TimingPoints, true); StreamReader sr = new StreamReader($@"{ChildFormConfig.GetMapsetPath()}\{MergeList.Items[0]}"); var line = sr.ReadLine(); List <string> template = new List <string>(); while (line.Contains("Version:") == false) { template.Add(line); line = sr.ReadLine(); } using (VersionName VName = new VersionName()) { Invoke((Action)(() => { VName.ShowDialog(); })); if (VName.DialogResult == DialogResult.OK) { line = $"Version: {VName.VersionNameV}"; } } while (line != "[TimingPoints]") { template.Add(line); line = sr.ReadLine(); } template.Add("[TimingPoints]"); foreach (var lines in FinalTimingPoints) { template.Add(lines); } while (line != "") { line = sr.ReadLine(); } while (line != "[HitObjects]") { template.Add(line); line = sr.ReadLine(); } template.Add("[HitObjects]"); foreach (var lines in FinalHitObjects) { template.Add(lines); } //close the file sr.Close(); //File.WriteAllLines(@"C:\Users\juliu\Desktop\Osu!\Songs\Camellia - Camellia 200Step Mix/testtest.txt", template); string FileName = "Merged"; string BaseFileName = "Merged"; int i = 1; while (File.Exists($"{ChildFormConfig.GetMapsetPath()}/{FileName}.osu")) // https://stackoverflow.com/questions/5270919/always-create-new-file-if-file-already-exists-with-same-location-in-c-sharp { i = i + 1; FileName = $"{BaseFileName}({i})"; } TextWriter writer = new StreamWriter($@"{ChildFormConfig.GetMapsetPath()}/{FileName}.osu", true); foreach (var lines in template) { writer.WriteLine(lines); } writer.Close(); }
private Exception PopupManager() { // try // { List <string> Files = new List <string>(); List <string> FilesForEMessageBox = new List <string>(); foreach (var file in MergeList.Items) { Files.Add($@"{ChildFormConfig.GetMapsetPath()}\{file}"); FilesForEMessageBox.Add(file.ToString()); } #region gets timing panels VAR = TimingPoints List <List <string> > TimingPoints = new List <List <string> >(); foreach (var file in Files) { StreamReader sr = new StreamReader(file); //Read the first line of text var line = sr.ReadLine(); //Continue to read until you reach end of file while (line != "[TimingPoints]") { line = sr.ReadLine(); } line = sr.ReadLine(); List <string> List = new List <string>(); while (line != "") { List.Add(line); line = sr.ReadLine(); } TimingPoints.Add(List); //close the file sr.Close(); } #endregion gets timing panels VAR = TimingPoints #region gets hitobjects VAR = HitObjects List <List <string> > HitObjects = new List <List <string> >(); foreach (var file in Files) { StreamReader sr = new StreamReader(file); //Read the first line of text var line = sr.ReadLine(); //Continue to read until you reach end of file while (line != "[HitObjects]") { line = sr.ReadLine(); } line = sr.ReadLine(); List <string> List = new List <string>(); while (line != null) { List.Add(line); line = sr.ReadLine(); } HitObjects.Add(List); //close the file sr.Close(); } #endregion gets hitobjects VAR = HitObjects List <List <string> > FinalTimingPoint = new List <List <string> >(); List <List <string> > FinalHitObjects = new List <List <string> >(); Exception operationCancelled = new Exception(); var UninheritedPoints = GetUP(TimingPoints); // credit https://www.youtube.com/watch?v=8aDsXyiBLsI&list=LL&index=5 using (Bpm_Offset_ErrorMessageBox EBox = new Bpm_Offset_ErrorMessageBox(TimingPoints, UninheritedPoints, FilesForEMessageBox)) { Invoke((Action)(() => { EBox.ShowDialog(); })); if (EBox.DialogResult == DialogResult.Ignore) { FinalTimingPoint = EBox.newTimingPoint; FinalHitObjects = HitObjects; StartMerge(FinalHitObjects, FinalTimingPoint); } else if (EBox.DialogResult == DialogResult.OK) { FinalTimingPoint = EBox.newTimingPoint; FinalHitObjects = HitObjects; StartMerge(FinalHitObjects, FinalTimingPoint); } else { operationCancelled = Exceptions.CancelOperation; } } return(operationCancelled); }
private void Reload_Click(object sender, EventArgs e) { MergerForm mergerForm = new MergerForm(); ChildFormConfig.ReloadChildform(this, mergerForm); }