Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions GitAutoFetch_Dev17/GitAutoFetch_Dev17.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,13 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.1.32210.191" ExcludeAssets="runtime">
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.14.40265" ExcludeAssets="runtime">
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.1.4054" />
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.14.2120">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<VSCTCompile Include="..\SharedFiles\GitAutoFetchPackage.vsct">
Expand Down
8 changes: 4 additions & 4 deletions GitAutoFetch_Dev17/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="ca8e6794-e60f-460f-9abd-c10f926deb98" Version="1.1.6.2022" Language="en-US" Publisher="Zwei Developer" />
<Identity Id="ca8e6794-e60f-460f-9abd-c10f926deb98" Version="1.1.8.2022" Language="en-US" Publisher="Zwei Developer" />
<DisplayName>GitAutoFetch VS2022</DisplayName>
<Description xml:space="preserve">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.</Description>
Expand All @@ -10,13 +10,13 @@ Version equal to 1.1.6.2022 is supported for Visual Studio 2022 only.</Descripti
<Tags>git, autofetch, git-autofetch, fetch</Tags>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0,18.0)">
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0,19.0)">
<ProductArchitecture>amd64</ProductArchitecture>
</InstallationTarget>
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[17.0,18.0)">
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[17.0,19.0)">
<ProductArchitecture>amd64</ProductArchitecture>
</InstallationTarget>
<InstallationTarget Id="Microsoft.VisualStudio.Enterprise" Version="[17.0,18.0)">
<InstallationTarget Id="Microsoft.VisualStudio.Enterprise" Version="[17.0,19.0)">
<ProductArchitecture>amd64</ProductArchitecture>
</InstallationTarget>
</Installation>
Expand Down
4 changes: 2 additions & 2 deletions SharedProject/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
[assembly: AssemblyVersion("1.1.8.0")]
[assembly: AssemblyFileVersion("1.1.8.0")]
9 changes: 6 additions & 3 deletions SharedProject/AutoFetch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -106,9 +109,9 @@ private async Task ExecFetchAsync()
await Task.Delay(Config.Instance.TimeValue_TimeSpan());
}
}
catch (Exception ex)
catch (Exception)
{
throw ex;
throw;
}
}

Expand Down
34 changes: 23 additions & 11 deletions SharedProject/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{ }

Expand All @@ -30,46 +44,44 @@ 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<Config>(await r.ReadToEndAsync());
var conf = await r.ReadToEndAsync();
_CurrentInstance = JsonConvert.DeserializeObject<Config>(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);
}
}
}

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
Expand Down