Пример #1
0
        public void Should_Parse_Effects_Path(string rawPath, string fullMatch, string objectPath, string objectName, string friendlyName)
        {
            var parsed = EffectsIdentifier.TryParse(rawPath, out var ident);

            Assert.True(parsed);
            Assert.Equal(ident.RawValue, fullMatch);
            Assert.Equal(objectPath, ident.ObjectPath);
            Assert.Equal(objectName, ident.BaseObjectName);
            Assert.Equal(friendlyName, ident.EffectsObject);
        }
Пример #2
0
        public static bool TryParse(string value, out EffectsIdentifier ident)
        {
            ident = null;
            var rex   = new System.Text.RegularExpressions.Regex(@"VFX\/(\w+?)\/(\w+\/?)(\w+\/)(.*?)\.ua\w+");
            var match = rex.Match(value);

            if (match != null && match.MatchedGroups().Count >= 4)
            {
                ident = new EffectsIdentifier(match.Groups[0].Value, match.Groups[1].Value, match.Groups[2].Value, match.Groups[3].Value, match.Groups[4].Value);
                return(true);
            }
            ident = null;
            return(false);
        }