diff --git a/src/GitHunter.Application.Shared/ApplicationSharedModule.cs b/src/GitHunter.Application.Shared/ApplicationSharedModule.cs index 73d4156..6c15975 100644 --- a/src/GitHunter.Application.Shared/ApplicationSharedModule.cs +++ b/src/GitHunter.Application.Shared/ApplicationSharedModule.cs @@ -1,9 +1,10 @@ -using GitHunter.Core.Shared; +using GitHunter.Core; +using GitHunter.Core.Modules; using Volo.Abp.Modularity; -namespace GitHunter.Application.Shared; +namespace GitHunter.Application; [DependsOn(typeof(CoreSharedModule))] -public class ApplicationSharedModule : AbpModule +public class ApplicationSharedModule : GitHunterModule { } \ No newline at end of file diff --git a/src/GitHunter.Application.Shared/Git/IGitManager.cs b/src/GitHunter.Application.Shared/Git/IGitManager.cs new file mode 100644 index 0000000..814e2cd --- /dev/null +++ b/src/GitHunter.Application.Shared/Git/IGitManager.cs @@ -0,0 +1,7 @@ +namespace GitHunter.Application.Git; + +public interface IGitManager +{ + void Initialize(string username, string password); + void Initialize(string token); +} \ No newline at end of file diff --git a/src/GitHunter.Application.Shared/GitHunter.Application.Shared.csproj b/src/GitHunter.Application.Shared/GitHunter.Application.Shared.csproj index 055ade0..09eb2ca 100644 --- a/src/GitHunter.Application.Shared/GitHunter.Application.Shared.csproj +++ b/src/GitHunter.Application.Shared/GitHunter.Application.Shared.csproj @@ -2,6 +2,7 @@ net7.0 + GitHunter.Application enable enable diff --git a/src/GitHunter.Application/ApplicationModule.cs b/src/GitHunter.Application/ApplicationModule.cs index 14d2ab6..3af5077 100644 --- a/src/GitHunter.Application/ApplicationModule.cs +++ b/src/GitHunter.Application/ApplicationModule.cs @@ -1,5 +1,5 @@ -using GitHunter.Application.Shared; -using GitHunter.Core; +using GitHunter.Core; +using GitHunter.Core.Modules; using Volo.Abp.Modularity; namespace GitHunter.Application; @@ -8,6 +8,6 @@ namespace GitHunter.Application; typeof(ApplicationSharedModule), typeof(CoreModule) )] -public class ApplicationModule : AbpModule +public class ApplicationModule : GitHunterModule { } \ No newline at end of file diff --git a/src/GitHunter.Application/Git/GitManager.cs b/src/GitHunter.Application/Git/GitManager.cs new file mode 100644 index 0000000..f5e411f --- /dev/null +++ b/src/GitHunter.Application/Git/GitManager.cs @@ -0,0 +1,82 @@ +using GitHunter.Core.DependencyProcesses; +using Microsoft.Extensions.Logging; +using Octokit; +using Volo.Abp.DependencyInjection; + +namespace GitHunter.Application.Git; + +[ProcessDependency] +public class GitManager : IGitManager, IDependencyProcess, ITransientDependency +{ + private ILogger _logger; + private static readonly GitHubClient Client = new(new ProductHeaderValue("GitHunter")); + + public GitManager(ILogger logger) + { + _logger = logger; + } + + private static void Initialize(Credentials? credentials = null) + { + if (credentials != null) + { + Client.Credentials = credentials; + } + } + + private async Task GetRepositories(GitInput input) + { + var request = new SearchRepositoriesRequest() + { + Language = input.Language, + Topic = input.Topic, + SortField = RepoSearchSort.Stars, + Page = input.Page, + PerPage = input.PerPage, + }; + var result = await Client.Search.SearchRepo(request); + return new GitOutput(result.Items, result.TotalCount, result.IncompleteResults); + } + + public void Initialize(string username, string password) + { + Initialize(new Credentials(username, password)); + } + + public void Initialize(string token) + { + Initialize(new Credentials(token)); + } +} + +public class GitInput +{ + public Language? Language { get; set; } + public string? Location { get; set; } + public string? User { get; set; } + public string? Repository { get; set; } + public string? Topic { get; set; } + public string? Keyword { get; set; } + public string? License { get; set; } + public string? Sort { get; set; } + public string? Order { get; set; } + public int Page { get; set; } + public int PerPage { get; set; } +} + +public class GitOutput +{ + public GitOutput(IReadOnlyList resultItems, int resultTotalCount, bool resultIncompleteResults) + { + Repositories = resultItems; + TotalCount = resultTotalCount; + IncompleteResults = resultIncompleteResults; + } + + public bool IncompleteResults { get; } + + public int TotalCount { get; } + + public IReadOnlyList Repositories { get; } + +} \ No newline at end of file diff --git a/src/GitHunter.Application/Git/GitProcessDependency.cs b/src/GitHunter.Application/Git/GitProcessDependency.cs new file mode 100644 index 0000000..0cc3fbe --- /dev/null +++ b/src/GitHunter.Application/Git/GitProcessDependency.cs @@ -0,0 +1,17 @@ +using GitHunter.Core.DependencyProcesses; + +namespace GitHunter.Application.Git; + +public class GitProcessDependency : IGitProcessDependency +{ + public bool Check() + { + var environmentVariable = Environment.GetEnvironmentVariable("PATH"); + var paths = environmentVariable?.Split(';'); + return paths != null && paths.Any(path => File.Exists(Path.Combine(path, "git.exe"))); + } +} + +public interface IGitProcessDependency : IProcessDependency +{ +} \ No newline at end of file diff --git a/src/GitHunter.Application/GitHunter.Application.csproj b/src/GitHunter.Application/GitHunter.Application.csproj index 41c161b..294c274 100644 --- a/src/GitHunter.Application/GitHunter.Application.csproj +++ b/src/GitHunter.Application/GitHunter.Application.csproj @@ -2,6 +2,7 @@ net7.0 + GitHunter.Application enable enable @@ -11,4 +12,8 @@ + + + + diff --git a/src/GitHunter.Core.Shared/CoreSharedModule.cs b/src/GitHunter.Core.Shared/CoreSharedModule.cs index 8f54850..107b561 100644 --- a/src/GitHunter.Core.Shared/CoreSharedModule.cs +++ b/src/GitHunter.Core.Shared/CoreSharedModule.cs @@ -1,13 +1,14 @@ -using Volo.Abp.Autofac; +using GitHunter.Core.Modules; +using Volo.Abp.Autofac; using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; -namespace GitHunter.Core.Shared; +namespace GitHunter.Core; [DependsOn( typeof(AbpAutofacModule), typeof(AbpAutoMapperModule) )] -public class CoreSharedModule : AbpModule +public class CoreSharedModule : GitHunterModule { } \ No newline at end of file diff --git a/src/GitHunter.Core.Shared/DependencyProcesses/IDependencyProcess.cs b/src/GitHunter.Core.Shared/DependencyProcesses/IDependencyProcess.cs new file mode 100644 index 0000000..fa6da85 --- /dev/null +++ b/src/GitHunter.Core.Shared/DependencyProcesses/IDependencyProcess.cs @@ -0,0 +1,5 @@ +namespace GitHunter.Core.DependencyProcesses; + +public interface IDependencyProcess +{ +} \ No newline at end of file diff --git a/src/GitHunter.Core.Shared/DependencyProcesses/IProcessDependency.cs b/src/GitHunter.Core.Shared/DependencyProcesses/IProcessDependency.cs new file mode 100644 index 0000000..30be6d3 --- /dev/null +++ b/src/GitHunter.Core.Shared/DependencyProcesses/IProcessDependency.cs @@ -0,0 +1,6 @@ +namespace GitHunter.Core.DependencyProcesses; + +public interface IProcessDependency +{ + bool Check(); +} \ No newline at end of file diff --git a/src/GitHunter.Core.Shared/DependencyProcesses/IProcessDependencyChecker.cs b/src/GitHunter.Core.Shared/DependencyProcesses/IProcessDependencyChecker.cs new file mode 100644 index 0000000..d579f4e --- /dev/null +++ b/src/GitHunter.Core.Shared/DependencyProcesses/IProcessDependencyChecker.cs @@ -0,0 +1,8 @@ +using System.Reflection; + +namespace GitHunter.Core.DependencyProcesses; + +public interface IProcessDependencyChecker +{ + bool CheckDependency(Assembly assembly); +} \ No newline at end of file diff --git a/src/GitHunter.Core.Shared/DependencyProcesses/ProcessDependencyAttribute.cs b/src/GitHunter.Core.Shared/DependencyProcesses/ProcessDependencyAttribute.cs new file mode 100644 index 0000000..8c1a86c --- /dev/null +++ b/src/GitHunter.Core.Shared/DependencyProcesses/ProcessDependencyAttribute.cs @@ -0,0 +1,16 @@ +namespace GitHunter.Core.DependencyProcesses; + + +public abstract class ProcessDependencyAttribute : Attribute +{ + public Type DependencyProcess { get; protected set; } +} + +[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] +public class ProcessDependencyAttribute : ProcessDependencyAttribute where T : IProcessDependency +{ + public ProcessDependencyAttribute() + { + DependencyProcess = typeof(T); + } +} \ No newline at end of file diff --git a/src/GitHunter.Core.Shared/GitHunter.Core.Shared.csproj b/src/GitHunter.Core.Shared/GitHunter.Core.Shared.csproj index 04fcf05..6f853c0 100644 --- a/src/GitHunter.Core.Shared/GitHunter.Core.Shared.csproj +++ b/src/GitHunter.Core.Shared/GitHunter.Core.Shared.csproj @@ -2,6 +2,7 @@ net7.0 + GitHunter.Core enable enable diff --git a/src/GitHunter.Core.Shared/Modules/GitHunterModule.cs b/src/GitHunter.Core.Shared/Modules/GitHunterModule.cs new file mode 100644 index 0000000..517f30c --- /dev/null +++ b/src/GitHunter.Core.Shared/Modules/GitHunterModule.cs @@ -0,0 +1,18 @@ +using System.Reflection; +using Volo.Abp.Modularity; + +namespace GitHunter.Core.Modules; + +public class GitHunterModule : AbpModule +{ + public static bool IsGitHunterModule(Type type) + { + var typeInfo = type.GetTypeInfo(); + + return + typeInfo.IsClass && + !typeInfo.IsAbstract && + !typeInfo.IsGenericType && + typeof(GitHunterModule).GetTypeInfo().IsAssignableFrom(type); + } +} \ No newline at end of file diff --git a/src/GitHunter.Core.Shared/Processes/IProcessManager.cs b/src/GitHunter.Core.Shared/Processes/IProcessManager.cs new file mode 100644 index 0000000..8eb416b --- /dev/null +++ b/src/GitHunter.Core.Shared/Processes/IProcessManager.cs @@ -0,0 +1,10 @@ +namespace GitHunter.Core.Processes; + +public interface IProcessManager +{ + Task RunAsync(string command, string arguments, string? workingDirectory = null); + + Task RunAsync(ProcessStartInfo processStartInfo); + + Task KillAllProcessesAsync(); +} \ No newline at end of file diff --git a/src/GitHunter.Core.Shared/Processes/ProcessResult.cs b/src/GitHunter.Core.Shared/Processes/ProcessResult.cs new file mode 100644 index 0000000..cdbb542 --- /dev/null +++ b/src/GitHunter.Core.Shared/Processes/ProcessResult.cs @@ -0,0 +1,8 @@ +namespace GitHunter.Core.Processes; + +public class ProcessResult +{ + public int ExitCode { get; set; } + public string? Output { get; set; } + public string? Error { get; set; } +} \ No newline at end of file diff --git a/src/GitHunter.Core.Shared/Processes/ProcessStartInfo.cs b/src/GitHunter.Core.Shared/Processes/ProcessStartInfo.cs new file mode 100644 index 0000000..16223e2 --- /dev/null +++ b/src/GitHunter.Core.Shared/Processes/ProcessStartInfo.cs @@ -0,0 +1,22 @@ +namespace GitHunter.Core.Processes; + +public class ProcessStartInfo +{ + public ProcessStartInfo(string command, string arguments, string? workingDirectory = null, Action? exited = null, + Action? outputDataReceived = null, Action? errorDataReceived = null) + { + Command = command; + Arguments = arguments; + Exited = exited; + WorkingDirectory = workingDirectory; + OutputDataReceived = outputDataReceived; + ErrorDataReceived = errorDataReceived; + } + + public string Command { get; private set; } + public string Arguments { get; private set; } + public string? WorkingDirectory { get; private set; } + public Action? OutputDataReceived { get; private set; } + public Action? ErrorDataReceived { get; private set; } + public Action? Exited { get; private set; } +} \ No newline at end of file diff --git a/src/GitHunter.Core/CoreModule.cs b/src/GitHunter.Core/CoreModule.cs index e70978b..1d6b2c6 100644 --- a/src/GitHunter.Core/CoreModule.cs +++ b/src/GitHunter.Core/CoreModule.cs @@ -1,9 +1,33 @@ -using GitHunter.Core.Shared; +using GitHunter.Core.DependencyProcesses; +using GitHunter.Core.Modules; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using Volo.Abp; using Volo.Abp.Modularity; namespace GitHunter.Core; [DependsOn(typeof(CoreSharedModule))] -public class CoreModule : AbpModule +public class CoreModule : GitHunterModule { + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + + using (var scope = context.ServiceProvider.CreateScope()) + { + var processDependencyChecker = scope.ServiceProvider.GetRequiredService(); + var processDependencyOptions = scope.ServiceProvider.GetRequiredService>().Value; + var modules = ModuleHelper.FindGitHunterModuleTypes(processDependencyOptions.StartupModule); + + foreach (var assembly in modules.Select(m=>m.Assembly)) + { + if (!processDependencyChecker.CheckDependency(assembly)) + { + processDependencyOptions.ErrorAction?.Invoke(); + } + } + } + + base.OnApplicationInitialization(context); + } } \ No newline at end of file diff --git a/src/GitHunter.Core/DependencyProcesses/ProcessDependencyChecker.cs b/src/GitHunter.Core/DependencyProcesses/ProcessDependencyChecker.cs new file mode 100644 index 0000000..24ca04b --- /dev/null +++ b/src/GitHunter.Core/DependencyProcesses/ProcessDependencyChecker.cs @@ -0,0 +1,24 @@ +using System.Reflection; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.DependencyInjection; + +namespace GitHunter.Core.DependencyProcesses; + +public class ProcessDependencyChecker : IProcessDependencyChecker, ISingletonDependency +{ + private readonly IServiceProvider _serviceProvider; + + public ProcessDependencyChecker(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + } + + public bool CheckDependency(Assembly assembly) + { + var dependenciesTypes = assembly.GetTypes().Where(t => typeof(IDependencyProcess).IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract).ToList(); + var dependenciesAttributes = dependenciesTypes.SelectMany(t => t.GetCustomAttributes(typeof(ProcessDependencyAttribute<>))).ToList(); + var dependencies = dependenciesAttributes.Cast().Select(t=>(IProcessDependency)ActivatorUtilities.CreateInstance(_serviceProvider, t.DependencyProcess)).ToList(); + + return dependencies.All(d => d.Check()); + } +} \ No newline at end of file diff --git a/src/GitHunter.Core/DependencyProcesses/ProcessDependencyOptions.cs b/src/GitHunter.Core/DependencyProcesses/ProcessDependencyOptions.cs new file mode 100644 index 0000000..105882d --- /dev/null +++ b/src/GitHunter.Core/DependencyProcesses/ProcessDependencyOptions.cs @@ -0,0 +1,8 @@ +namespace GitHunter.Core.DependencyProcesses; + +public class ProcessDependencyOptions +{ + public Type StartupModule { get; set; } + + public Action ErrorAction { get; set; } +} \ No newline at end of file diff --git a/src/GitHunter.Core/GitHunter.Core.csproj b/src/GitHunter.Core/GitHunter.Core.csproj index 055ade0..d5dc8ff 100644 --- a/src/GitHunter.Core/GitHunter.Core.csproj +++ b/src/GitHunter.Core/GitHunter.Core.csproj @@ -2,6 +2,7 @@ net7.0 + GitHunter.Core enable enable diff --git a/src/GitHunter.Core/Modules/ModuleHelper.cs b/src/GitHunter.Core/Modules/ModuleHelper.cs new file mode 100644 index 0000000..2b2a77b --- /dev/null +++ b/src/GitHunter.Core/Modules/ModuleHelper.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using Volo.Abp.Modularity; + +namespace GitHunter.Core.Modules; + +internal static class ModuleHelper +{ + public static IEnumerable FindGitHunterModuleTypes(Type startupModuleType) + { + if(!GitHunterModule.IsGitHunterModule(startupModuleType)) + { + throw new ArgumentException("Given type is not an GitHunter module: " + startupModuleType.AssemblyQualifiedName); + } + var moduleTypes = new List(); + AddModuleAndDependenciesRecursively(moduleTypes, startupModuleType); + return moduleTypes; + } + + private static List FindDependedModuleTypes(ICustomAttributeProvider moduleType) + { + var dependencies = new List(); + + var dependencyDescriptors = moduleType + .GetCustomAttributes(false) + .OfType(); + + foreach (var descriptor in dependencyDescriptors) + { + foreach (var dependedModuleType in descriptor.GetDependedTypes()) + { + dependencies.AddIfNotContains(dependedModuleType); + } + } + + return dependencies; + } + + private static void AddModuleAndDependenciesRecursively( + ICollection moduleTypes, + Type moduleType) + { + if(!GitHunterModule.IsGitHunterModule(moduleType)) + return; + + if (moduleTypes.Contains(moduleType)) + { + return; + } + + + moduleTypes.Add(moduleType); + + foreach (var dependedModuleType in FindDependedModuleTypes(moduleType)) + { + AddModuleAndDependenciesRecursively(moduleTypes, dependedModuleType); + } + } +} \ No newline at end of file diff --git a/src/GitHunter.Core/Processes/ProcessManager.cs b/src/GitHunter.Core/Processes/ProcessManager.cs new file mode 100644 index 0000000..00598a5 --- /dev/null +++ b/src/GitHunter.Core/Processes/ProcessManager.cs @@ -0,0 +1,95 @@ +using Volo.Abp.DependencyInjection; + +namespace GitHunter.Core.Processes; + +public class ProcessManager : IProcessManager, IScopedDependency +{ + private readonly List _processes = new(); + + private bool _killAllProcessesRequested; + + public Task RunAsync(string command, string arguments, string? workingDirectory = null) => + RunAsync(new ProcessStartInfo(command, arguments, workingDirectory)); + + + public Task RunAsync(ProcessStartInfo processStartInfo) + { + if (_killAllProcessesRequested) + { + throw new InvalidOperationException( + "Cannot run a new process after KillAllProcessesAsync() has been called."); + } + + var process = CreateProcess(processStartInfo); + + var tcs = new TaskCompletionSource(); + + string? output = null; + string? error = null; + + process.ErrorDataReceived += (sender, args) => + { + if (args.Data == null) return; + error += args.Data + Environment.NewLine; + processStartInfo.ErrorDataReceived?.Invoke(args.Data); + }; + + process.OutputDataReceived += (sender, args) => + { + if (args.Data == null) return; + output += args.Data + Environment.NewLine; + processStartInfo.OutputDataReceived?.Invoke(args.Data); + }; + + process.Exited += (sender, args) => + { + processStartInfo.Exited?.Invoke(); + var result = new ProcessResult + { + ExitCode = process.ExitCode, + Output = output, + Error = error + }; + + tcs.SetResult(result); + }; + + process.BeginOutputReadLine(); + process.BeginErrorReadLine(); + + process.Start(); + + _processes.Add(process); + + return tcs.Task; + } + + private System.Diagnostics.Process CreateProcess(ProcessStartInfo processStartInfo) + { + return new System.Diagnostics.Process + { + StartInfo = + { + Arguments = processStartInfo.Arguments, + FileName = processStartInfo.Command, + WorkingDirectory = processStartInfo.WorkingDirectory ?? Directory.GetCurrentDirectory(), + UseShellExecute = false, + RedirectStandardOutput = true, + RedirectStandardError = true, + CreateNoWindow = true + }, + EnableRaisingEvents = true + }; + } + + public Task KillAllProcessesAsync() + { + _killAllProcessesRequested = true; + foreach (var process in _processes.Where(process => !process.HasExited)) + { + process.Kill(); + } + + return Task.FromResult(true); + } +} \ No newline at end of file diff --git a/src/GitHunter.Core/Tasks/TaskManager.cs b/src/GitHunter.Core/Tasks/TaskManager.cs new file mode 100644 index 0000000..792b7b2 --- /dev/null +++ b/src/GitHunter.Core/Tasks/TaskManager.cs @@ -0,0 +1,19 @@ +namespace GitHunter.Core.Tasks; + +public class TaskManager +{ + private readonly Dictionary> _tasks = new(); + + public Task RunTask(List tasks, Func? exceptionHandler = null) + { + _tasks.Add(Guid.NewGuid(), tasks); + return Task.WhenAll(tasks).ContinueWith(t => + { + if (!t.IsFaulted) return; + if (exceptionHandler == null || !t.Exception!.InnerExceptions.Any(exceptionHandler)) + { + throw t.Exception!; + } + }); + } +} \ No newline at end of file diff --git a/src/GitHunter.Desktop.Shared/DesktopSharedModule.cs b/src/GitHunter.Desktop.Shared/DesktopSharedModule.cs index 2006b20..4b9dd7a 100644 --- a/src/GitHunter.Desktop.Shared/DesktopSharedModule.cs +++ b/src/GitHunter.Desktop.Shared/DesktopSharedModule.cs @@ -1,9 +1,10 @@ -using GitHunter.Application.Shared; +using GitHunter.Application; +using GitHunter.Core.Modules; using Volo.Abp.Modularity; -namespace GitHunter.Desktop.Shared; +namespace GitHunter.Desktop; [DependsOn(typeof(ApplicationSharedModule))] -public class DesktopSharedModule : AbpModule +public class DesktopSharedModule : GitHunterModule { } \ No newline at end of file diff --git a/src/GitHunter.Desktop.Shared/GitHunter.Desktop.Shared.csproj b/src/GitHunter.Desktop.Shared/GitHunter.Desktop.Shared.csproj index d239365..f0ac62d 100644 --- a/src/GitHunter.Desktop.Shared/GitHunter.Desktop.Shared.csproj +++ b/src/GitHunter.Desktop.Shared/GitHunter.Desktop.Shared.csproj @@ -2,6 +2,7 @@ net7.0 + GitHunter.Desktop enable enable diff --git a/src/GitHunter.Desktop.WindowsForm/DesktopWindowsFormModule.cs b/src/GitHunter.Desktop.WindowsForm/DesktopWindowsFormModule.cs index cddcabd..844ced6 100644 --- a/src/GitHunter.Desktop.WindowsForm/DesktopWindowsFormModule.cs +++ b/src/GitHunter.Desktop.WindowsForm/DesktopWindowsFormModule.cs @@ -1,11 +1,33 @@ using GitHunter.Application; -using GitHunter.Desktop.Shared; +using GitHunter.Core.DependencyProcesses; +using GitHunter.Core.Modules; using Volo.Abp.Modularity; -namespace GitHunter.Desktop.WindowsForm; +namespace GitHunter.Desktop; [DependsOn(typeof(DesktopSharedModule), typeof(ApplicationModule))] -public class DesktopWindowsFormModule : AbpModule +public class DesktopWindowsFormModule : GitHunterModule { + + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(o=> + { + o.StartupModule = typeof(DesktopWindowsFormModule); + o.ErrorAction = () => + { + MessageBox.Show("Error"); + }; + }); + + base.ConfigureServices(context); + } + + public override void PreConfigureServices(ServiceConfigurationContext context) + { + Configure(o=>o.StartupModule = typeof(DesktopWindowsFormModule)); + + base.PreConfigureServices(context); + } } \ No newline at end of file diff --git a/src/GitHunter.Desktop.WindowsForm/GitHunter.Desktop.WindowsForm.csproj b/src/GitHunter.Desktop.WindowsForm/GitHunter.Desktop.WindowsForm.csproj index 68a02bd..8be2b17 100644 --- a/src/GitHunter.Desktop.WindowsForm/GitHunter.Desktop.WindowsForm.csproj +++ b/src/GitHunter.Desktop.WindowsForm/GitHunter.Desktop.WindowsForm.csproj @@ -3,6 +3,7 @@ WinExe net7.0-windows + GitHunter.Desktop enable true enable diff --git a/src/GitHunter.Desktop.WindowsForm/MainForm.Designer.cs b/src/GitHunter.Desktop.WindowsForm/MainForm.Designer.cs index 803e7f3..b08c29a 100644 --- a/src/GitHunter.Desktop.WindowsForm/MainForm.Designer.cs +++ b/src/GitHunter.Desktop.WindowsForm/MainForm.Designer.cs @@ -1,4 +1,4 @@ -namespace GitHunter.Desktop.WindowsForm; +namespace GitHunter.Desktop; partial class MainForm { diff --git a/src/GitHunter.Desktop.WindowsForm/MainForm.cs b/src/GitHunter.Desktop.WindowsForm/MainForm.cs index 678e8f3..7c40583 100644 --- a/src/GitHunter.Desktop.WindowsForm/MainForm.cs +++ b/src/GitHunter.Desktop.WindowsForm/MainForm.cs @@ -1,11 +1,14 @@ +using GitHunter.Application.Git; using Volo.Abp.DependencyInjection; -namespace GitHunter.Desktop.WindowsForm; +namespace GitHunter.Desktop; public partial class MainForm : Form, ISingletonDependency { - public MainForm() + private readonly IGitManager _githubManager; + public MainForm(IGitManager githubManager) { + _githubManager = githubManager; InitializeComponent(); } } \ No newline at end of file diff --git a/src/GitHunter.Desktop.WindowsForm/Program.cs b/src/GitHunter.Desktop.WindowsForm/Program.cs index ca82684..4a3cda1 100644 --- a/src/GitHunter.Desktop.WindowsForm/Program.cs +++ b/src/GitHunter.Desktop.WindowsForm/Program.cs @@ -3,7 +3,7 @@ using Serilog.Events; using Volo.Abp; -namespace GitHunter.Desktop.WindowsForm; +namespace GitHunter.Desktop; public class Program {