private FileLoader(StreamReader rd, CompressedStorage storage, string fileId, string title) { m_reader = rd; m_storage = storage; m_fileId = fileId; Title = title; }
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) }); }
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) }); }
// Can return an array if path is a zip with multiple files public static FileLoader[] Load(string path, CompressedStorage storage) { var extension = Path.GetExtension(path).ToLower(); if (extension == ".bz2") { return(LoadBzip(path, storage)); } if (extension == ".zip") { return(LoadZip(path, storage)); } return(LoadStandardFile(path, storage)); }
// Can return an array if path is a zip with multiple files public static FileLoader[] Load(string path, CompressedStorage storage) { var extension = Path.GetExtension(path).ToLower(); if (extension == ".bz2") { return LoadBzip(path, storage); } if (extension == ".zip") { return LoadZip(path, storage); } return LoadStandardFile(path, storage); }
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()); }
public CompressedFileSearcher(CompressedStorage contents, string fileId) { m_contents = contents; m_fileId = fileId; }
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(); }
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)}; }
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) }; }
public StoredFile(CompressedStorage storage, string id) { m_storage = storage; m_id = id; m_asyncOp = AsyncOperationManager.CreateOperation(null); }
public SpanSearchState(CompressedStorage.Span s) { Span = s; }
public TextModel() { var settings = new AppSettingsReader(); MaxMemoryMb = GetIntConfig(settings, "MaxMemoryMb", 1024); MaxFilesPerZip = GetIntConfig(settings, "MaxFilesPerZip", 25); int maxConcurrency = GetIntConfig(settings, "MaxCompressConcurrency", 4); m_storage = new CompressedStorage(MaxMemoryMb, maxConcurrency); m_timer = new Timer(OnTick, null, TickPeriod, Timeout.Infinite); m_storage.OnNewData += OnNewData; }