-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
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,48 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
|
||
using System.Diagnostics; | ||
|
||
using Lindexi.Src.WhitmanRandomIdentifier; | ||
|
||
var projectType = "wpf"; | ||
if (args.Length > 0) | ||
{ | ||
projectType = args[0]; | ||
} | ||
|
||
var randomIdentifier = new RandomIdentifier(); | ||
|
||
var folderName = randomIdentifier.Generate(true); | ||
|
||
var folderPath = Path.Join(Environment.CurrentDirectory, folderName); | ||
|
||
Directory.CreateDirectory(folderPath); | ||
|
||
RunCommand($"dotnet new {projectType}", folderPath); | ||
RunCommand($"dotnet new sln", folderPath); | ||
RunCommand($"dotnet sln add .", folderPath); | ||
|
||
var slnFile = Path.Join(folderPath, $"{folderName}.sln"); | ||
Process.Start(new ProcessStartInfo(slnFile) { UseShellExecute = true }); | ||
|
||
|
||
void RunCommand(string command, string workingDirectory) | ||
{ | ||
var processStartInfo = new ProcessStartInfo("cmd") | ||
{ | ||
RedirectStandardInput = true, | ||
//RedirectStandardOutput = true, | ||
//RedirectStandardError = true, | ||
UseShellExecute = false, | ||
//CreateNoWindow = true, | ||
WorkingDirectory = workingDirectory, | ||
}; | ||
|
||
using var process = new Process(); | ||
process.StartInfo = processStartInfo; | ||
process.Start(); | ||
|
||
process.StandardInput.WriteLine(command); | ||
process.StandardInput.WriteLine("exit"); | ||
process.WaitForExit(); | ||
} |
14 changes: 14 additions & 0 deletions
14
app/Tool/创建随机项目/WhitmanProjectCreator/WhitmanProjectCreator.csproj
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,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\..\package\WhitmanRandomIdentifier\WhitmanRandomIdentifier.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
27 changes: 27 additions & 0 deletions
27
app/Tool/创建随机项目/WhitmanProjectCreator/WhitmanProjectCreator.sln
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,27 @@ | ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.0.31903.59 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WhitmanProjectCreator", "WhitmanProjectCreator.csproj", "{8FBD4516-D5FE-4413-88AA-A8141258A994}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WhitmanRandomIdentifier", "..\..\..\..\package\WhitmanRandomIdentifier\WhitmanRandomIdentifier.csproj", "{46C0917E-A95E-4590-824E-60AAB949816B}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{46C0917E-A95E-4590-824E-60AAB949816B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{46C0917E-A95E-4590-824E-60AAB949816B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{46C0917E-A95E-4590-824E-60AAB949816B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{46C0917E-A95E-4590-824E-60AAB949816B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{8FBD4516-D5FE-4413-88AA-A8141258A994}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{8FBD4516-D5FE-4413-88AA-A8141258A994}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{8FBD4516-D5FE-4413-88AA-A8141258A994}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{8FBD4516-D5FE-4413-88AA-A8141258A994}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |