private SceneControl AddSceenControl(Scene scene)
 {
     SceneControl sceneControl = new SceneControl(scene);
     ScenesWrapPanel.Children.Add(sceneControl);
     sceneControl.Removed += new EventHandler(sceneControl_Removed);
     return sceneControl;
 }
 public SceneControl(Scene scene)
 {
     this.InitializeComponent();
     Scene = scene;
     SceneNameTextBox.Text = scene.Name;
     Scene.Playing += new EventHandler(Scene_Playing);
     Scene.Stopping += new EventHandler(Scene_Stopping);
 }
 private void AddSceneButton_Click(object sender, RoutedEventArgs e)
 {
     Scene scene = new Scene();
     Module.Scenes.Add(scene);
     AddSceenControl(scene);
     SoundEffect soundEffect = new SoundEffect();
     scene.SoundEffects.Add(soundEffect);
     Sample sample = new Sample();
     soundEffect.Samples.Add(sample);
     Module.ReverbTime = 0;
     Module.ReverbMix = 0;
 }
        public SceneEditor(Scene sceneToEdit)
        {
            this.InitializeComponent();
            Scene = sceneToEdit;

            foreach (SoundEffect soundEffect in Scene.SoundEffects)
            {
                AddSoundEffectControl(soundEffect);
            }

            SceneNameTextBox.Text = Scene.Name;
            StopOthersCheckBox.IsChecked = Scene.StopsOthers;
            FadeOutCheckBox.IsChecked = Scene.FadesOut;
            PlayStopButton.IsChecked = Scene.IsPlaying;
            FadeOutSlider.Value = Scene.FadeOutLength;
            SceneVolumeSlider.Value = Scene.SceneVolume;
            FadeOutSlider.IsEnabled = Scene.FadesOut;

            AttachEvents();
        }
Beispiel #5
0
        public static void SaveSceneZip(Scene scene, string path)
        {
            using (ZipOutputStream zipStream = new ZipOutputStream(File.Create(path)))
            {
                zipStream.SetLevel(0);

                XmlSerializer serializer = new XmlSerializer(typeof(Scene));
                MemoryStream ms = new MemoryStream();
                TextWriter writer = new StreamWriter(ms, new UTF8Encoding());
                serializer.Serialize(writer, scene);
                writer.Close();

                ZipEntry manifest = new ZipEntry("manifest.xml");

                manifest.DateTime = DateTime.Now;

                zipStream.PutNextEntry(manifest);

                zipStream.Write(ms.ToArray(),0,ms.ToArray().Length);

                foreach (SoundEffect soundEffect in scene.SoundEffects)
                {
                    foreach (Sample sample in soundEffect.Samples)
                    {
                        ZipEntry sampleEntry = new ZipEntry(Path.GetFileName(sample.FileName));
                        zipStream.PutNextEntry(sampleEntry);
                        Byte[] sampleBytes = File.ReadAllBytes(sample.FileName);
                        zipStream.Write(sampleBytes, 0, sampleBytes.Length);
                    }
                }

                zipStream.Finish();
                zipStream.Close();

            }
        }