public HierarchicalModelCollection GetRootNodes()
        {
            HierarchicalModelCollection objRootNodes = new HierarchicalModelCollection();

            foreach (HierarchicalObjectBase objNavItem in this)
            {
                if (StringFunctions.IsNullOrWhiteSpace(objNavItem.ParentID))
                {
                    objRootNodes.Add(objNavItem);
                }
            }
            return(objRootNodes);
        }
Exemple #2
0
        private static bool HashMatch(System.Web.UI.ScriptManager objScriptManager)
        {
            //General.Debug.Trace("Starting Hash Match");
            string strPage       = GetPageKey(objScriptManager);
            string strTargetFile = objScriptManager.Page.MapPath("Scripts/Compiled/" + strPage + ".js");
            string strData       = File.ReadAllText(strTargetFile);

            strData = StringFunctions.AllBetween(strData, "<HASH>", "</HASH>");
            if (StringFunctions.IsNullOrWhiteSpace(strData))
            {
                return(false);
            }

            string[] aryHashKeys = strData.Split(',');
            if (aryHashKeys.Length != objScriptManager.Scripts.Count)
            {
                return(false);
            }

            foreach (string strHashKey in aryHashKeys)
            {
                string[] aryTemp = strHashKey.Split(':');
                string   strFile = aryTemp[0];

                if (!AlwaysCompress)
                {
                    System.Web.UI.ScriptReference objRef = FindScriptReference(strFile, objScriptManager);

                    if (objRef == null)
                    {
                        return(false);
                    }

                    bool blnCompressed = General.Data.SqlConvert.ToBoolean(aryTemp[2]);
                    if (blnCompressed != IsCompressed(strFile, objScriptManager))
                    {
                        return(false);
                    }
                }

                string strOldHash = aryTemp[1];
                string strNewHash = GetHashString(objScriptManager.Page.MapPath(strFile));

                if (strOldHash != strNewHash)
                {
                    return(false);
                }
            }
            //General.Debug.Trace("Finished Hash Match");
            return(true);
        }