protected void Page_Load(object sender, EventArgs e)
        {
            ApplyAutoLogin();

            string moduleType = Server.UrlDecode(Request.QueryString["Type"]);
            string moduleRef  = Server.UrlDecode(Request.QueryString["Module"]);

            // Check the required attributes and redirect, if not specified.
            if (String.IsNullOrEmpty(moduleType) || String.IsNullOrEmpty(moduleRef))
            {
                Response.Redirect(Portal.API.Config.MainPage);
            }

            // Check if the user has access to the Module.
            PortalDefinition portDef = PortalDefinition.Load();

            if (CheckAccess(portDef.tabs, moduleType, moduleRef))
            {
                IDownloadProcessor downloadObj = null;

                // Hardcoded at the moment. Possible replacement with dynamic creation i.e. the activator class.
                if (0 == "FileBrowser".CompareTo(Request.QueryString["Type"]))
                {
                    downloadObj = new Portal.Modules.FileBrowser.Download();
                }

                // Process the Download.
                if (downloadObj != null)
                {
                    Response.Clear();
                    try
                    {
                        downloadObj.Process(Request, Response, moduleType, moduleRef);
                    }
                    catch (Exception exc)
                    {
                        Response.Clear();
                        errorMessage.Text = exc.Message;
                        return;
                    }
                    Response.End();
                    return;
                }
            }
            errorMessage.Text = "File not found or access denied";
        }
Exemple #2
0
 public HSCrawler(Settings settings)
 {
     this.settings = settings;
     dlProcessor   = new QBitTorrentProcessor(settings);
 }
 public LibraryController(IEventRepository repo, IDownloadProcessor processor)
 {
     repository        = repo;
     downloadProcessor = processor;
 }