private Set getSetFromFile(string aFile)
        {
            Set tSet = new Set();

            using (System.IO.StreamReader tFile = new System.IO.StreamReader(aFile))
            {
                using (XmlReader tReader = XmlReader.Create(tFile))
                {
                    XmlDocument xml = new XmlDocument();
                    xml.Load(tReader);

                    tSet = new Set();

                    XmlNode xSet = xml.SelectSingleNode("Set");
                    if (xSet.Attributes.Count > 0)
                    {
                        XmlAttribute tAt = xSet.Attributes["Name"];
                        tSet.Name = tAt.Value;
                    }

                    XmlNodeList tList = xml.SelectNodes("/Set/Song");

                    foreach (XmlNode xSong in tList)
                    {
                        Song tS = new Song();
                        if (xSong.Attributes.Count > 0)
                            tS.Name = xSong.Attributes["Name"].Value;

                        foreach (XmlNode xTrig in xSong.ChildNodes)
                        { 
                            TriggerData tData = new TriggerData();
                            tData.Filename = xTrig["Filename"].InnerText;

                            TriggerMessage tTrig = new TriggerMessage();
                            XmlNode xMes = xTrig["Message"];
                            tTrig.stEvent = xMes["Event"].InnerText;
                            tTrig.stRawMessage = Convert.ToInt32(xMes["RawMessage"].InnerText);

                            tData.Message = tTrig;

                            tS.TriggerDataList.Add(tData);
                        }

                        tSet.SongList.Add(tS);
                    }

                }
            }

            return tSet;
        }
        /// <summary>
        /// Load song into panels
        /// </summary>
        /// <param name="aSong"></param>
        public void LoadSong(Song aSong)
        {
            DisposePanels();

            foreach (TriggerData tD in aSong.TriggerDataList)
            {
                TriggerPanel tPanel = new TriggerPanel(tD);
            }
        }
        /// <summary>
        /// Save song at the current index
        /// </summary>
        /// <param name="aSong"></param>
        private void saveSong(Song aSong)
        {

            // if we're not at the end of the list, add as new to Set
            if (mCurrentSongIndex > mSet.SongList.Count - 1)
            {
                mSet.SongList.Add(aSong);
                // regardless of the current position in the list,
                // make sure to put the current index at the end of the list
                mCurrentSongIndex = mSet.SongList.Count;
            }
            else
                mSet.SongList[mCurrentSongIndex] = aSong;
        }
        private Song getSongFromPanels()
        {
            // Save current set of panels as a song
            Song tSong = new Song();
            foreach (TriggerPanel tP in TriggerPanels)
            {
                TriggerData tD = tP.GetTriggerData();
                tSong.TriggerDataList.Add(tD);
            }

            tSong.Name = mWindow.GetSongName();

            return tSong;
        }
Example #5
0
 public void AddSong(Song aSong)
 {
     mSongList.Add(aSong);
 }