internal unsafe SvnListEventArgs( sbyte *path, svn_dirent_t dirent, svn_lock_t @lock, sbyte *absPath, Uri repositoryRoot, sbyte *externalParentUrl, sbyte *externalTarget) { if (path == null) { throw new ArgumentNullException(nameof(path)); } if (absPath == null) { throw new ArgumentNullException(nameof(absPath)); } Path = SvnBase.Utf8_PtrToString(path); _pDirEnt = dirent; _pLock = @lock; _pAbsPath = absPath; RepositoryRoot = repositoryRoot; _external_parent_url = externalParentUrl; _external_target = externalTarget; }
static unsafe string GetErrorText(svn_error_t error) { if (error == null) { return(""); } try { if (error.message != null) { return(SvnBase.Utf8_PtrToString(error.message)); } var buffer = new sbyte[1024]; string msg; fixed(sbyte *buf = &buffer[0]) { svn_error.svn_err_best_message(error, buf, Convert.ToUInt64(buffer.Length) - 1); msg = SvnBase.Utf8_PtrToString(buf); } return(msg?.Trim()); } catch (Exception) { return("Subversion error: Unable to retrieve error text"); } }
internal static unsafe SvnPropertyValue Create(sbyte *propertyName, svn_string_t value, SvnTarget target) { if (propertyName == null) { throw new ArgumentNullException(nameof(propertyName)); } string name = SvnBase.Utf8_PtrToString(propertyName); return(Create(propertyName, value, target, name)); }
static unsafe /*svn_error_t*/ IntPtr _svn_auth_ssl_server_trust_prompt_func( /*out svn_auth_cred_ssl_server_trust_t*/ void **ppCred, IntPtr baton, sbyte *realm, uint failures, /*svn_auth_ssl_server_cert_info_t*/ IntPtr certInfo, int maySave, /*apr_pool_t*/ IntPtr pool) { var wrapper = AprBaton <SvnAuthWrapper <SvnSslServerTrustEventArgs> > .Get(baton); var certInfoT = svn_auth_ssl_server_cert_info_t.__CreateInstance(certInfo); var args = new SvnSslServerTrustEventArgs( (SvnCertificateTrustFailures)failures, SvnBase.Utf8_PtrToString(certInfoT.hostname), SvnBase.Utf8_PtrToString(certInfoT.fingerprint), SvnBase.Utf8_PtrToString(certInfoT.valid_from), SvnBase.Utf8_PtrToString(certInfoT.valid_until), SvnBase.Utf8_PtrToString(certInfoT.issuer_dname), SvnBase.Utf8_PtrToString(certInfoT.ascii_cert), SvnBase.Utf8_PtrToString(realm), maySave != 0); var cred = (svn_auth_cred_ssl_server_trust_t.__Internal * *)ppCred; using (var tmpPool = new AprPool(pool, false)) { *cred = null; try { wrapper.Raise(args); } catch (Exception e) { return(SvnException.CreateExceptionSvnError("Authorization handler", e).__Instance); } if (args.Cancel) { return(svn_error.svn_error_create((int)SvnErrorCode.SVN_ERR_CANCELLED, null, "Authorization canceled operation").__Instance); } if (args.Break) { return(IntPtr.Zero); } if (args.AcceptedFailures != SvnCertificateTrustFailures.None) { *cred = (svn_auth_cred_ssl_server_trust_t.__Internal *)tmpPool.AllocCleared( sizeof(svn_auth_cred_ssl_server_trust_t.__Internal)); (*cred)->accepted_failures = (uint)args.AcceptedFailures; (*cred)->may_save = args.Save ? 1 : 0; } } return(IntPtr.Zero); }
internal unsafe SvnChangeItem(string path, svn_log_changed_path2_t changed_path) { if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException(nameof(path)); } if (changed_path == null) { throw new ArgumentNullException(nameof(changed_path)); } _changed_path = changed_path; Path = path; Action = (SvnChangeAction)changed_path.action; _copyFromPath = SvnBase.Utf8_PtrToString(changed_path.copyfrom_path); CopyFromRevision = changed_path.copyfrom_path != null ? changed_path.copyfrom_rev : -1; NodeKind = (SvnNodeKind)changed_path.node_kind; switch (changed_path.text_modified) { case svn_tristate_t.svn_tristate_false: ContentModified = false; break; case svn_tristate_t.svn_tristate_true: ContentModified = true; break; } switch (changed_path.props_modified) { case svn_tristate_t.svn_tristate_false: PropertiesModified = false; break; case svn_tristate_t.svn_tristate_true: PropertiesModified = true; break; } }
internal unsafe SvnCommitResult(svn_commit_info_t commitInfo, AprPool pool) { if (commitInfo == null) { throw new ArgumentNullException(nameof(commitInfo)); } if (pool == null) { throw new ArgumentNullException(nameof(pool)); } Revision = commitInfo.revision; long when = 0; svn_error_t err = svn_time.svn_time_from_cstring(ref when, commitInfo.date, pool.Handle); // pool is not used at this time (might be for errors in future versions) if (err == null) { Time = SvnBase.DateTimeFromAprTime(when); } else { svn_error.svn_error_clear(err); Time = DateTime.MinValue; } Author = SvnBase.Utf8_PtrToString(commitInfo.author); PostCommitError = commitInfo.post_commit_err != null ? SvnBase.Utf8_PtrToString(commitInfo.post_commit_err) .Replace("\n", Environment.NewLine) .Replace("\r\r", "\r") : null; if (commitInfo.repos_root != null) { RepositoryRoot = SvnBase.Utf8_PtrToUri(commitInfo.repos_root, SvnNodeKind.Directory); } }
static unsafe /*svn_error_t*/ IntPtr _svn_auth_simple_prompt_func( /*out svn_auth_cred_simple_t*/ void **credPtr, IntPtr baton, sbyte *realm, sbyte *username, int maySave, /*apr_pool_t*/ IntPtr pool) { var wrapper = AprBaton <SvnAuthWrapper <SvnUserNamePasswordEventArgs> > .Get(baton); var args = new SvnUserNamePasswordEventArgs(SvnBase.Utf8_PtrToString(username), SvnBase.Utf8_PtrToString(realm), maySave != 0); var cred = (svn_auth_cred_simple_t.__Internal * *)credPtr; using (var tmpPool = new AprPool(pool, false)) { *cred = null; try { wrapper.Raise(args); } catch (Exception e) { return(SvnException.CreateExceptionSvnError("Authorization handler", e).__Instance); } if (args.Cancel) { return(svn_error.svn_error_create((int)SvnErrorCode.SVN_ERR_CANCELLED, null, "Authorization canceled operation").__Instance); } if (args.Break) { return(IntPtr.Zero); } *cred = (svn_auth_cred_simple_t.__Internal *)tmpPool.AllocCleared(sizeof(svn_auth_cred_simple_t.__Internal)); (*cred)->username = new IntPtr(tmpPool.AllocString(args.UserName)); (*cred)->password = new IntPtr(tmpPool.AllocString(args.Password)); (*cred)->may_save = args.Save ? 1 : 0; } return(IntPtr.Zero); }