NAnt.Win32.Tasks.TlbImpTask.ExtractTypeLibPath C# (CSharp) Method

ExtractTypeLibPath() public static method

Returns the path of the type library, removing the identifier of the type library from the specified string.
An example of a path which includes the identifier of the type library (in this case "2") is C:\WINDOWS\system32\msvidctl.dll\2.
public static ExtractTypeLibPath ( string path ) : string
path string The path from which to extract the path of the type library.
return string
        public static string ExtractTypeLibPath(string path)
        {
            Regex regex = new Regex(@"^.*\\\d+$", RegexOptions.IgnorePatternWhitespace
                | RegexOptions.Multiline | RegexOptions.IgnoreCase);
            if (regex.IsMatch(path)) {
                return path.Substring(0, path.LastIndexOf("\\"));
            }
            return path;
        }