コード例 #1
0
        public static bool DoesImportOverwriteData(string filePath)
        {
            string srcFilePath, targetName, targetDir;

            PrepareImportFilePaths(filePath, out srcFilePath, out targetName, out targetDir);

            // Does the source file already exist?
            if (File.Exists(srcFilePath))
            {
                // If they're not the same file, this would overwrite existing data.
                return(!PathHelper.FilesEqual(filePath, srcFilePath));
            }

            // Find an importer and check if one of its output files already exist
            IFileImporter importer = importers.FirstOrDefault(i => i.CanImportFile(srcFilePath));

            return(importer != null && importer.GetOutputFiles(srcFilePath, targetName, targetDir).Any(File.Exists));
        }