/// <summary>
 /// Determines whether the resources structure is initialized. If it does not, it initializes.
 /// </summary>
 private static void EnsureAllChildren()
 {
     if (s_AllChildren == null)
     {
         s_AllChildren = new SortedList();
         ResourceVirtualDirectory rootDir = new ResourceVirtualDirectory(VirtualRootShortPath, s_AllChildren);
         s_AllChildren.Add(VirtualRootShortPath.ToLower(CultureInfo.CurrentCulture), rootDir);
     }
 }
        /// <summary>
        /// Initializes the structure of the virtual directory.
        /// </summary>
        /// <param name="virtualPath">The path to the virtual directory.</param>
        /// <param name="children">The collection to add all children of the newly created directory to.</param>
        private void Initialize(string virtualPath, SortedList children)
        {
            string     path       = null;
            string     fileName   = null;
            string     cutPath    = null;
            string     lowerPath  = null;
            object     obj        = null;
            SortedList listObj    = m_Files;
            bool       isFilePath = true;

            foreach (DataRow row in ResourcesTable.Select(string.Concat("Path LIKE '", virtualPath, "%'")))
            {
                path     = row["Path"].ToString();
                fileName = VirtualPathUtility.GetFileName(path);
                cutPath  = path.Replace(virtualPath, string.Empty);

                isFilePath = (string.Compare(fileName, cutPath, StringComparison.OrdinalIgnoreCase) == 0);

                if (!isFilePath)
                {
                    path    = path.Substring(0, (path.IndexOf('/', virtualPath.Length + 1) + 1));
                    listObj = m_Directories;
                }
                else
                {
                    listObj = m_Files;
                }

                lowerPath = path.ToLower(CultureInfo.CurrentCulture);

                if (!listObj.Contains(lowerPath))
                {
                    if (isFilePath)
                    {
                        obj = new ResourceVirtualFile(path);
                    }
                    else
                    {
                        obj = new ResourceVirtualDirectory(path, children);
                    }

                    m_Children.Add(obj);
                    listObj.Add(lowerPath, obj);
                    if (!children.Contains(lowerPath))
                    {
                        children.Add(lowerPath, obj);
                    }
                }
            }
        }