System.Security.Util.StringExpressionSet.CreateListFromExpressions C# (CSharp) Method

CreateListFromExpressions() static private method

static private CreateListFromExpressions ( String str, bool needFullPath ) : ArrayList
str String
needFullPath bool
return System.Collections.ArrayList
        internal static ArrayList CreateListFromExpressions(String[] str, bool needFullPath)
        {
            if (str == null)
            {
                throw new ArgumentNullException( "str" );
            }
            ArrayList retArrayList = new ArrayList();
            for (int index = 0; index < str.Length; ++index)
            {
                if (str[index] == null)
                    throw new ArgumentNullException( "str" );

                String oneString = StaticProcessWholeString( str[index] );

                if (oneString != null && oneString.Length != 0)
                {
                    String temp = StaticProcessSingleString( oneString);

                    int indexOfNull = temp.IndexOf( '\0' );

                    if (indexOfNull != -1)
                        temp = temp.Substring( 0, indexOfNull );

                    if (temp != null && temp.Length != 0)
                    {
#if !PLATFORM_UNIX                            
                        if (!((temp.Length >= 3 && temp[1] == ':' && temp[2] == '\\' && 
                               ((temp[0] >= 'a' && temp[0] <= 'z') || (temp[0] >= 'A' && temp[0] <= 'Z'))) ||
                              (temp.Length >= 2 && temp[0] == '\\' && temp[1] == '\\')))
#else
                        if(!(temp.Length >= 1 && temp[0] == m_directorySeparator))
#endif // !PLATFORM_UNIX
                        {
                            throw new ArgumentException( Environment.GetResourceString( "Argument_AbsolutePathRequired" ) );
                        }

                        temp = CanonicalizePath( temp, needFullPath );


                        retArrayList.Add( temp );
                    }
                }
            }

            return retArrayList;
        }
        

Usage Example

Example #1
0
 public void AddExpressions(string[] str, bool checkForDuplicates, bool needFullPath)
 {
     this.AddExpressions(StringExpressionSet.CreateListFromExpressions(str, needFullPath), checkForDuplicates);
 }