Merge branch 'master' into mega-fixes

This commit is contained in:
Timothy Baldridge 2021-07-30 21:29:16 -06:00 committed by GitHub
commit ef156867c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 55 additions and 16 deletions

34
.github/workflows/stale.yml vendored Normal file
View File

@ -0,0 +1,34 @@
# This is a basic workflow to help you get started with Actions
name: Mark Stale
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
schedule:
- cron: "0 0 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Close Stale Issues
uses: actions/stale@v4.0.0
with:
stale-issue-message: "Marked as stale due to inactivity"
stale-pr-message: "Marked as stale due to inactivity"
close-issue-message: "Closed due to inactivity"
close-pr-message: "Closed due ot inactivity"
days-before-stale: 180
debug-only: false
operations-per-run: 100

View File

@ -4,6 +4,9 @@ on:
push:
branches: [ master ]
pull_request:
paths:
- 'Wabbajack**'
- '.github/workflows/**'
branches: [ master ]
jobs:

View File

@ -350,13 +350,13 @@ namespace Wabbajack.Lib
});
*/
}
private static readonly Regex NoDeleteRegex = new(@"(?i)[\\\/]\[NoDelete\]", RegexOptions.Compiled);
/// <summary>
/// The user may already have some files in the OutputFolder. If so we can go through these and
/// figure out which need to be updated, deleted, or left alone
/// </summary>
public async Task OptimizeModlist()
protected async Task OptimizeModlist()
{
Utils.Log("Optimizing ModList directives");
@ -370,7 +370,6 @@ namespace Wabbajack.Lib
var savePath = (RelativePath)"saves";
UpdateTracker.NextStep("Looking for files to delete");
var regex = new Regex(@"(?i)[\\\/]\[NoDelete\]");
await OutputFolder.EnumerateFiles()
.PMap(Queue, UpdateTracker, async f =>
{
@ -380,7 +379,7 @@ namespace Wabbajack.Lib
if (f.InFolder(profileFolder) && f.Parent.FileName == savePath) return;
if (regex.IsMatch(f.ToString()))
if (NoDeleteRegex.IsMatch(f.ToString()))
return;
Utils.Log($"Deleting {relativeTo} it's not part of this ModList");

View File

@ -14,7 +14,7 @@ namespace Wabbajack.Lib.CompilationSteps
{
_pattern = pattern;
_reason = $"Ignored because path matches regex {pattern}";
_regex = new Regex(pattern);
_regex = new Regex(pattern, RegexOptions.Compiled);
}
public override async ValueTask<Directive?> Run(RawSourceFile source)

View File

@ -13,7 +13,7 @@ namespace Wabbajack.Lib.CompilationSteps
public IncludeRegex(ACompiler compiler, string pattern) : base(compiler)
{
_pattern = pattern;
_regex = new Regex(pattern);
_regex = new Regex(pattern, RegexOptions.Compiled);
}
public override async ValueTask<Directive?> Run(RawSourceFile source)

View File

@ -12,14 +12,15 @@ using Wabbajack.Lib.Validation;
namespace Wabbajack.Lib.Downloaders
{
public class GoogleDriveDownloader : IDownloader, IUrlDownloader
public class GoogleDriveDownloader : IUrlDownloader
{
public async Task<AbstractDownloadState?> GetDownloaderState(dynamic archiveINI, bool quickMode)
{
var url = archiveINI?.General?.directURL;
var url = archiveINI.General?.directURL;
return GetDownloaderState(url);
}
private static readonly Regex GDriveRegex = new("((?<=id=)[a-zA-Z0-9_-]*)|(?<=\\/file\\/d\\/)[a-zA-Z0-9_-]*", RegexOptions.Compiled);
public AbstractDownloadState? GetDownloaderState(string? url)
{
if (url == null) return null;
@ -27,8 +28,8 @@ namespace Wabbajack.Lib.Downloaders
if (!url.StartsWith("https://drive.google.com"))
return null;
var regex = new Regex("((?<=id=)[a-zA-Z0-9_-]*)|(?<=\\/file\\/d\\/)[a-zA-Z0-9_-]*");
var match = regex.Match(url);
var match = GDriveRegex.Match(url);
return new State(match.ToString());
}

View File

@ -25,19 +25,18 @@ namespace Wabbajack
private readonly ReadOnlyObservableCollection<ModListArchive> _archives;
public ReadOnlyObservableCollection<ModListArchive> Archives => _archives;
private static readonly Regex NameMatcher = new(@"(?<=\.)[^\.]+(?=\+State)", RegexOptions.Compiled);
public ModListContentsVM(MainWindowVM mwvm) : base(mwvm)
{
_mwvm = mwvm;
Status = new ObservableCollectionExtended<DetailedStatusItem>();
Regex nameMatcher = new Regex(@"(?<=\.)[^\.]+(?=\+State)");
string TransformClassName(Archive a)
{
var cname = a.State.GetType().FullName;
if (cname == null) return null;
var match = nameMatcher.Match(cname);
var match = NameMatcher.Match(cname);
return match.Success ? match.ToString() : null;
}

View File

@ -132,8 +132,11 @@ namespace Wabbajack
canExecute: this.WhenAny(x => x.TargetMod.State.URL)
.Select(x =>
{
var regex = new Regex("^(http|https):\\/\\/");
return x != null && regex.Match(x.ToString()).Success;
//var regex = new Regex("^(http|https):\\/\\/");
var scheme = x?.Scheme;
return scheme != null &&
(scheme.Equals("https", StringComparison.OrdinalIgnoreCase) ||
scheme.Equals("http", StringComparison.OrdinalIgnoreCase));
})
.ObserveOnGuiThread());