Пример #1
0
 protected void uploadAudio_click(object sender, EventArgs e)
 {
     if (Page.IsValid && uploadedfile.HasFile)
     {
         String extension = Path.GetExtension(uploadedfile.FileName);
         if (AudioReader.isAudioFile(uploadedfile.FileName))
         {
             string filename = uploadedfile.FileName;
             uploadedfile.SaveAs(Server.MapPath("~\\Audio\\") + filename);
             string filepath = Server.MapPath("~\\Audio\\");
             ar = new AudioReader(filename, filepath);
             FileInfoLabel.Text = ar.audioInfo();
             //ar.testloop();
             step1.Visible        = false;
             step2.Visible        = true;
             namelabel.Text       = filename;
             pathlabel.Text       = filepath;
             mediainfo.Visible    = true;
             ErrorMessage.Visible = false;
         }
         else
         {
             ErrorMessage.Text    = "Please upload an Audio File (.wav, .midi, .mp3, etc...)";
             ErrorMessage.Visible = true;
         }
     }
     else
     {
         ErrorMessage.Text    = "No file found!";
         ErrorMessage.Visible = true;
     }
 }
Пример #2
0
        protected void uploadAudio_click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (AudioReader.isAudioFile(uploadedfile.FileName) && AudioReader.isAudioFile(uploadedfile2.FileName) && uploadedfile.HasFile && uploadedfile2.HasFile)
                {
                    string filepath = Server.MapPath("~\\AudioWatermark\\");
                    string filename;

                    filename = uploadedfile.FileName;
                    uploadedfile.SaveAs(Server.MapPath("~\\AudioWatermark\\") + filename);
                    ar1 = new AudioReader(filename, filepath);
                    originalinfolabel.Text = ar1.audioInfo();
                    string file1path = filepath;
                    string file1name = filename;
                    ;

                    filename = uploadedfile2.FileName;
                    uploadedfile2.SaveAs(Server.MapPath("~\\AudioWatermark\\") + filename);
                    ar2 = new AudioReader(filename, filepath);
                    watermarkinfolabel.Text = ar2.audioInfo();
                    string file2path = filepath;
                    string file2name = filename;
                    watermarkdatalabel.Text = AudioReader.verifyWatermark(ar1.readAudio(0, 40000, 2), ar2.readAudio(0, 40000, 2), Int32.Parse(UserDropdown.SelectedValue), file1name, file2path + file2name);

                    step1.Visible = false;
                    step2.Visible = true;
                }


                if (!uploadedfile.HasFile)
                {
                    ErrorMessage1.Text    = "No file found!";
                    ErrorMessage1.Visible = true;
                }
                else
                {
                    if (!AudioReader.isAudioFile(uploadedfile.FileName))
                    {
                        ErrorMessage1.Text    = "Please upload an Audio File (.wav, .midi, .mp3, etc...)";
                        ErrorMessage1.Visible = true;
                    }
                }
                if (!uploadedfile2.HasFile)
                {
                    ErrorMessage2.Text    = "No file found!";
                    ErrorMessage2.Visible = true;
                }
                else
                {
                    if (!AudioReader.isAudioFile(uploadedfile2.FileName))
                    {
                        ErrorMessage2.Text    = "Please upload an Audio File (.wav, .midi, .mp3, etc...)";
                        ErrorMessage2.Visible = true;
                    }
                }
            }
        }