24 lines
522 B
C#
24 lines
522 B
C#
|
|
using System.IO;
|
|||
|
|
|
|||
|
|
namespace NamedPipes
|
|||
|
|
{
|
|||
|
|
// Contains the method executed in the context of the impersonated user
|
|||
|
|
public class ReadFileToStream
|
|||
|
|
{
|
|||
|
|
private readonly string fn;
|
|||
|
|
private readonly StreamString ss;
|
|||
|
|
|
|||
|
|
public ReadFileToStream(StreamString str, string filename)
|
|||
|
|
{
|
|||
|
|
fn = filename;
|
|||
|
|
ss = str;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void Start()
|
|||
|
|
{
|
|||
|
|
string contents = File.ReadAllText(fn);
|
|||
|
|
ss.WriteString(contents);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|