Esempio n. 1
0
        public void SetName(string newName)
        {
            CheckWritable();

            if (!parent.IsFreeName(newName))
            {
                throw new IOException(
                          "the name \"" + newName + "\" is already in use");
            }

            parent.UnlinkEntry(this);
            fileName = newName;
            parent.LinkEntry(this);
        }
Esempio n. 2
0
        /// <summary>
        /// Moves this entry to a new directory under the specified name.
        /// </summary>
        /// <param name="target">the direcrory where this entry should be moved to</param>
        /// <param name="newName">the new name under which this entry will be accessible
        ///     in the target directory</param>
        /// <exception cref="IOException">IOException on error moving this entry</exception>
        /// <exception cref="ReadOnlyException">ReadOnlyException if this directory is read-only</exception>
        public void MoveTo(FatLfnDirectory target, string newName)
        {
            CheckWritable();

            if (!target.IsFreeName(newName))
            {
                throw new IOException(
                          "the name \"" + newName + "\" is already in use");
            }

            parent.UnlinkEntry(this);
            parent   = target;
            fileName = newName;
            parent.LinkEntry(this);
        }