protected void BindDirectoryList() { ImageFolder = ""; DirectoryList.DataSource = Directory.GetDirectories(FileImageFolder).Select(directory => directory.Substring(directory.LastIndexOf('\\') + 1)); DirectoryList.DataBind(); DirectoryList.Items.Insert(0, "userfiles/images"); }
protected void BindDirectoryList() { LinkFolder = ""; string[] directories = Directory.GetDirectories(FileLinkFolder); directories = Array.ConvertAll <string, string>(directories, delegate(string directory) { return(directory.Substring(directory.LastIndexOf('\\') + 1)); }); DirectoryList.DataSource = directories; DirectoryList.DataBind(); DirectoryList.Items.Insert(0, "Root"); }
protected void Page_Init(object sender, EventArgs e) { if (!(CurrentUser = Request.GetUser()).Browse) { Response.StatusCode = 401; return; } if (InfoDirectory.Exists) { Views.SetActiveView(DirectoryView); if (IsPostBack) { return; } var dirs = InfoDirectory.EnumerateDirectories().ToList(); DirectoryList.DataSource = dirs; DirectoryList.DataBind(); DirectoryCount = dirs.Count.ToString(CultureInfo.InvariantCulture); var files = InfoDirectory.EnumerateFiles().ToList(); FileList.DataSource = files; FileList.DataBind(); FileCount = files.Count.ToString(CultureInfo.InvariantCulture); ArchiveFilePath.Text = string.IsNullOrWhiteSpace(RelativePath) ? "Files.7z" : (RelativePath + ".7z"); } else if (InfoFile.Exists) { string dataPath = FileHelper.GetDataFilePath(RelativePath), state = FileHelper.GetFileValue(dataPath, "state"); Task = GenerateFileTask.Create(RelativePath); if (Task == null) { if (state == TaskType.NoTask) { if (Request.IsAjaxRequest()) { Response.Redirect(Request.RawUrl, true); // processing is finished } Views.SetActiveView(FileView); Mime = FileHelper.GetDefaultMime(dataPath); RefreshFile(); } else { Views.SetActiveView(GeneralTaskProcessingView); } } else if (state == TaskType.UploadTask) { Views.SetActiveView(FileUploadingView); } else { Viewer.SetTask(Task); Views.SetActiveView(FileProcessingView); } } else { Views.SetActiveView(GoneView); Response.StatusCode = 404; } }