0

Basically what iam trying to do is to compress wave files with some txt data files with a custom extension for example: compressed.bpc note that "bpc" is a custom file extension.

So far the only thing i've got is loading the wave files like so:

public void pictureBox23_Click(object sender, EventArgs e)
{
    ofd.Filter = "WAV|*.wav";
    this.ofd.Multiselect = true;
    if (ofd.ShowDialog() == DialogResult.OK)
    {
        foreach (string fileName in ofd.FileNames)                
        {
        if (System.IO.Path.GetFileName(fileName) == "01.wav")
        {
            label5.Text = System.IO.Path.GetFileName(fileName) + " Ready!";
            label37.Text = System.IO.Path.GetDirectoryName(fileName) + @"\" + System.IO.Path.GetFileName(fileName);
        }
        if (System.IO.Path.GetFileName(fileName) == "02.wav")
        {
            label23.Text = "Beats Loaded";
            label19.Text = System.IO.Path.GetFileName(fileName) + " Ready!";
            label38.Text = System.IO.Path.GetDirectoryName(fileName) + @"\" + System.IO.Path.GetFileName(fileName);
        }
        if (System.IO.Path.GetFileName(fileName) == "03.wav")
        {
            label23.Text = "Beats Loaded";
            label21.Text = System.IO.Path.GetFileName(fileName) + " Ready!";
            label39.Text = System.IO.Path.GetDirectoryName(fileName) + @"\" + System.IO.Path.GetFileName(fileName);
        }
        if (System.IO.Path.GetFileName(fileName) == "04.wav")
        {
            label23.Text = "Beats Loaded";
            label24.Text = System.IO.Path.GetFileName(fileName) + " Ready!";
            label40.Text = System.IO.Path.GetDirectoryName(fileName) + @"\" + System.IO.Path.GetFileName(fileName);
        }
        if (System.IO.Path.GetFileName(fileName) == "05.wav")
        {
            label23.Text = "Beats Loaded";
            label25.Text = System.IO.Path.GetFileName(fileName) + " Ready!";
            label41.Text = System.IO.Path.GetDirectoryName(fileName) + @"\" + System.IO.Path.GetFileName(fileName);
        }
        if (System.IO.Path.GetFileName(fileName) == "06.wav")
        {
            label23.Text = "Beats Loaded";
            label26.Text = System.IO.Path.GetFileName(fileName) + " Ready!";
            label42.Text = System.IO.Path.GetDirectoryName(fileName) + @"\" + System.IO.Path.GetFileName(fileName);
        }
        if (System.IO.Path.GetFileName(fileName) == "07.wav")
        {
            label23.Text = "Beats Loaded";
            label27.Text = System.IO.Path.GetFileName(fileName) + " Ready!";
            label43.Text = System.IO.Path.GetDirectoryName(fileName) + @"\" + System.IO.Path.GetFileName(fileName);
        }
        if (System.IO.Path.GetFileName(fileName) == "08.wav")
        {
            label23.Text = "Beats Loaded";
            label28.Text = System.IO.Path.GetFileName(fileName) + " Ready!";
            label44.Text = System.IO.Path.GetDirectoryName(fileName) + @"\" + System.IO.Path.GetFileName(fileName);
        }
        if (System.IO.Path.GetFileName(fileName) == "09.wav")
        {
            label23.Text = "Beats Loaded";
            label36.Text = System.IO.Path.GetFileName(fileName) + " Ready!";
            label45.Text = System.IO.Path.GetDirectoryName(fileName) + @"\" + System.IO.Path.GetFileName(fileName);
        }
        if (System.IO.Path.GetFileName(fileName) == "10.wav")
        {
            label23.Text = "Beats Loaded";
            label35.Text = System.IO.Path.GetFileName(fileName) + " Ready!";
            label46.Text = System.IO.Path.GetDirectoryName(fileName) + @"\" + System.IO.Path.GetFileName(fileName);
        }
        if (System.IO.Path.GetFileName(fileName) == "11.wav")
        {
            label23.Text = "Beats Loaded";
            label34.Text = System.IO.Path.GetFileName(fileName) + " Ready!";
            label47.Text = System.IO.Path.GetDirectoryName(fileName) + @"\" + System.IO.Path.GetFileName(fileName);
        }
        if (System.IO.Path.GetFileName(fileName) == "12.wav")
        {
            label23.Text = "Beats Loaded";
            label33.Text = System.IO.Path.GetFileName(fileName) + " Ready!";
            label48.Text = System.IO.Path.GetDirectoryName(fileName) + @"\" + System.IO.Path.GetFileName(fileName);
        }
        if (System.IO.Path.GetFileName(fileName) == "13.wav")
        {
            label23.Text = "Beats Loaded";
            label32.Text = System.IO.Path.GetFileName(fileName) + " Ready!";
            label49.Text = System.IO.Path.GetDirectoryName(fileName) + @"\" + System.IO.Path.GetFileName(fileName);
        }
        if (System.IO.Path.GetFileName(fileName) == "14.wav")
        {
            label23.Text = "Beats Loaded";
            label31.Text = System.IO.Path.GetFileName(fileName) + " Ready!";
            label50.Text = System.IO.Path.GetDirectoryName(fileName) + @"\" + System.IO.Path.GetFileName(fileName);
        }
        if (System.IO.Path.GetFileName(fileName) == "15.wav")
        {
            label23.Text = "Beats Loaded";
            label30.Text = System.IO.Path.GetFileName(fileName) + " Ready!";
            label51.Text = System.IO.Path.GetDirectoryName(fileName) + @"\" + System.IO.Path.GetFileName(fileName);
        }
        if (System.IO.Path.GetFileName(fileName) == "16.wav")
        {
            label23.Text = "Beats Loaded";
            label29.Text = System.IO.Path.GetFileName(fileName) + " Ready!";
            label52.Text = System.IO.Path.GetDirectoryName(fileName) + @"\" + System.IO.Path.GetFileName(fileName);
        }
        }

    }
    else
    {
        label23.Text = "Select beats...";
    }
}

Please leave examples or the code iwth references and so, Iam not that experienced so i need specific examples or tutorials.

Thanks!

Joscplan
  • 1,024
  • 2
  • 15
  • 35
  • Here is example of compressing: http://stackoverflow.com/questions/11153542/how-to-compress-files-in-c-sharp – Dilshod Mar 22 '13 at 01:20
  • Not sure what you want. Do you want to (a) rename the file with a custom extension, (b) simply concatenate some text to the end of the filename to display in a label, or (c) actually compress the audio file using a compression algorithm and save the file somewhere else? – rein Mar 22 '13 at 01:24
  • as you are probably already aware you have a very unmaintainable approach on the boil there with all those manual checks for filename and labels. – Paul Farry Mar 22 '13 at 02:14
  • @PaulFarry Yeah well I am aware but as I told I am pretty new to this and that's what I came up to, could you suggest a better way? Thanks! – Joscplan Mar 22 '13 at 02:40
  • @rein a. once I manage to compress the file rename the file with a custom extension and then obviously read it once I open it. – Joscplan Mar 22 '13 at 02:40
  • Using Vanilla framework add a ListView and set it's view to "list" then setup up 3 columns. (ready, filename, ??2nd filename) then you just add a row as you complete each file. You'll remove the need to have all your Else conditions you just process the file, add a row.. Repeat – Paul Farry Mar 22 '13 at 04:01
  • @PaulFarry Any example or tutorial please? Thanks! – Joscplan Mar 22 '13 at 04:26
  • there are plenty of beginner tutorials for that kind of thing – Paul Farry Mar 22 '13 at 05:50

0 Answers0