mirror of
https://github.com/FalloutCollaborationProject/FCP-Mod-Updater.git
synced 2026-07-27 17:04:05 -07:00
Version 1.0
This commit is contained in:
+481
@@ -0,0 +1,481 @@
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/rider,csharp
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=rider,csharp
|
||||
|
||||
### Csharp ###
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.tlog
|
||||
*.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
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# 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
|
||||
# Note: 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
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable 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
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# 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
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# 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
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
|
||||
*.vbp
|
||||
|
||||
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
||||
*.dsw
|
||||
*.dsp
|
||||
|
||||
# Visual Studio 6 technical files
|
||||
|
||||
# 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/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# Visual Studio History (VSHistory) files
|
||||
.vshistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
|
||||
# VS Code files for those working on multiple tools
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Windows Installer files from build outputs
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
|
||||
### Rider ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# AWS User-specific
|
||||
.idea/**/aws.xml
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# SonarLint plugin
|
||||
.idea/sonarlint/
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/rider,csharp
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
/projectSettingsUpdater.xml
|
||||
/modules.xml
|
||||
/.idea.FCPModUpdater.iml
|
||||
/contentModel.xml
|
||||
# Ignored default folder with query files
|
||||
/queries/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||
</project>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,93 @@
|
||||
using FCPModUpdater.Commands.Settings;
|
||||
using FCPModUpdater.Services;
|
||||
using FCPModUpdater.UI;
|
||||
using Spectre.Console;
|
||||
using Spectre.Console.Cli;
|
||||
|
||||
namespace FCPModUpdater.Commands;
|
||||
|
||||
public class ScanCommand : AsyncCommand<ModPathSettings>
|
||||
{
|
||||
public override async Task<int> ExecuteAsync(CommandContext context, ModPathSettings settings,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Resolve mods directory
|
||||
var modsDirectory = ResolveModsDirectory(settings);
|
||||
if (modsDirectory == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
AnsiConsole.MarkupLine($"[grey]Using mods directory: {modsDirectory}[/]");
|
||||
AnsiConsole.WriteLine();
|
||||
|
||||
// Check for git
|
||||
var gitService = new GitService();
|
||||
if (!await gitService.IsGitInstalledAsync(cancellationToken))
|
||||
{
|
||||
AnsiConsole.MarkupLine("[yellow]Warning: Git is not installed or not in PATH.[/]");
|
||||
AnsiConsole.MarkupLine("[yellow]Git-based features will be limited.[/]");
|
||||
AnsiConsole.MarkupLine("[grey]Install git from: https://git-scm.com/downloads[/]");
|
||||
AnsiConsole.WriteLine();
|
||||
}
|
||||
|
||||
// Initialize services
|
||||
var gitHubApiService = new GitHubApiService();
|
||||
var modDiscoveryService = new ModDiscoveryService(gitService, gitHubApiService);
|
||||
|
||||
// Run interactive menu
|
||||
var menu = new InteractiveMenu(
|
||||
gitService,
|
||||
gitHubApiService,
|
||||
modDiscoveryService,
|
||||
modsDirectory);
|
||||
|
||||
await menu.RunAsync(cancellationToken);
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
AnsiConsole.MarkupLine("[grey]Operation cancelled.[/]");
|
||||
return 1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AnsiConsole.WriteException(ex);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
private static string? ResolveModsDirectory(ModPathSettings settings)
|
||||
{
|
||||
if (settings.ModDirectory != null)
|
||||
{
|
||||
return settings.ModDirectory.FullName;
|
||||
}
|
||||
|
||||
// Auto-discover
|
||||
var pathDiscovery = new PathDiscoveryService();
|
||||
var paths = pathDiscovery.DiscoverModPaths();
|
||||
|
||||
if (paths.Count == 0)
|
||||
{
|
||||
AnsiConsole.MarkupLine("[red]Error: Could not find RimWorld Mods folder.[/]");
|
||||
AnsiConsole.MarkupLine("[grey]Please specify the path using --directory[/]");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (paths.Count == 1)
|
||||
{
|
||||
return paths[0];
|
||||
}
|
||||
|
||||
// Multiple paths found - let user choose
|
||||
return AnsiConsole.Prompt(
|
||||
new SelectionPrompt<string>()
|
||||
.Title("[bold]Multiple RimWorld installations found. Select one:[/]")
|
||||
.PageSize(10)
|
||||
.AddChoices(paths));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.ComponentModel;
|
||||
using JetBrains.Annotations;
|
||||
using Spectre.Console;
|
||||
using Spectre.Console.Cli;
|
||||
|
||||
namespace FCPModUpdater.Commands.Settings;
|
||||
|
||||
[UsedImplicitly]
|
||||
public class ModPathSettings : CommandSettings
|
||||
{
|
||||
[CommandOption("-d|--directory")]
|
||||
[Description("Path to the RimWorld/Mods folder. If not specified, will attempt to auto-discover.")]
|
||||
public DirectoryInfo? ModDirectory { get; init; }
|
||||
|
||||
public override ValidationResult Validate()
|
||||
{
|
||||
if (ModDirectory != null && !ModDirectory.Exists)
|
||||
{
|
||||
return ValidationResult.Error($"Directory does not exist: {ModDirectory.FullName}");
|
||||
}
|
||||
|
||||
return ValidationResult.Success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
using FCPModUpdater.Commands.Settings;
|
||||
using FCPModUpdater.Models;
|
||||
using FCPModUpdater.Services;
|
||||
using FCPModUpdater.UI;
|
||||
using Spectre.Console;
|
||||
using Spectre.Console.Cli;
|
||||
|
||||
namespace FCPModUpdater.Commands;
|
||||
|
||||
public class UpdateCommand : AsyncCommand<ModPathSettings>
|
||||
{
|
||||
public override async Task<int> ExecuteAsync(CommandContext context, ModPathSettings settings,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Resolve mods directory
|
||||
var modsDirectory = ResolveModsDirectory(settings);
|
||||
if (modsDirectory == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
AnsiConsole.MarkupLine($"[grey]Using mods directory: {modsDirectory}[/]");
|
||||
AnsiConsole.WriteLine();
|
||||
|
||||
// Check for git
|
||||
var gitService = new GitService();
|
||||
if (!await gitService.IsGitInstalledAsync(cancellationToken))
|
||||
{
|
||||
AnsiConsole.MarkupLine("[red]Error: Git is not installed or not in PATH.[/]");
|
||||
AnsiConsole.MarkupLine("[grey]Install git from: https://git-scm.com/downloads[/]");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Initialize services
|
||||
var gitHubApiService = new GitHubApiService();
|
||||
var modDiscoveryService = new ModDiscoveryService(gitService, gitHubApiService);
|
||||
|
||||
// Discover mods
|
||||
var mods = await ProgressReporter.WithStatusAsync(
|
||||
"Scanning mods directory...",
|
||||
async () => await modDiscoveryService.DiscoverModsAsync(modsDirectory, ct: cancellationToken));
|
||||
|
||||
// Find updateable mods
|
||||
var updateableMods = mods
|
||||
.Where(m => m.Source == ModSource.Git && m.Status == ModStatus.Behind)
|
||||
.ToList();
|
||||
|
||||
if (updateableMods.Count == 0)
|
||||
{
|
||||
AnsiConsole.MarkupLine("[green]All FCP mods are up to date![/]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
AnsiConsole.MarkupLine($"[yellow]Found {updateableMods.Count} mod(s) with updates available:[/]");
|
||||
foreach (var mod in updateableMods)
|
||||
{
|
||||
AnsiConsole.MarkupLine($" • {mod.Name} [grey]({mod.CommitsBehind} commits behind)[/]");
|
||||
}
|
||||
|
||||
AnsiConsole.WriteLine();
|
||||
|
||||
// Update all
|
||||
var results = await ProgressReporter.WithBatchProgressAsync(
|
||||
"Updating mods",
|
||||
updateableMods,
|
||||
m => m.Name,
|
||||
async (mod, progress) =>
|
||||
{
|
||||
progress.Report(25);
|
||||
var fetchOk = await gitService.FetchAsync(mod.Path, ct: cancellationToken);
|
||||
if (!fetchOk)
|
||||
return (false, "Fetch failed");
|
||||
|
||||
progress.Report(50);
|
||||
var pullOk = await gitService.PullAsync(mod.Path, ct: cancellationToken);
|
||||
progress.Report(100);
|
||||
|
||||
return (pullOk, pullOk ? null : "Pull failed");
|
||||
});
|
||||
|
||||
ModTableRenderer.RenderUpdateSummary(results);
|
||||
|
||||
var failCount = results.Count(r => !r.Success);
|
||||
return failCount > 0 ? 1 : 0;
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
AnsiConsole.MarkupLine("[grey]Operation cancelled.[/]");
|
||||
return 1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AnsiConsole.WriteException(ex);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
private static string? ResolveModsDirectory(ModPathSettings settings)
|
||||
{
|
||||
if (settings.ModDirectory != null)
|
||||
{
|
||||
return settings.ModDirectory.FullName;
|
||||
}
|
||||
|
||||
// Auto-discover
|
||||
var pathDiscovery = new PathDiscoveryService();
|
||||
var paths = pathDiscovery.DiscoverModPaths();
|
||||
|
||||
if (paths.Count == 0)
|
||||
{
|
||||
AnsiConsole.MarkupLine("[red]Error: Could not find RimWorld Mods folder.[/]");
|
||||
AnsiConsole.MarkupLine("[grey]Please specify the path using --directory[/]");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (paths.Count == 1)
|
||||
{
|
||||
return paths[0];
|
||||
}
|
||||
|
||||
// Multiple paths found - use first one for non-interactive mode
|
||||
AnsiConsole.MarkupLine($"[yellow]Multiple installations found, using: {paths[0]}[/]");
|
||||
AnsiConsole.MarkupLine("[grey]Use --directory to specify a different path[/]");
|
||||
return paths[0];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2025.2.4" />
|
||||
<PackageReference Include="Spectre.Console" Version="0.54.0" />
|
||||
<PackageReference Include="Spectre.Console.Cli" Version="0.53.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,3 @@
|
||||
<Solution>
|
||||
<Project Path="FCPModUpdater.csproj" />
|
||||
</Solution>
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace FCPModUpdater.Models;
|
||||
|
||||
public record GitCommitInfo(
|
||||
string Hash,
|
||||
string ShortHash,
|
||||
string Message,
|
||||
string Author,
|
||||
DateTimeOffset Date
|
||||
);
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace FCPModUpdater.Models;
|
||||
|
||||
public record InstalledMod
|
||||
{
|
||||
public required string Name { get; init; }
|
||||
public required string Path { get; init; }
|
||||
public required ModSource Source { get; init; }
|
||||
public string? RemoteUrl { get; init; }
|
||||
public string? Branch { get; init; }
|
||||
public GitCommitInfo? CurrentCommit { get; init; }
|
||||
public ModStatus Status { get; init; }
|
||||
public int CommitsBehind { get; init; }
|
||||
public int CommitsAhead { get; init; }
|
||||
public string? MatchedRepoName { get; init; }
|
||||
public string? ErrorMessage { get; init; }
|
||||
public bool HasLocalChanges { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace FCPModUpdater.Models;
|
||||
|
||||
public enum ModStatus
|
||||
{
|
||||
UpToDate,
|
||||
Behind,
|
||||
Ahead,
|
||||
Diverged,
|
||||
LocalChanges,
|
||||
NonGit,
|
||||
Error,
|
||||
Unknown
|
||||
}
|
||||
|
||||
public enum ModSource
|
||||
{
|
||||
Git,
|
||||
Local,
|
||||
Workshop
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace FCPModUpdater.Models;
|
||||
|
||||
public record RemoteRepo(
|
||||
[property: JsonPropertyName("name")] string Name,
|
||||
[property: JsonPropertyName("clone_url")] string CloneUrl,
|
||||
[property: JsonPropertyName("ssh_url")] string SshUrl,
|
||||
[property: JsonPropertyName("default_branch")] string DefaultBranch,
|
||||
[property: JsonPropertyName("description")] string? Description,
|
||||
[property: JsonPropertyName("html_url")] string HtmlUrl
|
||||
);
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
using FCPModUpdater.Commands;
|
||||
using Spectre.Console.Cli;
|
||||
|
||||
var app = new CommandApp();
|
||||
|
||||
app.Configure(config =>
|
||||
{
|
||||
config.SetApplicationName("fcp-mod-manager");
|
||||
config.SetApplicationVersion("1.0.0");
|
||||
|
||||
config.AddCommand<ScanCommand>("scan")
|
||||
.WithDescription("Scan mods and show interactive menu")
|
||||
.WithExample("scan")
|
||||
.WithExample("scan", "--directory", "/path/to/RimWorld/Mods");
|
||||
|
||||
config.AddCommand<UpdateCommand>("update")
|
||||
.WithDescription("Update all FCP mods (non-interactive)")
|
||||
.WithExample("update")
|
||||
.WithExample("update", "--directory", "/path/to/RimWorld/Mods");
|
||||
});
|
||||
|
||||
return await app.RunAsync(args);
|
||||
@@ -0,0 +1,123 @@
|
||||
using System.Net.Http.Json;
|
||||
using FCPModUpdater.Models;
|
||||
|
||||
namespace FCPModUpdater.Services;
|
||||
|
||||
public class GitHubApiService : IGitHubApiService, IDisposable
|
||||
{
|
||||
private const string OrgName = "FalloutCollaborationProject";
|
||||
private const string BaseUrl = "https://api.github.com";
|
||||
|
||||
private readonly HttpClient _httpClient;
|
||||
private readonly TimeSpan _cacheExpiry = TimeSpan.FromHours(1);
|
||||
|
||||
private IReadOnlyList<RemoteRepo>? _cachedRepos;
|
||||
private DateTimeOffset _cacheTime = DateTimeOffset.MinValue;
|
||||
|
||||
public int? RemainingRateLimit { get; private set; }
|
||||
public DateTimeOffset? RateLimitReset { get; private set; }
|
||||
|
||||
public GitHubApiService(HttpClient? httpClient = null)
|
||||
{
|
||||
_httpClient = httpClient ?? new HttpClient();
|
||||
_httpClient.DefaultRequestHeaders.UserAgent.ParseAdd("FCPModUpdater/1.0");
|
||||
_httpClient.DefaultRequestHeaders.Accept.ParseAdd("application/vnd.github+json");
|
||||
|
||||
var token = Environment.GetEnvironmentVariable("GITHUB_TOKEN");
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
{
|
||||
_httpClient.DefaultRequestHeaders.Authorization =
|
||||
new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyList<RemoteRepo>> GetOrganizationReposAsync(CancellationToken ct = default)
|
||||
{
|
||||
if (_cachedRepos != null && DateTimeOffset.UtcNow - _cacheTime < _cacheExpiry)
|
||||
{
|
||||
return _cachedRepos;
|
||||
}
|
||||
|
||||
var allRepos = new List<RemoteRepo>();
|
||||
var page = 1;
|
||||
const int perPage = 100;
|
||||
|
||||
while (true)
|
||||
{
|
||||
var url = $"{BaseUrl}/orgs/{OrgName}/repos?per_page={perPage}&page={page}";
|
||||
|
||||
try
|
||||
{
|
||||
HttpResponseMessage response = await _httpClient.GetAsync(url, ct);
|
||||
UpdateRateLimitInfo(response);
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.Forbidden && RemainingRateLimit == 0)
|
||||
{
|
||||
// Rate limited - return cached data if available
|
||||
if (_cachedRepos != null)
|
||||
return _cachedRepos;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
var repos = await response.Content.ReadFromJsonAsync<List<RemoteRepo>>(ct);
|
||||
if (repos == null || repos.Count == 0)
|
||||
break;
|
||||
|
||||
allRepos.AddRange(repos);
|
||||
|
||||
if (repos.Count < perPage)
|
||||
break;
|
||||
|
||||
page++;
|
||||
}
|
||||
catch (HttpRequestException)
|
||||
{
|
||||
// Network error - return cached data if available
|
||||
if (_cachedRepos != null)
|
||||
return _cachedRepos;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (allRepos.Count > 0)
|
||||
{
|
||||
_cachedRepos = allRepos;
|
||||
_cacheTime = DateTimeOffset.UtcNow;
|
||||
}
|
||||
|
||||
return _cachedRepos ?? [];
|
||||
}
|
||||
|
||||
public async Task<RemoteRepo?> GetRepoByNameAsync(string repoName, CancellationToken ct = default)
|
||||
{
|
||||
var repos = await GetOrganizationReposAsync(ct);
|
||||
return repos.FirstOrDefault(r =>
|
||||
r.Name.Equals(repoName, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
private void UpdateRateLimitInfo(HttpResponseMessage response)
|
||||
{
|
||||
if (response.Headers.TryGetValues("X-RateLimit-Remaining", out var remaining))
|
||||
{
|
||||
if (int.TryParse(remaining.FirstOrDefault(), out var value))
|
||||
RemainingRateLimit = value;
|
||||
}
|
||||
|
||||
if (response.Headers.TryGetValues("X-RateLimit-Reset", out var reset))
|
||||
{
|
||||
if (long.TryParse(reset.FirstOrDefault(), out var timestamp))
|
||||
RateLimitReset = DateTimeOffset.FromUnixTimeSeconds(timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_httpClient.Dispose();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using FCPModUpdater.Models;
|
||||
|
||||
namespace FCPModUpdater.Services;
|
||||
|
||||
public class GitService : IGitService
|
||||
{
|
||||
private bool? _gitInstalled;
|
||||
|
||||
public async Task<bool> IsGitInstalledAsync(CancellationToken ct = default)
|
||||
{
|
||||
if (_gitInstalled.HasValue)
|
||||
return _gitInstalled.Value;
|
||||
|
||||
var (exitCode, _, _) = await RunGitCommandAsync(".", "--version", ct);
|
||||
_gitInstalled = exitCode == 0;
|
||||
return _gitInstalled.Value;
|
||||
}
|
||||
|
||||
public async Task<bool> IsGitRepositoryAsync(string path, CancellationToken ct = default)
|
||||
{
|
||||
var (exitCode, _, _) = await RunGitCommandAsync(path, "rev-parse --is-inside-work-tree", ct);
|
||||
return exitCode == 0;
|
||||
}
|
||||
|
||||
public async Task<string?> GetRemoteUrlAsync(string path, CancellationToken ct = default)
|
||||
{
|
||||
var (exitCode, output, _) = await RunGitCommandAsync(path, "remote get-url origin", ct);
|
||||
return exitCode == 0 ? output.Trim() : null;
|
||||
}
|
||||
|
||||
public async Task<GitCommitInfo?> GetCurrentCommitAsync(string path, CancellationToken ct = default)
|
||||
{
|
||||
var format = "%H%n%h%n%s%n%an%n%aI";
|
||||
var (exitCode, output, _) = await RunGitCommandAsync(path, $"log -1 --format=\"{format}\"", ct);
|
||||
|
||||
if (exitCode != 0)
|
||||
return null;
|
||||
|
||||
var lines = output.Split('\n', StringSplitOptions.RemoveEmptyEntries);
|
||||
if (lines.Length < 5)
|
||||
return null;
|
||||
|
||||
return new GitCommitInfo(
|
||||
Hash: lines[0].Trim(),
|
||||
ShortHash: lines[1].Trim(),
|
||||
Message: lines[2].Trim(),
|
||||
Author: lines[3].Trim(),
|
||||
Date: DateTimeOffset.Parse(lines[4].Trim())
|
||||
);
|
||||
}
|
||||
|
||||
public async Task<string?> GetCurrentBranchAsync(string path, CancellationToken ct = default)
|
||||
{
|
||||
var (exitCode, output, _) = await RunGitCommandAsync(path, "rev-parse --abbrev-ref HEAD", ct);
|
||||
if (exitCode != 0)
|
||||
return null;
|
||||
|
||||
var branch = output.Trim();
|
||||
return branch == "HEAD" ? null : branch; // Detached HEAD
|
||||
}
|
||||
|
||||
public async Task<(int Behind, int Ahead)> GetCommitDifferenceAsync(string path, CancellationToken ct = default)
|
||||
{
|
||||
var branch = await GetCurrentBranchAsync(path, ct);
|
||||
if (branch == null)
|
||||
return (0, 0);
|
||||
|
||||
var (exitCode, output, _) = await RunGitCommandAsync(path,
|
||||
$"rev-list --left-right --count origin/{branch}...HEAD", ct);
|
||||
|
||||
if (exitCode != 0)
|
||||
return (0, 0);
|
||||
|
||||
var parts = output.Trim().Split('\t');
|
||||
if (parts.Length != 2)
|
||||
return (0, 0);
|
||||
|
||||
int.TryParse(parts[0], out var behind);
|
||||
int.TryParse(parts[1], out var ahead);
|
||||
|
||||
return (behind, ahead);
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyList<GitCommitInfo>> GetIncomingCommitsAsync(string path, int limit = 10,
|
||||
CancellationToken ct = default)
|
||||
{
|
||||
var branch = await GetCurrentBranchAsync(path, ct);
|
||||
if (branch == null)
|
||||
return [];
|
||||
|
||||
var format = "%H%n%h%n%s%n%an%n%aI%n---";
|
||||
var (exitCode, output, _) = await RunGitCommandAsync(path,
|
||||
$"log HEAD..origin/{branch} --format=\"{format}\" -n {limit}", ct);
|
||||
|
||||
if (exitCode != 0)
|
||||
return [];
|
||||
|
||||
return ParseCommitLog(output);
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyList<GitCommitInfo>> GetCommitHistoryAsync(string path, int limit = 20,
|
||||
CancellationToken ct = default)
|
||||
{
|
||||
var format = "%H%n%h%n%s%n%an%n%aI%n---";
|
||||
var (exitCode, output, _) = await RunGitCommandAsync(path,
|
||||
$"log --format=\"{format}\" -n {limit}", ct);
|
||||
|
||||
if (exitCode != 0)
|
||||
return [];
|
||||
|
||||
return ParseCommitLog(output);
|
||||
}
|
||||
|
||||
public async Task<bool> FetchAsync(string path, IProgress<string>? progress = null,
|
||||
CancellationToken ct = default)
|
||||
{
|
||||
progress?.Report("Fetching from remote...");
|
||||
var (exitCode, _, error) = await RunGitCommandAsync(path, "fetch --all --prune", ct);
|
||||
|
||||
if (exitCode != 0)
|
||||
progress?.Report($"Fetch failed: {error}");
|
||||
|
||||
return exitCode == 0;
|
||||
}
|
||||
|
||||
public async Task<bool> PullAsync(string path, IProgress<string>? progress = null,
|
||||
CancellationToken ct = default)
|
||||
{
|
||||
progress?.Report("Pulling changes...");
|
||||
var (exitCode, _, error) = await RunGitCommandAsync(path, "pull --ff-only", ct);
|
||||
|
||||
if (exitCode != 0)
|
||||
progress?.Report($"Pull failed: {error}");
|
||||
|
||||
return exitCode == 0;
|
||||
}
|
||||
|
||||
public async Task<bool> CloneAsync(string url, string targetPath, IProgress<string>? progress = null,
|
||||
CancellationToken ct = default)
|
||||
{
|
||||
progress?.Report($"Cloning {url}...");
|
||||
|
||||
var parentDir = Path.GetDirectoryName(targetPath) ?? ".";
|
||||
var folderName = Path.GetFileName(targetPath);
|
||||
|
||||
var (exitCode, _, error) = await RunGitCommandAsync(parentDir, $"clone \"{url}\" \"{folderName}\"", ct,
|
||||
timeoutMs: 300000); // 5 minute timeout for clone
|
||||
|
||||
if (exitCode != 0)
|
||||
progress?.Report($"Clone failed: {error}");
|
||||
|
||||
return exitCode == 0;
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyList<string>> GetRemoteBranchesAsync(string path, CancellationToken ct = default)
|
||||
{
|
||||
var (exitCode, output, _) = await RunGitCommandAsync(path, "branch -r", ct);
|
||||
|
||||
if (exitCode != 0)
|
||||
return [];
|
||||
|
||||
return output.Split('\n', StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(b => b.Trim())
|
||||
.Where(b => !b.Contains("->")) // Filter out HEAD -> origin/main
|
||||
.Select(b => b.StartsWith("origin/") ? b[7..] : b)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public async Task<bool> CheckoutAsync(string path, string branchOrCommit, CancellationToken ct = default)
|
||||
{
|
||||
var (exitCode, _, _) = await RunGitCommandAsync(path, $"checkout \"{branchOrCommit}\"", ct);
|
||||
return exitCode == 0;
|
||||
}
|
||||
|
||||
public async Task<bool> HasLocalChangesAsync(string path, CancellationToken ct = default)
|
||||
{
|
||||
var (exitCode, output, _) = await RunGitCommandAsync(path, "status --porcelain", ct);
|
||||
return exitCode == 0 && !string.IsNullOrWhiteSpace(output);
|
||||
}
|
||||
|
||||
private static IReadOnlyList<GitCommitInfo> ParseCommitLog(string output)
|
||||
{
|
||||
var commits = new List<GitCommitInfo>();
|
||||
var entries = output.Split("---", StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
foreach (var entry in entries)
|
||||
{
|
||||
var lines = entry.Split('\n', StringSplitOptions.RemoveEmptyEntries);
|
||||
if (lines.Length < 5)
|
||||
continue;
|
||||
|
||||
commits.Add(new GitCommitInfo(
|
||||
Hash: lines[0].Trim(),
|
||||
ShortHash: lines[1].Trim(),
|
||||
Message: lines[2].Trim(),
|
||||
Author: lines[3].Trim(),
|
||||
Date: DateTimeOffset.TryParse(lines[4].Trim(), out var date) ? date : DateTimeOffset.MinValue
|
||||
));
|
||||
}
|
||||
|
||||
return commits;
|
||||
}
|
||||
|
||||
private static async Task<(int ExitCode, string Output, string Error)> RunGitCommandAsync(
|
||||
string workingDirectory, string arguments, CancellationToken ct, int timeoutMs = 30000)
|
||||
{
|
||||
using var process = new Process();
|
||||
process.StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = "git",
|
||||
Arguments = arguments,
|
||||
WorkingDirectory = workingDirectory,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
var outputBuilder = new StringBuilder();
|
||||
var errorBuilder = new StringBuilder();
|
||||
|
||||
process.OutputDataReceived += (_, e) =>
|
||||
{
|
||||
if (e.Data != null) outputBuilder.AppendLine(e.Data);
|
||||
};
|
||||
process.ErrorDataReceived += (_, e) =>
|
||||
{
|
||||
if (e.Data != null) errorBuilder.AppendLine(e.Data);
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
process.Start();
|
||||
process.BeginOutputReadLine();
|
||||
process.BeginErrorReadLine();
|
||||
|
||||
using var cts = CancellationTokenSource.CreateLinkedTokenSource(ct);
|
||||
cts.CancelAfter(timeoutMs);
|
||||
|
||||
await process.WaitForExitAsync(cts.Token);
|
||||
|
||||
return (process.ExitCode, outputBuilder.ToString(), errorBuilder.ToString());
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
try
|
||||
{
|
||||
process.Kill(entireProcessTree: true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore kill errors
|
||||
}
|
||||
|
||||
return (ExitCode: -1, Output: "", Error: "Operation timed out or was cancelled");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return (ExitCode: -1, Output: "", Error: ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using FCPModUpdater.Models;
|
||||
|
||||
namespace FCPModUpdater.Services;
|
||||
|
||||
public interface IGitHubApiService
|
||||
{
|
||||
Task<IReadOnlyList<RemoteRepo>> GetOrganizationReposAsync(CancellationToken ct = default);
|
||||
Task<RemoteRepo?> GetRepoByNameAsync(string repoName, CancellationToken ct = default);
|
||||
int? RemainingRateLimit { get; }
|
||||
DateTimeOffset? RateLimitReset { get; }
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using FCPModUpdater.Models;
|
||||
|
||||
namespace FCPModUpdater.Services;
|
||||
|
||||
public interface IGitService
|
||||
{
|
||||
Task<bool> IsGitInstalledAsync(CancellationToken ct = default);
|
||||
Task<bool> IsGitRepositoryAsync(string path, CancellationToken ct = default);
|
||||
Task<string?> GetRemoteUrlAsync(string path, CancellationToken ct = default);
|
||||
Task<GitCommitInfo?> GetCurrentCommitAsync(string path, CancellationToken ct = default);
|
||||
Task<string?> GetCurrentBranchAsync(string path, CancellationToken ct = default);
|
||||
Task<(int Behind, int Ahead)> GetCommitDifferenceAsync(string path, CancellationToken ct = default);
|
||||
Task<IReadOnlyList<GitCommitInfo>> GetIncomingCommitsAsync(string path, int limit = 10, CancellationToken ct = default);
|
||||
Task<bool> FetchAsync(string path, IProgress<string>? progress = null, CancellationToken ct = default);
|
||||
Task<bool> PullAsync(string path, IProgress<string>? progress = null, CancellationToken ct = default);
|
||||
Task<bool> CloneAsync(string url, string targetPath, IProgress<string>? progress = null, CancellationToken ct = default);
|
||||
Task<IReadOnlyList<string>> GetRemoteBranchesAsync(string path, CancellationToken ct = default);
|
||||
Task<bool> CheckoutAsync(string path, string branchOrCommit, CancellationToken ct = default);
|
||||
Task<bool> HasLocalChangesAsync(string path, CancellationToken ct = default);
|
||||
Task<IReadOnlyList<GitCommitInfo>> GetCommitHistoryAsync(string path, int limit = 20, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using FCPModUpdater.Models;
|
||||
|
||||
namespace FCPModUpdater.Services;
|
||||
|
||||
public interface IModDiscoveryService
|
||||
{
|
||||
Task<IReadOnlyList<InstalledMod>> DiscoverModsAsync(
|
||||
string modsDirectory,
|
||||
IProgress<string>? progress = null,
|
||||
CancellationToken ct = default);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user