private void DeleteFileAndSend(Session session, FileDeleteRequest request) { var deleteFileEventArgs = new DeleteFileEventArgs(request.Key); var response = new FileDeleteResponse() { MessageId = request.MessageId, ResponseType = ResponseType.OK }; try { DeleteFile?.Invoke( this, deleteFileEventArgs); } catch (Exception ex) { OnException(session, ex, disconnect: false); response.ResponseType = ResponseType.Exception; response.Exception = ex.Message; } SendData( session, SerializeManager.Current.Serialize(response)); }
public string DeleteChapterFile(string path) { var model = new FileDeleteResponse(); if (System.IO.File.Exists(path)) { // model.EncodeFilePath = EncodeFile(path); try { System.IO.File.Delete(path); model.Status = true; } catch (Exception e) { //RedirectToAction("ErrorOnPage", "Error"); } } var serializer = new JavaScriptSerializer { MaxJsonLength = Int32.MaxValue, RecursionLimit = 100 }; string jsonResult = serializer.Serialize(model); return(jsonResult); }
public string DeleteChapterFile(string path) { var model = new FileDeleteResponse(); if (System.IO.File.Exists(path)) { // model.EncodeFilePath = EncodeFile(path); try { System.IO.File.Delete(path); model.Status = true; } catch (Exception e) { //RedirectToAction("ErrorOnPage", "Error"); } } var serializer = new JavaScriptSerializer { MaxJsonLength = Int32.MaxValue, RecursionLimit = 100 }; string jsonResult = serializer.Serialize(model); return jsonResult; }