private void InternalOpenFile(string file) { try { // load the score from the filesystem Score = ScoreLoader.loadScore(file); trackDetails.Controls.Clear(); trackBars.Controls.Clear(); for (int i = Score.tracks.length - 1; i >= 0; i--) { TrackDetailsControl details = new TrackDetailsControl((Track)Score.tracks[i]); details.Dock = DockStyle.Top; details.Height = 25; trackDetails.Controls.Add(details); details.Selected += details_Click; TrackBarsControl bars = new TrackBarsControl((Track)Score.tracks[i]); bars.Dock = DockStyle.Top; trackBars.Controls.Add(bars); } UpdateSelectedTrack(); } catch (Exception e) { MessageBox.Show(this, e.Message, "An error during opening the file occured", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Usage AlphaTab.ScoreDump.exe Path"); return; } // load score Score score = ScoreLoader.loadScore(args[0]); // render score with svg engine Settings settings = Settings.defaults(); settings.engine = "gdi"; ScoreRenderer renderer = new ScoreRenderer(settings, null); // iterate tracks for (int i = 0; i < score.tracks.length; i++) { Track track = (Track)score.tracks[i]; // render track Console.WriteLine("Rendering track {0} - {1}", i + 1, track.name); renderer.render(track); // write png FileInfo info = new FileInfo(args[0]); string path = Path.Combine(info.DirectoryName, Path.GetFileNameWithoutExtension(info.Name) + "-" + i + ".png"); using (Bitmap bmp = ((GdiCanvas)renderer.canvas).getImage()) { bmp.Save(path, ImageFormat.Png); } } }
static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Usage AlphaTab.ScoreDump.exe Path"); return; } Score score = ScoreLoader.loadScore(args[0]); // score info Console.WriteLine("Title: {0}", score.title); Console.WriteLine("Subtitle: {0}", score.subTitle); Console.WriteLine("Artist: {0}", score.artist); Console.WriteLine("Tempo: {0}", score.tempo); Console.WriteLine("Bars: {0}", score.masterBars.length); Console.WriteLine("Time Signature: {0}/{1}", ((MasterBar)score.masterBars[0]).timeSignatureNumerator, ((MasterBar)score.masterBars[0]).timeSignatureDenominator); // tracks Console.WriteLine("Tracks: "); for (int i = 0; i < score.tracks.length; i++) { Track track = (Track)score.tracks[i]; Console.WriteLine(" {0} - {1} - {2}", i + 1, track.name, track.isPercussion ? "Percussion" : "Midi Instrument: " + track.playbackInfo.program); } }
private void InternalOpenFile(string file) { try { // load the score from the filesystem Score = ScoreLoader.loadScore(file); // build the track info objects for the ui TrackViewModel[] trackInfos = new TrackViewModel[Score.tracks.length]; for (int i = 0; i < trackInfos.Length; i++) { trackInfos[i] = new TrackViewModel((Track)Score.tracks[i]); } TrackInfos = trackInfos; } catch (Exception e) { _errorService.OpenFailed(e); } }
/// <summary> /// Defines the entry point of the application. /// </summary> /// <param name="args">The arguments.</param> public static void Main(string[] args) { if (!string.IsNullOrWhiteSpace(gpFile) && File.Exists(gpFile)) { try { // Load the score from the GuitarPro file var gpScore = ScoreLoader.loadScore(gpFile); var score = CreateScore(gpScore); // Serialize the score SerializeScore(score); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadKey(); } }
static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Usage AlphaTab.ScoreDump.exe Path"); return; } // we need to use english culture to have correct string variants of floating points (dot as decimal separator) Thread.CurrentThread.CurrentCulture = new CultureInfo("en-us"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-us"); // load score Score score = ScoreLoader.loadScore(args[0]); // render score with svg engine Settings settings = Settings.defaults(); settings.engine = "svg"; ScoreRenderer renderer = new ScoreRenderer(settings, null); // get iterate tracks for (int i = 0; i < score.tracks.length; i++) { Track track = (Track)score.tracks[i]; // render track Console.WriteLine("Rendering track {0} - {1}", i + 1, track.name); renderer.render(track); // write svg file string svg = ((SvgCanvas)renderer.canvas).toSvg(true, "alphaTab"); FileInfo info = new FileInfo(args[0]); string path = Path.Combine(info.DirectoryName, Path.GetFileNameWithoutExtension(info.Name) + "-" + i + ".svg"); File.WriteAllText(path, svg); } }