public void WriteToFile(string path, string msg, string fileName, bool isUpload) { msg = msg.Replace("%40", "@"); TestingCode.ExportToXML(TestingCode.XMLFilePath(path), m_SessHandler); if (!FilePathIsInvalid(path, ConstantVariables.TEXT_EXTENSION)) { // TestingCode.ExportToXML(path.Replace(ConstantVariables.TEXT_EXTENSION, ConstantVariables.XML_EXTENSION), m_SessHandler); System.IO.File.AppendAllText(path, msg + Environment.NewLine); if (fileName != null) { // ExportToXML(fileName, isUpload); } } }
public void ExportToXML(string fileName, bool isUpload) { if (fileName == null) { return; } lock (Locker) { TestingCode.ExportToXML(TestingCode.XMLFilePath("E:\\temp\\"), m_SessHandler); FileStream tempFilsStream; if (fileName != string.Empty) { fileName = fileName.Replace("\"", string.Empty); tempFilsStream = new FileStream("E:\\temp\\" + GetDateTime() + fileName, FileMode.Create); } else { tempFilsStream = new FileStream("E:\\temp\\" + GetDateTime(), FileMode.Create); } if (isUpload) { if (m_SessHandler.RequestRawData != null) { tempFilsStream.Write(m_SessHandler.RequestRawData, 0, m_SessHandler.RequestRawData.Length); } } else { if (m_SessHandler.ResponseRawData != null) { tempFilsStream.Write(m_SessHandler.ResponseRawData, 0, m_SessHandler.ResponseRawData.Length); } } tempFilsStream.Close(); } }