コード例 #1
0
        public string RenameSubfile(string subfile, string newName)
        {
            int index = FindSubfile(subfile);

            if (index < 0)
            {
                throw new Exception("Couldn't find the subfile " + subfile);
            }

            newName = newName.Trim();
            if (!Utility.ValidFilePath(newName))
            {
                throw new Exception("The name is invalid");
            }

            if (FindSubfile(newName) >= 0)
            {
                throw new Exception("A subfile with " + newName + " already exists");
            }

            Parser.Subfiles[index].Name = newName;
            return(newName);
        }