예제 #1
0
        private static FileLoader[] LoadStandardFile(string path, CompressedStorage storage)
        {
            var rd     = File.OpenText(path);
            var fileId = storage.AddFile(path);
            var title  = Path.GetFileName(path);

            return(new[] { new FileLoader(rd, storage, fileId, title) });
        }
예제 #2
0
        private static FileLoader[] LoadBzip(string path, CompressedStorage storage)
        {
            var uncompressor = new BZip2InputStream(File.OpenRead(path));
            var rd           = new StreamReader(uncompressor);
            var fileId       = storage.AddFile(path);
            var title        = Path.GetFileName(path);

            return(new[] { new FileLoader(rd, storage, fileId, title) });
        }
예제 #3
0
        private static FileLoader[] LoadZip(string path, CompressedStorage storage)
        {
            var zip    = new ZipFile(path);
            var result = new List <FileLoader>();

            for (int i = 0; i < zip.Count; i++)
            {
                var entry = zip[i];
                if (entry.IsFile)
                {
                    var uncompressor = zip.GetInputStream(i);
                    var rd           = new StreamReader(uncompressor);
                    var fileId       = storage.AddFile(path);
                    var title        = string.Format("{0}:{1}", Path.GetFileNameWithoutExtension(path), zip[i].Name);

                    result.Add(new FileLoader(rd, storage, fileId, title));
                }
            }

            return(result.ToArray());
        }
예제 #4
0
        private static FileLoader[] LoadZip(string path, CompressedStorage storage)
        {
            var zip = new ZipFile(path);
            var result = new List<FileLoader>();
            for (int i = 0; i < zip.Count; i++)
            {
                var entry = zip[i];
                if (entry.IsFile)
                {
                    var uncompressor = zip.GetInputStream(i);
                    var rd = new StreamReader(uncompressor);
                    var fileId = storage.AddFile(path);
                    var title = string.Format("{0}:{1}", Path.GetFileNameWithoutExtension(path), zip[i].Name);

                    result.Add(new FileLoader(rd, storage, fileId, title));
                }
            }

            return result.ToArray();
        }
예제 #5
0
        private static FileLoader[] LoadBzip(string path, CompressedStorage storage)
        {
            var uncompressor = new BZip2InputStream(File.OpenRead(path));
            var rd = new StreamReader(uncompressor);
            var fileId = storage.AddFile(path);
            var title = Path.GetFileName(path);

            return new[] { new FileLoader(rd, storage, fileId, title) };
        }
예제 #6
0
        private static FileLoader[] LoadStandardFile(string path, CompressedStorage storage)
        {
            var rd = File.OpenText(path);
            var fileId = storage.AddFile(path);
            var title = Path.GetFileName(path);

            return new[] {new FileLoader(rd, storage, fileId, title)};
        }