internal override Response GetResponse() { Response response; switch (_code) { case HttpStatusCodes.SuccessCreated: { response = new Response(_code); return(response); } case HttpStatusCodes.SuccessMultistatus: { String str; try { str = FileManager.GetInstanse().GetDirInfo(_mFileName).Exists ? PropFindHelper.GetFilesPropInDir(_mFileName, 0) : PropFindHelper.GetFilesProp(_mFileName); response = new Response(HttpStatusCodes.SuccessMultistatus); } catch (DirectoryNotFoundException) { str = ""; response = new Response(HttpStatusCodes.ClientErrorNotFound); } Stream stream = new MemoryStream(Encoding.UTF8.GetBytes(str)); response.SetContentLength(stream.Length); response.SetData(stream); response.AddHeaderValue("Content-Type", "application/xml; charset=\"utf-8\""); return(response); } default: throw new Exception("Bad code " + _code); } }
internal override Response GetResponse() { Response response; String str; try { str = FileManager.GetInstanse().GetDirInfo(_mPath).Exists ? PropFindHelper.GetFilesPropInDir(_mPath, _mDepth) : PropFindHelper.GetFilesProp(_mPath); response = new Response(HttpStatusCodes.SuccessMultistatus); Logger.Trace(str); } catch (DirectoryNotFoundException) { str = ""; response = new Response(HttpStatusCodes.ClientErrorNotFound); } Stream stream = new MemoryStream(Encoding.UTF8.GetBytes(str)); response.SetContentLength(stream.Length); response.SetData(stream); response.AddHeaderValue("Content-Type", "application/xml; charset=\"utf-8\""); return(response); }