コード例 #1
0
        private void ExecuteOutputGenerationPostActions(TempGenerationResult result)
        {
            var postActions = PostactionFactory.FindOutputGenerationPostActions(result);

            foreach (var postAction in postActions)
            {
                postAction.Execute();
            }
        }
コード例 #2
0
        private TempGenerationResult CompareTempGenerationWithProject()
        {
            var parentGenerationOutputPath = Directory.GetParent(GenContext.Current.GenerationOutputPath).FullName;
            var parentDestinationPath      = Directory.GetParent(GenContext.Current.DestinationPath).FullName;
            var result = new TempGenerationResult();
            var files  = Directory
                         .EnumerateFiles(parentGenerationOutputPath, "*", SearchOption.AllDirectories)
                         .Where(f => !Regex.IsMatch(f, MergeConfiguration.PostactionRegex) && !Regex.IsMatch(f, MergeConfiguration.FailedPostactionRegex))
                         .ToList();

            foreach (var file in files)
            {
                var destFilePath = file.GetDestinationPath();
                var fileName     = file.GetPathRelativeToGenerationParentPath();

                var projectFileName = Path.GetFullPath(Path.Combine(parentDestinationPath, fileName));

                if (File.Exists(projectFileName))
                {
                    if (GenContext.Current.MergeFilesFromProject.ContainsKey(fileName))
                    {
                        if (FilesAreEqual(file, destFilePath))
                        {
                            if (!GenContext.Current.FailedMergePostActions.Any(g => g.FileName == fileName))
                            {
                                GenContext.Current.MergeFilesFromProject.Remove(fileName);
                                result.UnchangedFiles.Add(fileName);
                            }
                        }
                        else
                        {
                            result.ModifiedFiles.Add(fileName);
                        }
                    }
                    else
                    {
                        if (FilesAreEqual(file, destFilePath))
                        {
                            result.UnchangedFiles.Add(fileName);
                        }
                        else
                        {
                            result.ConflictingFiles.Add(fileName);
                        }
                    }
                }
                else
                {
                    result.NewFiles.Add(fileName);
                }
            }

            return(result);
        }