private void readStyle(ArrangerState arrangerState, string styleFile) { Style style = new Style(); string line = ""; StreamReader reader = new StreamReader(styleFile); while ((line = reader.ReadLine()) != null) { this.processStyleLine(style, line); } reader.Close(); arrangerState.Styles.Add(style); }
public void ReadStyles(ArrangerState arrangerState) { try { arrangerState.Styles.Clear(); string stylePath = this.getStylesFolder(); String[] stylesFiles = Directory.GetFiles(stylePath); foreach (string styleFile in stylesFiles) { readStyle(arrangerState, styleFile); } } catch (Exception e) { MessageBox.Show("Error reading styles, the app will close"); Console.WriteLine(e.Message); throw; } }
public void ReadChords(ArrangerState arrangerState) { try { arrangerState.Chords.Clear(); string chordsFile = this.getChordsFile(); string line = ""; StreamReader reader = new StreamReader(chordsFile); bool headerRead = false; while ((line = reader.ReadLine()) != null) { if (!headerRead) { headerRead = true; } else { Chord chord = new Chord(); string[] values = line.Split(','); chord.Name = values[0].Trim(); string intervals = values[1].Trim(); string [] intervalsValues = intervals.Split(' '); foreach (string intervalValue in intervalsValues) { chord.Intevals.Add(Convert.ToInt32(intervalValue)); } arrangerState.Chords.Add(chord); Console.WriteLine(line); } } reader.Close(); } catch (Exception e) { MessageBox.Show("Error chords definition file, the app will close"); Console.WriteLine(e.Message); throw; } }
public void ReadStyles(ArrangerState arrangerState) { StyleReader sr = new StyleReader(); sr.ReadStyles(arrangerState); }