mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Added process names to history stats output
This commit is contained in:
parent
241619cc07
commit
86b1d718b0
2 changed files with 21 additions and 7 deletions
|
@ -332,6 +332,8 @@ private void UpdatePictureBox()
|
||||||
|
|
||||||
private string OutputStats(HistoryItem[] historyItems)
|
private string OutputStats(HistoryItem[] historyItems)
|
||||||
{
|
{
|
||||||
|
string empty = "(empty)";
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
sb.AppendLine(Resources.HistoryItemCounts);
|
sb.AppendLine(Resources.HistoryItemCounts);
|
||||||
|
@ -360,9 +362,9 @@ private string OutputStats(HistoryItem[] historyItems)
|
||||||
IEnumerable<string> fileExtensions = historyItems.
|
IEnumerable<string> fileExtensions = historyItems.
|
||||||
Where(x => !string.IsNullOrEmpty(x.FileName) && !x.FileName.EndsWith(")")).
|
Where(x => !string.IsNullOrEmpty(x.FileName) && !x.FileName.EndsWith(")")).
|
||||||
Select(x => Helpers.GetFileNameExtension(x.FileName)).
|
Select(x => Helpers.GetFileNameExtension(x.FileName)).
|
||||||
GroupBy(x => x).
|
GroupBy(x => string.IsNullOrWhiteSpace(x) ? empty : x).
|
||||||
OrderByDescending(x => x.Count()).
|
OrderByDescending(x => x.Count()).
|
||||||
Select(x => string.Format("{0} ({1})", x.Key, x.Count()));
|
Select(x => string.Format("[{0}] {1}", x.Count(), x.Key));
|
||||||
|
|
||||||
sb.AppendLine(string.Join(Environment.NewLine, fileExtensions));
|
sb.AppendLine(string.Join(Environment.NewLine, fileExtensions));
|
||||||
|
|
||||||
|
@ -370,11 +372,21 @@ private string OutputStats(HistoryItem[] historyItems)
|
||||||
sb.AppendLine(Resources.HistoryStats_Hosts);
|
sb.AppendLine(Resources.HistoryStats_Hosts);
|
||||||
|
|
||||||
IEnumerable<string> hosts = historyItems.
|
IEnumerable<string> hosts = historyItems.
|
||||||
GroupBy(x => x.Host).
|
GroupBy(x => string.IsNullOrWhiteSpace(x.Host) ? empty : x.Host).
|
||||||
OrderByDescending(x => x.Count()).
|
OrderByDescending(x => x.Count()).
|
||||||
Select(x => string.Format("{0} ({1})", x.Key, x.Count()));
|
Select(x => string.Format("[{0}] {1}", x.Count(), x.Key));
|
||||||
|
|
||||||
sb.Append(string.Join(Environment.NewLine, hosts));
|
sb.AppendLine(string.Join(Environment.NewLine, hosts));
|
||||||
|
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine("Process names:"); // TODO: Translate
|
||||||
|
|
||||||
|
IEnumerable<string> processNames = historyItems.
|
||||||
|
GroupBy(x => string.IsNullOrWhiteSpace(x.TagsProcessName) ? empty : x.TagsProcessName).
|
||||||
|
OrderByDescending(x => x.Count()).
|
||||||
|
Select(x => string.Format("[{0}] {1}", x.Count(), x.Key));
|
||||||
|
|
||||||
|
sb.Append(string.Join(Environment.NewLine, processNames));
|
||||||
|
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,8 @@ namespace ShareX
|
||||||
{
|
{
|
||||||
public class TaskMetadata : IDisposable
|
public class TaskMetadata : IDisposable
|
||||||
{
|
{
|
||||||
|
private const int WindowInfoMaxLength = 255;
|
||||||
|
|
||||||
public Bitmap Image { get; set; }
|
public Bitmap Image { get; set; }
|
||||||
|
|
||||||
private string windowTitle;
|
private string windowTitle;
|
||||||
|
@ -43,7 +45,7 @@ public string WindowTitle
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
windowTitle = value.Truncate(255);
|
windowTitle = value.Truncate(WindowInfoMaxLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +59,7 @@ public string ProcessName
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
processName = value.Truncate(255);
|
processName = value.Truncate(WindowInfoMaxLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue