diff --git a/GitAutoFetch_Dev17/GitAutoFetch_Dev17.csproj b/GitAutoFetch_Dev17/GitAutoFetch_Dev17.csproj
index 2138ae2..6f4241a 100644
--- a/GitAutoFetch_Dev17/GitAutoFetch_Dev17.csproj
+++ b/GitAutoFetch_Dev17/GitAutoFetch_Dev17.csproj
@@ -67,10 +67,13 @@
-
+
compile; build; native; contentfiles; analyzers; buildtransitive
-
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
diff --git a/GitAutoFetch_Dev17/source.extension.vsixmanifest b/GitAutoFetch_Dev17/source.extension.vsixmanifest
index d350ef1..7268736 100644
--- a/GitAutoFetch_Dev17/source.extension.vsixmanifest
+++ b/GitAutoFetch_Dev17/source.extension.vsixmanifest
@@ -1,7 +1,7 @@
-
+
GitAutoFetch VS2022
Auto fetch in Git, menu location in solution explorer (Git AutoFetch and Configure Fetching).
Version equal to 1.1.6.2022 is supported for Visual Studio 2022 only.
@@ -10,13 +10,13 @@ Version equal to 1.1.6.2022 is supported for Visual Studio 2022 only.git, autofetch, git-autofetch, fetch
-
diff --git a/SharedProject/AssemblyInfo.cs b/SharedProject/AssemblyInfo.cs
index 1b75d28..8e91861 100644
--- a/SharedProject/AssemblyInfo.cs
+++ b/SharedProject/AssemblyInfo.cs
@@ -28,5 +28,5 @@
// 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.1.6.0")]
-[assembly: AssemblyFileVersion("1.1.6.0")]
\ No newline at end of file
+[assembly: AssemblyVersion("1.1.8.0")]
+[assembly: AssemblyFileVersion("1.1.8.0")]
\ No newline at end of file
diff --git a/SharedProject/AutoFetch.cs b/SharedProject/AutoFetch.cs
index bfbd101..86b9e43 100644
--- a/SharedProject/AutoFetch.cs
+++ b/SharedProject/AutoFetch.cs
@@ -3,6 +3,7 @@
using Microsoft.VisualStudio.Shell.Interop;
using System;
using System.ComponentModel.Design;
+using System.Threading;
using Task = System.Threading.Tasks.Task;
namespace GitAutoFetch
@@ -85,8 +86,10 @@ private void Execute(object sender, EventArgs e)
}
}
- private async Task ExecFetchAsync()
+ private async Task ExecFetchAsync(CancellationToken cancellationToken = default)
{
+ await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
+
try
{
while (!DisposeGit)
@@ -106,9 +109,9 @@ private async Task ExecFetchAsync()
await Task.Delay(Config.Instance.TimeValue_TimeSpan());
}
}
- catch (Exception ex)
+ catch (Exception)
{
- throw ex;
+ throw;
}
}
diff --git a/SharedProject/Config.cs b/SharedProject/Config.cs
index 5ceaa6f..788ce85 100644
--- a/SharedProject/Config.cs
+++ b/SharedProject/Config.cs
@@ -8,10 +8,24 @@ namespace GitAutoFetch
{
public class Config
{
+ #region Constants
+
private const int DefaultTime = 5;
- public int UserTime { get; set; }
+
+ #endregion Constants
+
+ #region Fields
+
private static Config _CurrentInstance;
+ #endregion Fields
+
+ #region Properties
+
+ public int UserTime { get; set; }
+
+ #endregion Properties
+
private Config()
{ }
@@ -30,27 +44,25 @@ public static Config Instance
public TimeSpan TimeValue_TimeSpan() => TimeSpan.FromMinutes(TimeValue());
- public string ReturnPath()
- {
- return $@"{Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)}\VsGitAutoFetch.json";
- }
+ public string ReturnPath() => $@"{Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)}\VsGitAutoFetch.json";
public async Task VerifyConfigAsync()
{
- string pathConfig = ReturnPath();
+ var pathConfig = ReturnPath();
if (File.Exists(pathConfig))
{
using (var r = new StreamReader(pathConfig))
{
- _CurrentInstance = JsonConvert.DeserializeObject(await r.ReadToEndAsync());
+ var conf = await r.ReadToEndAsync();
+ _CurrentInstance = JsonConvert.DeserializeObject(conf);
}
}
else
{
using (var w = new StreamWriter(pathConfig))
{
- string conf = JsonConvert.SerializeObject(_CurrentInstance, Formatting.Indented);
+ var conf = JsonConvert.SerializeObject(_CurrentInstance, Formatting.Indented);
await w.WriteAsync(conf);
}
}
@@ -58,18 +70,18 @@ public async Task VerifyConfigAsync()
public void OpenConfigFile()
{
- string pathConfig = ReturnPath();
+ var pathConfig = ReturnPath();
if (File.Exists(pathConfig))
{
- string execute = $@"/C notepad {ReturnPath()}";
+ var execute = $@"/C notepad {ReturnPath()}";
Process.Start(new ProcessStartInfo()
{
FileName = "cmd.exe",
Arguments = execute,
CreateNoWindow = false,
- WindowStyle = ProcessWindowStyle.Hidden
+ WindowStyle = ProcessWindowStyle.Hidden,
}).Close();
}
else