System.Security.Permissions.FileIOAccess.GetRoot C# (CSharp) Method

GetRoot() private static method

private static GetRoot ( String path ) : String
path String
return String
        private static String GetRoot( String path )
        {
#if !PLATFORM_UNIX            
            String str = path.Substring( 0, 3 );
            if (str.EndsWith( ":\\", StringComparison.Ordinal))
#else
            String str = path.Substring( 0, 1 );
            if(str ==  "/")
#endif // !PLATFORM_UNIX                        
            {
                return str;
            }
            else
            {
                return null;
            }
        }
        

Usage Example

 public bool IsSubsetOf(FileIOAccess operand)
 {
     if (operand == null)
     {
         return(this.IsEmpty());
     }
     if (operand.m_allFiles)
     {
         return(true);
     }
     if ((!this.m_pathDiscovery || !this.m_set.IsSubsetOfPathDiscovery(operand.m_set)) && !this.m_set.IsSubsetOf(operand.m_set))
     {
         if (!operand.m_allLocalFiles)
         {
             return(false);
         }
         string[] array = this.m_set.UnsafeToStringArray();
         for (int i = 0; i < array.Length; i++)
         {
             string root = FileIOAccess.GetRoot(array[i]);
             if (root == null || !FileIOAccess.IsLocalDrive(FileIOAccess.GetRoot(root)))
             {
                 return(false);
             }
         }
     }
     return(true);
 }
All Usage Examples Of System.Security.Permissions.FileIOAccess::GetRoot