示例#1
0
        public Project ShowDialog(FamiStudioForm parent)
        {
            var project = (Project)null;

            if (dialog != null)
            {
                // This is only ran in desktop and this isnt really async, so its ok.
                dialog.ShowDialogAsync(parent, (r) =>
                {
                    if (r == DialogResult.OK)
                    {
                        var songIndex           = Array.IndexOf(songNames, dialog.Properties.GetPropertyValue <string>(0));;
                        var duration            = dialog.Properties.GetPropertyValue <int>(1);
                        var patternLen          = dialog.Properties.GetPropertyValue <int>(2);
                        var startFrame          = dialog.Properties.GetPropertyValue <int>(3);
                        var removeIntro         = dialog.Properties.GetPropertyValue <bool>(4);
                        var reverseDpcmBits     = dialog.Properties.GetPropertyValue <bool>(5);
                        var preserveDpcmPadding = dialog.Properties.GetPropertyValue <bool>(6);

                        project = new NsfFile().Load(filename, songIndex, duration, patternLen, startFrame, removeIntro, reverseDpcmBits, preserveDpcmPadding);
                    }
                });
            }

            return(project);
        }
示例#2
0
        private void ExportNsf()
        {
            var filename = PlatformUtils.ShowSaveFileDialog("Export NSF File", "Nintendo Sound Files (*.nsf)|*.nsf");

            if (filename != null)
            {
                var props  = dialog.GetPropertyPage((int)ExportFormat.Nsf);
                var kernel = (FamitoneMusicFile.FamiToneKernel)Enum.Parse(typeof(FamitoneMusicFile.FamiToneKernel), props.GetPropertyValue <string>(5));

                NsfFile.Save(project, kernel, filename,
                             GetSongIds(props.GetPropertyValue <bool[]>(4)),
                             props.GetPropertyValue <string>(0),
                             props.GetPropertyValue <string>(1),
                             props.GetPropertyValue <string>(2));
            }
        }
示例#3
0
        public NsfImportDialog(string file)
        {
            filename  = file;
            songNames = NsfFile.GetSongNames(filename);

            if (songNames != null && songNames.Length > 0)
            {
                dialog = new PropertyDialog(350);
                dialog.Properties.AddStringList("Song:", songNames, songNames[0]); // 0
                dialog.Properties.AddIntegerRange("Duration (s):", 120, 1, 600);   // 1
                dialog.Properties.AddIntegerRange("Pattern Length:", 256, 4, 256); // 2
                dialog.Properties.AddIntegerRange("Start frame:", 0, 0, 256);      // 3
                dialog.Properties.AddBoolean("Remove intro silence:", true);       // 4
                dialog.Properties.AddBoolean("Reverse DPCM bits:", false);         // 5
                dialog.Properties.Build();
            }
        }
示例#4
0
        public NsfImportDialog(string file)
        {
            filename  = file;
            songNames = NsfFile.GetSongNames(filename);

            if (songNames != null && songNames.Length > 0)
            {
                dialog = new PropertyDialog("NSF Import", 350);
                dialog.Properties.AddDropDownList("Song:", songNames, songNames[0]); // 0
                dialog.Properties.AddNumericUpDown("Duration (s):", 120, 1, 600);    // 1
                dialog.Properties.AddNumericUpDown("Pattern Length:", 256, 4, 256);  // 2
                dialog.Properties.AddNumericUpDown("Start frame:", 0, 0, 256);       // 3
                dialog.Properties.AddCheckBox("Remove intro silence:", true);        // 4
                dialog.Properties.AddCheckBox("Reverse DPCM bits:", false);          // 5
                dialog.Properties.AddCheckBox("Preserve DPCM padding byte:", false); // 6
                dialog.Properties.Build();
            }
        }
示例#5
0
        private void ExportNsf()
        {
            var sfd = new SaveFileDialog()
            {
                Filter = "Nintendo Sound Files (*.nsf)|*.nsf",
                Title  = "Export NSF File"
            };

            if (sfd.ShowDialog() == DialogResult.OK)
            {
                var props = formatProps[(int)ExportFormat.Nsf];

                NsfFile.Save(project, sfd.FileName,
                             GetSongIds(props.GetPropertyValue <bool[]>(4)),
                             props.GetPropertyValue <string>(0),
                             props.GetPropertyValue <string>(1),
                             props.GetPropertyValue <string>(2));
            }
        }
示例#6
0
        public NsfImportDialog(string file, Rectangle mainWinRect)
        {
            int width  = 350;
            int height = 300;
            int x      = mainWinRect.Left + (mainWinRect.Width - width) / 2;
            int y      = mainWinRect.Top + (mainWinRect.Height - height) / 2;

            filename  = file;
            songNames = NsfFile.GetSongNames(filename);

            if (songNames != null && songNames.Length > 0)
            {
                dialog = new PropertyDialog(x, y, width, height);
                dialog.Properties.AddStringList("Song:", songNames, songNames[0]); // 0
                dialog.Properties.AddIntegerRange("Duration (s):", 120, 1, 600);   // 1
                dialog.Properties.AddIntegerRange("Pattern Length:", 256, 4, 256); // 2
                dialog.Properties.AddIntegerRange("Start frame:", 0, 0, 256);      // 3
                dialog.Properties.AddBoolean("Remove intro silence:", true);       // 4
                dialog.Properties.Build();
            }
        }