public static GetFiles ( string url, bool download ) : List |
||
url | string | |
download | bool | |
Результат | List |
public static TabPanel BuildSourceTabs(string idSuffix, string url) { List <FileInfo> files = SourceModel.GetFiles(url, false); TabPanel tabs = new TabPanel { ID = "tpw" + idSuffix, Border = false, ActiveTabIndex = 0 }; int i = 0; foreach (FileInfo fileInfo in files) { Panel panel = new Panel(); panel.ID = "tptw" + idSuffix + i++; panel.Title = fileInfo.Name; switch (fileInfo.Extension) { case ".aspx": case ".cshtml": case ".ascx": panel.Icon = Icon.PageWhiteCode; break; case ".cs": panel.Icon = Icon.PageWhiteCsharp; break; case ".xml": case ".xsl": panel.Icon = Icon.ScriptCodeRed; break; case ".js": panel.Icon = Icon.Script; break; case ".css": panel.Icon = Icon.Css; break; } panel.Loader = new ComponentLoader(); panel.Loader.Url = ExamplesModel.ApplicationRoot + "/Source/GetSourceFile"; panel.Loader.Mode = LoadMode.Frame; panel.Loader.Params.Add(new Parameter("file", SourceModel.PhysicalToVirtual(fileInfo.FullName), ParameterMode.Value)); panel.Loader.LoadMask.ShowMask = true; tabs.Items.Add(panel); } return(tabs); }
public ActionResult DownloadExample(string url) { if (string.IsNullOrEmpty(url)) { return(new HttpStatusCodeResult((int)HttpStatusCode.BadRequest)); } string path = this.HttpContext.Server.MapPath("~/Areas" + url); string examplesRoot = this.HttpContext.Server.MapPath(ExamplesModel.ApplicationRoot + "/Areas/"); if (url.ToLowerInvariant() == "all") { return(new ZipResult(examplesRoot, "Ext_Net_MVC_Samples")); } if (!path.StartsWith(examplesRoot, true, CultureInfo.CurrentCulture)) { return(new HttpStatusCodeResult((int)HttpStatusCode.BadRequest)); } return(new ZipResult(SourceModel.GetFiles(url, true), new DirectoryInfo(path).Name)); }