XFEstudio/MyFirstRespo
add-添加数个配置文件
1a8b238
代码差异
9 个文件
+70
-16
@@ -19,4 +19,6 @@ public partial class AppPath
19
19
private static readonly string localVersionProfile = $@"{AppLocalVersionData}\Profiles";
20
20
[AutoPath]
21
21
private static readonly string synProfile = $@"{AppSynData}\Profiles";
22
[AutoPath]
23
private static readonly string cacheProfile = $@"{AppCache}\Profiles";
22
24
}
@@ -0,0 +1,11 @@
1
using XFEExtension.NetCore.AutoConfig;
2
using XFEToolBox.Core.Model;
3
4
namespace XFEToolBox.Profiles.CacheProfiles;
5
6
public partial class AppCacheProfile
7
{
8
[ProfileProperty]
9
private string noticeText = "";
10
public AppCacheProfile() => ProfilePath = @$"{AppPath.CacheProfile}\{typeof(AppCacheProfile)}.xfe";
11
}
@@ -0,0 +1,12 @@
1
using XFEToolBox.Core.Model;
2
3
namespace XFEToolBox.Profiles.CrossVersionProfiles;
4
5
public partial class SystemProfile
6
{
7
/// <summary>
8
/// 工具箱现在是否可以被关闭
9
/// </summary>
10
public static bool CanClosed { get; set; }
11
//public SystemProfile() => ProfilePath = @$"{AppPath.LocalProfile}\{typeof(SystemProfile)}.xfe";
12
}
@@ -1,9 +0,0 @@
1
namespace XFEToolBox.Profiles;
2
3
public partial class SystemProfile
4
{
5
/// <summary>
6
/// 工具箱现在是否可以被关闭
7
/// </summary>
8
public static bool CanClosed { get; set; }
9
}
@@ -0,0 +1,22 @@
1
using System.IO;
2
3
namespace XFEToolBox.Utilities;
4
5
public static class FileHelper
6
{
7
public static long GetDirectorySize(DirectoryInfo directoryInfo)
8
{
9
long size = 0;
10
FileInfo[] files = directoryInfo.GetFiles();
11
foreach (FileInfo file in files)
12
{
13
size += file.Length;
14
}
15
DirectoryInfo[] directories = directoryInfo.GetDirectories();
16
foreach (DirectoryInfo directory in directories)
17
{
18
size += GetDirectorySize(directory);
19
}
20
return size;
21
}
22
}
@@ -1,10 +1,10 @@
1
1
using CommunityToolkit.Mvvm.ComponentModel;
2
using CommunityToolkit.Mvvm.Input;
3
using System.Windows;
4
using System.Windows.Controls;
5
using XFEToolBox.Profiles.CrossVersionProfiles;
2
6
using XFEToolBox.Views.Pages;
3
7
using XFEToolBox.Views.Windows;
4
using System.Windows.Controls;
5
using System.Windows;
6
using XFEToolBox.Profiles;
7
using CommunityToolkit.Mvvm.Input;
8
8
9
9
namespace XFEToolBox.ViewModel;
10
10
@@ -22,7 +22,7 @@ public partial class MainWindowViewModel : ObservableObject
22
22
/// <summary>
23
23
/// 最小化窗体
24
24
/// </summary>
25
public void Minimize() => ViewPage!.WindowState = System.Windows.WindowState.Minimized;
25
public void Minimize() => ViewPage!.WindowState = WindowState.Minimized;
26
26
/// <summary>
27
27
/// 关闭窗口退出应用
28
28
/// </summary>
@@ -6,11 +6,18 @@
6
6
xmlns:local="clr-namespace:XFEToolBox.Views.Pages"
7
7
mc:Ignorable="d"
8
8
d:DesignHeight="450" d:DesignWidth="800"
9
Title="MainPage">
9
Title="MainPage" Loaded="Page_Loaded">
10
10
<Grid>
11
11
<Grid.ColumnDefinitions>
12
12
<ColumnDefinition Width="2*"/>
13
13
<ColumnDefinition Width="*"/>
14
14
</Grid.ColumnDefinitions>
15
<Grid.RowDefinitions>
16
<RowDefinition Height="2*"/>
17
<RowDefinition Height="*"/>
18
</Grid.RowDefinitions>
19
<Border CornerRadius="15" Background="White" Margin="10" BorderBrush="#5b5be7" BorderThickness="2">
20
<TextBlock x:Name="notifyText"/>
21
</Border>
15
22
</Grid>
16
23
</Page>
@@ -1,4 +1,6 @@
1
1
using System.Windows.Controls;
2
using XFEExtension.NetCore.FileExtension;
3
using XFEToolBox.Utilities;
2
4
3
5
namespace XFEToolBox.Views.Pages;
4
6
@@ -13,4 +15,9 @@ public partial class MainPage : Page
13
15
InitializeComponent();
14
16
Current = this;
15
17
}
18
19
private void Page_Loaded(object sender, System.Windows.RoutedEventArgs e)
20
{
21
notifyText.Text = FileHelper.GetDirectorySize(new(@"C:\Users\XFEstudio\Downloads")).FileSize();
22
}
16
23
}
@@ -26,7 +26,7 @@
26
26
<ItemGroup>
27
27
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
28
28
<PackageReference Include="XFEExtension.NetCore" Version="3.0.0" />
29
<PackageReference Include="XFEExtension.NetCore.AutoConfig" Version="1.0.4" />
29
<PackageReference Include="XFEExtension.NetCore.AutoConfig" Version="1.1.1" />
30
30
<PackageReference Include="XFEExtension.NetCore.AutoPath" Version="1.0.1" />
31
31
<PackageReference Include="XFEExtension.NetCore.TodoHighLight" Version="1.0.0" />
32
32
</ItemGroup>
@@ -44,6 +44,8 @@
44
44
45
45
<ItemGroup>
46
46
<Folder Include="Model\" />
47
<Folder Include="Profiles\CurrentVersionProfiles\" />
48
<Folder Include="Profiles\SynProfiles\" />
47
49
</ItemGroup>
48
50
49
51
<ItemGroup>