示例#1
0
        private SongReader GetSong2()
        {
            SongReader songReader = new SongReader(new Chord("Es"));

            songReader.Read("Es f.7 B F");
            return(songReader);
        }
示例#2
0
        private SongReader GetSong1()
        {
            SongReader songReader = new SongReader(new Chord("a"));

            songReader.Read("a C d G");
            return(songReader);
        }
示例#3
0
        public void ReadTest2()
        {
            const string sContents  = "a\n C  \ne F";
            SongReader   songReader = new SongReader(new Chord("a"));

            songReader.Read(sContents);
            var identities = songReader.SongIdentities;

            Assert.AreEqual(6, identities.Count);
        }
示例#4
0
        private static void ListView_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (Form.TreeView.SelectedNode == null ||
                Form.TreeView.SelectedNode.Parent == null)
            {
                return;
            }

            var item = Form.ListView.SelectedItems.Cast <ListViewItem>().FirstOrDefault();

            if (item == null)
            {
                return;
            }

            var node = Form.TreeView.SelectedNode;

            if (node.Name == "Songs")
            {
                var song    = int.Parse(item.Name);
                var address = int.Parse(item.SubItems[1].Text, System.Globalization.NumberStyles.HexNumber);

                var position = address;

                var length = SuperNintendo.Console.Memory[position++] | (SuperNintendo.Console.Memory[position++] << 8);

                //Array.Copy(SuperNintendo.Console.Memory, position, SuperNintendo.Apu.Memory, 0x2000, length);

                for (var index = 0; index < length; index++)
                {
                    var source = ((position & 0xff0000) >> 1) | (position & 0x7fff);
                    source += index;
                    source  = ((source & 0x7f8000) << 1) | (source & 0x7fff) | 0x8000;

                    var destination = 0x2000 + index;

                    SuperNintendo.Apu.Memory[destination] = SuperNintendo.Console.Memory[source];
                }

                SongReader.Position = 0x2000;
                SongReader.Read();

                MidiPlayer.Song = song;
                SongPlayer.Reset();

                SongWindow.Show();
            }
        }
示例#5
0
        public void ReadTest()
        {
            const string sContents  = "a C [x2] \n [ref:] e F";
            SongReader   songReader = new SongReader(new Chord("a"));

            songReader.Read(sContents);
            var identities = songReader.SongIdentities;

            Assert.AreEqual(7, identities.Count);
            Assert.AreEqual(new SongEntity("a").ToString(), identities[0].ToString());
            Assert.AreEqual(new SongEntity("C").ToString(), identities[1].ToString());
            Assert.AreEqual(new SongEntity("[x2]").ToString(), identities[2].ToString());
            Assert.AreEqual(new SongEntity("\n").ToString(), identities[3].ToString());
            Assert.AreEqual(new SongEntity("[ref:]").ToString(), identities[4].ToString());
            Assert.AreEqual(new SongEntity("e").ToString(), identities[5].ToString());
            Assert.AreEqual(new SongEntity("F").ToString(), identities[6].ToString());
        }