コード例 #1
0
ファイル: MainWindow.cs プロジェクト: kotn3l/AudioBookCutter
 private void saveMarkerFrames_Click(object sender, EventArgs e)
 {
     saveFileDialog1 = new SaveFileDialog();
     saveFileDialog1.InitialDirectory = audio.aPath;
     saveFileDialog1.Title            = "Add meg a menteni kívánt markerek gyűjtőnevét!";
     if (saveFileDialog1.ShowDialog() == DialogResult.OK)
     {
         try
         {
             manager = new CUEManager();
             List <TimeSpan> times = new List <TimeSpan>();
             for (int i = 0; i < markers.Count; i++)
             {
                 times.Add(markers[i].Time);
             }
             manager.saveMarkersOG(times, saveFileDialog1.FileName + ".cue", audio);
             Log.Information(main + "Marker (frames) saved at: {0}", saveFileDialog1.FileName + ".cue");
         }
         catch (Exception ex)
         {
             Log.Error(ex, "Error occured while trying to save markers (frames)");
             MessageBox.Show(errorMsg);
         }
     }
 }
コード例 #2
0
ファイル: MainWindow.cs プロジェクト: kotn3l/AudioBookCutter
 private void openMarker_Click(object sender, EventArgs e)
 {
     openFileDialog1        = new OpenFileDialog();
     openFileDialog1.Filter = "cue fájlok|*.cue";
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         try
         {
             manager = new CUEManager();
             if (manager.max(openFileDialog1.FileName) <= player.GetLength())
             {
                 List <Marker> omarkers = manager.openMarkers(openFileDialog1.FileName);
                 if (markers == null || markers.Count == 0)
                 {
                     for (int i = 0; i < omarkers.Count; i++)
                     {
                         addMarker(omarkers[i]);
                     }
                     resetDataSource();
                     Log.Information(main + "Markers loaded from {0}", openFileDialog1.FileName);
                 }
                 else
                 {
                     if (MessageBox.Show("Ki akarod cserélni az eddigi markereket a megnyitottakra?", "Marker csere?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                     {
                         removeAllMarkers();
                         for (int i = 0; i < omarkers.Count; i++)
                         {
                             addMarker(omarkers[i]);
                         }
                         resetDataSource();
                         Log.Information(main + "Markers loaded from {0}, deleted old markers", openFileDialog1.FileName);
                     }
                 }
             }
             else
             {
                 MessageBox.Show("A megnyitott marker az audio fájlon kívűlre mutat!");
             }
         }
         catch (Exception ex)
         {
             Log.Error(ex, "Error occured while trying to open markers");
             MessageBox.Show(errorMsg);
         }
     }
 }