/// <summary>
        /// True if the script is matched by the filter.
        /// </summary>
        /// <param name="script"></param>
        /// <returns></returns>
        private bool IsMatch(ScriptSelectionRecord script)
        {
            if (FilterOption.Contents == _filterOption)
            {
                if (string.IsNullOrEmpty(script.Source))
                {
                    script.Source = File.ReadAllText(script.AbsPath);
                }

                return(_filterRegexCompiled.IsMatch(script.Source));
            }

            return(_filterRegexCompiled.IsMatch(script.AbsPath));
        }
 /// <summary>
 /// Retrieves all scripts.
 /// </summary>
 private void FindAllScripts()
 {
     _scripts = Directory
                .GetFiles(
         Application.dataPath,
         "*.html",
         SearchOption.AllDirectories)
                .Select(file => new ScriptSelectionRecord
     {
         Name    = Path.GetFileName(file),
         AbsPath = file
     })
                .ToArray();
     _selected = _scripts.FirstOrDefault();
 }
 /// <summary>
 /// Called when a script has been selected.
 /// </summary>
 /// <param name="listElement"></param>
 private void ScriptsList_OnSelected(ListElement listElement)
 {
     Selected = _scripts.FirstOrDefault(
         script => script == listElement.Value <ScriptSelectionRecord>());
 }