public void Play(Sound sound) { try { Stop(); File.WriteAllBytes("temp\\" + sound.Name, sound.Data); } catch (IOException) { return; } PlayingIndex = Sounds.IndexOf(sound); player.URL = "temp\\" + sound.Name; player.controls.play(); }
private void BTN_Add_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Multiselect = true; if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { WaitingForm form = new WaitingForm(); form.Show(); Application.DoEvents(); for (int i = 0; i < dlg.FileNames.Count(); i++) { byte[] data = File.ReadAllBytes(dlg.FileNames[i]); Sound sound = new Sound() { Data = data, Name = dlg.SafeFileNames[i] }; SoundBundle.Sounds.Add(sound); LIST_Sounds.Items.Add(sound); } form.Close(); } }
public AnimationFrame(SerializationInfo info, StreamingContext context) { Particules = info.GetValue("Particules", typeof(AnimationParticules[])) as AnimationParticules[]; Images = info.GetValue("Images", typeof(List<AnimationPatternFrame>)) as List<AnimationPatternFrame>; Pixels = info.GetValue("Pixels", typeof(AnimationPixels[])) as AnimationPixels[]; Overlay = (Color)info.GetValue("Overlay", typeof(Color)); Upperlay = (Color)info.GetValue("Upperlay", typeof(Color)); BGS = info.GetValue("BGS", typeof(Sound)) as Sound; }