Esempio n. 1
0
        public AprArray Append(AprPool pool, AprArray array)
        {
            IntPtr ptr;
            Type   arrType;

            CheckPtr();
            if (mEltsType != null && array.mEltsType != null && mEltsType != array.mEltsType)
            {
                throw new AprInvalidOperationException("Array type mismatch.");
            }

            if (mEltsType == null && array.mEltsType != null)
            {
                arrType = array.mEltsType;
            }
            arrType = mEltsType;

            Debug.Write(String.Format("apr_array_append({0},{1},{2})...", pool, array, this));
            ptr = Apr.apr_array_append(pool, (IntPtr)mArray, array);
            if (ptr == IntPtr.Zero)
            {
                throw new AprException("apr_array_append: Can't append an apr_array_header_t");
            }
            Debug.WriteLine(String.Format("Done({0:X})", ((Int32)ptr)));

            return(new AprArray(ptr, arrType));
        }
Esempio n. 2
0
        public void Cat(AprArray array)
        {
            CheckPtr();
            if (mEltsType != null && array.mEltsType != null && mEltsType != array.mEltsType)
            {
                throw new AprInvalidOperationException("Array types mismatch.");
            }

            if (mEltsType == null && array.mEltsType != null)
            {
                mEltsType = array.mEltsType;
            }

            Debug.WriteLine(String.Format("apr_array_cat({0},{1})", this, array));
            Apr.apr_array_cat((IntPtr)mArray, array);
        }
Esempio n. 3
0
        public static AprArray Make(AprPool pool, ICollection list, Type type)
        {
            if (list is AprArray &&
                ((AprArray)list).ElementType == type)
            {
                return(((AprArray)list).Copy(pool));
            }
            else
            {
                AprArray a = Make(pool, list.Count, type);

                IEnumerator it = list.GetEnumerator();
                while (it.MoveNext())
                {
                    a.Push(it.Current);
                }
                return(a);
            }
        }
Esempio n. 4
0
        public static AprArray Make(AprPool pool, ICollection list)
        {
            if (list is AprArray)
            {
                return(((AprArray)list).Copy(pool));
            }
            else
            {
                IEnumerator it = list.GetEnumerator();
                it.MoveNext();

                AprArray a = Make(pool, list.Count, it.Current.GetType());
                it.Reset();

                while (it.MoveNext())
                {
                    a.Push(it.Current);
                }
                return(a);
            }
        }
Esempio n. 5
0
        public SvnError GetCommitLogCallback(out AprString logMessage, out SvnPath tmpFile,
							 		   	  	 AprArray commitItems, IntPtr baton,
									      	 AprPool pool)
        {
            if (!commitItems.IsNull)
            {
                foreach (SvnClientCommitItem item in commitItems)
                {
                    Console.WriteLine("C1: {1} ({2}) r{3}",
                        item.Path, item.Kind, item.Revision);
                    Console.WriteLine("C2: {1} -> {2}",
                        item.Url,
                        item.CopyFromUrl);
                }
                Console.WriteLine();
            }

            Console.Write("Enter log message: ");
            logMessage = new AprString(Console.ReadLine(), pool);
            tmpFile = new SvnPath(pool);

            return(SvnError.NoError);
        }
Esempio n. 6
0
        protected static void InternalDiff(AprArray diffOptions,
								IAprUnmanaged path1, SvnOptRevision revision1,
								IAprUnmanaged path2, SvnOptRevision revision2,
								bool recurse, bool ignoreAncestry, bool noDiffDeleted,
								AprFile outFile, AprFile errFile,  
							    SvnClientContext ctx, AprPool pool)
        {
            Debug.WriteLine(String.Format("svn_client_diff({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11})",diffOptions,path1,revision1,path2,revision2,recurse,ignoreAncestry,noDiffDeleted,outFile,errFile,ctx,pool));
            SvnError err = Svn.svn_client_diff(diffOptions, path1.ToIntPtr(), revision1,
                                               path2.ToIntPtr(), revision2,
                                               (recurse ? 1 : 0), (ignoreAncestry ? 1 : 0),
                                               (noDiffDeleted ? 1 : 0), outFile, errFile,
                                               ctx, pool);
            if( !err.IsNoError )
                throw new SvnException(err);
        }
Esempio n. 7
0
        public static void Revert(AprArray paths, bool recurse, 								  
							      SvnClientContext ctx, AprPool pool)
        {
            Debug.WriteLine(String.Format("svn_client_revert({0},{1},{2},{3})",paths,recurse,ctx,pool));
            SvnError err = Svn.svn_client_revert(paths, (recurse ? 1 : 0), ctx, pool);
            if( !err.IsNoError )
                throw new SvnException(err);
        }
Esempio n. 8
0
        public static SvnClientCommitInfo Mkdir(AprArray paths,  
							   					SvnClientContext ctx, AprPool pool)
        {
            IntPtr commitInfo;
            Debug.Write(String.Format("svn_client_mkdir({0},{1},{2})...",paths,ctx,pool));
            SvnError err = Svn.svn_client_mkdir(out commitInfo, paths, ctx, pool);
            if( !err.IsNoError )
                throw new SvnException(err);
            Debug.WriteLine(String.Format("Done({0})",commitInfo));
            return(commitInfo);
        }
