diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml
index 82306634b..d7920504c 100644
--- a/Flow.Launcher/SettingWindow.xaml
+++ b/Flow.Launcher/SettingWindow.xaml
@@ -2524,9 +2524,10 @@
Click="OpenSettingFolder"
Content="{DynamicResource settingfolder}" />
+ Content="{Binding CheckLogFolder, UpdateSourceTrigger=PropertyChanged}" />
diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs
index 94b539c7a..4bc6e8815 100644
--- a/Flow.Launcher/SettingWindow.xaml.cs
+++ b/Flow.Launcher/SettingWindow.xaml.cs
@@ -279,6 +279,7 @@ namespace Flow.Launcher
{
file.Delete();
}
+ ClearLogFolderBtn.Content = viewModel.CheckLogFolder;
}
else
{
diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
index a63e54f3b..7dfd6d108 100644
--- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
+++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
@@ -555,6 +555,39 @@ namespace Flow.Launcher.ViewModel
public string Github => Constant.GitHub;
public static string Version => Constant.Version;
public string ActivatedTimes => string.Format(_translater.GetTranslation("about_activate_times"), Settings.ActivateTimes);
+ public string CheckLogFolder
+ {
+ get
+ {
+ DirectoryInfo dirInfo = new DirectoryInfo(Path.Combine(DataLocation.DataDirectory(), Constant.Logs, Constant.Version));
+ long size = 0;
+ foreach (FileInfo fi in dirInfo.GetFiles("*", SearchOption.AllDirectories))
+ {
+ size += fi.Length;
+ }
+ return string.Format(_translater.GetTranslation("clearlogfolder")) + " (" + FormatBytes(size) + ")" ;
+ }
+ set
+ {
+ }
+
+ }
+
+ public string FormatBytes(long bytes)
+ {
+ const int scale = 1024;
+ string[] orders = new string[] { "GB", "MB", "KB", "Bytes" };
+ long max = (long)Math.Pow(scale, orders.Length - 1);
+
+ foreach (string order in orders)
+ {
+ if (bytes > max)
+ return string.Format("{0:##.##} {1}", decimal.Divide(bytes, max), order);
+
+ max /= scale;
+ }
+ return "0 Bytes";
+ }
#endregion
}
}