使用C#中的自定义文件扩展名压缩wave文件

时间:2013-03-22 01:13:33

标签: c# file compression

基本上我想做的是用一些带有自定义扩展名的txt数据文件来压缩wave文件,例如:compressed.bpc注意“bpc”是一个自定义文件扩展名。

到目前为止,我唯一能得到的就是加载wave文件:

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...";
    }
}

请留下示例或代码中的代码,因此,我没有经验,所以我需要具体的示例或教程。

谢谢!

0 个答案:

没有答案