private void GetContents(HttpListenerRequest request, HttpListenerResponse response, ILog log) { Dictionary <string, string> parameters = request.Url.Query.ParseQueryParameters(); if (parameters.ContainsKey("file")) { string file = Uri.UnescapeDataString(parameters["file"]); response.WriteString(EditorLoadSaveHelper.LoadFile(_workdir, file, log), "text/plain"); } }
private void Save(HttpListenerRequest request, HttpListenerResponse response, ILog log) { Dictionary <string, string> parameters = request.ParsePostParameters(); if (parameters.ContainsKey("file") && parameters.ContainsKey("content")) { string file = Uri.UnescapeDataString(parameters["file"]); string content = Uri.UnescapeDataString(parameters["content"]); bool result = EditorLoadSaveHelper.SaveFile(_workdir, file, content, log); if (result) { response.WriteString("OK", "text/plain"); } else { response.WriteString("Error", "text/plain"); } } }