//SSolution solu,string docName // @"G:\GitHub\dotnet\TestRoslyn\Samples\ConsoleApp1\ConsoleApp1.sln" public static async Task SolutionAsync(ISolutionHandler handle, bool useInclude) { CancellationToken cancellationToken = default(CancellationToken); if (handle.m_solution == null) { CCLog.Error("SolutionAsync: solution == null"); return; } //else //{ // bool res = Compiler.CompileSolution(handle.m_solution, "."); // CCLog.Info("CompileSolution:" + res); // return; //} //提取所有的Type IEnumerable <Project> Projects = handle.m_solution.Projects; foreach (Project project in handle.m_solution.Projects) { if (!project.HasDocuments) { continue; } // FilePath "G:\\Aotu\\worksapce100\\DClient2\\Trunk\\Assets\\Cinemachine\\Base\\Runtime\\Behaviours\\CinemachineBlendListCamera.cs" string foreach (Document document in project.Documents) { if (!ValidDocName(document.FilePath, useInclude)) { continue; } //docName != null if (!handle.preCheck(document)) { continue; } //遍历 await handleDocument(document, handle.m_dtl); //替换 await handle.Run(document); //保存 if (handle.postHandle(document)) { return; } } } handle.postHandleSolution(); }
public static async Task DumpAllTypesAsync(string sln, bool useInclude) { ISolutionHandler handle = new ISolutionHandler(sln); await handle.InitSolution(sln); await SolutionAsync(handle, useInclude); // string path = Path.GetDirectoryName(sln); Directory.SetCurrentDirectory(path); CRenameTokenHandler rhandle = new CRenameTokenHandler(); rhandle.m_workspace = handle.m_workspace; rhandle.newSolution = handle.m_solution; rhandle.m_solu = handle.m_solu; rhandle.m_sln = handle.m_sln; await replaceAllSolutionTypeMemberID(rhandle, useInclude); rhandle.SaveNewSolution(); }