protected virtual ISerializedItem GetExistingSerializedItem(ID id)
        {
            Assert.ArgumentNotNullOrEmpty(id, "id");

            var item = Database.GetItem(id);

            if (item == null)
            {
                return(null);
            }

            var reference = _serializationProvider.GetReference(new SitecoreSourceItem(item));

            if (reference == null)
            {
                return(null);
            }

            return(reference.GetItem());
        }
Beispiel #2
0
        private void WriteFullPackage(RemotingPackage package, string path)
        {
            // get rid of any existing serialized items before we overwrite them
            var roots = _pathResolver.GetRootSourceItems();

            foreach (var root in roots)
            {
                var rootReference = _serializationProvider.GetReference(root);
                if (rootReference != null)
                {
                    rootReference.Delete();
                }
            }

            var sourcePath = new DirectoryInfo(Path.Combine(package.TempDirectory, "serialization"));
            var targetPath = new DirectoryInfo(path);

            targetPath.Create();
            CopyFilesRecursively(sourcePath, targetPath);
        }