コード例 #1
0
        private string RenameFile(string oldPath)
        {
            string newPath = new TaggedMediaFileRenamer(oldPath, remamePattern).GetNewPath(_wordCasing);

            FEFileTaskSupport support = new FEFileTaskSupport(null);

            List <string> linkedFiles = support.GetChildFiles(oldPath, FileTaskType.Move);

            File.Move(oldPath, newPath);

            if (linkedFiles != null)
            {
                string oldName = Path.GetFileNameWithoutExtension(oldPath);
                string newName = Path.GetFileNameWithoutExtension(newPath);

                foreach (string linkedFile in linkedFiles)
                {
                    string newLinkedFile = linkedFile.Replace(oldName, newName);
                    File.Move(linkedFile, StringUtils.Capitalize(newLinkedFile, _wordCasing));
                }
            }

            files[currentStep] = newPath;
            return(Translator.Translate("TXT_SUCCESS"));
        }
コード例 #2
0
ファイル: Task.cs プロジェクト: rraguso/protone-suite
        private string RenameFile(string oldPath)
        {
            string newPath = new TaggedMediaFileRenamer(oldPath, remamePattern).GetNewPath(_wordCasing);

            FEFileTaskSupport support = new FEFileTaskSupport(null);

            FileInfo fi = new FileInfo(oldPath);
            List<string> linkedFiles = support.GetChildFiles(fi, FileTaskType.Move);

            File.Move(oldPath, newPath);

            if (linkedFiles != null)
            {
                string oldName = Path.GetFileNameWithoutExtension(oldPath);
                string newName = Path.GetFileNameWithoutExtension(newPath);

                foreach (string linkedFile in linkedFiles)
                {
                    string newLinkedFile = linkedFile.Replace(oldName, newName);
                    File.Move(linkedFile, StringUtils.Capitalize(newLinkedFile, _wordCasing));
                }
            }

            files[currentStep] = newPath;
            return Translator.Translate("TXT_SUCCESS");
        }