Esempio n. 1
0
        public void ParseText(string filepath)
        {
            var text = File.ReadAllText(filepath).Trim();

            foreach (var command in Regex.Split(text, "\n"))
            {
                string type = Regex.Match(command, "[-+#]").Value;
                if (type == "+")
                {
                    _tagSpaceManager.OpenTagSpace();
                    foreach (var tag in Regex.Split(command.Substring(1).Trim(), ";"))
                    {
                        if (tag.Length > 0)
                        {
                            var tagName  = Regex.Match(tag, @"([^:]+)(?=:)").Value;
                            var tagValue = Regex.Match(tag, @"(?<=:)([^:]+)").Value;

                            _tagSpaceManager.SetTag(tagName, tagValue);
                        }
                    }
                }
                else if (type == "-")
                {
                    _tagSpaceManager.CloseTagSpace();
                }
                else if (type == "#")
                {
                    _tracklistManager.AddTrack();
                }
                else
                {
                    throw new Exception("something went very wrong, lol");
                }
            }
        }
        public void Execute(IParserCommand commandIn, Scope scope)
        {
            var command      = commandIn as SetTagMatch;
            var curString    = scope.CurString;
            var valuePattern = command.Pattern;

            var match = Regex.Match(curString, valuePattern).Value;

            _tagSpaceManager.SetTag(command.TagName, match);
        }
        public void Execute(IParserCommand commandIn, Scope scope)
        {
            var command = commandIn as SetTag;

            _tagSpaceManager.SetTag(command.TagName, command.TagValue);
        }