Esempio n. 9
0
        public static void Log(AprArray targets,
							   SvnOptRevision start, SvnOptRevision end,
							   bool discoverChangedPaths, bool strictNodeHistory,
							   LogMessageReceiver receiver, IntPtr baton,
							   SvnClientContext ctx, AprPool pool)
        {
            SvnDelegate receiverDelegate = new SvnDelegate(receiver);
            Debug.WriteLine(String.Format("svn_client_log({0},{1},{2},{3},{4},{5},{6:X},{7},{8})",targets,start,end,discoverChangedPaths,strictNodeHistory,receiver.Method.Name,baton.ToInt32(),ctx,pool));
            SvnError err = Svn.svn_client_log(targets, start, end,
                                              (discoverChangedPaths ? 1 :0),
                                              (strictNodeHistory ? 1 :0),
                                              (Svn.svn_log_message_receiver_t)receiverDelegate.Wrapper,
                                              baton,
                                              ctx, pool);
            if( !err.IsNoError )
                throw new SvnException(err);
        }
Esempio n. 10
0
        public static void Diff(AprArray diffOptions,
								SvnPath path1, SvnOptRevision revision1,
								SvnUrl path2, SvnOptRevision revision2,
								bool recurse, bool ignoreAncestry, bool noDiffDeleted,
								AprFile outFile, AprFile errFile,  
							    SvnClientContext ctx, AprPool pool)
        {
            InternalDiff(diffOptions, path1, revision1, path2, revision2,
                         recurse, ignoreAncestry, noDiffDeleted, outFile, errFile, ctx, pool);
        }
Esempio n. 11
0
        public static SvnClientCommitInfo Commit(AprArray targets, bool nonrecursive,
							   					 SvnClientContext ctx, AprPool pool)
        {
            IntPtr commitInfo;
            Debug.Write(String.Format("svn_client_commit({0},{1},{2},{3})...",targets,nonrecursive,ctx,pool));
            SvnError err = Svn.svn_client_commit(out commitInfo, targets, (nonrecursive ? 1 : 0),
                                                 ctx, pool);
            if( !err.IsNoError )
                throw new SvnException(err);
            Debug.WriteLine(String.Format("Done({0})",commitInfo));
            return(commitInfo);
        }
Esempio n. 12
0
        public void Make()
        {
            AprPool p = AprPool.Create();
            Assert.IsFalse(p.IsNull,"#A01");

            AprArray a = new AprArray();
            Assert.IsTrue(a.IsNull,"#A02");

            a = AprArray.Make(p,10,Marshal.SizeOf(typeof(int)));
            Assert.IsFalse(a.IsNull,"#A03");
            Assert.AreEqual(((IntPtr) p).ToInt32(),((IntPtr)a.Pool).ToInt32(),"#A04");
            Assert.AreEqual(10,a.AllocatedCount,"#A05");
            Assert.AreEqual(Marshal.SizeOf(typeof(int)),a.ElementSize,"#A06");
            Assert.IsTrue(a.IsEmpty(),"#A07");
            Assert.AreEqual(0,a.Count,"#A08");

               	p.Destroy();
            Assert.IsTrue(p.IsNull,"#A09");
        }
Esempio n. 13
0
 public AprArrayEnumerator(AprArray array)
 {
     mArray = array;
     mIndex = -1;
 }
Esempio n. 14
0
 public AprArrayEnumerator(AprArray array)
 {
     mArray = array;
     mIndex = -1;
 }
Esempio n. 15
0
        public void Cat(AprArray array)
        {
            CheckPtr();
            if (mEltsType != null && array.mEltsType != null && mEltsType != array.mEltsType)
                throw new AprInvalidOperationException("Array types mismatch.");

            if(mEltsType == null && array.mEltsType != null)
                mEltsType = array.mEltsType;

            Debug.WriteLine(String.Format("apr_array_cat({0},{1})",this,array));
            Apr.apr_array_cat((IntPtr)mArray,array);
        }
Esempio n. 16
0
        public AprArray Append(AprPool pool, AprArray array)
        {
            IntPtr ptr;
            Type arrType;

            CheckPtr();
            if (mEltsType != null && array.mEltsType != null && mEltsType != array.mEltsType)
                throw new AprInvalidOperationException("Array type mismatch.");

            if(mEltsType == null && array.mEltsType != null)
                arrType = array.mEltsType;
               	arrType = mEltsType;

            Debug.Write(String.Format("apr_array_append({0},{1},{2})...",pool,array,this));
            ptr = Apr.apr_array_append(pool,(IntPtr)mArray,array);
            if(ptr == IntPtr.Zero )
                throw new AprException("apr_array_append: Can't append an apr_array_header_t");
            Debug.WriteLine(String.Format("Done({0:X})",((Int32)ptr)));

            return(new AprArray(ptr,arrType));
        }