Ejemplo n.º 1
0
        /// <summary>Sets the specified property on the specfied path to value</summary>
        /// <remarks>Use <see cref="DeleteProperty(string,string, SvnSetPropertyArgs)" /> to remove an existing property</remarks>
        public bool SetProperty(string target, string propertyName, ICollection <byte> bytes, SvnSetPropertyArgs args)
        {
            if (string.IsNullOrEmpty(target))
            {
                throw new ArgumentNullException(nameof(target));
            }
            if (string.IsNullOrEmpty(propertyName))
            {
                throw new ArgumentNullException(nameof(propertyName));
            }
            if (!IsNotUri(target))
            {
                throw new ArgumentException(SharpSvnStrings.ArgumentMustBeAPathNotAUri, nameof(target));
            }
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }
            if (bytes == null)
            {
                throw new ArgumentNullException(nameof(bytes));
            }

            using var pool = new AprPool(_pool);

            var byteArray = bytes as byte[];

            if (byteArray == null)
            {
                byteArray = new byte[bytes.Count];

                bytes.CopyTo(byteArray, 0);
            }

            return(InternalSetProperty(target, propertyName, pool.AllocSvnString(byteArray), args, pool));
        }