Example #1
0
        public Umbraco.Courier.Core.Revision GetRevision(string name, string username, string password)
        {
            //Auth login and IP
            AuthorizeClient(username, password);

            /*
             * RevisionStorage revstorage = new RevisionStorage();
             * var rev = revstorage.GetFromDirectory(name, name);
             * revstorage.Dispose();
             */


            return(LocalRepo.GetRevision(name));
        }
Example #2
0
        public void CloseSession(string sessionKey, string username, string password)
        {
            if (string.IsNullOrEmpty(sessionKey))
            {
                sessionKey = "default";
            }

            //Auth login and IP
            AuthorizeClient(username, password);

            LocalRepo.SessionKey = sessionKey;
            LocalRepo.CloseSession(sessionKey);

            //RevisionLog.CloseCurrentLog(Core.Context.Current.MapPath("/app_data/courier/temp_log.temp"), false);
        }
Example #3
0
        public string GetResourceContents(string sessionKey, ItemIdentifier itemId, string itemTypeName, Resource resource, string user, string pass)
        {
            //Auth login and IP
            AuthorizeClient(user, pass);

            LocalRepo.SessionKey = sessionKey;
            Type itemType = Type.GetType(itemTypeName);

            byte[] resourceContents = LocalRepo.GetResourceContents(itemId, itemType, resource, "");

            if (resourceContents == null || resourceContents.Length <= 0)
            {
                return("");
            }

            return(Convert.ToBase64String(resourceContents));
        }
Example #4
0
        public RepositoryActionResponse Extract(string sessionKey, byte[] item, ItemIdentifier itemId, bool overwrite, string user, string pass)
        {
            //Auth login and IP
            AuthorizeClient(user, pass);

            var p = ItemProviderCollection.Instance.GetProvider(itemId.ProviderId);
            var i = p.Deserialize(itemId, item);

            if (string.IsNullOrEmpty(sessionKey))
            {
                sessionKey = "default";
            }

            LocalRepo.SessionKey = sessionKey;
            var status = LocalRepo.ExtractItem(i, overwrite);

            return(status);
        }
Example #5
0
        public string Package(string sessionKey, ItemIdentifier itemId, string user, string pass)
        {
            //Auth login and IP
            AuthorizeClient(user, pass);

            LocalRepo.SessionKey = sessionKey;
            var item = LocalRepo.Package(itemId);

            byte[] item_array = new byte[0];

            if (item != null)
            {
                foreach (var r in item.Resources)
                {
                    r.ResourceContents = null;
                }

                item_array = Core.Serialization.Serializer.Serialize(item, item.GetType());
            }

            return(Convert.ToBase64String(item_array));
        }
Example #6
0
        public bool TransferResources(string sessionKey, ResourceTransfer[] resources, string user, string pass)
        {
            //Auth login and IP
            AuthorizeClient(user, pass);

            foreach (var rt in resources)
            {
                if (!Core.Settings.disableBase64Encoding && !string.IsNullOrEmpty(rt.Resource.ResourceAsBase64))
                {
                    rt.Resource.ResourceContents = Convert.FromBase64String(rt.Resource.ResourceAsBase64);
                    rt.Resource.ResourceAsBase64 = string.Empty;
                }

                if (!Core.Settings.disableZip)
                {
                    rt.Resource.ResourceContents = Compression.Decompress(rt.Resource.ResourceContents);
                }
            }

            LocalRepo.SessionKey = sessionKey;
            return(LocalRepo.TransferResources(resources));
        }
Example #7
0
        public bool TransferResource(string sessionKey, ItemIdentifier itemId, string type, Resource resource, bool overwrite, string user, string pass)
        {
            //Auth login and IP
            AuthorizeClient(user, pass);

            ResourceTransfer rt = new ResourceTransfer();

            rt.ItemType  = type;
            rt.OverWrite = overwrite;
            rt.ItemID    = itemId;

            rt.Resource = resource;
            rt.Resource.ResourceContents = Convert.FromBase64String(resource.ResourceAsBase64);
            rt.Resource.ResourceAsBase64 = string.Empty;

            if (string.IsNullOrEmpty(sessionKey))
            {
                sessionKey = "default";
            }

            LocalRepo.SessionKey = sessionKey;
            return(LocalRepo.TransferResource(rt));
        }
Example #8
0
 public SystemItem[] GetChildren(ItemIdentifier itemId, string user, string pass)
 {
     //Auth login and IP
     AuthorizeClient(user, pass);
     return(LocalRepo.GetChildren(itemId));
 }
Example #9
0
 public bool Exists(ItemIdentifier itemId, string user, string pass)
 {
     AuthorizeClient(user, pass);
     return(LocalRepo.Exists(itemId));
 }