Init
This commit is contained in:
+291
@@ -0,0 +1,291 @@
|
|||||||
|
# Huge kudos to all contributors to https://github.com/github/gitignore which is where
|
||||||
|
# this file came from.
|
||||||
|
|
||||||
|
syntax: glob
|
||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
|
||||||
|
# Visual Studio 2015 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUNIT
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# DNX
|
||||||
|
project.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_i.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# JustCode is a .NET coding add-in
|
||||||
|
.JustCode
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/packages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/packages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/packages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignoreable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
#*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
node_modules/
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# JetBrains Rider
|
||||||
|
.idea/
|
||||||
|
*.sln.iml
|
||||||
|
|
||||||
|
# Visual Studio design time assembly cache
|
||||||
|
*.cache
|
||||||
|
|
||||||
|
#Aeroclub lib catalog
|
||||||
|
[Ll]ib/
|
||||||
|
src/Aeroclub.WCF.CommonGateway/!Web.config
|
||||||
|
src/Aeroclub.WCF.CommonGateway/Web.config
|
||||||
|
src/Aeroclub.WCF.CommonGateway/!NLog.config
|
||||||
|
src/Aeroclub.WCF.CommonGateway/NLog.config
|
||||||
|
|
||||||
|
*.ncrunchproject
|
||||||
|
|
||||||
|
# WSCommon logs
|
||||||
|
src/Aeroclub.WCF.CommonGateway/logs/
|
||||||
|
build/nuget/*.exe
|
||||||
|
*.orig
|
||||||
|
|
||||||
|
tools/Confluence.dll*
|
||||||
|
.sonarqube/*
|
||||||
|
paket.lock
|
||||||
|
test/*
|
||||||
|
.paket/Paket/tools/paket.exe
|
||||||
|
coverage/*
|
||||||
|
src/WscommonDoc/Help/*.json
|
||||||
|
src/WscommonDoc/Help/*.json
|
||||||
|
src/WscommonDoc/Help/*
|
||||||
|
src/WscommonDoc/icons/Help.png
|
||||||
|
src/WscommonDoc/Doc/Working/*
|
||||||
|
src/WscommonDoc/Doc/*
|
||||||
|
.paket/*
|
||||||
|
*.env
|
||||||
|
.teamcity/target/*
|
||||||
|
docfx_project/_site/*
|
||||||
|
docfx_project/api/*.yml
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 170 KiB |
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 15
|
||||||
|
VisualStudioVersion = 15.0.28307.421
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiraTimeBotForm", "JiraTimeBotForm\JiraTimeBotForm.csproj", "{F3B89316-C38C-4CE6-9D88-0B1373CFBA1A}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{F3B89316-C38C-4CE6-9D88-0B1373CFBA1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F3B89316-C38C-4CE6-9D88-0B1373CFBA1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F3B89316-C38C-4CE6-9D88-0B1373CFBA1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F3B89316-C38C-4CE6-9D88-0B1373CFBA1A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {2132DC12-967F-4EA3-9E39-5500488F1288}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
|
||||||
|
</startup>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="RestSharp" publicKeyToken="598062e77f915f75" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-106.6.9.0" newVersion="106.6.9.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace JiraTimeBotForm.Configuration
|
||||||
|
{
|
||||||
|
public class Settings
|
||||||
|
{
|
||||||
|
public int MinuterPerWorkDay = 8 * 60;
|
||||||
|
public string JiraUrl = "https://myteam.aeroclub.ru";
|
||||||
|
|
||||||
|
public string RepositoryPath { get; set; }
|
||||||
|
public string MercurialAuthorEmail { get; set; }
|
||||||
|
public string JiraUserName { get; set; }
|
||||||
|
public string JiraPassword { get; set; }
|
||||||
|
public TimeSpan ActivationTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace JiraTimeBotForm.Extensions
|
||||||
|
{
|
||||||
|
public static class Extensions
|
||||||
|
{
|
||||||
|
[DllImport( "user32.dll" )]
|
||||||
|
private static extern int ShowWindow( IntPtr hWnd, uint Msg );
|
||||||
|
|
||||||
|
private const uint SW_RESTORE = 0x09;
|
||||||
|
|
||||||
|
public static void Restore( this Form form )
|
||||||
|
{
|
||||||
|
if (form.WindowState == FormWindowState.Minimized)
|
||||||
|
{
|
||||||
|
ShowWindow(form.Handle, SW_RESTORE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
+220
@@ -0,0 +1,220 @@
|
|||||||
|
namespace JiraTimeBotForm
|
||||||
|
{
|
||||||
|
partial class frmMain
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
|
||||||
|
this.actTime = new System.Windows.Forms.DateTimePicker();
|
||||||
|
this.txtJiraLogin = new System.Windows.Forms.TextBox();
|
||||||
|
this.lbl1 = new System.Windows.Forms.Label();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.txtJiraPassword = new System.Windows.Forms.TextBox();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.txtMercurialEmail = new System.Windows.Forms.TextBox();
|
||||||
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
|
this.btnSave = new System.Windows.Forms.Button();
|
||||||
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
|
this.txtRepoPath = new System.Windows.Forms.TextBox();
|
||||||
|
this.txtLog = new System.Windows.Forms.TextBox();
|
||||||
|
this.btnStart = new System.Windows.Forms.Button();
|
||||||
|
this.ntfyIcon = new System.Windows.Forms.NotifyIcon(this.components);
|
||||||
|
this.tmrStart = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// actTime
|
||||||
|
//
|
||||||
|
this.actTime.Format = System.Windows.Forms.DateTimePickerFormat.Time;
|
||||||
|
this.actTime.Location = new System.Drawing.Point(94, 120);
|
||||||
|
this.actTime.Name = "actTime";
|
||||||
|
this.actTime.Size = new System.Drawing.Size(100, 20);
|
||||||
|
this.actTime.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// txtJiraLogin
|
||||||
|
//
|
||||||
|
this.txtJiraLogin.Location = new System.Drawing.Point(94, 42);
|
||||||
|
this.txtJiraLogin.Name = "txtJiraLogin";
|
||||||
|
this.txtJiraLogin.Size = new System.Drawing.Size(100, 20);
|
||||||
|
this.txtJiraLogin.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// lbl1
|
||||||
|
//
|
||||||
|
this.lbl1.AutoSize = true;
|
||||||
|
this.lbl1.Location = new System.Drawing.Point(28, 45);
|
||||||
|
this.lbl1.Name = "lbl1";
|
||||||
|
this.lbl1.Size = new System.Drawing.Size(60, 13);
|
||||||
|
this.lbl1.TabIndex = 2;
|
||||||
|
this.lbl1.Text = "Ëîãèí Jira:";
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(21, 71);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(67, 13);
|
||||||
|
this.label1.TabIndex = 4;
|
||||||
|
this.label1.Text = "Ïàðîëü Jira:";
|
||||||
|
//
|
||||||
|
// txtJiraPassword
|
||||||
|
//
|
||||||
|
this.txtJiraPassword.Location = new System.Drawing.Point(94, 68);
|
||||||
|
this.txtJiraPassword.Name = "txtJiraPassword";
|
||||||
|
this.txtJiraPassword.PasswordChar = '*';
|
||||||
|
this.txtJiraPassword.Size = new System.Drawing.Size(100, 20);
|
||||||
|
this.txtJiraPassword.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(6, 97);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(82, 13);
|
||||||
|
this.label2.TabIndex = 6;
|
||||||
|
this.label2.Text = "EMail Mercurial:";
|
||||||
|
//
|
||||||
|
// txtMercurialEmail
|
||||||
|
//
|
||||||
|
this.txtMercurialEmail.Location = new System.Drawing.Point(94, 94);
|
||||||
|
this.txtMercurialEmail.Name = "txtMercurialEmail";
|
||||||
|
this.txtMercurialEmail.Size = new System.Drawing.Size(100, 20);
|
||||||
|
this.txtMercurialEmail.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
this.label3.AutoSize = true;
|
||||||
|
this.label3.Location = new System.Drawing.Point(45, 126);
|
||||||
|
this.label3.Name = "label3";
|
||||||
|
this.label3.Size = new System.Drawing.Size(43, 13);
|
||||||
|
this.label3.TabIndex = 7;
|
||||||
|
this.label3.Text = "Âðåìÿ:";
|
||||||
|
//
|
||||||
|
// btnSave
|
||||||
|
//
|
||||||
|
this.btnSave.Location = new System.Drawing.Point(62, 146);
|
||||||
|
this.btnSave.Name = "btnSave";
|
||||||
|
this.btnSave.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.btnSave.TabIndex = 8;
|
||||||
|
this.btnSave.Text = "Save";
|
||||||
|
this.btnSave.UseVisualStyleBackColor = true;
|
||||||
|
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
this.label4.AutoSize = true;
|
||||||
|
this.label4.Location = new System.Drawing.Point(12, 19);
|
||||||
|
this.label4.Name = "label4";
|
||||||
|
this.label4.Size = new System.Drawing.Size(76, 13);
|
||||||
|
this.label4.TabIndex = 10;
|
||||||
|
this.label4.Text = "Ïóòü äî ðåïî:";
|
||||||
|
//
|
||||||
|
// txtRepoPath
|
||||||
|
//
|
||||||
|
this.txtRepoPath.Location = new System.Drawing.Point(94, 16);
|
||||||
|
this.txtRepoPath.Name = "txtRepoPath";
|
||||||
|
this.txtRepoPath.Size = new System.Drawing.Size(100, 20);
|
||||||
|
this.txtRepoPath.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// txtLog
|
||||||
|
//
|
||||||
|
this.txtLog.Location = new System.Drawing.Point(218, 16);
|
||||||
|
this.txtLog.Multiline = true;
|
||||||
|
this.txtLog.Name = "txtLog";
|
||||||
|
this.txtLog.Size = new System.Drawing.Size(510, 264);
|
||||||
|
this.txtLog.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// btnStart
|
||||||
|
//
|
||||||
|
this.btnStart.Location = new System.Drawing.Point(48, 257);
|
||||||
|
this.btnStart.Name = "btnStart";
|
||||||
|
this.btnStart.Size = new System.Drawing.Size(103, 23);
|
||||||
|
this.btnStart.TabIndex = 12;
|
||||||
|
this.btnStart.Text = "Set task times";
|
||||||
|
this.btnStart.UseVisualStyleBackColor = true;
|
||||||
|
this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
|
||||||
|
//
|
||||||
|
// ntfyIcon
|
||||||
|
//
|
||||||
|
this.ntfyIcon.Text = "notifyIcon1";
|
||||||
|
this.ntfyIcon.Visible = true;
|
||||||
|
//
|
||||||
|
// tmrStart
|
||||||
|
//
|
||||||
|
this.tmrStart.Enabled = true;
|
||||||
|
this.tmrStart.Interval = 1000;
|
||||||
|
this.tmrStart.Tick += new System.EventHandler(this.tmrStart_Tick);
|
||||||
|
//
|
||||||
|
// frmMain
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(740, 292);
|
||||||
|
this.Controls.Add(this.btnStart);
|
||||||
|
this.Controls.Add(this.txtLog);
|
||||||
|
this.Controls.Add(this.label4);
|
||||||
|
this.Controls.Add(this.txtRepoPath);
|
||||||
|
this.Controls.Add(this.btnSave);
|
||||||
|
this.Controls.Add(this.label3);
|
||||||
|
this.Controls.Add(this.label2);
|
||||||
|
this.Controls.Add(this.txtMercurialEmail);
|
||||||
|
this.Controls.Add(this.label1);
|
||||||
|
this.Controls.Add(this.txtJiraPassword);
|
||||||
|
this.Controls.Add(this.lbl1);
|
||||||
|
this.Controls.Add(this.txtJiraLogin);
|
||||||
|
this.Controls.Add(this.actTime);
|
||||||
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(2);
|
||||||
|
this.Name = "frmMain";
|
||||||
|
this.Text = "Áîò ëîãèðîâàíèÿ âðåìåíè";
|
||||||
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmMain_FormClosing);
|
||||||
|
this.Load += new System.EventHandler(this.Form1_Load);
|
||||||
|
this.Resize += new System.EventHandler(this.frmMain_Resize);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.DateTimePicker actTime;
|
||||||
|
private System.Windows.Forms.TextBox txtJiraLogin;
|
||||||
|
private System.Windows.Forms.Label lbl1;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
private System.Windows.Forms.TextBox txtJiraPassword;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private System.Windows.Forms.TextBox txtMercurialEmail;
|
||||||
|
private System.Windows.Forms.Label label3;
|
||||||
|
private System.Windows.Forms.Button btnSave;
|
||||||
|
private System.Windows.Forms.Label label4;
|
||||||
|
private System.Windows.Forms.TextBox txtRepoPath;
|
||||||
|
private System.Windows.Forms.TextBox txtLog;
|
||||||
|
private System.Windows.Forms.Button btnStart;
|
||||||
|
private System.Windows.Forms.NotifyIcon ntfyIcon;
|
||||||
|
private System.Windows.Forms.Timer tmrStart;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using JiraTimeBotForm.Configuration;
|
||||||
|
using JiraTimeBotForm.JiraIntegration;
|
||||||
|
using JiraTimeBotForm.Passwords;
|
||||||
|
using JiraTimeBotForm.TaskTime;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
// This is the code for your desktop app.
|
||||||
|
// Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app.
|
||||||
|
|
||||||
|
namespace JiraTimeBotForm
|
||||||
|
{
|
||||||
|
public partial class frmMain : Form
|
||||||
|
{
|
||||||
|
private readonly string _settingsPath;
|
||||||
|
private readonly ILog _log;
|
||||||
|
private readonly NotifyIcon trayIcon;
|
||||||
|
private readonly ContextMenu trayMenu;
|
||||||
|
|
||||||
|
public frmMain()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_settingsPath = Path.Combine(Application.UserAppDataPath, "settings.json");
|
||||||
|
_log = new Logger(txtLog);
|
||||||
|
|
||||||
|
trayMenu = new ContextMenu();
|
||||||
|
trayMenu.MenuItems.Add("Exit", OnExit);
|
||||||
|
|
||||||
|
trayIcon = new NotifyIcon();
|
||||||
|
trayIcon.Text = "JiraTimeBot";
|
||||||
|
trayIcon.Icon = this.Icon;// new Icon(SystemIcons.WinLogo, 40, 40);
|
||||||
|
|
||||||
|
trayIcon.ContextMenu = trayMenu;
|
||||||
|
trayIcon.Click += btnTray_Click;
|
||||||
|
trayIcon.DoubleClick += btnTray_Click;
|
||||||
|
trayIcon.Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
|
{
|
||||||
|
trayIcon.Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnExit(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Application.Exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnTray_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.Visible = true;
|
||||||
|
this.Activate();
|
||||||
|
this.BringToFront();
|
||||||
|
Extensions.Extensions.Restore(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var settings = new Settings
|
||||||
|
{
|
||||||
|
JiraUserName = txtJiraLogin.Text,
|
||||||
|
JiraPassword = txtJiraPassword.Text,
|
||||||
|
MercurialAuthorEmail = txtMercurialEmail.Text,
|
||||||
|
ActivationTime = TimeSpan.Parse(actTime.Text),
|
||||||
|
RepositoryPath = txtRepoPath.Text
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var password = new EncryptionClass().Encrypt(settings.JiraUserName, settings.JiraPassword, settings.JiraUrl);
|
||||||
|
settings.JiraPassword = password;
|
||||||
|
|
||||||
|
var settingsString = JsonConvert.SerializeObject(settings);
|
||||||
|
File.WriteAllText(_settingsPath, settingsString);
|
||||||
|
|
||||||
|
MessageBox.Show("Settings saved.");
|
||||||
|
LoadSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Form1_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (File.Exists(_settingsPath))
|
||||||
|
{
|
||||||
|
LoadSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadSettings()
|
||||||
|
{
|
||||||
|
var settingsText = File.ReadAllText(_settingsPath);
|
||||||
|
var settings = JsonConvert.DeserializeObject<Settings>(settingsText);
|
||||||
|
|
||||||
|
var password = new EncryptionClass().Decrypt(settings.JiraUserName, settings.JiraPassword, settings.JiraUrl);
|
||||||
|
|
||||||
|
txtJiraLogin.Text = settings.JiraUserName;
|
||||||
|
txtJiraPassword.Text = password;
|
||||||
|
txtMercurialEmail.Text = settings.MercurialAuthorEmail;
|
||||||
|
txtRepoPath.Text = settings.RepositoryPath;
|
||||||
|
actTime.Text = settings.ActivationTime.ToString("hh\\:mm\\:ss");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnStart_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DoTheJob();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void frmMain_Resize(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (FormWindowState.Minimized == this.WindowState)
|
||||||
|
{
|
||||||
|
trayIcon.Visible = true;
|
||||||
|
this.Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (FormWindowState.Normal == this.WindowState)
|
||||||
|
{
|
||||||
|
trayIcon.Visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tmrStart_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var runTime = TimeSpan.Parse(actTime.Text);
|
||||||
|
if (Math.Abs((DateTime.Now.TimeOfDay - runTime).TotalSeconds) < 1)
|
||||||
|
{
|
||||||
|
if (DateTime.Now.DayOfWeek == DayOfWeek.Saturday || DateTime.Now.DayOfWeek == DayOfWeek.Sunday)
|
||||||
|
{
|
||||||
|
_log.Error("ñåãîäíÿ ñóááîòà èëè âîñêðåñåíüå. Ðàáîòàòü íåëüçÿ =)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DoTheJob();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DoTheJob()
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(txtRepoPath.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Ïàïêà ñ ðåïî íå ñóøåñòâóåò.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
txtLog.Text = "";
|
||||||
|
var settings = new Settings
|
||||||
|
{
|
||||||
|
JiraUserName = txtJiraLogin.Text,
|
||||||
|
JiraPassword = txtJiraPassword.Text,
|
||||||
|
MercurialAuthorEmail = txtMercurialEmail.Text,
|
||||||
|
ActivationTime = TimeSpan.Parse(actTime.Text),
|
||||||
|
RepositoryPath = txtRepoPath.Text
|
||||||
|
};
|
||||||
|
|
||||||
|
var jira = new JiraApi(settings, _log);
|
||||||
|
var taskDiscoverer = new TaskTimeDiscoverer(_log);
|
||||||
|
|
||||||
|
int daysDiff = 0;
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
var date = DateTime.Now.Date.AddDays(daysDiff);
|
||||||
|
var taskTimes = taskDiscoverer.GetTaskTimes(settings, date);
|
||||||
|
if (!taskTimes.Any())
|
||||||
|
{
|
||||||
|
_log.Warn($"{date} âû íå ñäåëàëè íè÷åãî ïîëåçíîãî =) Èñïîëüçóþ ïðåäûäóùèé äåíü.");
|
||||||
|
daysDiff--;
|
||||||
|
if (daysDiff < 7)
|
||||||
|
{
|
||||||
|
_log.Error("Íå íàøëè íè îäíîãî êîììèòà çà ïðåäûäóùèå 7 äíåé. Âîçìîæíî âû â îòïóñêå? Âûõîæó.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
_log.Trace($"Íà ðåàëüíóþ äàòó {date:dd.MM.yyyy} ðàñïðåäåëåíèå ïî çàäà÷àì:");
|
||||||
|
foreach (var taskTime in taskTimes)
|
||||||
|
{
|
||||||
|
_log.Trace($"- {taskTime.Branch} (êîììèòîâ {taskTime.Commits}): {taskTime.Time}");
|
||||||
|
}
|
||||||
|
|
||||||
|
jira.SetTodayWorklog(taskTimes);
|
||||||
|
_log.Info("Ãîòîâî.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 170 KiB |
@@ -0,0 +1,71 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Atlassian.Jira;
|
||||||
|
using JiraTimeBotForm.Configuration;
|
||||||
|
using JiraTimeBotForm.TaskTime;
|
||||||
|
|
||||||
|
namespace JiraTimeBotForm.JiraIntegration
|
||||||
|
{
|
||||||
|
public class JiraApi
|
||||||
|
{
|
||||||
|
private readonly Settings _settings;
|
||||||
|
private readonly ILog _log;
|
||||||
|
private Jira _jira;
|
||||||
|
|
||||||
|
public JiraApi(Settings settings, ILog log = null)
|
||||||
|
{
|
||||||
|
_settings = settings;
|
||||||
|
_log = log;
|
||||||
|
_jira = Jira.CreateRestClient(_settings.JiraUrl, _settings.JiraUserName, _settings.JiraPassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTodayWorklog(List<TaskTimeItem> taskTimeItems, DateTime? date = null)
|
||||||
|
{
|
||||||
|
if (date == null)
|
||||||
|
{
|
||||||
|
date = DateTime.Now.Date;
|
||||||
|
}
|
||||||
|
date = date.Value.Date;
|
||||||
|
|
||||||
|
foreach (var taskTimeItem in taskTimeItems)
|
||||||
|
{
|
||||||
|
var issue = _jira.Issues.Queryable.FirstOrDefault(f => f.Key == taskTimeItem.Branch);
|
||||||
|
if (issue == null)
|
||||||
|
{
|
||||||
|
_log.Error($"Не могу найти ветку {taskTimeItem.Branch}, пропускаю!");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var hasTodayWorklog = false;
|
||||||
|
var workLogs = issue.GetWorklogsAsync().Result;
|
||||||
|
foreach (var workLog in workLogs)
|
||||||
|
{
|
||||||
|
var timeSpent = TimeSpan.FromSeconds(workLog.TimeSpentInSeconds);
|
||||||
|
if (workLog.CreateDate.GetValueOrDefault().Date == date && workLog.Author == _settings.JiraUserName)
|
||||||
|
{
|
||||||
|
var timeDiff = (timeSpent - taskTimeItem.Time).TotalMinutes;
|
||||||
|
if (timeDiff > 1)
|
||||||
|
{
|
||||||
|
_log.Trace($"Время отличается на {timeDiff} минут, удаляю worklog: {taskTimeItem.Branch} {workLog.Author} {workLog.CreateDate}: {workLog.TimeSpent}");
|
||||||
|
issue.DeleteWorklogAsync(workLog, WorklogStrategy.RetainRemainingEstimate);
|
||||||
|
hasTodayWorklog = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_log.Trace($"По задаче {taskTimeItem.Branch} уже есть аналогичный worklog. Пропускаю.");
|
||||||
|
hasTodayWorklog = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasTodayWorklog)
|
||||||
|
{
|
||||||
|
var timeSpentJira = $"{taskTimeItem.Time.TotalMinutes}m";
|
||||||
|
var addedWorklog = issue.AddWorklogAsync(new Worklog(timeSpentJira, date.Value)).Result;
|
||||||
|
_log.Trace($"Добавили Worklog для {taskTimeItem.Branch}: {addedWorklog.Author} {addedWorklog.CreateDate}: {addedWorklog.TimeSpent}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{F3B89316-C38C-4CE6-9D88-0B1373CFBA1A}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<RootNamespace>JiraTimeBotForm</RootNamespace>
|
||||||
|
<AssemblyName>JiraTimeBotForm</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<ApplicationIcon>Google-Noto-Emoji-Smileys-10103-robot-face.ico</ApplicationIcon>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Atlassian.Jira, Version=10.4.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Atlassian.SDK.10.4.0\lib\net452\Atlassian.Jira.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Mercurial.Net, Version=1.1.1.607, Culture=neutral, PublicKeyToken=9e2fabf3af85dba9, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Mercurial.Net.1.1.1.607\lib\net35-Client\Mercurial.Net.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NLog.4.5.11\lib\net45\NLog.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="RestSharp, Version=106.6.9.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\RestSharp.106.6.9\lib\net452\RestSharp.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.DirectoryServices" />
|
||||||
|
<Reference Include="System.IO.Compression" />
|
||||||
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
|
<Reference Include="System.Security" />
|
||||||
|
<Reference Include="System.ServiceModel" />
|
||||||
|
<Reference Include="System.Transactions" />
|
||||||
|
<Reference Include="System.Web" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Deployment" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Extensions\Extensions.cs" />
|
||||||
|
<Compile Include="Logger.cs" />
|
||||||
|
<Compile Include="Configuration\Settings.cs" />
|
||||||
|
<Compile Include="Form1.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Form1.Designer.cs">
|
||||||
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="JiraIntegration\JiraApi.cs" />
|
||||||
|
<Compile Include="Passwords\EncryptionClass.cs" />
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="TaskTime\ITaskTimeDiscoverer.cs" />
|
||||||
|
<Compile Include="TaskTime\TaskTimeDiscoverer.cs" />
|
||||||
|
<Compile Include="TaskTime\TaskTimeItem.cs" />
|
||||||
|
<EmbeddedResource Include="Form1.resx">
|
||||||
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Google-Noto-Emoji-Smileys-10103-robot-face.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace JiraTimeBotForm
|
||||||
|
{
|
||||||
|
public class Logger : ILog
|
||||||
|
{
|
||||||
|
private readonly TextBox _txt;
|
||||||
|
|
||||||
|
public Logger(TextBox txt)
|
||||||
|
{
|
||||||
|
_txt = txt;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AppendText(string message)
|
||||||
|
{
|
||||||
|
message = $"{DateTime.Now:HH:mm} {message}";
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(_txt.Text))
|
||||||
|
{
|
||||||
|
_txt.Text = message;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_txt.Text += Environment.NewLine + message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Info([Localizable(false)] string message)
|
||||||
|
{
|
||||||
|
AppendText(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Trace([Localizable(false)] string message)
|
||||||
|
{
|
||||||
|
AppendText(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Warn([Localizable(false)] string message)
|
||||||
|
{
|
||||||
|
AppendText(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Error([Localizable(false)] string message)
|
||||||
|
{
|
||||||
|
AppendText(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ILog
|
||||||
|
{
|
||||||
|
void Info([Localizable(false)] string message);
|
||||||
|
void Trace([Localizable(false)] string message);
|
||||||
|
void Warn([Localizable(false)] string message);
|
||||||
|
void Error([Localizable(false)] string message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
|
namespace JiraTimeBotForm.Passwords
|
||||||
|
{
|
||||||
|
public class EncryptionClass
|
||||||
|
{
|
||||||
|
private byte[] GetEntropy(string EntropyString)
|
||||||
|
{
|
||||||
|
|
||||||
|
MD5 md5 = MD5.Create();
|
||||||
|
return md5.ComputeHash(Encoding.UTF8.GetBytes(EntropyString));
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Encrypt(string username, string password, string address)
|
||||||
|
{
|
||||||
|
byte[] entropy = GetEntropy(address + username);
|
||||||
|
byte[] pass = Encoding.UTF8.GetBytes(password);
|
||||||
|
byte[] crypted = ProtectedData.Protect(pass, entropy, DataProtectionScope.LocalMachine);
|
||||||
|
var cryptedBase64 = Convert.ToBase64String(crypted);
|
||||||
|
|
||||||
|
return cryptedBase64;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Decrypt(string username, string password, string address)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var pass = Convert.FromBase64String(password);
|
||||||
|
byte[] entropy = GetEntropy(address + username);
|
||||||
|
pass = ProtectedData.Unprotect(pass, entropy, DataProtectionScope.LocalMachine);
|
||||||
|
return Encoding.UTF8.GetString(pass);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace JiraTimeBotForm
|
||||||
|
{
|
||||||
|
static class Program
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The main entry point for the application.
|
||||||
|
/// </summary>
|
||||||
|
[STAThread]
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
Application.EnableVisualStyles();
|
||||||
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
Application.Run(new frmMain());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("JiraTimeBotForm")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("JiraTimeBotForm")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("f3b89316-c38c-4ce6-9d88-0b1373cfba1a")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
+71
@@ -0,0 +1,71 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace JiraTimeBotForm.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||||
|
/// </summary>
|
||||||
|
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||||
|
// class via a tool like ResGen or Visual Studio.
|
||||||
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
|
// with the /str option, or rebuild your VS project.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources
|
||||||
|
{
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the cached ResourceManager instance used by this class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if ((resourceMan == null))
|
||||||
|
{
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("JiraTimeBotForm.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides the current thread's CurrentUICulture property for all
|
||||||
|
/// resource lookups using this strongly typed resource class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace JiraTimeBotForm.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using JiraTimeBotForm.Configuration;
|
||||||
|
|
||||||
|
namespace JiraTimeBotForm.TaskTime
|
||||||
|
{
|
||||||
|
public interface ITaskTimeDiscoverer
|
||||||
|
{
|
||||||
|
List<TaskTimeItem> GetTaskTimes(Settings settings, DateTime? date = null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using JiraTimeBotForm.Configuration;
|
||||||
|
using Mercurial;
|
||||||
|
|
||||||
|
namespace JiraTimeBotForm.TaskTime
|
||||||
|
{
|
||||||
|
public class TaskTimeDiscoverer: ITaskTimeDiscoverer
|
||||||
|
{
|
||||||
|
private readonly ILog _log;
|
||||||
|
|
||||||
|
public TaskTimeDiscoverer(ILog log = null)
|
||||||
|
{
|
||||||
|
_log = log;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TaskTimeItem> GetTaskTimes(Settings settings, DateTime? date = null)
|
||||||
|
{
|
||||||
|
if (date == null)
|
||||||
|
{
|
||||||
|
date = DateTime.Now.Date;
|
||||||
|
}
|
||||||
|
date = date.Value.Date;
|
||||||
|
|
||||||
|
List<string> workTasks = new List<string>();
|
||||||
|
foreach (var repoDirectory in Directory.GetDirectories(settings.RepositoryPath))
|
||||||
|
{
|
||||||
|
//var project = new DirectoryInfo(repoDirectory).Name;
|
||||||
|
if (!Directory.Exists(Path.Combine(repoDirectory, ".hg")))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var repo = new Repository(repoDirectory);
|
||||||
|
var log = repo.Log(new LogCommand {Date = date, Users = { settings.MercurialAuthorEmail }});
|
||||||
|
foreach (var changeset in log)
|
||||||
|
{
|
||||||
|
if (!changeset.Branch.Contains("-"))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
workTasks.Add(changeset.Branch);
|
||||||
|
_log.Trace($" - Найден changeset: {changeset.Timestamp} - {changeset.Branch} - {changeset.AuthorEmailAddress}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Нам нужно раскидать 480 минут в день.
|
||||||
|
var workTimeItems = new List<TaskTimeItem>();
|
||||||
|
foreach (var taskGroup in workTasks.GroupBy(f=>f))
|
||||||
|
{
|
||||||
|
var minutesPerTime = settings.MinuterPerWorkDay / workTasks.Count;
|
||||||
|
var minutesForCurrentTaskGroup = minutesPerTime * taskGroup.Count();
|
||||||
|
|
||||||
|
workTimeItems.Add(new TaskTimeItem
|
||||||
|
{
|
||||||
|
Branch = taskGroup.Key,
|
||||||
|
Time = TimeSpan.FromMinutes(minutesForCurrentTaskGroup),
|
||||||
|
Commits = taskGroup.Count()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return workTimeItems;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace JiraTimeBotForm.TaskTime
|
||||||
|
{
|
||||||
|
public class TaskTimeItem
|
||||||
|
{
|
||||||
|
public string Branch { get; set; }
|
||||||
|
public TimeSpan Time { get; set; }
|
||||||
|
public int Commits { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Atlassian.SDK" version="10.4.0" targetFramework="net461" />
|
||||||
|
<package id="Mercurial.Net" version="1.1.1.607" targetFramework="net461" />
|
||||||
|
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net461" />
|
||||||
|
<package id="NLog" version="4.5.11" targetFramework="net461" />
|
||||||
|
<package id="RestSharp" version="106.6.9" targetFramework="net461" />
|
||||||
|
</packages>
|
||||||
Reference in New Issue
Block a user