mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-24 04:53:45 +08:00
Update Demo
This commit is contained in:
@@ -35,6 +35,7 @@ namespace SugarCodeGeneration.Codes
|
|||||||
|
|
||||||
public static void AddCsproj(string classPath, string projectName)
|
public static void AddCsproj(string classPath, string projectName)
|
||||||
{
|
{
|
||||||
|
CreateProject(projectName);
|
||||||
var classDirectory = Methods.GetSlnPath + "\\" + projectName + "\\" + classPath.TrimStart('\\');
|
var classDirectory = Methods.GetSlnPath + "\\" + projectName + "\\" + classPath.TrimStart('\\');
|
||||||
if (FileHelper.IsExistDirectory(classDirectory) == false)
|
if (FileHelper.IsExistDirectory(classDirectory) == false)
|
||||||
{
|
{
|
||||||
@@ -90,11 +91,26 @@ namespace SugarCodeGeneration.Codes
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void CreateProject(string name) {
|
public static void CreateProject(string name)
|
||||||
|
{
|
||||||
var templatePath = GetCurrentProjectPath + "/Template/Project.txt";
|
var templatePath = GetCurrentProjectPath + "/Template/Project.txt";
|
||||||
string project = System.IO.File.ReadAllText(templatePath).Replace("@pid", Guid.NewGuid().ToString()); //从文件中读出模板内容
|
string project = System.IO.File.ReadAllText(templatePath).Replace("@pid", Guid.NewGuid().ToString()); //从文件中读出模板内容
|
||||||
//FileHelper
|
var projectPath = GetSlnPath + "\\" + name + "\\" + name + ".csproj";
|
||||||
|
var projectDic = GetSlnPath + "\\" + name + "\\";
|
||||||
|
var binDic = GetSlnPath + "\\" + name + "\\bin";
|
||||||
|
if (!FileHelper.IsExistFile(projectPath))
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!FileHelper.IsExistDirectory(projectDic))
|
||||||
|
{
|
||||||
|
FileHelper.CreateDirectory(projectDic);
|
||||||
|
}
|
||||||
|
if (!FileHelper.IsExistDirectory(binDic))
|
||||||
|
{
|
||||||
|
FileHelper.CreateDirectory(binDic);
|
||||||
|
}
|
||||||
|
FileHelper.CreateFile(projectPath,project,System.Text.Encoding.UTF8);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user