예제 #1
0
        private void btnDecode_Click(object sender, System.EventArgs e)
        {
            TreeNode tn = null;

            switch (this.tabBrowsers.SelectedIndex)
            {
            case 0: tn = this.tvMusicBrowser.SelectedNode; break;

            case 1: tn = this.tvSoundBrowser.SelectedNode; break;
            }
            if (tn == null)
            {
                return;
            }
            var fi = tn.Tag as FileInfo;

            if (fi == null || fi.AudioFile == null)
            {
                return;
            }
            this.dlgSaveWave.FileName = tn.Text;
            if (this.dlgSaveWave.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            try {
                var safeName = Path.GetInvalidPathChars().Aggregate(this.dlgSaveWave.FileName, (current, C) => current.Replace(C, '_'));
                using (var ww = new WaveWriter(fi.AudioFile, safeName))
                    ww.ShowDialog(this);
            }
            catch (Exception ex) {
                MessageBox.Show("Failed to decode audio file: " + ex.Message, "Audio Decode Failed");
            }
        }
예제 #2
0
        private void btnDecode_Click(object sender, System.EventArgs e)
        {
            TreeNode TN = null;

            switch (this.tabBrowsers.SelectedIndex)
            {
            case 0: TN = this.tvMusicBrowser.SelectedNode; break;

            case 1: TN = this.tvSoundBrowser.SelectedNode; break;
            }
            if (TN != null)
            {
                FileInfo FI = TN.Tag as FileInfo;
                if (FI != null && FI.AudioFile != null)
                {
                    this.dlgSaveWave.FileName = TN.Text;
                    if (this.dlgSaveWave.ShowDialog() == DialogResult.OK)
                    {
                        try {
                            string SafeName = this.dlgSaveWave.FileName;
                            foreach (char C in Path.GetInvalidPathChars())
                            {
                                SafeName = SafeName.Replace(C, '_');
                            }
                            using (WaveWriter WW = new WaveWriter(FI.AudioFile, SafeName))
                                WW.ShowDialog(this);
                        } catch (Exception E) {
                            MessageBox.Show("Failed to decode audio file: " + E.Message, "Audio Decode Failed");
                        }
                    }
                }
            }
        }
예제 #3
0
 private void btnDecode_Click(object sender, System.EventArgs e)
 {
     TreeNode tn = null;
       switch (this.tabBrowsers.SelectedIndex) {
     case 0: tn = this.tvMusicBrowser.SelectedNode; break;
     case 1: tn = this.tvSoundBrowser.SelectedNode; break;
       }
       if (tn == null)
     return;
       var fi = tn.Tag as FileInfo;
       if (fi == null || fi.AudioFile == null)
     return;
       this.dlgSaveWave.FileName = tn.Text;
       if (this.dlgSaveWave.ShowDialog() != DialogResult.OK)
     return;
       try {
     var safeName = Path.GetInvalidPathChars().Aggregate(this.dlgSaveWave.FileName, (current, C) => current.Replace(C, '_'));
     using (var ww = new WaveWriter(fi.AudioFile, safeName))
       ww.ShowDialog(this);
       }
       catch (Exception ex) {
     MessageBox.Show("Failed to decode audio file: " + ex.Message, "Audio Decode Failed");
       }
 }
예제 #4
0
 private void btnDecode_Click(object sender, System.EventArgs e)
 {
     TreeNode TN = null;
     switch (this.tabBrowsers.SelectedIndex)
     {
     case 0:
         TN = this.tvMusicBrowser.SelectedNode;
         break;
     case 1:
         TN = this.tvSoundBrowser.SelectedNode;
         break;
     }
     if (TN != null)
     {
         FileInfo FI = TN.Tag as FileInfo;
         if (FI != null && FI.AudioFile != null)
         {
             this.dlgSaveWave.FileName = TN.Text;
             if (this.dlgSaveWave.ShowDialog() == DialogResult.OK)
             {
                 try
                 {
                     string SafeName = this.dlgSaveWave.FileName;
                     foreach (char C in Path.GetInvalidPathChars())
                     {
                         SafeName = SafeName.Replace(C, '_');
                     }
                     using (WaveWriter WW = new WaveWriter(FI.AudioFile, SafeName))
                     {
                         WW.ShowDialog(this);
                     }
                 }
                 catch (Exception E)
                 {
                     MessageBox.Show("Failed to decode audio file: " + E.Message, "Audio Decode Failed");
                 }
             }
         }
     }
 }