dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] pnetlib/System Uri.cs,1.46,1.47


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnetlib/System Uri.cs,1.46,1.47
Date: Fri, 07 Nov 2003 03:58:45 +0000

Update of /cvsroot/dotgnu-pnet/pnetlib/System
In directory subversions:/tmp/cvs-serv26410/System

Modified Files:
        Uri.cs 
Log Message:


Flesh out the Uri.IsPrefix method.


Index: Uri.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Uri.cs,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** Uri.cs      13 Oct 2003 00:58:24 -0000      1.46
--- Uri.cs      7 Nov 2003 03:58:43 -0000       1.47
***************
*** 1030,1039 ****
  
        // Determine if this URI is a prefix of a specified URI.
-       [TODO]
        internal bool IsPrefix(Uri uri)
        {
!               // TODO
!               return false;
        }
  
        // Determine if this is an UNC path.
--- 1030,1075 ----
  
        // Determine if this URI is a prefix of a specified URI.
        internal bool IsPrefix(Uri uri)
        {
!               String strhost = this.Host;
!               String specifiedstrhost = uri.Host;
!               String strpath = this.LocalPath;
!               String specifiedstrpath=uri.LocalPath;
!               String strscheme = this.Scheme;
!               String specifiedstrscheme = uri.Scheme;
!               
!               if(String.Compare(strscheme, specifiedstrscheme, true) == 0 && 
String.Compare(strhost, specifiedstrhost, true) == 0)
!               {
!                       if(String.CompareOrdinal(strpath, specifiedstrpath) == 
0)
!                       {
!                               //if paths exactly the same, return true
!                               return true;
!                                       
!                       } else if(String.CompareOrdinal(strpath, 
strpath.Length, "/", 0, 1) == 0 )
!                       {
!                               //path string has / at the end of it, so direct 
comparison can be made.
!                               if (String.CompareOrdinal(strpath, 0, 
specifiedstrpath, 0, strpath.Length) == 0)
!                               {
!                                       return true;
!                               } else {
!                                       return false;
!                               }
!                                                                               
                        
!                       } else {
! 
!                               // a / must be appended to this.LocalPath to do 
comparison
!                               strpath = strpath + "/";
!                               if (String.CompareOrdinal(strpath, 0, 
specifiedstrpath, 0, strpath.Length) == 0)
!                               {
!                                       return true;
!                               } else {
!                                       return false;
!                               } 
!                       }
!               } else {
!                       return false;
!               }
        }
+ 
  
        // Determine if this is an UNC path.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]