예제 #1
0
        public bool Rename(string newName)
        {
            var a = GetFullName().Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
            var b = a[a.Length - 1].Length + 1;

            string str = GetFullName().Remove(GetFullName().Length - b, b);

            string fullPathRenames;

            if (str == "")
            {
                fullPathRenames = newName;
            }
            else
            {
                fullPathRenames = str + '/' + newName;
            }

            foreach (var el in items)
            {
                if (el.GetType() == EntityType.ZIPDIRECTORY)
                {
                    ((EntityZipDirect)el).RenameFullPath(newName + '/' + el.GetName());
                }
                else
                {
                    ((EntityZipFile)el).RenameFullPath(newName + '/' + el.GetName());
                }
            }

            entry.FileName = fullPathRenames;
            ZipParent.SaveZip();
            return(true);
        }
예제 #2
0
 public bool Rename(string newName)
 {
     entry.FileName = Path.GetDirectoryName(entry.FileName) + @"\" + newName;
     ZipParent.SaveZip();
     return(true);
 }