Example #1
0
        private void AddSound()
        {
            // Create OpenFileDialog
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

            // Set filter for file extension and default file extension
            dlg.DefaultExt = ".mp3";
            dlg.Filter     = "Audio Files|*.mp3;*.wav;*.wmp";;

            // Display OpenFileDialog by calling ShowDialog method
            Nullable <bool> result = dlg.ShowDialog();

            // Get the selected file name
            if (result == true)
            {
                // Copy sound file to AppData Sounds folder
                File.Copy(dlg.FileName, appdata + dlg.SafeFileName, true);

                // Add new sound file to sound preferences list
                soundPreferences.Sounds.Add(dlg.SafeFileName);
                soundPreferences.Save();
                SoundsList.Add(dlg.SafeFileName);
                messanger.Success("Added", false);
            }
        }
Example #2
0
        private void LoadData()
        {
            foreach (var item in soundPreferences.Sounds)
            {
                SoundsList.Add(item);
            }

            SelectedSoundTypeChanged();
        }
Example #3
0
        public MainWindowVM()
        {
            ImagedList.Add(new VmHierarchicalMenuItem("Images", PackIconKind.Image));
            SoundsList.Add(new VmHierarchicalMenuItem("Sounds", PackIconKind.Music));

            var item = new VmHierarchicalMenuItem("Documents", PackIconKind.Folder);

            item.SubItems = new List <VmHierarchicalMenuItem>();
            item.SubItems.Add(new VmHierarchicalMenuItem("Sounds", PackIconKind.Music));
            DocumentsList.Add(item);
        }
Example #4
0
        /// <summary>
        /// The load sound scenery.
        /// </summary>
        /// <param name="SoundsList">The sounds list.</param>
        /// <remarks></remarks>
        public void LoadSoundScenery(ref List <SceneryInfo> SoundsList)
        {
            if (SoundsList == null)
            {
                SoundsList = new List <SceneryInfo>();
            }
            else
            {
                SoundsList.Clear();
            }

            map.OpenMap(MapTypes.Internal);

            // Lists all Scenery & Obstacles
            for (int i = 0; i < map.MapHeader.fileCount; i++)
            {
                if (map.MetaInfo.TagType[i] == "scnr")
                {
                    Meta m = new Meta(map);

                    // Base address of SCNR tag, offset of Sound Scenery Palette pointer (+224)
                    map.BR.BaseStream.Position = map.MetaInfo.Offset[i] + 224;
                    int chunkCount  = map.BR.ReadInt32();
                    int chunkOffset = map.BR.ReadInt32() - map.SecondaryMagic;

                    // Scenery Palette Objects
                    for (int a = 0; a < chunkCount; a++)
                    {
                        SceneryInfo Sound = new SceneryInfo();

                        // The Palette Chunk #
                        Sound.ScenPalNumber = a;

                        // Each chunk is 40 bytes apart
                        map.BR.BaseStream.Position = chunkOffset + a * 40;
                        char[] tagName = map.BR.ReadChars(4);
                        Sound.ScenTagNumber = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32());

                        if (Sound.ScenTagNumber != -1)
                        {
                            string[] s = map.FileNames.Name[Sound.ScenTagNumber].Split('\\');
                            Sound.Name    = s[s.Length - 1];
                            Sound.TagPath = map.FileNames.Name[Sound.ScenTagNumber];
                            Sound.TagType = map.MetaInfo.TagType[Sound.ScenTagNumber];
                            SoundsList.Add(Sound);
                        }
                    }

                    break;
                }
            }

            map.CloseMap();
        }