public static void Start(PathResolver path) { switch (path.Type) { case PathType.Unresolved: throw new InvalidOperationException($"Could not resolve path '{path.OriginalPath}', try specifying the protocol (e.g. 'http://')."); case PathType.File: case PathType.Directory: OpenFile(path.Path); break; case PathType.Web: case PathType.UnknownProtocol: OpenUsingExplorer(path.Path); break; case PathType.ActionVariable: PathVariables.TryExecute(path.Path); break; default: throw new ArgumentOutOfRangeException(nameof(path), path, $"'{nameof(path)}' resolved to unknown {nameof(PathType)}."); } }
public static void Start(string path) { var resolver = new PathResolver(path); Start(resolver); }