コード例 #1
0
        public ScriptFilesComparerBase CreateScriptFilesComparer <TScriptFileType>(DBCommands dbCommands, string folderPath)
            where TScriptFileType : ScriptFileTypeBase, new()
        {
            DBExecutedFiles dbExecutedFiles = new DBExecutedFiles(dbCommands, ScriptFileTypeBase.Create <TScriptFileType>());

            ScriptFilesComparerBase scriptFilesComparer = null;

            if (typeof(TScriptFileType) == typeof(IncrementalScriptFileType))
            {
                FileSystemScriptFiles fileSystemScriptFiles = new FileSystemScriptFiles(_fileChecksum, ScriptFileTypeBase.Create <TScriptFileType>(), folderPath);
                scriptFilesComparer = new IncrementalScriptFilesComparer(fileSystemScriptFiles, dbExecutedFiles);
            }
            else if (typeof(TScriptFileType) == typeof(RepeatableScriptFileType))
            {
                FileSystemScriptFiles fileSystemScriptFiles = new FileSystemScriptFiles(_fileChecksum, ScriptFileTypeBase.Create <TScriptFileType>(), folderPath);
                scriptFilesComparer = new RepeatableScriptFilesComparer(fileSystemScriptFiles, dbExecutedFiles);
            }
            else if (typeof(TScriptFileType) == typeof(DevDummyDataScriptFileType))
            {
                FileSystemScriptFiles fileSystemScriptFiles = new FileSystemScriptFiles(_fileChecksum, ScriptFileTypeBase.Create <TScriptFileType>(), folderPath);
                scriptFilesComparer = new DevDummyDataScriptFilesComparer(fileSystemScriptFiles, dbExecutedFiles);
            }

            return(scriptFilesComparer);
        }
コード例 #2
0
        protected RuntimeScriptFile CreateLasetExecutedFileItem()
        {
            RuntimeScriptFile prevExecutionLastScriptFile = null;

            if (!string.IsNullOrWhiteSpace(DBExecutedFiles.LastFileOfLastExecutedFilename))
            {
                string lastFileFullPath = Path.Combine(FileSystemScriptFiles.FolderPath, DBExecutedFiles.LastFileOfLastExecutedFilename);
                prevExecutionLastScriptFile = FileSystemScriptFiles.CreateRuntimeScriptFileInstanceByFilename(lastFileFullPath);
            }

            return(prevExecutionLastScriptFile);
        }
コード例 #3
0
        public ScriptFilesComparerBase(FileSystemScriptFiles fileSystemScriptFiles,
                                       DBExecutedFiles dbExecutedFiles)
        {
            fileSystemScriptFiles.ThrowIfNull(nameof(fileSystemScriptFiles));
            dbExecutedFiles.ThrowIfNull(nameof(dbExecutedFiles));

            ScriptFileType        = fileSystemScriptFiles.ScriptFileType;
            FileSystemScriptFiles = fileSystemScriptFiles;
            DBExecutedFiles       = dbExecutedFiles;

            SetIsHashDifferentFlag();

            CreateFileExistInDBButNotExistInSystemList(fileSystemScriptFiles);
        }
コード例 #4
0
        private void CreateFileExistInDBButNotExistInSystemList(FileSystemScriptFiles fileSystemScriptFiles)
        {
            NotExistInFileSystemButExistInDB = new List <RuntimeScriptFile>();

            foreach (DataRow dbExecutedFileRow in DBExecutedFiles.ExecutedFilesList)
            {
                string dbFilename = Convert.ToString(dbExecutedFileRow["Filename"], CultureInfo.InvariantCulture);

                RuntimeScriptFile fileSystemFile =
                    AllFileSystemScriptFiles.FirstOrDefault(e => dbFilename.Trim().ToUpperInvariant() == e.Filename.Trim().ToUpperInvariant());

                if (fileSystemFile == null)
                {
                    string            fileFullPath = Path.Combine(fileSystemScriptFiles.FolderPath, dbFilename);
                    RuntimeScriptFile misssingFileSystemFileItem = fileSystemScriptFiles.CreateRuntimeScriptFileInstanceByFilename(fileFullPath);
                    NotExistInFileSystemButExistInDB.Add(misssingFileSystemFileItem);
                }

                if (dbFilename == DBExecutedFiles.LastFileOfLastExecutedFilename)
                {
                    break;
                }
            }
        }
コード例 #5
0
 public RuntimeScriptFile CreateNextNewScriptFile(string scriptName)
 {
     return(FileSystemScriptFiles.CreateNextRuntimeScriptFileInstance(scriptName, LastScriptFile));
 }
コード例 #6
0
 public bool TryParseNextRuntimeScriptFileName(string scriptName, out RuntimeScriptFile newRuntimeScriptFile)
 {
     return(FileSystemScriptFiles.TryParseNextRuntimeScriptFileName(scriptName, LastScriptFile, out newRuntimeScriptFile));
 }