public static List <string> PlaceTabViewContent(string LoadType, string Path) { ReadFileStreams MyStream = new ReadFileStreams(); HttpContext context = System.Web.HttpContext.Current; String DynamicUrl = string.Empty; if (context.Request.PhysicalPath.Length > context.Request.PhysicalApplicationPath.Length) { DynamicUrl = context.Request.PhysicalPath.Remove(0, context.Request.PhysicalApplicationPath.Length).Replace("\\", "/"); } List <string> Filestream = new List <string>(); string[] StreamSplit = DynamicUrl.Split('/'); if (StreamSplit.Length >= 2 && LoadType == "View") { //LoadView. Filestream = MyStream.GetFileData(Path + @"\" + StreamSplit[0] + @"\" + StreamSplit[1] + ".aspx"); } if (StreamSplit.Length >= 2 && LoadType == "PartialView") { //LoadView. Filestream = MyStream.GetFileData(Path + @"\" + StreamSplit[0] + @"\" + StreamSplit[1] + "PartialView.ascx"); } return(Filestream); }
public static string PlaceTabContent(string LoadType, string Path) { ReadFileStreams MyStream = new ReadFileStreams(); HttpContext context = System.Web.HttpContext.Current; String DynamicUrl = string.Empty; if (context.Request.PhysicalPath.Length > context.Request.PhysicalApplicationPath.Length) { DynamicUrl = context.Request.PhysicalPath.Remove(0, context.Request.PhysicalApplicationPath.Length).Replace("\\", "/"); } List <string> Filestream = new List <string>(); string CatchStreamStr = ""; string[] StreamSplit = DynamicUrl.Split('/'); if (StreamSplit.Length >= 2) { if (LoadType == "Controller") { if (StreamSplit[1] == "edit" || StreamSplit[1] == "delete") { StreamSplit[1] = "CRUD"; } if (StreamSplit[1] == "orders") { StreamSplit[1] = "ConditionalFormatting"; } //LoadController. Filestream = MyStream.GetFileData(Path + @"\" + StreamSplit[0] + @"\" + StreamSplit[1] + "Controller.cs"); CatchStreamStr = ""; foreach (string StreamStr in Filestream) { CatchStreamStr = CatchStreamStr + StreamStr; } } } return(CatchStreamStr); }
//public MvcSampleBrowser.Models.Northwind SqlCE //{ // get // { // AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true); // string connectionString = @"Data Source=|DataDirectory|\Northwind.sdf"; // return new MvcSampleBrowser.Models.Northwind(connectionString); // } //} //public MvcSampleBrowser.Models.EFModels.PUBSEntities EntitySQL //{ // get // { // return new MvcSampleBrowser.Models.EFModels.PUBSEntities(); // } //} //public MvcSampleBrowser.Models.PUBSEntities1 OutlookSQL //{ // get // { // return new MvcSampleBrowser.Models.PUBSEntities1(); // } //} ///// <summary> ///// Accordions this instance. ///// </summary> public void MainAccordion() { string DynamicUrl = System.Web.HttpContext.Current.Request.RawUrl.ToString(); // string order = "-1"; string[] subURL = { }; string[] selectedItem = { }; // Checks for query string format if (DynamicUrl.Contains('?')) { subURL = DynamicUrl.Split('?'); selectedItem = subURL[1].Split('='); DynamicUrl = subURL[0]; } AccordionModel accordionModel = new AccordionModel(); DirectoryInfo dir = new DirectoryInfo(HttpContext.Request.PhysicalApplicationPath + "Views"); FileInfo[] files = dir.GetFiles("Category.xml", SearchOption.AllDirectories); XDocument doc = new XDocument(); XElement root = new XElement("root"); // Reads the file foreach (FileInfo fileInfo in files) { root.Add(XDocument.Load(fileInfo.FullName).FirstNode); } // Gets the categories var catgories = from category in root.Elements("Category") orderby category.Attribute("Order").Value select new { categName = category.Attribute("Name").Value, categOrder = category.Attribute("Order").Value, subItem = category.Elements("Samples"), jQueryUI = category.Attribute("jQueryUI") }; foreach (var Categ in catgories) { string name = Categ.categName; var subItems = from category in Categ.subItem orderby category.Attribute("order").Value select new { subItemName = category.Attribute("displayname").Value, subItemUrl = Url.Content(String.Format("~/{0}", category.Attribute("url").Value)), child = category.FirstNode, filesList = category.Elements("FilesList").Elements("File") }; //Gets the sub categories foreach (var subCateg in subItems) { TagBuilder div = new TagBuilder("div"); HtmlA anchor = new HtmlA("", subCateg.subItemName, subCateg.subItemUrl); if (DynamicUrl.ToLower() == subCateg.subItemUrl.ToLower()) { var OtherFilesList = from category in subCateg.filesList select new { subItemName = category.Attribute("displayname").Value, subItemUrl = category.Attribute("url").Value }; foreach (var file in OtherFilesList) { string FileContent = string.Empty; ReadFileStreams MyStream = new ReadFileStreams(); List <string> Filestream = new List <string>(); Filestream = MyStream.GetFileData(HttpContext.Request.PhysicalApplicationPath + file.subItemUrl); foreach (string m in (IEnumerable)Filestream) { if (m != null) { FileContent += m.ToString(); } } FileContentList.Add(FileContent); FileNametoDisplay.Add(file.subItemName); int ExtensionStart = (file.subItemUrl).LastIndexOf("."); string Extension = file.subItemUrl.Substring(ExtensionStart + 1, file.subItemUrl.Length - ExtensionStart - 1); CSharpFormat FileCSFormat = new CSharpFormat(); HtmlFormat FileHtmlFormat = new HtmlFormat(); string FileFormatneed; if (Extension == "cs") { FileFormatneed = FileCSFormat.FormatCode(FileContent); } else { FileFormatneed = FileHtmlFormat.FormatCode(FileContent); } FileFormatreq.Add(FileFormatneed); } description = ((System.Xml.Linq.XText)(subCateg.child)).Value; ViewData["CurrentParent"] = Categ.categName; ViewData["CurrentItem"] = subCateg.subItemName; } div.InnerHtml = anchor.ToString(); } } accordionModel.Collapsible = true; accordionModel.Navigation = false; accordionModel.CustomCss = "MyAccordionStyle"; accordionModel.AutoHeight = false; ViewData["Mainaccordion"] = accordionModel; }