3 using System
.Collections
;
12 public class TextFileObject
: FileObject
{
14 const int body_size
= 10;
17 public TextFileObject ()
19 body
= new string [body_size
];
20 for (int i
= 0; i
< body_size
; ++i
)
21 body
[i
] = Token
.GetRandom ();
24 override public string MimeType
{
25 get { return "text/plain"; }
28 override public string Extension
{
29 get { return ".txt"; }
32 override public void AddToStream (Stream stream
, EventTracker tracker
)
35 tracker
.ExpectingAdded (this.Uri
);
37 // We can't just use a StreamWriter here, since that
38 // will close the underlying stream when it gets
40 UnclosableStream unclosable
= new UnclosableStream (stream
);
41 StreamWriter writer
= new StreamWriter (unclosable
);
43 foreach (string str
in body
)
44 writer
.WriteLine (str
);
49 override protected bool MatchesQueryPart (QueryPart abstract_part
)
51 if (abstract_part
is QueryPart_Text
) {
53 part
= (QueryPart_Text
) abstract_part
;
55 if (part
.SearchFullText
)
56 foreach (string str
in body
)