mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 17:56:51 +13:00
Merge remote-tracking branch 'refs/remotes/ShareX/master'
This commit is contained in:
commit
1e63510793
4 changed files with 12 additions and 11 deletions
|
@ -27,6 +27,7 @@ You should have received a copy of the GNU General Public License
|
||||||
using ShareX.HistoryLib;
|
using ShareX.HistoryLib;
|
||||||
using ShareX.UploadersLib;
|
using ShareX.UploadersLib;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace ShareX
|
namespace ShareX
|
||||||
|
@ -126,14 +127,14 @@ public string UploaderHost
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime StartTime { get; set; }
|
public DateTime TaskStartTime { get; set; }
|
||||||
public DateTime UploadTime { get; set; }
|
public DateTime TaskEndTime { get; set; }
|
||||||
|
|
||||||
public TimeSpan UploadDuration
|
public TimeSpan TaskDuration
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return UploadTime - StartTime;
|
return TaskEndTime - TaskStartTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +169,7 @@ public HistoryItem GetHistoryItem()
|
||||||
{
|
{
|
||||||
Filename = FileName,
|
Filename = FileName,
|
||||||
Filepath = FilePath,
|
Filepath = FilePath,
|
||||||
DateTime = UploadTime,
|
DateTime = TaskEndTime,
|
||||||
Type = DataType.ToString(),
|
Type = DataType.ToString(),
|
||||||
Host = UploaderHost,
|
Host = UploaderHost,
|
||||||
URL = Result.URL,
|
URL = Result.URL,
|
||||||
|
|
|
@ -184,7 +184,7 @@ private static void CreateListViewItem(WorkerTask task)
|
||||||
if (task.Status == TaskStatus.History)
|
if (task.Status == TaskStatus.History)
|
||||||
{
|
{
|
||||||
lvi.SubItems.Add(Resources.TaskManager_CreateListViewItem_History);
|
lvi.SubItems.Add(Resources.TaskManager_CreateListViewItem_History);
|
||||||
lvi.SubItems.Add(task.Info.UploadTime.ToString());
|
lvi.SubItems.Add(task.Info.TaskEndTime.ToString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -318,7 +318,7 @@ private static void task_TaskCompleted(WorkerTask task)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DebugHelper.WriteLine("Task completed. Filename: {0}, URL: {1}, Duration: {2} ms", info.FileName, info.Result.ToString(), (int)info.UploadDuration.TotalMilliseconds);
|
DebugHelper.WriteLine($"Task completed. Filename: {info.FileName}, URL: {info.Result}, Duration: {info.TaskDuration.TotalMilliseconds:d} ms");
|
||||||
|
|
||||||
string result = info.Result.ToString();
|
string result = info.Result.ToString();
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ public string Parse(TaskInfo info, string pattern)
|
||||||
pattern = pattern.Replace("$thumbnailfilenamenoext", !string.IsNullOrEmpty(info.ThumbnailFilePath) ? Path.GetFileNameWithoutExtension(info.ThumbnailFilePath) : "");
|
pattern = pattern.Replace("$thumbnailfilenamenoext", !string.IsNullOrEmpty(info.ThumbnailFilePath) ? Path.GetFileNameWithoutExtension(info.ThumbnailFilePath) : "");
|
||||||
pattern = pattern.Replace("$thumbnailfilename", !string.IsNullOrEmpty(info.ThumbnailFilePath) ? Path.GetFileName(info.ThumbnailFilePath) : "");
|
pattern = pattern.Replace("$thumbnailfilename", !string.IsNullOrEmpty(info.ThumbnailFilePath) ? Path.GetFileName(info.ThumbnailFilePath) : "");
|
||||||
|
|
||||||
pattern = pattern.Replace("$uploadtime", ((int)info.UploadDuration.TotalMilliseconds).ToString());
|
pattern = pattern.Replace("$uploadtime", ((int)info.TaskDuration.TotalMilliseconds).ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return pattern;
|
return pattern;
|
||||||
|
|
|
@ -100,7 +100,7 @@ public static WorkerTask CreateHistoryTask(RecentTask recentTask)
|
||||||
task.Info.Result.ThumbnailURL = recentTask.ThumbnailURL;
|
task.Info.Result.ThumbnailURL = recentTask.ThumbnailURL;
|
||||||
task.Info.Result.DeletionURL = recentTask.DeletionURL;
|
task.Info.Result.DeletionURL = recentTask.DeletionURL;
|
||||||
task.Info.Result.ShortenedURL = recentTask.ShortenedURL;
|
task.Info.Result.ShortenedURL = recentTask.ShortenedURL;
|
||||||
task.Info.UploadTime = recentTask.Time.ToLocalTime();
|
task.Info.TaskEndTime = recentTask.Time.ToLocalTime();
|
||||||
|
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
@ -302,7 +302,7 @@ public void Stop()
|
||||||
|
|
||||||
private void ThreadDoWork()
|
private void ThreadDoWork()
|
||||||
{
|
{
|
||||||
Info.StartTime = DateTime.UtcNow;
|
Info.TaskStartTime = DateTime.UtcNow;
|
||||||
|
|
||||||
CreateTaskReferenceHelper();
|
CreateTaskReferenceHelper();
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ private void ThreadDoWork()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info.UploadTime = DateTime.UtcNow;
|
Info.TaskEndTime = DateTime.UtcNow;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateTaskReferenceHelper()
|
private void CreateTaskReferenceHelper()
|
||||||
|
|
Loading…
Reference in a new issue