Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #165 from Cysharp/solution_file_processor
solution file processor sample
- Loading branch information
Showing
6 changed files
with
53 additions
and
24 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
samples/ChatApp/ChatApp.Unity/Assets/Editor/SolutionFileProcessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using UnityEditor; | ||
|
||
public class SolutionFileProcessor : AssetPostprocessor | ||
{ | ||
const string ProjectTypeGuidCsharp = "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"; | ||
const string ProjectTypeGuidConsoleApp = "9A19103F-16F7-4668-BE54-9A1E7A4F7556"; | ||
|
||
private static string OnGeneratedSlnSolution(string path, string content) | ||
{ | ||
// Automatically include ProjectFiles into SolutionFile | ||
|
||
var newContent = AddProject( | ||
content: content, | ||
ProjectTypeGuidConsoleApp, | ||
projectGuid: "053476FC-B8B2-4A14-AED2-3733DFD5DFC3", | ||
projectName: "ChatApp.Server", | ||
projectPath: "..\\ChatApp.Server\\ChatApp.Server.csproj"); | ||
|
||
|
||
return newContent; | ||
} | ||
|
||
private static string AddProject(string content, string projectTypeGuid, string projectGuid, string projectName, string projectPath) | ||
{ | ||
var add = $"Project(\"{projectTypeGuid}\") = \"{projectName}\", \"{projectPath}\", \"{projectGuid}\",\"{Environment.NewLine}EndProject"; | ||
|
||
var newContent = content.Replace($"EndProject{Environment.NewLine}Global", | ||
$"EndProject{Environment.NewLine}{add}{Environment.NewLine}Global"); | ||
|
||
return newContent; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
samples/ChatApp/ChatApp.Unity/Assets/Editor/SolutionFileProcessor.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
samples/ChatApp/ChatApp.Unity/Assets/Plugins/dll/System.Interactive.Async.meta
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
samples/ChatApp/ChatApp.Unity/Assets/Plugins/dll/System.Interactive.Async/lib.meta
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
samples/ChatApp/ChatApp.Unity/Assets/Plugins/dll/System.Interactive.Async/lib/net45.meta
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters