PhysicalToVirtual() public static method

public static PhysicalToVirtual ( string physicalPath ) : string
physicalPath string
return string
        public static NodeCollection BuildFirstLevel()
        {
            string        path = HttpContext.Current.Server.MapPath("~/Examples/");
            DirectoryInfo root = new DirectoryInfo(path);

            DirectoryInfo[] folders = root.GetDirectories();
            folders = UIHelpers.SortFolders(root, folders);

            NodeCollection nodes = new NodeCollection(false);

            foreach (DirectoryInfo folder in folders)
            {
                if ((folder.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden ||
                    excludeList.Contains(folder.Name) || folder.Name.StartsWith("_"))
                {
                    continue;
                }

                ExampleConfig cfg = new ExampleConfig(folder.FullName + "\\config.xml", false);

                string iconCls = string.IsNullOrEmpty(cfg.IconCls) ? "" : cfg.IconCls;
                Node   node    = new Node();

                node.Text    = UIHelpers.MarkNew(folder.FullName, folder.Name.Replace("_", " "));
                node.IconCls = iconCls;

                string url = UIHelpers.PhysicalToVirtual(folder.FullName + "/");
                node.NodeID = "e" + Math.Abs(url.ToLower().GetHashCode());

                nodes.Add(node);
            }

            return(nodes);
        }
        private static NodeCollection BuildTreeLevel(DirectoryInfo root, int level, int maxLevel, XmlElement siteMap)
        {
            DirectoryInfo[] folders = root.GetDirectories();

            folders = SortFolders(root, folders);

            NodeCollection nodes = new NodeCollection(false);

            foreach (DirectoryInfo folder in folders)
            {
                if ((folder.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden ||
                    excludeList.Contains(folder.Name) || folder.Name.StartsWith("_"))
                {
                    continue;
                }

#if !PREEXTENSIONS
                if (level == 1 && (folder.Name == "Gantt" || folder.Name == "Scheduler"))
                {
                    continue;
                }
#endif

                ExampleConfig cfg = new ExampleConfig(folder.FullName + "\\config.xml", false);

                string     iconCls  = string.IsNullOrEmpty(cfg.IconCls) ? "" : cfg.IconCls;
                Node       node     = new Node();
                XmlElement siteNode = null;

                string folderName = folder.Name.Replace("_", " ");

                if (level < maxLevel)
                {
                    node.Text = folderName;

                    flagNode(ref node, folder.FullName);

                    node.IconCls = iconCls;
                    node.NodeID  = BaseControl.GenerateID();
                    //node.SingleClickExpand = true;

                    if (siteMap != null)
                    {
                        siteNode = siteMap.OwnerDocument.CreateElement("siteMapNode");
                        siteNode.SetAttribute("title", folderName);
                        siteMap.AppendChild(siteNode);
                    }

                    node.Children.AddRange(UIHelpers.BuildTreeLevel(folder, level + 1, maxLevel, siteNode));
                }
                else
                {
                    node.Text = folderName;

                    flagNode(ref node, folder.FullName);

                    node.IconCls = iconCls;
                    string url = PhysicalToVirtual(folder.FullName + "/");
                    node.NodeID = "e" + Math.Abs(url.ToLower().GetHashCode());
                    //node.Href = Regex.Replace(url, "^/Examples","");
                    node.CustomAttributes.Add(new ConfigItem("url", Regex.Replace(url, "^/Examples", "")));

                    node.Leaf = true;

                    if (siteMap != null)
                    {
                        siteNode = siteMap.OwnerDocument.CreateElement("siteMapNode");
                        siteNode.SetAttribute("title", folderName);
                        siteNode.SetAttribute("description", string.IsNullOrEmpty(cfg.Description) ? "No description" : cfg.Description);
                        siteNode.SetAttribute("url", "~" + UIHelpers.PhysicalToVirtual(folder.FullName + "/"));
                        siteMap.AppendChild(siteNode);
                    }
                }

                node.CustomAttributes.Add(new { tags = cfg.Tags.Select(item => item.ToLower()) });

                nodes.Add(node);
            }

            return(nodes);
        }
        private string BuildSourceTabs(string id, string wId, ExampleConfig cfg, DirectoryInfo dir)
        {
            List <string> files = cfg != null ? cfg.OuterFiles : new List <string>();

            FileInfo[]      filesInfo = dir.GetFiles();
            List <FileInfo> fileList  = new List <FileInfo>(filesInfo);

            int dIndex = 0;

            for (int ind = 0; ind < fileList.Count; ind++)
            {
                if (fileList[ind].Name.ToLower() == "default.aspx")
                {
                    dIndex = ind;
                }
            }

            if (dIndex > 0)
            {
                FileInfo fi = fileList[dIndex];
                fileList.RemoveAt(dIndex);
                fileList.Insert(0, fi);
            }

            foreach (string file in files)
            {
                fileList.Add(new FileInfo(file));
            }

            DirectoryInfo[] resources = dir.GetDirectories("resources", SearchOption.TopDirectoryOnly);

            if (resources.Length > 0)
            {
                GetSubFiles(fileList, resources[0]);
            }

            TabPanel tabs = new TabPanel
            {
                ID             = "tpw" + id,
                Border         = false,
                ActiveTabIndex = 0
            };

            int i = 0;

            foreach (FileInfo fileInfo in fileList)
            {
                if (excludeList.Contains(fileInfo.Name) || excludeExtensions.Contains(fileInfo.Extension.ToLower()))
                {
                    continue;
                }

                Panel panel = new Panel();
                panel.ID    = "tptw" + id + i++;
                panel.Title = fileInfo.Name;
                panel.CustomConfig.Add(new ConfigItem("url", UIHelpers.PhysicalToVirtual(fileInfo.FullName), ParameterMode.Value));
                switch (fileInfo.Extension)
                {
                case ".aspx":
                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  = UIHelpers.ApplicationRoot + "/GenerateSource.ashx";
                panel.Loader.Mode = LoadMode.Frame;
                panel.Loader.Params.Add(new Parameter("f", UIHelpers.PhysicalToVirtual(fileInfo.FullName), ParameterMode.Value));
                panel.Loader.LoadMask.ShowMask = true;

                tabs.Items.Add(panel);
            }

            return(tabs.ToScript(RenderMode.AddTo, wId));
        }