返回提交历史
Added
XFEExtension.NetCore.AutoPath.sln
+24
-0
Added
XFEExtension.NetCore.AutoPath/AutoPathAttribute.cs
+27
-0
Added
XFEExtension.NetCore.AutoPath/XFEAutoPath.cs
+18
-0
Added
XFEExtension.NetCore.AutoPath/XFEExtension.NetCore.AutoPath.csproj
+9
-0
XFEstudio/XFEExtension.NetCore.AutoPath
添加项目文件。
23398b7
代码差异
4 个文件
+78
-0
@@ -0,0 +1,24 @@
1
Microsoft Visual Studio Solution File, Format Version 12.00
2
# Visual Studio Version 17
3
VisualStudioVersion = 17.11.34929.205
4
MinimumVisualStudioVersion = 10.0.40219.1
5
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XFEExtension.NetCore.AutoPath", "XFEExtension.NetCore.AutoPath\XFEExtension.NetCore.AutoPath.csproj", "{5AE91819-3D1B-497A-8910-28182ACE3053}"
6
EndProject
7
Global
8
GlobalSection(ExtensibilityGlobals) = postSolution
9
SolutionGuid = {90AADC1F-6681-41B3-88DF-16A19E421FF8}
10
EndGlobalSection
11
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12
{5AE91819-3D1B-497A-8910-28182ACE3053}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13
{5AE91819-3D1B-497A-8910-28182ACE3053}.Debug|Any CPU.Build.0 = Debug|Any CPU
14
{5AE91819-3D1B-497A-8910-28182ACE3053}.Release|Any CPU.ActiveCfg = Release|Any CPU
15
{5AE91819-3D1B-497A-8910-28182ACE3053}.Release|Any CPU.Build.0 = Release|Any CPU
16
EndGlobalSection
17
GlobalSection(SolutionConfigurationPlatforms) = preSolution
18
Debug|Any CPU = Debug|Any CPU
19
Release|Any CPU = Release|Any CPU
20
EndGlobalSection
21
GlobalSection(SolutionProperties) = preSolution
22
HideSolutionNode = FALSE
23
EndGlobalSection
24
EndGlobal
@@ -0,0 +1,27 @@
1
namespace XFEExtension.NetCore.PathExtension;
2
3
/// <summary>
4
/// 自动检测并生成对应文件夹
5
/// </summary>
6
[AttributeUsage(AttributeTargets.Field)]
7
public sealed class AutoPathAttribute : Attribute
8
{
9
/// <summary>
10
/// 生成的属性名称
11
/// </summary>
12
public string? PropertyName { get; set; }
13
/// <summary>
14
/// 自动检测并生成对应文件夹
15
/// </summary>
16
public AutoPathAttribute()
17
{
18
}
19
/// <summary>
20
/// 自动检测并生成对应文件夹
21
/// </summary>
22
/// <param name="propertyName"></param>
23
public AutoPathAttribute(string propertyName)
24
{
25
PropertyName = propertyName;
26
}
27
}
@@ -0,0 +1,18 @@
1
namespace XFEExtension.NetCore.PathExtension;
2
3
/// <summary>
4
/// 自动目录
5
/// </summary>
6
public static class XFEAutoPath
7
{
8
/// <summary>
9
/// 检测文件夹路径是否存在否则创建
10
/// </summary>
11
/// <param name="path">文件夹路径</param>
12
/// <param name="enableCheck">是否启用检测</param>
13
public static void CheckPathExistAndCreate(string path, bool enableCheck = true)
14
{
15
if (enableCheck && !Path.Exists(path))
16
Directory.CreateDirectory(path);
17
}
18
}
@@ -0,0 +1,9 @@
1
<Project Sdk="Microsoft.NET.Sdk">
2
3
<PropertyGroup>
4
<TargetFramework>net8.0</TargetFramework>
5
<ImplicitUsings>enable</ImplicitUsings>
6
<Nullable>enable</Nullable>
7
</PropertyGroup>
8
9
</Project>