Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c86cefa53 | ||
|
|
2d8214e64f | ||
|
|
02bee8abbd | ||
|
|
0f00ba3f0e | ||
|
|
71d02f7efe | ||
|
|
71fbd6ee80 | ||
|
|
7d236ba9b0 |
+1
-1
@@ -1 +1 @@
|
||||
1.0.15
|
||||
1.0.19
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace JiraTimeBotForm.Configuration
|
||||
namespace JiraTimeBot.Configuration
|
||||
{
|
||||
public class PasswordEncryptionClass
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace JiraTimeBotForm.Configuration
|
||||
namespace JiraTimeBot.Configuration
|
||||
{
|
||||
public class Settings
|
||||
{
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
using System.Windows.Forms;
|
||||
using Autofac;
|
||||
using Autofac.Extras.AggregateService;
|
||||
using JiraTimeBotForm.JiraIntegration;
|
||||
using JiraTimeBotForm.JiraIntegration.Comments;
|
||||
using JiraTimeBotForm.Mercurial;
|
||||
using JiraTimeBotForm.Mercurial.Modifiers;
|
||||
using JiraTimeBotForm.TasksProcessors;
|
||||
using JiraTimeBotForm.TaskTime;
|
||||
using JiraTimeBotForm.UI;
|
||||
using JiraTimeBotForm.UI.Tray;
|
||||
using JiraTimeBot.JiraIntegration;
|
||||
using JiraTimeBot.JiraIntegration.Comments;
|
||||
using JiraTimeBot.Mercurial;
|
||||
using JiraTimeBot.Mercurial.Modifiers;
|
||||
using JiraTimeBot.TasksProcessors;
|
||||
using JiraTimeBot.TaskTime;
|
||||
using JiraTimeBot.UI.Tray;
|
||||
|
||||
namespace JiraTimeBotForm.DI
|
||||
namespace JiraTimeBot.DI
|
||||
{
|
||||
public class Bootstrapper
|
||||
{
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using JiraTimeBotForm.TaskTime.Objects;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.TaskTime.Objects;
|
||||
|
||||
namespace JiraTimeBotForm.JiraIntegration.Comments
|
||||
namespace JiraTimeBot.JiraIntegration.Comments
|
||||
{
|
||||
public interface IJiraDescriptionSource
|
||||
{
|
||||
string GetDescription(TaskTimeItem item, bool addCommentsToWorklog);
|
||||
string GetDescription(TaskTimeItem item, bool addCommentsToWorklog, Settings settings);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JiraTimeBotForm.TaskTime.Objects;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.TaskTime.Objects;
|
||||
|
||||
namespace JiraTimeBotForm.JiraIntegration.Comments
|
||||
namespace JiraTimeBot.JiraIntegration.Comments
|
||||
{
|
||||
public class JiraDescriptionSource : IJiraDescriptionSource
|
||||
{
|
||||
@@ -13,14 +14,19 @@ namespace JiraTimeBotForm.JiraIntegration.Comments
|
||||
"кодинг", "написание кода и тестов"
|
||||
};
|
||||
|
||||
public string GetDescription(TaskTimeItem taskTimeItem, bool addCommentsToWorklog)
|
||||
public string GetDescription(TaskTimeItem taskTimeItem, bool addCommentsToWorklog, Settings settings)
|
||||
{
|
||||
if (addCommentsToWorklog)
|
||||
{
|
||||
return taskTimeItem.Description;
|
||||
}
|
||||
|
||||
return _dummyComments.OrderBy(f => Guid.NewGuid()).FirstOrDefault();
|
||||
if (settings.WorkType == WorkType.Mercurial)
|
||||
{
|
||||
return _dummyComments.OrderBy(f => Guid.NewGuid()).FirstOrDefault();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Atlassian.Jira;
|
||||
using JiraTimeBotForm.Configuration;
|
||||
using JiraTimeBotForm.JiraIntegration.Comments;
|
||||
using JiraTimeBotForm.TaskTime.Objects;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.JiraIntegration.Comments;
|
||||
using JiraTimeBot.TaskTime.Objects;
|
||||
|
||||
namespace JiraTimeBotForm.JiraIntegration
|
||||
namespace JiraTimeBot.JiraIntegration
|
||||
{
|
||||
public class JiraApi
|
||||
{
|
||||
@@ -119,7 +119,7 @@ namespace JiraTimeBotForm.JiraIntegration
|
||||
{
|
||||
var timeSpentJira = $"{taskTimeItem.Time.TotalMinutes}m";
|
||||
|
||||
var comment = _descriptionSource.GetDescription(taskTimeItem, addCommentsToWorklog);
|
||||
var comment = _descriptionSource.GetDescription(taskTimeItem, addCommentsToWorklog, settings);
|
||||
|
||||
Worklog workLogToAdd = new Worklog(timeSpentJira, date.Value, comment);
|
||||
if (!dummy)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using JiraTimeBotForm.Configuration;
|
||||
using JiraTimeBotForm.Mercurial;
|
||||
using JiraTimeBotForm.Mercurial.Objects;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.Mercurial;
|
||||
using JiraTimeBot.Mercurial.Objects;
|
||||
|
||||
namespace JiraTimeBotForm.JiraIntegration
|
||||
namespace JiraTimeBot.JiraIntegration
|
||||
{
|
||||
public class JiraCommitEmulator : IMercurialLog
|
||||
{
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{F3B89316-C38C-4CE6-9D88-0B1373CFBA1A}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>JiraTimeBotForm</RootNamespace>
|
||||
<AssemblyName>JiraTimeBotForm</AssemblyName>
|
||||
<RootNamespace>JiraTimeBot</RootNamespace>
|
||||
<AssemblyName>JiraTimeBot</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
@@ -61,6 +61,7 @@
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.DirectoryServices" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.IO.Compression.FileSystem" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
@@ -131,6 +132,7 @@
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="UI\frmSettings.resx">
|
||||
<DependentUpon>frmSettings.cs</DependentUpon>
|
||||
|
||||
@@ -3,14 +3,14 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using JiraTimeBotForm.Configuration;
|
||||
using JiraTimeBotForm.Mercurial;
|
||||
using JiraTimeBotForm.Mercurial.Objects;
|
||||
using JiraTimeBotForm.TasksProcessors;
|
||||
using JiraTimeBotForm.TaskTime;
|
||||
using JiraTimeBotForm.TaskTime.Objects;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.Mercurial;
|
||||
using JiraTimeBot.Mercurial.Objects;
|
||||
using JiraTimeBot.TasksProcessors;
|
||||
using JiraTimeBot.TaskTime;
|
||||
using JiraTimeBot.TaskTime.Objects;
|
||||
|
||||
namespace JiraTimeBotForm
|
||||
namespace JiraTimeBot
|
||||
{
|
||||
class Job
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace JiraTimeBotForm
|
||||
namespace JiraTimeBot
|
||||
{
|
||||
public class Logger : ILog
|
||||
{
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JiraTimeBotForm.JiraIntegration;
|
||||
using JiraTimeBot.JiraIntegration;
|
||||
|
||||
namespace JiraTimeBotForm.Mercurial
|
||||
namespace JiraTimeBot.Mercurial
|
||||
{
|
||||
public interface IAllMercurialProviders
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using JiraTimeBotForm.Configuration;
|
||||
using JiraTimeBotForm.Mercurial.Objects;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.Mercurial.Objects;
|
||||
|
||||
namespace JiraTimeBotForm.Mercurial
|
||||
namespace JiraTimeBot.Mercurial
|
||||
{
|
||||
public interface IMercurialLog
|
||||
{
|
||||
|
||||
@@ -4,12 +4,12 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using JiraTimeBotForm.Configuration;
|
||||
using JiraTimeBotForm.Mercurial.Modifiers;
|
||||
using JiraTimeBotForm.Mercurial.Objects;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.Mercurial.Modifiers;
|
||||
using JiraTimeBot.Mercurial.Objects;
|
||||
using Mercurial;
|
||||
|
||||
namespace JiraTimeBotForm.Mercurial
|
||||
namespace JiraTimeBot.Mercurial
|
||||
{
|
||||
public class MercurialLog: IMercurialLog
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace JiraTimeBotForm.Mercurial.Modifiers
|
||||
namespace JiraTimeBot.Mercurial.Modifiers
|
||||
{
|
||||
public class CommitSkipper : ICommitSkipper
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace JiraTimeBotForm.Mercurial.Modifiers
|
||||
namespace JiraTimeBot.Mercurial.Modifiers
|
||||
{
|
||||
public interface ICommitSkipper
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace JiraTimeBotForm.Mercurial.Modifiers
|
||||
namespace JiraTimeBot.Mercurial.Modifiers
|
||||
{
|
||||
public interface ITechnicalInfoSkipper
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
|
||||
namespace JiraTimeBotForm.Mercurial.Modifiers
|
||||
namespace JiraTimeBot.Mercurial.Modifiers
|
||||
{
|
||||
public class TechnicalInfoSkipper : ITechnicalInfoSkipper
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace JiraTimeBotForm.Mercurial.Objects
|
||||
namespace JiraTimeBot.Mercurial.Objects
|
||||
{
|
||||
public class MercurialCommitItem
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using JiraTimeBotForm.UI;
|
||||
using JiraTimeBot.UI;
|
||||
|
||||
namespace JiraTimeBotForm
|
||||
namespace JiraTimeBot
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
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("JiraTimeBot")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("JiraTimeBot")]
|
||||
[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.15")]
|
||||
[assembly: AssemblyFileVersion("1.0.15")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.15")]
|
||||
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("JiraTimeBot")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("JiraTimeBot")]
|
||||
[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.19")]
|
||||
[assembly: AssemblyFileVersion("1.0.19")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.19")]
|
||||
|
||||
+20
-28
@@ -1,4 +1,4 @@
|
||||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
@@ -8,10 +8,10 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace JiraTimeBotForm.Properties
|
||||
{
|
||||
|
||||
|
||||
namespace JiraTimeBot.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
@@ -19,51 +19,43 @@ namespace JiraTimeBotForm.Properties
|
||||
// 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.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
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()
|
||||
{
|
||||
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);
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("JiraTimeBot.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
|
||||
{
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-14
@@ -1,4 +1,4 @@
|
||||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
@@ -8,21 +8,17 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace JiraTimeBotForm.Properties
|
||||
{
|
||||
|
||||
|
||||
namespace JiraTimeBot.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
|
||||
{
|
||||
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.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
|
||||
{
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using JiraTimeBotForm.Configuration;
|
||||
using JiraTimeBotForm.Mercurial;
|
||||
using JiraTimeBotForm.Mercurial.Objects;
|
||||
using JiraTimeBotForm.TaskTime.Objects;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.Mercurial.Objects;
|
||||
using JiraTimeBot.TaskTime.Objects;
|
||||
|
||||
namespace JiraTimeBotForm.TaskTime
|
||||
namespace JiraTimeBot.TaskTime
|
||||
{
|
||||
public interface ITaskTimeCalculator
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace JiraTimeBotForm.TaskTime.Objects
|
||||
namespace JiraTimeBot.TaskTime.Objects
|
||||
{
|
||||
public class TaskTimeItem
|
||||
{
|
||||
|
||||
@@ -3,12 +3,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using JiraTimeBotForm.Configuration;
|
||||
using JiraTimeBotForm.Mercurial;
|
||||
using JiraTimeBotForm.Mercurial.Objects;
|
||||
using JiraTimeBotForm.TaskTime.Objects;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.Mercurial.Objects;
|
||||
using JiraTimeBot.TaskTime.Objects;
|
||||
|
||||
namespace JiraTimeBotForm.TaskTime
|
||||
namespace JiraTimeBot.TaskTime
|
||||
{
|
||||
public class TaskTimeByCommitsCalculator: ITaskTimeCalculator
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace JiraTimeBotForm.TasksProcessors
|
||||
namespace JiraTimeBot.TasksProcessors
|
||||
{
|
||||
public interface IAllTasksProcessors
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using JiraTimeBotForm.Configuration;
|
||||
using JiraTimeBotForm.TaskTime.Objects;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.TaskTime.Objects;
|
||||
|
||||
namespace JiraTimeBotForm.TasksProcessors
|
||||
namespace JiraTimeBot.TasksProcessors
|
||||
{
|
||||
interface ITasksProcessor
|
||||
{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JiraTimeBotForm.Configuration;
|
||||
using JiraTimeBotForm.JiraIntegration;
|
||||
using JiraTimeBotForm.TaskTime.Objects;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.JiraIntegration;
|
||||
using JiraTimeBot.TaskTime.Objects;
|
||||
|
||||
namespace JiraTimeBotForm.TasksProcessors
|
||||
namespace JiraTimeBot.TasksProcessors
|
||||
{
|
||||
public class MeetingProcessor : ITasksProcessor
|
||||
{
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using JiraTimeBotForm.Configuration;
|
||||
using JiraTimeBotForm.JiraIntegration;
|
||||
using JiraTimeBotForm.TaskTime;
|
||||
using JiraTimeBotForm.TaskTime.Objects;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.JiraIntegration;
|
||||
using JiraTimeBot.TaskTime.Objects;
|
||||
|
||||
namespace JiraTimeBotForm.TasksProcessors
|
||||
namespace JiraTimeBot.TasksProcessors
|
||||
{
|
||||
public class WorkLogTasksProcessor : ITasksProcessor
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace JiraTimeBotForm.UI.Tray
|
||||
namespace JiraTimeBot.UI.Tray
|
||||
{
|
||||
public interface ITrayMenu
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace JiraTimeBotForm.UI.Tray
|
||||
namespace JiraTimeBot.UI.Tray
|
||||
{
|
||||
public static class RestoreFromTray {
|
||||
[DllImport( "user32.dll" )]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace JiraTimeBotForm.UI.Tray
|
||||
namespace JiraTimeBot.UI.Tray
|
||||
{
|
||||
public class TrayMenu: ITrayMenu
|
||||
{
|
||||
|
||||
Generated
+2
-2
@@ -1,4 +1,4 @@
|
||||
namespace JiraTimeBotForm.UI
|
||||
namespace JiraTimeBot.UI
|
||||
{
|
||||
partial class frmMain
|
||||
{
|
||||
@@ -114,7 +114,7 @@
|
||||
//
|
||||
// tmrUpdate
|
||||
//
|
||||
this.tmrUpdate.Interval = 1000;
|
||||
this.tmrUpdate.Interval = 10000;
|
||||
this.tmrUpdate.Tick += new System.EventHandler(this.tmrUpdate_Tick);
|
||||
//
|
||||
// frmMain
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Autofac;
|
||||
using JiraTimeBotForm.Configuration;
|
||||
using JiraTimeBotForm.DI;
|
||||
using JiraTimeBotForm.TasksProcessors;
|
||||
using JiraTimeBotForm.UI.Tray;
|
||||
using JiraTimeBotForm.Update;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.DI;
|
||||
using JiraTimeBot.TasksProcessors;
|
||||
using JiraTimeBot.UI.Tray;
|
||||
using JiraTimeBot.Update;
|
||||
|
||||
// This is the code for your desktop app.
|
||||
// Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app.
|
||||
|
||||
namespace JiraTimeBotForm.UI
|
||||
namespace JiraTimeBot.UI
|
||||
{
|
||||
public partial class frmMain : Form
|
||||
{
|
||||
@@ -95,7 +96,15 @@ namespace JiraTimeBotForm.UI
|
||||
|
||||
PrintStartMessage();
|
||||
tmrStart.Enabled = true;
|
||||
tmrUpdate.Enabled = true;
|
||||
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
_log.Trace("Приложение запущено в режиме отладки. Отключаю обновление.");
|
||||
}
|
||||
else
|
||||
{
|
||||
tmrUpdate.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void PrintStartMessage()
|
||||
@@ -189,23 +198,90 @@ namespace JiraTimeBotForm.UI
|
||||
|
||||
private void tmrUpdate_Tick(object sender, EventArgs e)
|
||||
{
|
||||
tmrUpdate.Interval = 8 * 60 * 60 * 1000;
|
||||
|
||||
var checker = new UpdateChecker();
|
||||
var release = checker.GetRelease();
|
||||
if (release == null)
|
||||
try
|
||||
{
|
||||
return;
|
||||
tmrUpdate.Interval = 8 * 60 * 60 * 1000;
|
||||
|
||||
var checker = new UpdateChecker();
|
||||
var release = checker.GetRelease();
|
||||
if (release == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var gitVersionStr = checker.GetLatestVersion(release);
|
||||
var gitVersion = new Version(gitVersionStr);
|
||||
var appVersion = new Version(Application.ProductVersion);
|
||||
|
||||
if (gitVersion > appVersion)
|
||||
{
|
||||
var downloadUrl = checker.GetDownloadUrl(release);
|
||||
_log.Info($"Доступна новая версия: {gitVersion} {downloadUrl}");
|
||||
|
||||
var success = checker.DownloadFile(downloadUrl, "update.zip");
|
||||
if (!success)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var result = InstallUpdate(gitVersion, "update.zip");
|
||||
if (result)
|
||||
{
|
||||
//если обновились - отключаем до рестарта
|
||||
tmrUpdate.Enabled = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.Info($"Вы используете последнюю версию.");
|
||||
}
|
||||
}
|
||||
|
||||
var gitVersionStr = checker.GetLatestVersion(release);
|
||||
var gitVersion = new Version(gitVersionStr);
|
||||
var appVersion = new Version(Application.ProductVersion);
|
||||
|
||||
if (gitVersion > appVersion)
|
||||
catch (Exception ex)
|
||||
{
|
||||
var downloadUrl = checker.GetDownloadUrl(release);
|
||||
_log.Info($"Доступна новая версия: {gitVersion} {downloadUrl}");
|
||||
//в процессе обновления ни при каком раскладе мы не должны уложить бота.
|
||||
_log.Error($"Фатальная ошибка в процессе обновления: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private bool InstallUpdate(Version gitVersion, string updateFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
_log.Info($"Устанавливаю обновление до версии {gitVersion}.");
|
||||
//Rename he executing file
|
||||
System.IO.FileInfo appFile = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||
var bkpDir = Path.Combine(appFile.DirectoryName, "bkp");
|
||||
if (!Directory.Exists(bkpDir))
|
||||
{
|
||||
Directory.CreateDirectory(bkpDir);
|
||||
}
|
||||
|
||||
using (ZipArchive archive = ZipFile.OpenRead(Path.Combine(appFile.DirectoryName, updateFile)))
|
||||
{
|
||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||
{
|
||||
var zipEntryPath = Path.Combine(appFile.DirectoryName, entry.FullName);
|
||||
if (File.Exists(zipEntryPath))
|
||||
{
|
||||
System.IO.FileInfo zipEntryFile = new System.IO.FileInfo(zipEntryPath);
|
||||
if (File.Exists(bkpDir + "\\" + zipEntryFile.Name))
|
||||
{
|
||||
File.Delete(bkpDir + "\\" + zipEntryFile.Name);
|
||||
}
|
||||
System.IO.File.Move(zipEntryFile.FullName, bkpDir + "\\" + zipEntryFile.Name);
|
||||
}
|
||||
|
||||
entry.ExtractToFile(zipEntryPath);
|
||||
}
|
||||
}
|
||||
|
||||
_log.Info("Обновление установлено. Перезапустите программу для применения изменений.");
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
_log.Error($"Что-то пошло не так при обновлении.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace JiraTimeBotForm.UI
|
||||
namespace JiraTimeBot.UI
|
||||
{
|
||||
partial class frmSettings
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using JiraTimeBotForm.Configuration;
|
||||
using JiraTimeBot.Configuration;
|
||||
|
||||
namespace JiraTimeBotForm.UI
|
||||
namespace JiraTimeBot.UI
|
||||
{
|
||||
public partial class frmSettings : Form
|
||||
{
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace JiraTimeBotForm.Update
|
||||
namespace JiraTimeBot.Update
|
||||
{
|
||||
public partial class GitHubReleaseResponse
|
||||
{
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace JiraTimeBotForm.Update
|
||||
namespace JiraTimeBot.Update
|
||||
{
|
||||
class UpdateChecker
|
||||
{
|
||||
@@ -38,12 +35,22 @@ namespace JiraTimeBotForm.Update
|
||||
return release;
|
||||
}
|
||||
|
||||
public void DownloadFile(string url)
|
||||
public bool DownloadFile(string url, string to)
|
||||
{
|
||||
using (var client = new WebClient())
|
||||
try
|
||||
{
|
||||
client.Headers.Add("User-Agent", "Mozilla/5.0 (X11; Linux i686; rv:64.0) Gecko/20100101 Firefox/64.0");
|
||||
client.DownloadFile(url, "update.zip");
|
||||
|
||||
using (var client = new WebClient())
|
||||
{
|
||||
client.Headers.Add("User-Agent",
|
||||
"Mozilla/5.0 (X11; Linux i686; rv:64.0) Gecko/20100101 Firefox/64.0");
|
||||
client.DownloadFile(url, to);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user