Advertisement
absjabed

Untitled

Apr 20th, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.82 KB | None | 0 0
  1. //Js portion
  2. elFinder.prototype.i18.en.messages['cmdcustom'] = 'Create new custom folder';
  3.             elFinder.prototype._options.commands.push('custom');
  4.             elFinder.prototype.commands.custom = function () {
  5.             this.disableOnSearch = !0,
  6.             this.updateOnSelect = !1,
  7.             this.mime = "directory",
  8.             this.prefix = "Style name",
  9.             this.exec = e.proxy(this.fm.res("mixin", "make"), this),
  10.             this.shortcuts = [{
  11.                 pattern: "ctrl+shift+s"
  12.             }],
  13.             this.getstate = function () {
  14.                 return !this._disabled && this.fm.cwd().write ? 0 : -1
  15.                 }
  16.             }
  17.  
  18. //C# portion in FileSystemDriver.cs
  19. JsonResult IDriver.CustomMakeDir(string target, string name) {
  20.  
  21.             FullPath fullPath = ParsePath(target);
  22.             DirectoryInfo newDir = Directory.CreateDirectory(Path.Combine(fullPath.Directory.FullName, name));
  23.             JsonResult vr = Json(new AddResponse(newDir, fullPath.Root));
  24.             string json = new JavaScriptSerializer().Serialize(vr);
  25.  
  26.             JsonResultModel jsm = Newtonsoft.Json.JsonConvert.DeserializeObject<JsonResultModel>(json);
  27.             List<Added> listAddedObj = jsm.Data.Added;
  28.             string newParenthash = listAddedObj.FirstOrDefault().Hash; List<string> folders =  new List<string> {"COST","MIN","MAX"};
  29.  
  30.             foreach(string folderName in folders){
  31.                 FullPath fullPathn = ParsePath(newParenthash); //ParseCustomPath
  32.                 DirectoryInfo newDirn = Directory.CreateDirectory(Path.Combine(fullPathn.Directory.FullName, folderName));
  33.                 JsonResult jr = Json(new AddResponse(newDir, fullPathn.Root));
  34.                 string jsn = new JavaScriptSerializer().Serialize(jr);
  35.             }
  36.             return vr;
  37.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement