コード例 #1
0
        internal static unsafe bool TryParse(string targetString, bool allowOperationalRevision, out SvnUriTarget target, AprPool pool)
        {
            if (string.IsNullOrEmpty(targetString))
            {
                throw new ArgumentNullException(nameof(targetString));
            }
            if (pool == null)
            {
                throw new ArgumentNullException(nameof(pool));
            }

            if (allowOperationalRevision)
            {
                svn_error_t r;
                sbyte *     truePath;

                var path = pool.AllocString(targetString);

                if ((r = svn_opt.svn_opt_parse_path(out svn_opt_revision_t rev, &truePath, path, pool.Handle)) == null)
                {
                    if (Uri.TryCreate(Utf8_PtrToString(truePath), UriKind.Absolute, out var uri))
                    {
                        var pegRev = SvnRevision.Load(rev);

                        target = new SvnUriTarget(uri, pegRev);
                        return(true);
                    }
                }
                else
                {
                    svn_error.svn_error_clear(r);
                }
            }
コード例 #2
0
ファイル: SvnPathTarget.cs プロジェクト: mendix/LibSvnSharp
        internal static unsafe bool TryParse(string targetName, bool allowOperationalRevisions, out SvnPathTarget target, AprPool pool)
        {
            if (string.IsNullOrEmpty(targetName))
            {
                throw new ArgumentNullException(nameof(targetName));
            }
            if (pool == null)
            {
                throw new ArgumentNullException(nameof(pool));
            }

            target = null;

            if (!IsNotUri(targetName))
            {
                return(false);
            }

            if (allowOperationalRevisions)
            {
                svn_error_t r;
                sbyte *     truePath;

                var path = pool.AllocDirent(targetName);

                if ((r = svn_opt.svn_opt_parse_path(out svn_opt_revision_t rev, &truePath, path, pool.Handle)) == null)
                {
                    var realPath = Utf8_PtrToString(truePath);

                    if (!realPath.Contains("://"))
                    {
                        var pegRev = SvnRevision.Load(rev);

                        target = new SvnPathTarget(realPath, pegRev);
                        return(true);
                    }
                }
                else
                {
                    svn_error.svn_error_clear(r);
                }
            }