Ext.Net.MVC.Examples.ExamplesModel.IsNew C# (CSharp) Method

IsNew() private static method

private static IsNew ( string folder ) : bool
folder string
return bool
        private static bool IsNew(string folder)
        {
            if (ExamplesModel.rootCfg == null)
            {
                ExamplesModel.rootCfg = new ExampleConfig(new DirectoryInfo(HttpContext.Current.Server.MapPath(ExamplesModel.ExamplesRoot)) + "\\config.xml");
            }

            foreach (string newFolder in rootCfg.NewFolders)
            {
                string newPath = string.Concat(HttpContext.Current.Server.MapPath(ExamplesModel.ExamplesRoot), newFolder);

                if (newPath.StartsWith(folder, StringComparison.CurrentCultureIgnoreCase))
                {
                    string end = newPath.Substring(folder.Length);

                    if ((end.StartsWith("\\") || end.Equals("")))
                    {
                        return true;
                    }
                }
            }

            return false;
        }

Usage Example

Ejemplo n.º 1
0
        private static void BuildViewsLevel(DirectoryInfo area, Node areaNode)
        {
            DirectoryInfo[] folders = new DirectoryInfo(area.FullName + "\\Views").GetDirectories();

            folders = ExamplesModel.SortFolders(area, folders);

            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");

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

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

                node.Text = folderName;

                if (ExamplesModel.IsNew(folder.FullName))
                {
                    node.CustomAttributes.Add(new ConfigItem("isNew", "true", ParameterMode.Raw));
                }

                node.IconCls = iconCls;
                string url = string.Concat(ExamplesModel.ApplicationRoot, "/", area.Name, "/", folder.Name, "/");
                node.NodeID = "e" + Math.Abs(url.ToLower().GetHashCode());
                //node.Href = url;
                node.CustomAttributes.Add(new ConfigItem("url", url));

                node.Leaf = true;

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

                areaNode.Children.Add(node);
            }
        }
All Usage Examples Of Ext.Net.MVC.Examples.ExamplesModel::IsNew