コード例 #1
0
 protected ProjectPatcher(SolutionOptions solutionOptions, ProjectInfo project)
 {
     this.solutionOptions = solutionOptions ?? throw new ArgumentNullException(nameof(solutionOptions));
     this.project         = project ?? throw new ArgumentNullException(nameof(project));
     Debug.Assert(solutionOptions.AllProjects.Any(a => a == project));
     textFilePatcher = new TextFilePatcher(project.Filename);
 }
コード例 #2
0
 public SolutionPatcher(SolutionOptions solutionOptions)
 {
     this.solutionOptions = solutionOptions ?? throw new ArgumentNullException(nameof(solutionOptions));
     solutionDir          = Path.GetDirectoryName(solutionOptions.SolutionFilename) !;
     textFilePatcher      = new TextFilePatcher(solutionOptions.SolutionFilename);
     unityVersionDirGuid  = Guid.NewGuid();
 }
コード例 #3
0
ファイル: Patcher.cs プロジェクト: abcordova/dnSpy-Unity-mono
        void CopyOriginalUnityFiles()
        {
            Log($"Copying files from {unityRepo.RepoPath} to {dnSpyVersionPath}");
            unityRepo.ThrowIfTreeNotClean();
            dnSpyRepo.ThrowIfTreeNotClean();
            unityRepo.CheckOut(unityGitHash);
            dnSpyRepo.CheckOut(Constants.DnSpyUnityRepo_master_Branch);
            unityRepo.ThrowIfTreeNotClean();
            dnSpyRepo.ThrowIfTreeNotClean();
            FileUtils.CopyFilesFromTo(unityRepo.RepoPath, dnSpyVersionPath);
            foreach (var dir in Constants.unityFoldersToCopy)
            {
                var sourceDir      = Path.Combine(unityRepo.RepoPath, dir);
                var destinationDir = Path.Combine(dnSpyVersionPath, dir);
                FileUtils.CopyDirectoryFromTo(sourceDir, destinationDir);
            }

            var gitignore = Path.Combine(dnSpyVersionPath, "mono", "cil", ".gitignore");

            if (!TextFilePatcher.RemoveLines(gitignore, line => line.Text == "/opcode.def"))
            {
                throw new ProgramException("Couldn't remove /opcode.def from .gitignore");
            }

            Log($"Committing copied files");
            dnSpyRepo.CommitAllFiles($"Add Unity files ({Path.GetFileName(dnSpyVersionPath)}), commit hash {unityGitHash}");
        }
コード例 #4
0
 protected ProjectPatcher(SolutionOptions?solutionOptions, ProjectInfo?project, string oldProjectToolsVersion, string newProjectToolsVersion)
 {
     this.solutionOptions        = solutionOptions ?? throw new ArgumentNullException(nameof(solutionOptions));
     this.project                = project ?? throw new ArgumentNullException(nameof(project));
     this.oldProjectToolsVersion = oldProjectToolsVersion ?? throw new ArgumentNullException(nameof(oldProjectToolsVersion));
     this.newProjectToolsVersion = newProjectToolsVersion ?? throw new ArgumentNullException(nameof(newProjectToolsVersion));
     Debug.Assert(solutionOptions.AllProjects.Any(a => a == project));
     textFilePatcher = new TextFilePatcher(project.Filename);
 }
コード例 #5
0
        public static bool RemoveLines(string filename, Func <TextLine, bool> shouldRemove)
        {
            if (shouldRemove == null)
            {
                throw new ArgumentNullException(nameof(shouldRemove));
            }
            var  patcher      = new TextFilePatcher(filename);
            bool removedLines = patcher.RemoveLines(shouldRemove);

            if (removedLines)
            {
                patcher.Write();
            }
            return(removedLines);
        }
コード例 #6
0
 public ReadMePatcher(string unityVersion, string unityGitHash, string readmeFilename)
 {
     this.unityVersion = unityVersion ?? throw new ArgumentNullException(nameof(unityVersion));
     this.unityGitHash = unityGitHash ?? throw new ArgumentNullException(nameof(unityGitHash));
     textFilePatcher   = new TextFilePatcher(readmeFilename);
 }