/// <summary> /// Attempts to get the <see cref="AutomaticAnimationInfo"/> for the <paramref name="directory"/>. /// </summary> /// <param name="directory">The absolute directory path to try to get the <see cref="AutomaticAnimationInfo"/> /// for.</param> /// <returns>The <see cref="AutomaticAnimationInfo"/> for the <paramref name="directory"/>, or null if /// the <paramref name="directory"/> is invalid or does not match the pattern for an automatic animation.</returns> public static AutomaticAnimationInfo GetAutomaticAnimationInfo(string directory) { const int defaultSpeed = 400; // Get the regex match var match = _aaFolderRegex.Match(directory); if (!match.Success) { return(null); } // Grab the different parts, and return the values var title = match.Groups["Title"].Value; var speed = defaultSpeed; if (match.Groups["Speed"].Success) { speed = Parser.Invariant.ParseInt(match.Groups["Speed"].Value); } var animationRegexInfo = new AutomaticAnimationInfo(directory, title, speed); return(animationRegexInfo); }
/// <summary> /// Attempts to get the <see cref="AutomaticAnimationInfo"/> for the <paramref name="directory"/>. /// </summary> /// <param name="directory">The absolute directory path to try to get the <see cref="AutomaticAnimationInfo"/> /// for.</param> /// <returns>The <see cref="AutomaticAnimationInfo"/> for the <paramref name="directory"/>, or null if /// the <paramref name="directory"/> is invalid or does not match the pattern for an automatic animation.</returns> public static AutomaticAnimationInfo GetAutomaticAnimationInfo(string directory) { const int defaultSpeed = 400; // Get the regex match var match = _aaFolderRegex.Match(directory); if (!match.Success) return null; // Grab the different parts, and return the values var title = match.Groups["Title"].Value; var speed = defaultSpeed; if (match.Groups["Speed"].Success) speed = Parser.Invariant.ParseInt(match.Groups["Speed"].Value); var animationRegexInfo = new AutomaticAnimationInfo(directory, title, speed); return animationRegexInfo; }