public void AddProperty(Property p) { if (p != null) { properties.Add(p); } if (p.Directive == (byte)Directives.Attributes) { attributes = OperaHistory.ParseRow(p.Content).Properties; } }
public bool HasNextIndexable () { if (history_enumerator == null) return false; while (history_enumerator.MoveNext ()) { OperaHistory.Row row = (OperaHistory.Row) history_enumerator.Current; if (Allowed (row) && ! IsUpToDate (row)) return true; } history_enumerator = null; history = null; // Help the GC here return false; }
public static void Main(string[] args) { if (args.Length != 1) { return; } OperaHistory op = new OperaHistory(args [0]); IEnumerator iter = op.GetEnumerator(); while (iter.MoveNext()) { Row row = (Row)iter.Current; Uri uri = row.Address; Console.WriteLine(uri); } }
public OperaIndexableGenerator(OperaIndexer indexer, string cache_dir) { this.cache_dir = cache_dir; this.indexer = indexer; if(history != null && history.GetLastRead() >= Directory.GetLastWriteTime(cache_dir)){ history_enumerator = history.GetEnumerator(); return; } try { history = new OperaHistory (Path.Combine (cache_dir, "dcache4.url")); history_enumerator = history.GetEnumerator (); } catch (Exception e) { Logger.Log.Error (e, "Failed to list cache objects in {0}", Path.Combine (cache_dir, "dcache4.url")); } }
public OperaIndexableGenerator(OperaIndexer indexer, string cache_dir) { this.cache_dir = cache_dir; this.indexer = indexer; if (history != null && history.GetLastRead() >= Directory.GetLastWriteTime(cache_dir)) { history_enumerator = history.GetEnumerator(); return; } try { history = new OperaHistory(Path.Combine(cache_dir, "dcache4.url")); history_enumerator = history.GetEnumerator(); } catch (Exception e) { Logger.Log.Error(e, "Failed to list cache objects in {0}", Path.Combine(cache_dir, "dcache4.url")); } }
public bool HasNextIndexable() { if (history_enumerator == null) { return(false); } while (history_enumerator.MoveNext()) { OperaHistory.Row row = (OperaHistory.Row)history_enumerator.Current; if (Allowed(row) && !IsUpToDate(row)) { return(true); } } history_enumerator = null; history = null; // Help the GC here return(false); }
private Indexable OperaRowToIndexable (OperaHistory.Row row) { // It's unsafe to index secure content since it may contain sensitive data if (row.Address.Scheme == Uri.UriSchemeHttps) return null; Indexable indexable = new Indexable (row.Address); indexable.HitType = "WebHistory"; indexable.MimeType = row.MimeType; indexable.Timestamp = row.LastVisited; indexable.AddProperty(Beagle.Property.New ("fixme:host",row.Address.Host)); indexable.AddProperty (Beagle.Property.NewUnsearched ("fixme:size", row.Length)); // hint for the filter about the charset indexable.AddProperty (Property.NewUnsearched (StringFu.UnindexedNamespace + "charset", row.Encoding.ToString ())); if(row.Compression == "gzip") indexable.SetBinaryStream (new GZipInputStream (File.OpenRead (Path.Combine (cache_dir, row.LocalFileName)))); else indexable.ContentUri = new Uri (Path.Combine (cache_dir, row.LocalFileName)); indexer.AttributeStore.AttachLastWriteTime (Path.Combine (cache_dir, row.LocalFileName), DateTime.UtcNow); return indexable; }
public bool Allowed (OperaHistory.Row row) { foreach (string mime in indexed_mimetypes) { if (row.MimeType == mime) return true; } return false; }
public bool IsUpToDate (OperaHistory.Row row) { return indexer.AttributeStore.IsUpToDate (Path.Combine (cache_dir, row.LocalFileName)); }
public static void Main (string[] args) { if (args.Length != 1) return; OperaHistory op = new OperaHistory (args [0]); IEnumerator iter = op.GetEnumerator (); while (iter.MoveNext ()) { Row row = (Row) iter.Current; Uri uri = row.Address; Console.WriteLine (uri); } }