Esempio n. 1
0
        private void LoadFiles(string path1, string extra, int count)
        {
            if ((string.IsNullOrEmpty(path1) == false) && Directory.Exists(path1))
            {
                foreach (var fileName in Directory.GetFiles(path1))
                {
                    if (new FileInfo(fileName).Length < maxFileSize)
                    {
                        var file = File.ReadAllBytes(fileName);

                        lock (files)
                        {
                            if (count != loadCount)
                            {
                                return;
                            }
                            files.Add(extra + Path.GetFileName(fileName),
                                      new HttpFile(file, HttpMessage.GetContentType(fileName, file)));
                        }
                    }
                }

                foreach (var directory in Directory.GetDirectories(path1))
                {
                    LoadFiles(directory, extra + Path.GetFileName(directory) + "/", count);
                }
            }
        }