- Files:
-
- /trunk/AprSharp/test/src/AprArrayTest.cs (modified) (2 diffs)
- /trunk/AprSharp/dev/src/AprNullReferenceException.cs (modified) (1 diff)
- /trunk/AprSharp/dev/src/AprTimeExp.cs (modified) (1 diff)
- /trunk/AprSharp/dev/src/AprArray.cs (modified) (15 diffs)
- /trunk/AprSharp/dev/src/Apr.cs (modified) (1 diff)
- /trunk/AprSharp/dev/src/AprMemNode.cs (modified) (3 diffs)
- /trunk/AprSharp/dev/src/AprInvalidOperationException.cs (added)
- /trunk/AprSharp/dev/src/AprSharp.prjx (modified) (1 diff)
- /trunk/AprSharp/dev/src/AprArgumentOutOfRangeException.cs (modified) (1 diff)
- /trunk/AprSharp/dev/src/AprArgumentNullException.cs (modified) (2 diffs)
- /trunk/AprSharp/dev/src/AprArgumentException.cs (modified) (1 diff)
- /trunk/AprSharp/dev/src/AprString.cs (modified) (1 diff)
- /trunk/AprSharp/dev/src/Apr-old.cs (deleted)
- /trunk/SubversionSharp/test/src/Main.cs (modified) (2 diffs)
- /trunk/SubversionSharp/dev/src/SubversionSharp.prjx (modified) (1 diff)
- /trunk/SubversionSharp/dev/src/SvnAuthSslServerCertInfo.cs (modified) (1 diff)
- /trunk/SubversionSharp/dev/src/SvnAuthBaton.cs (added)
- /trunk/SubversionSharp/dev/src/SvnError.cs (modified) (1 diff)
- /trunk/SubversionSharp/dev/src/SvnAuthProvider.cs (modified) (5 diffs)
- /trunk/SubversionSharp/dev/src/Svn.cs (modified) (1 diff)
- /trunk/SubversionSharp/dev/src/SvnAuthCred.cs (modified) (5 diffs)
- /trunk/SubversionSharp/dev/src/SvnClientContext.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
/trunk/AprSharp/test/src/AprArrayTest.cs
r17 r29 99 99 100 100 [Test] 101 public void PushPopObject() 102 { 103 AprPool p = AprPool.Create(); 104 Assert.IsFalse(p.IsNull,"#B01"); 105 106 AprArray a = AprArray.Make(p,5,typeof(int)); 107 Assert.IsFalse(a.IsNull,"#B02"); 108 109 a.Push(1); 110 a.Push(2); 111 a.Push(3); 112 a.Push(4); 113 a.Push(5); 114 115 Assert.AreEqual(5,a.PopObject(),"#B05"); 116 Assert.AreEqual(4,a.PopObject(),"#BO6"); 117 Assert.AreEqual(3,a.PopObject(),"#BO7"); 118 Assert.AreEqual(2,a.PopObject(),"#BO8"); 119 Assert.AreEqual(1,a.PopObject(),"#BO9"); 120 121 a = AprArray.Make(p,5,typeof(AprString)); 122 123 a.Push(new AprString(p,"This")); 124 a.Push(new AprString(p,"is")); 125 a.Push(new AprString(p,"a")); 126 a.Push(new AprString(p,"test.")); 127 128 Assert.AreEqual("test.",a.PopObject().ToString(),"#B10"); 129 Assert.AreEqual("a",a.PopObject().ToString(),"#B11"); 130 Assert.AreEqual("is",a.PopObject().ToString(),"#B12"); 131 Assert.AreEqual("This",a.PopObject().ToString(),"#B13"); 132 133 p.Destroy(); 134 Assert.IsTrue(p.IsNull,"#B14"); 135 } 136 137 [Test] 101 138 public void Copy() 102 139 { … … 205 242 p.Destroy(); 206 243 Assert.IsTrue(p.IsNull,"#C04"); 207 } 244 } 245 246 [Test] 247 public void CopyTo() 248 { 249 AprPool p = AprPool.Create(); 250 Assert.IsFalse(p.IsNull,"#C01"); 251 252 AprArray a = AprArray.Make(p,5,typeof(AprString)); 253 Assert.IsFalse(a.IsNull,"#C02"); 254 255 Marshal.WriteIntPtr(a.Push(),new AprString(p,"1")); 256 Marshal.WriteIntPtr(a.Push(),new AprString(p,"2")); 257 Marshal.WriteIntPtr(a.Push(),new AprString(p,"3")); 258 Marshal.WriteIntPtr(a.Push(),new AprString(p,"4")); 259 Marshal.WriteIntPtr(a.Push(),new AprString(p,"5")); 260 261 AprString[] arr = new AprString[5]; 262 a.CopyTo(arr,0); 263 264 Assert.AreEqual("1",arr[0].ToString(),"#C03"); 265 Assert.AreEqual("2",arr[1].ToString(),"#C04"); 266 Assert.AreEqual("3",arr[2].ToString(),"#C05"); 267 Assert.AreEqual("4",arr[3].ToString(),"#C06"); 268 Assert.AreEqual("5",arr[4].ToString(),"#C07"); 269 270 p.Destroy(); 271 Assert.IsTrue(p.IsNull,"#C08"); 272 } 208 273 } 209 274 } /trunk/AprSharp/dev/src/AprNullReferenceException.cs
r1 r29 12 12 using System; 13 13 using System.Runtime.Serialization; 14 using Softec;15 14 16 15 namespace Softec.AprSharp /trunk/AprSharp/dev/src/AprTimeExp.cs
r16 r22 45 45 { 46 46 handle = GCHandle.Alloc(new apr_time_exp_t(),GCHandleType.Pinned); 47 mTimeExp = handle.AddrOfPinnedObject().ToPointer();47 mTimeExp = (apr_time_exp_t *)handle.AddrOfPinnedObject().ToPointer(); 48 48 } 49 49 50 50 public AprTimeExp(IntPtr ptr) 51 51 { 52 mTimeExp = ptr.ToPointer();52 mTimeExp = (apr_time_exp_t *)ptr.ToPointer(); 53 53 } 54 54 /trunk/AprSharp/dev/src/AprArray.cs
r9 r29 11 11 using System; 12 12 using System.Diagnostics; 13 using System.Reflection; 13 14 using System.Runtime.InteropServices; 14 15 using System.Collections; … … 16 17 namespace Softec.AprSharp 17 18 { 18 public unsafe struct AprArray 19 public unsafe struct AprArray : IEnumerable 19 20 { 20 21 private apr_array_header_t *mArray; 22 private Type mEltsType; 21 23 22 24 [StructLayout( LayoutKind.Sequential )] … … 27 29 public int nelts; 28 30 public int nalloc; 29 public byte *elts;31 public IntPtr elts; 30 32 } 31 33 … … 34 36 { 35 37 mArray = ptr; 38 mEltsType = null; 36 39 } 37 40 38 41 public AprArray(IntPtr ptr) 39 42 { 40 mArray = ptr.ToPointer(); 43 mArray = (apr_array_header_t *)ptr.ToPointer(); 44 mEltsType = null; 45 } 46 47 public AprArray(IntPtr ptr, Type eltsType) 48 { 49 mArray = (apr_array_header_t *)ptr.ToPointer(); 50 mEltsType = null; 51 if( eltsType != null ) 52 ElementType = eltsType; 41 53 } 42 54 … … 58 70 { 59 71 mArray = null; 72 mEltsType = null; 60 73 } 61 74 … … 74 87 return("[apr_array_header_t:"+(new IntPtr(mArray)).ToInt32().ToString("X")+"]"); 75 88 } 89 90 public Type ElementType 91 { 92 get 93 { 94 return(mEltsType); 95 } 96 set 97 { 98 if( (value.IsPrimitive && Marshal.SizeOf(value) != mArray->elt_size) 99 ||(!value.IsPrimitive && Marshal.SizeOf(typeof(IntPtr)) != mArray->elt_size) ) 100 throw new AprArgumentException("Type does not match element size."); 101 102 if( value.IsPrimitive ) 103 mEltsType = value; 104 else { 105 if( value.GetConstructor(new Type[] {typeof(IntPtr)}) == null ) 106 throw new AprInvalidOperationException("Type is not primitive and cannot be constructed from an IntPtr."); 107 mEltsType = value; 108 } 109 } 110 } 76 111 #endregion 77 112 78 113 #region Methods wrappers 114 public static AprArray Make(AprPool pool, int nElts, Type eltsType ) 115 { 116 if(eltsType.IsPrimitive) 117 return(new AprArray(Make(pool, nElts, Marshal.SizeOf(eltsType)),eltsType)); 118 else 119 return(new AprArray(Make(pool, nElts, Marshal.SizeOf(typeof(IntPtr))),eltsType)); 120 } 121 79 122 public static AprArray Make(AprPool pool, int nElts, int eltSize ) 80 123 { … … 101 144 Debug.WriteLine(String.Format("Done({0:X})",((Int32)ptr))); 102 145 103 return( ptr);146 return(new AprArray(ptr,mEltsType)); 104 147 } 105 148 … … 115 158 Debug.WriteLine(String.Format("Done({0:X})",((Int32)ptr))); 116 159 117 return( ptr);160 return(new AprArray(ptr,mEltsType)); 118 161 } 119 162 … … 121 164 { 122 165 IntPtr ptr; 123 124 CheckPtr(); 166 Type arrType; 167 168 CheckPtr(); 169 if (mEltsType != null && array.mEltsType != null && mEltsType != array.mEltsType) 170 throw new AprInvalidOperationException("Array type mismatch."); 171 172 if(mEltsType == null && array.mEltsType != null) 173 arrType = array.mEltsType; 174 arrType = mEltsType; 175 125 176 Debug.Write(String.Format("apr_array_append({0},{1},{2})...",pool,array,this)); 126 177 ptr = Apr.apr_array_append(pool,(IntPtr)mArray,array); … … 129 180 Debug.WriteLine(String.Format("Done({0:X})",((Int32)ptr))); 130 181 131 return( ptr);182 return(new AprArray(ptr,arrType)); 132 183 } 133 184 134 185 public void Cat(AprArray array) 135 186 { 136 CheckPtr(); 187 Type arrType; 188 189 CheckPtr(); 190 if (mEltsType != null && array.mEltsType != null && mEltsType != array.mEltsType) 191 throw new AprInvalidOperationException("Array type mismatch."); 192 193 if(mEltsType == null && array.mEltsType != null) 194 mEltsType = array.mEltsType; 195 137 196 Debug.WriteLine(String.Format("apr_array_cat({0},{1})",this,array)); 138 197 Apr.apr_array_cat((IntPtr)mArray,array); … … 149 208 150 209 CheckPtr(); 210 if(mEltsType != null && mEltsType != typeof(AprString)) 211 throw new AprInvalidOperationException("Not an AprString array."); 212 151 213 Debug.Write(String.Format("apr_array_pstrcat({0},{1},{2})...",pool,this,sep)); 152 214 ptr = Apr.apr_array_pstrcat(pool,new IntPtr(mArray),sep); … … 158 220 } 159 221 222 public void Push(byte o) 223 { 224 CheckPtr(); 225 Marshal.WriteByte(Push(),o); 226 } 227 228 public void Push(short o) 229 { 230 CheckPtr(); 231 Marshal.WriteInt16(Push(),o); 232 } 233 234 public void Push(int o) 235 { 236 CheckPtr(); 237 Marshal.WriteInt32(Push(),o); 238 } 239 240 public void Push(long o) 241 { 242 CheckPtr(); 243 Marshal.WriteInt64(Push(),o); 244 } 245 246 public void Push(IntPtr ptr) 247 { 248 CheckPtr(); 249 Marshal.WriteIntPtr(Push(),ptr); 250 } 251 160 252 public IntPtr Push() 161 253 { … … 170 262 171 263 return(ptr); 172 } 264 } 265 266 public object PopObject() 267 { 268 if(mEltsType == null) 269 throw new AprInvalidOperationException("Array not typed."); 270 271 if(mEltsType.IsPrimitive) 272 { 273 object val; 274 switch(ElementSize) 275 { 276 case 1: 277 val = Marshal.ReadByte(Pop()); 278 break; 279 case 2: 280 val = Marshal.ReadInt16(Pop()); 281 break; 282 case 4: 283 val = Marshal.ReadInt32(Pop()); 284 break; 285 case 8: 286 val = Marshal.ReadInt64(Pop()); 287 break; 288 default: 289 throw new AprInvalidOperationException("Invalid element size."); 290 } 291 return(Convert.ChangeType(val,mEltsType)); 292 } 293 294 ConstructorInfo ctor = mEltsType.GetConstructor(new Type[] {typeof(IntPtr)}); 295 if( ctor == null ) 296 throw new AprInvalidOperationException("Type is not primitive and cannot be constructed from an IntPtr."); 297 298 IntPtr ptr = Marshal.ReadIntPtr(Pop()); 299 return(ctor.Invoke(new Object[] { ptr })); 300 } 173 301 174 302 public IntPtr Pop() … … 203 331 } 204 332 333 public int AllocatedCount 334 { 335 get { 336 return(mArray->nalloc); 337 } 338 } 339 340 public int ElementSize 341 { 342 get { 343 return(mArray->elt_size); 344 } 345 } 346 347 public IntPtr Data 348 { 349 get { 350 return(mArray->elts); 351 } 352 } 353 #endregion 354 355 #region ICollection 356 public void CopyTo(Array array, int arrayIndex) 357 { 358 if(null == array) 359 throw new AprArgumentNullException("array"); 360 if(arrayIndex < 0 || arrayIndex > array.Length) 361 throw new AprArgumentOutOfRangeException("arrayIndex"); 362 if(array.Rank > 1) 363 throw new AprArgumentException("array is multidimensional"); 364 if((array.Length - arrayIndex) < Count) 365 throw new AprArgumentException("Not enough room from arrayIndex to end of array for this AprArray"); 366 367 int i = arrayIndex; 368 IEnumerator it = GetEnumerator(); 369 while(it.MoveNext()) { 370 array.SetValue(it.Current, i++); 371 } 372 } 373 374 public bool IsSynchronized 375 { 376 get 377 { 378 return false; 379 } 380 } 381 382 public object SyncRoot 383 { 384 get 385 { 386 return this; 387 } 388 } 389 205 390 public int Count 206 391 { … … 209 394 } 210 395 } 211 212 public int AllocatedCount 213 { 214 get { 215 return(mArray->nalloc); 216 } 217 } 218 219 public int ElementSize 220 { 221 get { 222 return(mArray->elt_size); 223 } 224 } 225 226 public IntPtr Data 227 { 228 get { 229 return(new IntPtr(mArray->elts)); 230 } 231 } 232 233 [CLSCompliant(false)] 234 public byte *NativeData 235 { 236 get { 237 return(mArray->elts); 238 } 396 #endregion 397 398 #region IEnumerable 399 public IEnumerator GetEnumerator() 400 { 401 return (IEnumerator) new AprArrayEnumerator(this); 239 402 } 240 403 #endregion 404 405 } 406 407 public class AprArrayEnumerator : IEnumerator 408 { 409 AprArray mArray; 410 int mIndex; 411 412 public AprArrayEnumerator(AprArray array) 413 { 414 mArray = array; 415 mIndex = -1; 416 } 417 418 #region IEnumerator 419 public bool MoveNext() 420 { 421 if (++mIndex >= mArray.Count) { 422 mIndex = mArray.Count; 423 return(false); 424 } 425 return(true); 426 } 427 428 public void Reset() 429 { 430 mIndex = -1; 431 } 432 433 public object Current 434 { 435 get 436 { 437 if (mIndex < 0 || mIndex >= mArray.Count) 438 throw new AprInvalidOperationException("No current item."); 439 440 if(mArray.ElementType == null) 441 throw new AprInvalidOperationException("Array not typed."); 442 443 if(mArray.ElementType.IsPrimitive) 444 { 445 object val; 446 switch(mArray.ElementSize) 447 { 448 case 1: 449 val = Marshal.ReadByte(mArray.Data,mIndex); 450 break; 451 case 2: 452 val = Marshal.ReadInt16(mArray.Data,mIndex*2); 453 break; 454 case 4: 455 val = Marshal.ReadInt32(mArray.Data,mIndex*4); 456 break; 457 case 8: 458 val = Marshal.ReadInt64(mArray.Data,mIndex*8); 459 break; 460 default: 461 throw new AprInvalidOperationException("Invalid element size."); 462 } 463 return(Convert.ChangeType(val,mArray.ElementType)); 464 } 465 466 ConstructorInfo ctor = mArray.ElementType.GetConstructor(new Type[] {typeof(IntPtr)}); 467 if( ctor == null ) 468 throw new AprInvalidOperationException("Type is not primitive and cannot be constructed from an IntPtr."); 469 470 IntPtr ptr = Marshal.ReadIntPtr(mArray.Data,mIndex*mArray.ElementSize); 471 return(ctor.Invoke(new Object[] { ptr })); 472 } 473 } 474 #endregion 475 241 476 } 242 477 } /trunk/AprSharp/dev/src/Apr.cs
r20 r30 19 19 ///<summary>Embeds all APR external calls</summary> 20 20 ///<remark>Take care to call apr_initialize</remark> 21 public class Apr21 public sealed class Apr 22 22 { 23 23 // no instance constructor ! /trunk/AprSharp/dev/src/AprMemNode.cs
r9 r22 38 38 public AprMemNode(IntPtr ptr) 39 39 { 40 mMemNode = ptr.ToPointer();40 mMemNode = (apr_memnode_t *)ptr.ToPointer(); 41 41 } 42 42 … … 113 113 { 114 114 CheckPtr(); 115 mMemNode->selfref= value.ToPointer();115 mMemNode->selfref=(apr_memnode_t **)value.ToPointer(); 116 116 } 117 117 } … … 165 165 { 166 166 CheckPtr(); 167 mMemNode->first_avail= value.ToPointer();167 mMemNode->first_avail=(byte *)value.ToPointer(); 168 168 } 169 169 } /trunk/AprSharp/dev/src/AprSharp.prjx
r6 r29 20 20 <File name="./AprHashIndex.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 21 21 <File name="./AprArray.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 22 <File name="./AprInvalidOperationException.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 22 23 </Contents> 23 24 <References /> /trunk/AprSharp/dev/src/AprArgumentOutOfRangeException.cs
r1 r29 12 12 using System; 13 13 using System.Runtime.Serialization; 14 using Softec;15 14 16 15 namespace Softec.AprSharp /trunk/AprSharp/dev/src/AprArgumentNullException.cs
r1 r29 12 12 using System; 13 13 using System.Runtime.Serialization; 14 using Softec;15 14 16 15 namespace Softec.AprSharp … … 21 20 const int Result = unchecked ((int)0xA0654003); 22 21 23 private string mParamName;24 25 22 public AprArgumentNullException() 26 23 : base ("Argument cannot be null.") /trunk/AprSharp/dev/src/AprArgumentException.cs
r1 r29 12 12 using System; 13 13 using System.Runtime.Serialization; 14 using Softec;15 14 16 15 namespace Softec.AprSharp /trunk/AprSharp/dev/src/AprString.cs
r17 r28 88 88 public override string ToString() 89 89 { 90 return(Marshal.PtrToStringAnsi(mString)); 90 if( IsNull ) 91 return("[apr_string:NULL]"); 92 else 93 return(Marshal.PtrToStringAnsi(mString)); 91 94 } 92 95 #endregion /trunk/SubversionSharp/test/src/Main.cs
r7 r21 2 2 using System; 3 3 using System.Diagnostics; 4 using System.Collections; 4 5 using Softec.AprSharp; 5 6 using Softec.SubversionSharp; … … 15 16 SvnClientContext ctx = SvnClientContext.Create(pool); 16 17 ctx.Config = SvnConfig.GetConfig(pool); 17 AprHash ctxcfg = ctx.Config; 18 foreach(AprHashEntry cfg in ctxcfg) 19 { 20 Console.WriteLine("{0}\t{1:X}",cfg.KeyAsString,cfg.Value.ToInt32()); 21 } 18 19 ArrayList authObj = new ArrayList(); 20 authObj.Add(SvnAuthProviderObject.GetSimpleProvider(pool)); 21 authObj.Add(SvnAuthProviderObject.GetUsernameProvider(pool)); 22 authObj.Add(SvnAuthProviderObject.GetSslServerTrustFileProvider(pool)); 23 authObj.Add(SvnAuthProviderObject.GetSslClientCertFileProvider(pool)); 24 authObj.Add(SvnAuthProviderObject.GetSslClientCertPwFileProvider(pool)); 25 authObj.Add(SvnAuthProviderObject.GetPromptProvider( 26 new SvnAuthProviderObject.SimplePrompt(SimpleAuth), 27 IntPtr.Zero, 2, pool)); 28 authObj.Add(SvnAuthProviderObject.GetPromptProvider( 29 new SvnAuthProviderObject.UsernamePrompt(UsernameAuth), 30 IntPtr.Zero, 2, pool)); 31 32 22 33 pool.Destroy(); 23 34 } 35 36 public static SvnError SimpleAuth(out SvnAuthCredSimple cred, IntPtr baton, 37 AprString realm, AprString username, 38 bool maySave, AprPool pool) 39 { 40 Console.WriteLine("Simple Authentication"); 41 Console.WriteLine("---------------------"); 42 Console.WriteLine("Realm: {0}", realm); 43 Console.WriteLine(""); 44 45 bool valid = false; 46 string line; 47 48 while(!valid) 49 { 50 if (!username.IsNull) 51 Console.Write("Enter Username ({0}): ", username); 52 else 53 Console.Write("Enter Username: "); 54 55 line = Console.ReadLine(); 56 57 if (line.Trim().Length == 0 && !username.IsNull) 58 { 59 line = username.ToString(); 60 valid = true; 61 } 62 else if (line.Trim().Length > 0) 63 { 64 valid = true; 65 } 66 } 67 68 cred = SvnAuthCredSimple.Alloc(pool); 69 cred.Username = new AprString(pool, line); 70 Console.Write("Enter Password: "); 71 cred.Password = new AprString(pool, Console.ReadLine()); 72 cred.MaySave = maySave; 73 return(SvnError.NoError); 74 } 75 76 public static SvnError UsernameAuth(out SvnAuthCredUsername cred, IntPtr baton, 77 AprString realm, bool maySave, AprPool pool) 78 { 79 Console.WriteLine("Username Authentication:"); 80 Console.WriteLine("------------------------"); 81 Console.WriteLine("Realm: {0}", realm); 82 Console.WriteLine(""); 83 84 bool valid = false; 85 string line; 86 87 while(!valid) 88 { 89 Console.Write("Enter Username: "); 90 91 line = Console.ReadLine(); 92 93 if (line.Trim().Length > 0) 94 { 95 valid = true; 96 } 97 } 98 99 cred = SvnAuthCredUsername.Alloc(pool); 100 cred.Username = new AprString(pool, line); 101 cred.MaySave = maySave; 102 return(SvnError.NoError); 103 } 24 104 } /trunk/SubversionSharp/dev/src/SubversionSharp.prjx
r19 r21 11 11 <File name="./SvnAuthCred.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 12 12 <File name="./SvnAuthSslServerCertInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 13 <File name="./SvnAuthBaton.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 13 14 </Contents> 14 15 <References> /trunk/SubversionSharp/dev/src/SvnAuthSslServerCertInfo.cs
r19 r27 40 40 public SvnAuthSslServerCertInfo(IntPtr ptr) 41 41 { 42 mSslServerCertInfo = ptr.ToPointer();42 mSslServerCertInfo = (svn_auth_ssl_server_cert_info *) ptr.ToPointer(); 43 43 } 44 44 /trunk/SubversionSharp/dev/src/SvnError.cs
r18 r27 39 39 public SvnError(IntPtr ptr) 40 40 { 41 mError = ptr.ToPointer();41 mError = (svn_error_t *) ptr.ToPointer(); 42 42 } 43 43 /trunk/SubversionSharp/dev/src/SvnAuthProvider.cs
r19 r21 17 17 public struct SvnAuthProviderObject 18 18 { 19 IntPtr mAuthProviderObject; 19 private IntPtr mAuthProviderObject; 20 internal SvnAuthProvider mAuthProvider; 20 21 21 22 #region Generic embedding functions of an IntPtr … … 23 24 { 24 25 mAuthProviderObject = ptr; 26 mAuthProvider = null; 27 } 28 29 private SvnAuthProviderObject(IntPtr ptr, SvnAuthProvider authProvider) 30 { 31 mAuthProviderObject = ptr; 32 mAuthProvider = authProvider; 25 33 } 26 34 … … 85 93 86 94 #region Wrapper client method 87 public static SvnAuthProviderObject Get SimplePromptProvider(95 public static SvnAuthProviderObject GetPromptProvider( 88 96 SimplePrompt promptFunc, 89 97 IntPtr promptBaton, int retryLimit, AprPool pool) 90 98 { 91 99 IntPtr authObj; 92 throw new NotImplementedException(); 93 //return(new SvnAuthProviderObject()); 100 SvnAuthProvider auth = new SvnAuthProvider(promptFunc); 101 Svn.svn_client_get_simple_prompt_provider(out authObj, 102 (Svn.svn_auth_simple_prompt_func_t) auth.Wrapper, 103 promptBaton, retryLimit, pool); 104 return(new SvnAuthProviderObject(authObj,auth)); 94 105 } 95 106 96 public static SvnAuthProviderObject Get UsernamePromptProvider(107 public static SvnAuthProviderObject GetPromptProvider( 97 108 UsernamePrompt promptFunc, 98 109 IntPtr promptBaton, int retryLimit, AprPool pool) 99 110 { 100 111 IntPtr authObj; 101 throw new NotImplementedException(); 102 //return(new SvnAuthProviderObject()); 112 SvnAuthProvider auth = new SvnAuthProvider(promptFunc); 113 Svn.svn_client_get_username_prompt_provider(out authObj, 114 (Svn.svn_auth_username_prompt_func_t) auth.Wrapper, 115 promptBaton, retryLimit, pool); 116 return(new SvnAuthProviderObject(authObj,auth)); 103 117 } 104 118 … … 138 152 } 139 153 140 public static SvnAuthProviderObject Get SslServerTrustPromptProvider(154 public static SvnAuthProviderObject GetPromptProvider( 141 155 SslServerTrustPrompt promptFunc, 142 156 IntPtr promptBaton, AprPool pool) 143 157 { 144 158 IntPtr authObj; 145 throw new NotImplementedException(); 146 //return(new SvnAuthProviderObject()); 147 } 148 149 public static SvnAuthProviderObject GetSslClientCertPromptProvider( 159 SvnAuthProvider auth = new SvnAuthProvider(promptFunc); 160 Svn.svn_client_get_ssl_server_trust_prompt_provider(out authObj, 161 (Svn.svn_auth_ssl_server_trust_prompt_func_t) auth.Wrapper, 162 promptBaton, pool); 163 return(new SvnAuthProviderObject(authObj,auth)); 164 } 165 166 public static SvnAuthProviderObject GetPromptProvider( 150 167 SslClientCertPrompt promptFunc, 151 168 IntPtr promptBaton, int retryLimit, AprPool pool) 152 169 { 153 170 IntPtr authObj; 154 throw new NotImplementedException(); 155 //return(new SvnAuthProviderObject()); 156 } 157 158 public static SvnAuthProviderObject GetSslClientCertPwPromptProvider( 171 SvnAuthProvider auth = new SvnAuthProvider(promptFunc); 172 Svn.svn_client_get_ssl_client_cert_prompt_provider(out authObj, 173 (Svn.svn_auth_ssl_client_cert_prompt_func_t) auth.Wrapper, 174 promptBaton, retryLimit, pool); 175 return(new SvnAuthProviderObject(authObj,auth)); 176 } 177 178 public static SvnAuthProviderObject GetPromptProvider( 159 179 SslClientCertPwPrompt promptFunc, 160 180 IntPtr promptBaton, int retryLimit, AprPool pool) 161 181 { 162 182 IntPtr authObj; 163 throw new NotImplementedException(); 164 //return(new SvnAuthProviderObject()); 183 SvnAuthProvider auth = new SvnAuthProvider(promptFunc); 184 Svn.svn_client_get_ssl_client_cert_pw_prompt_provider(out authObj, 185 (Svn.svn_auth_ssl_client_cert_pw_prompt_func_t) auth.Wrapper, 186 promptBaton, retryLimit, pool); 187 return(new SvnAuthProviderObject(authObj,auth)); 165 188 } 166 189 #endregion 167 190 } 168 191 169 publicclass SvnAuthProvider192 internal class SvnAuthProvider 170 193 { 171 194 object mFunc; 195 object mWrapperFunc; 196 197 public SvnAuthProvider(SvnAuthProviderObject.SimplePrompt func) 198 { 199 mFunc = func; 200 mWrapperFunc = new Svn.svn_auth_simple_prompt_func_t(SvnAuthSimplePrompt); 201 } 202 203 public SvnAuthProvider(SvnAuthProviderObject.UsernamePrompt func) 204 { 205 mFunc = func; 206 mWrapperFunc = new Svn.svn_auth_username_prompt_func_t(SvnAuthUsernamePrompt); 207 } 208 209 public SvnAuthProvider(SvnAuthProviderObject.SslServerTrustPrompt func) 210 { 211 mFunc = func; 212 mWrapperFunc = new Svn.svn_auth_ssl_server_trust_prompt_func_t(SvnAuthSslServerTrustPrompt); 213 } 214 215 public SvnAuthProvider(SvnAuthProviderObject.SslClientCertPrompt func) 216 { 217 mFunc = func; 218 mWrapperFunc = new Svn.svn_auth_ssl_client_cert_prompt_func_t(SvnAuthSslClientCertPrompt); 219 } 220 221 public SvnAuthProvider(SvnAuthProviderObject.SslClientCertPwPrompt func) 222 { 223 mFunc = func; 224 mWrapperFunc = new Svn.svn_auth_ssl_client_cert_pw_prompt_func_t(SvnAuthSslClientCertPwPrompt); 225 } 226 227 public object Wrapper 228 { 229 get 230 { 231 return(mWrapperFunc); 232 } 233 } 172 234 173 235 private IntPtr SvnAuthSimplePrompt(out IntPtr cred, IntPtr baton, … … 227 289 } 228 290 229 [CLSCompliant(false)]291 //[CLSCompliant(false)] 230 292 private IntPtr SvnAuthSslServerTrustPrompt(out IntPtr cred, IntPtr baton, 231 293 IntPtr realm, uint failures, /trunk/SubversionSharp/dev/src/Svn.cs
r19 r21 142 142 svn_auth_ssl_client_cert_pw_prompt_func_t prompt_func, 143 143 IntPtr prompt_baton, int retry_limit, IntPtr pool); 144 #endregion 145 146 #region AuthBaton 147 [DllImport("svn_client-1")] static extern 148 internal void svn_auth_open(out IntPtr auth_baton, IntPtr providers, IntPtr pool); 149 150 [DllImport("svn_client-1")] static extern 151 internal void svn_auth_set_parameter(IntPtr auth_baton, IntPtr name, IntPtr value); 152 153 [DllImport("svn_client-1")] static extern 154 internal IntPtr svn_auth_get_parameter(IntPtr auth_baton, IntPtr name); 144 155 #endregion 145 156 } /trunk/SubversionSharp/dev/src/SvnAuthCred.cs
r19 r27 36 36 public SvnAuthCredSimple(IntPtr ptr) 37 37 { 38 mCred = ptr.ToPointer();38 mCred = (svn_auth_cred_simple_t *)ptr.ToPointer(); 39 39 } 40 40 … … 141 141 public SvnAuthCredUsername(IntPtr ptr) 142 142 { 143 mCred = ptr.ToPointer();143 mCred = (svn_auth_cred_username_t *)ptr.ToPointer(); 144 144 } 145 145 … … 233 233 public SvnAuthCredSslServerTrust(IntPtr ptr) 234 234 { 235 mCred = ptr.ToPointer();235 mCred = (svn_auth_cred_ssl_server_trust_t *) ptr.ToPointer(); 236 236 } 237 237 … … 338 338 public SvnAuthCredSslClientCert(IntPtr ptr) 339 339 { 340 mCred = ptr.ToPointer();340 mCred = (svn_auth_cred_ssl_client_cert_t *) ptr.ToPointer(); 341 341 } 342 342 … … 431 431 public SvnAuthCredSslClientCertPw(IntPtr ptr) 432 432 { 433 mCred = ptr.ToPointer();433 mCred = (svn_auth_cred_ssl_client_cert_pw_t *) ptr.ToPointer(); 434 434 } 435 435 /trunk/SubversionSharp/dev/src/SvnClientContext.cs
r8 r27 42 42 public SvnClientContext(IntPtr ptr) 43 43 { 44 mClientContext = ptr.ToPointer();44 mClientContext = (svn_client_ctx_t *) ptr.ToPointer(); 45 45 } 46 46