мелкие изменнеия
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace JiraTimeBotForm.CommitWorks
|
||||
{
|
||||
public class BuzzwordReplacer
|
||||
{
|
||||
public string FixBuzzwords(string commitMessage)
|
||||
{
|
||||
Dictionary<string, string> buzzReplace = new Dictionary<string, string>()
|
||||
{
|
||||
{"fix", "исправление"},
|
||||
{"up", "обновил"},
|
||||
{"init", "начало"},
|
||||
{"build", "сборка"},
|
||||
{"namespace", "неймспейс"}
|
||||
};
|
||||
|
||||
foreach (var buzzReplaceItm in buzzReplace)
|
||||
{
|
||||
commitMessage = ReplaceCaseInsensitive(commitMessage, $" {buzzReplaceItm.Key} ", $" {buzzReplaceItm.Value} ");
|
||||
commitMessage = ReplaceCaseInsensitive(commitMessage, $" {buzzReplaceItm.Key}.", $" {buzzReplaceItm.Value}.");
|
||||
commitMessage = ReplaceCaseInsensitive(commitMessage, $" {buzzReplaceItm.Key},", $" {buzzReplaceItm.Value},");
|
||||
if (commitMessage.StartsWith($"{buzzReplaceItm.Key}", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
commitMessage = ReplaceCaseInsensitive(commitMessage, $"{buzzReplaceItm.Key} ", $"{buzzReplaceItm.Value} ");
|
||||
}
|
||||
}
|
||||
|
||||
return commitMessage;
|
||||
}
|
||||
|
||||
private string ReplaceCaseInsensitive(string input, string search, string replacement){
|
||||
string result = Regex.Replace(
|
||||
input,
|
||||
Regex.Escape(search),
|
||||
replacement.Replace("$","$$"),
|
||||
RegexOptions.IgnoreCase
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,6 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CommitWorks\BuzzwordReplacer.cs" />
|
||||
<Compile Include="Extensions\Extensions.cs" />
|
||||
<Compile Include="Job.cs" />
|
||||
<Compile Include="Logger.cs" />
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using JiraTimeBotForm.CommitWorks;
|
||||
using JiraTimeBotForm.Configuration;
|
||||
using JiraTimeBotForm.Mercurial;
|
||||
using JiraTimeBotForm.TaskProcessors;
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JiraTimeBotForm.Mercurial
|
||||
{
|
||||
@@ -10,8 +6,7 @@ namespace JiraTimeBotForm.Mercurial
|
||||
{
|
||||
public string Description { get; set; }
|
||||
public string Branch { get; set; }
|
||||
|
||||
public DateTime StartTime { get; set; }
|
||||
public DateTime EndTime { get; set; }
|
||||
public DateTime Time { get; set; }
|
||||
public int FilesAffected { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using JiraTimeBotForm.Configuration;
|
||||
using JiraTimeBotForm.TaskTime;
|
||||
using Mercurial;
|
||||
|
||||
namespace JiraTimeBotForm.Mercurial
|
||||
@@ -61,14 +59,13 @@ namespace JiraTimeBotForm.Mercurial
|
||||
continue;
|
||||
}
|
||||
commitMessage = StripTechnicalInfo(commitMessage);
|
||||
//commitMessage = _buzzwordReplacer.FixBuzzwords(commitMessage);
|
||||
|
||||
workTasks.Add(new MercurialCommitItem
|
||||
{
|
||||
Description = commitMessage,
|
||||
Branch = changeset.Branch,
|
||||
StartTime = changeset.Timestamp,
|
||||
EndTime = changeset.Timestamp
|
||||
Time = changeset.Timestamp,
|
||||
FilesAffected = changeset.PathActions.Count
|
||||
});
|
||||
_log?.Trace($" - Найден changeset: {changeset.Timestamp} - {changeset.Branch} - {changeset.AuthorEmailAddress} - {commitMessage}");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using JiraTimeBotForm.Configuration;
|
||||
using JiraTimeBotForm.Mercurial;
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using JiraTimeBotForm.Configuration;
|
||||
using JiraTimeBotForm.Mercurial;
|
||||
using Mercurial;
|
||||
|
||||
namespace JiraTimeBotForm.TaskTime
|
||||
{
|
||||
@@ -38,7 +36,7 @@ namespace JiraTimeBotForm.TaskTime
|
||||
int currentTaskTime = (int)RoundTo(settings.MinuterPerWorkDay / totalCommitsCount * currentTaskCommits);
|
||||
remainMinutes = remainMinutes - currentTaskTime;
|
||||
|
||||
var orderedTasks = taskGroup.OrderBy(f => f.StartTime).ToArray();
|
||||
var orderedTasks = taskGroup.OrderBy(f => f.Time).ToArray();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (var task in orderedTasks)
|
||||
{
|
||||
@@ -52,8 +50,8 @@ namespace JiraTimeBotForm.TaskTime
|
||||
Commits = taskGroup.Count(),
|
||||
Description = sb.ToString(),
|
||||
|
||||
StartTime = orderedTasks.First().StartTime,
|
||||
EndTime = orderedTasks.Last().StartTime
|
||||
StartTime = orderedTasks.First().Time,
|
||||
EndTime = orderedTasks.Last().Time
|
||||
};
|
||||
|
||||
workTimeItems.Add(taskTimeItem);
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using JiraTimeBotForm.CommitWorks;
|
||||
using JiraTimeBotForm.Configuration;
|
||||
using JiraTimeBotForm.Mercurial;
|
||||
using JiraTimeBotForm.Passwords;
|
||||
@@ -21,12 +20,10 @@ namespace JiraTimeBotForm
|
||||
{
|
||||
private readonly string _settingsPath;
|
||||
private readonly ILog _log;
|
||||
private readonly NotifyIcon trayIcon;
|
||||
private readonly ContextMenu trayMenu;
|
||||
private readonly NotifyIcon _trayIcon;
|
||||
private Job _job;
|
||||
private readonly IReadOnlyList<Control> _controls;
|
||||
private CancellationTokenSource _tokenSource;
|
||||
private BuzzwordReplacer _buzzwordReplacer;
|
||||
|
||||
private CancellationTokenSource GetTokenSource()
|
||||
{
|
||||
@@ -45,12 +42,11 @@ namespace JiraTimeBotForm
|
||||
InitializeComponent();
|
||||
_settingsPath = Path.Combine(Application.UserAppDataPath, "settings.json");
|
||||
_log = new Logger(txtLog);
|
||||
_buzzwordReplacer = new BuzzwordReplacer();
|
||||
|
||||
trayMenu = new ContextMenu();
|
||||
var trayMenu = new ContextMenu();
|
||||
trayMenu.MenuItems.Add("Exit", OnExit);
|
||||
|
||||
trayIcon = new NotifyIcon
|
||||
_trayIcon = new NotifyIcon
|
||||
{
|
||||
Text = "JiraTimeBot",
|
||||
Icon = this.Icon,
|
||||
@@ -58,8 +54,8 @@ namespace JiraTimeBotForm
|
||||
Visible = false,
|
||||
|
||||
};
|
||||
trayIcon.Click += btnTray_Click;
|
||||
trayIcon.DoubleClick += btnTray_Click;
|
||||
_trayIcon.Click += btnTray_Click;
|
||||
_trayIcon.DoubleClick += btnTray_Click;
|
||||
|
||||
var mercurialLog = new MercurialLog(_log);
|
||||
var taskTimeDiscoverer = new TaskTimeDiscoverer(_log);
|
||||
@@ -70,7 +66,7 @@ namespace JiraTimeBotForm
|
||||
|
||||
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
trayIcon.Visible = false;
|
||||
_trayIcon.Visible = false;
|
||||
}
|
||||
|
||||
private void OnExit(object sender, EventArgs e)
|
||||
@@ -176,13 +172,13 @@ namespace JiraTimeBotForm
|
||||
{
|
||||
if (FormWindowState.Minimized == this.WindowState)
|
||||
{
|
||||
trayIcon.Visible = true;
|
||||
_trayIcon.Visible = true;
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
else if (FormWindowState.Normal == this.WindowState)
|
||||
{
|
||||
trayIcon.Visible = false;
|
||||
_trayIcon.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user