public FormSoundNotifyConfigDialog(SoundNotifier module, FormSoundNotifyConfigDialogMode mode, PlaylistEntry parPlaylistEntry = null)
            : this()
        {
            this.ParentModule = module;
            listBoxChooseSound.Items.AddRange(SoundBank.GetSoundsArray());
            listBoxChooseSound.Sorted = true;

            checkedListBoxSearchIn.Items.AddRange((object[])GameLogTypesEX.GetAllNames());

            if (mode == FormSoundNotifyConfigDialogMode.Edit)
            {
                // change title
                this.Text = "Edit entry";
                // choose sound
                if (listBoxChooseSound.Items.Contains((object)parPlaylistEntry.SoundName))
                {
                    listBoxChooseSound.SetSelected((int)(listBoxChooseSound.Items.IndexOf((object)(parPlaylistEntry.SoundName))), true);
                }
                // input condition
                if (!parPlaylistEntry.isCustomRegex) textBoxChooseCond.Text = ParentModule.ConvertRegexToCondOutput(parPlaylistEntry.Condition);
                else textBoxChooseCond.Text = parPlaylistEntry.Condition;
                // choose logs
                foreach (var cond in parPlaylistEntry.SpecialSettings)
                {
                    if (GameLogTypesEX.doesTypeExist(cond))
                    {
                        checkedListBoxSearchIn.SetItemChecked(checkedListBoxSearchIn.Items.IndexOf((object)(cond)), true);
                    }
                }
                // choose specials
                foreach (var cond in parPlaylistEntry.SpecialSettings)
                {
                    if (cond == "s:CustomRegex")
                    {
                        checkBoxUseRegexSemantics.Checked = true;
                    }
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// called from GUI Form
 /// </summary>
 /// <param name="soundname"></param>
 /// <param name="cond"></param>
 /// <param name="speccond"></param>
 /// <param name="insertIndex">needed only for inserting, def -1 for adding</param>
 public void AddPlaylistEntry(string soundname, string cond, List<string> speccond, bool active, int insertIndex = -1)
 {
     PlaylistEntry playlistentry = new PlaylistEntry();
     playlistentry.SoundName = soundname;
     playlistentry.Soundplayer = SoundBank.GetSoundPlayer(playlistentry.SoundName);
     playlistentry.Condition = cond;
     if (speccond != null)
     {
         foreach (string _cond in speccond)
         {
             playlistentry.SpecialSettings.Add(_cond);
             if (_cond.Contains("s:CustomRegex")) playlistentry.isCustomRegex = true;
         }
     }
     if (insertIndex == -1) Playlist.Add(playlistentry);
     else Playlist.Insert(insertIndex, playlistentry);
     SavePlaylist();
 }
Esempio n. 3
0
        void LoadPlaylist()
        {
            //check file version
            bool queueSoundFixNeeded = false;
            string version = PlaylistTextFile.ReadNextLine();

            int activePos;
            int soundnamePos;
            int conditionPos;
            int specialPos;
            // assign index positions for data in file in respect to version
            if (version == "FILEVERSION 3")
            {
                activePos = 0;
                soundnamePos = 1;
                conditionPos = 2;
                specialPos = 3;
            }
            else if (version == "FILEVERSION 2")
            {
                activePos = 0;
                soundnamePos = 1;
                conditionPos = 2;
                specialPos = 3;
                queueSoundFixNeeded = true;
            }
            else //old versionless playlist
            {
                PlaylistTextFile.resetReadPos(); //it has no version line
                activePos = -1; //def indicator that it doesnt exist in this version
                soundnamePos = 0;
                conditionPos = 1;
                specialPos = 2;
            }

            string line = PlaylistTextFile.ReadNextLine();
            while (line != null)
            {
                PlaylistEntry playlistentry = new PlaylistEntry();

                //parse line entries
                string[] entries = line.Split(DefDelimiter);
                if (activePos != -1)
                {
                    if (Convert.ToBoolean(entries[activePos]) == false) playlistentry.isActive = false;
                    else playlistentry.isActive = true;
                }
                playlistentry.SoundName = entries[soundnamePos];
                playlistentry.Soundplayer = SoundBank.GetSoundPlayer(playlistentry.SoundName);
                playlistentry.Condition = entries[conditionPos];
                for (int i = specialPos; i < entries.Length; i++)
                {
                    playlistentry.SpecialSettings.Add(entries[i]);
                    if (entries[i].Contains("s:CustomRegex")) playlistentry.isCustomRegex = true;
                }
                Playlist.Add(playlistentry);
                line = PlaylistTextFile.ReadNextLine();
            }

            if (queueSoundFixNeeded) MoveQueueSound();
            CacheSpecializedPlaylists();
        }