2 // TraceFilter.cs: Internal generic (Input/Output) trace filter
5 // Sebastien Pouliot (spouliot@motus.com)
7 // (C) 2003 Motus Technologies Inc. (http://www.motus.com)
12 using System
.Reflection
;
15 namespace Microsoft
.Web
.Services
.Diagnostics
{
17 internal class TraceFilter
{
19 public static string GetCompleteFilename (string filename
)
21 return AppDomain
.CurrentDomain
.BaseDirectory
+ Path
.DirectorySeparatorChar
+ filename
;
24 public static void WriteEnvelope (string filename
, SoapEnvelope envelope
)
27 throw new ArgumentNullException ("envelope");
30 XmlDocument log
= null;
32 // load and lock xml document
33 if (!File
.Exists (filename
)) {
34 fs
= File
.Open (filename
, FileMode
.Create
, FileAccess
.Write
, FileShare
.Read
);
35 log
= new XmlDocument ();
36 log
.LoadXml (String
.Format ("<?xml version=\"1.0\" encoding=\"utf-8\"?>{0}<log/>", Environment
.NewLine
));
39 fs
= File
.Open (filename
, FileMode
.Open
, FileAccess
.ReadWrite
, FileShare
.Read
);
40 log
= new XmlDocument ();
44 XmlNode xn
= log
.ImportNode (envelope
.DocumentElement
, true);
45 log
.DocumentElement
.AppendChild (xn
);