Exemple #1
0
        internal static List <Rykonpath> getDirectoryPaths(string dir, string rootdirectory, out int sepindex)
        {
            sepindex = 0;
            try
            {
                if (AppHelper.ExistedDir(dir) == false)
                {
                    dir = AppHelper.RepairPathSlashes(dir);
                    AppHelper.RepairPath(dir);
                }
                if (AppHelper.ExistedDir(dir) == false)
                {
                    return(null);
                }
                List <Rykonpath> resul = new List <Rykonpath>();
                string[]         files = AppHelper.GetFiles(dir);
                string[]         dirs  = AppHelper.GetDirectories(dir);
                if (dirs != null)
                {
                    foreach (string d in dirs)
                    {
                        resul.Add(new Rykonpath(d, Rykonpathtype.directory, rootdirectory));
                    }
                }

                if (files != null)
                {
                    foreach (string f in files)
                    {
                        resul.Add(new Rykonpath(f, Rykonpathtype.File, rootdirectory));
                    }
                }

                sepindex = dirs.Length;
                return(resul);
            }
            catch
            {
                return(null);
            }
        }