示例#1
0
        EnumFile[] EnumerateFiles(string folder)
        {
            InteropSvc.InteropLib.WIN32_FIND_DATA data;
            uint handle = InteropSvc.InteropLib.Instance.FindFirstFile7(folder + "\\*", out data);
            var  list   = new List <EnumFile>();

            if (handle != 0xFFFFFFFFU)
            {
                bool result = false;
                do
                {
                    if (data.cFileName != "." && data.cFileName != "..")
                    {
                        EnumFile ef = new EnumFile();
                        ef.FileName = data.cFileName;
                        bool t = ((data.dwFileAttributes & 0x10) == 0x10) ? true : false;
                        ef.isFolder = t ? true : false;
                        list.Add(ef);
                    }
                    result = InteropSvc.InteropLib.Instance.FindNextFile7(handle, out data);
                } while (result != false);
                InteropSvc.InteropLib.Instance.FindClose7(handle);
            }
            return(list.ToArray());
        }
示例#2
0
        EnumFile[] EnumerateFiles(string folder)
        {
            InteropSvc.InteropLib.WIN32_FIND_DATA data;
            uint handle = InteropSvc.InteropLib.Instance.FindFirstFile7(folder + "\\*", out data);
            var list = new List<EnumFile>();

            if (handle != 0xFFFFFFFFU)
            {
                bool result = false;
                do
                {
                    if (data.cFileName != "." && data.cFileName != "..")
                    {
                        EnumFile ef = new EnumFile();
                        ef.FileName = data.cFileName;
                        bool t = ((data.dwFileAttributes & 0x10) == 0x10) ? true : false;
                        ef.isFolder = t ? true : false;
                        list.Add(ef);
                    }
                    result = InteropSvc.InteropLib.Instance.FindNextFile7(handle, out data);
                } while (result != false);
                InteropSvc.InteropLib.Instance.FindClose7(handle);
            }
            return list.ToArray();
        }
示例#3
0
        public EnumFile Enum(Type type)
        {
            var t = type.UnderlyingType();

            if (!EnumFiles.ContainsKey(t))
            {
                EnumFiles[t] = new EnumFile(t, RootDir);
            }

            return(EnumFiles[t]);
        }