コード例 #1
0
        public ISerializedItem GetItemByPath(string database, string path)
        {
            var physicalPath = SerializationPathUtility.GetSerializedItemPath(_rootPath, database, path);

            if (!File.Exists(physicalPath))
            {
                // check for a short-path version
                physicalPath = SerializationPathUtility.GetShortSerializedItemPath(_rootPath, database, path);

                if (!File.Exists(physicalPath))
                {
                    return(null);
                }
            }

            var reference = new SitecoreSerializedReference(physicalPath, this);

            return(GetItem(reference));
        }
コード例 #2
0
        public virtual ISerializedItem GetItem(ISerializedReference reference)
        {
            Assert.ArgumentNotNull(reference, "reference");

            var path = SerializationPathUtility.GetReferenceItemPath(reference);

            if (File.Exists(path))
            {
                return(ReadItemFromDisk(path));
            }

            var shortPath = SerializationPathUtility.GetShortSerializedItemPath(_rootPath, reference);

            if (File.Exists(shortPath))
            {
                return(ReadItemFromDisk(shortPath));
            }

            return(null);
        }