refactor: fix wait parse to be invariant
This commit is contained in:
parent
9dd61cbf78
commit
07f7ea581c
|
@ -15,7 +15,7 @@ namespace Macrology {
|
||||||
|
|
||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
[JsonConverter(typeof(NodeConverter))]
|
[JsonConverter(typeof(NodeConverter))]
|
||||||
public List<INode> Nodes { get; private set; } = new List<INode>();
|
public List<INode> Nodes { get; private set; } = new();
|
||||||
|
|
||||||
public int MaxLength { get; set; } = 10_000;
|
public int MaxLength { get; set; } = 10_000;
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ namespace Macrology {
|
||||||
public class Folder : INode {
|
public class Folder : INode {
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public List<INode> Children { get; private set; } = new List<INode>();
|
public List<INode> Children { get; private set; } = new();
|
||||||
|
|
||||||
public Folder(string name, List<INode>? children = null) {
|
public Folder(string name, List<INode>? children = null) {
|
||||||
this.Id = Guid.NewGuid();
|
this.Id = Guid.NewGuid();
|
||||||
|
@ -111,7 +111,7 @@ namespace Macrology {
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Contents { get; set; }
|
public string Contents { get; set; }
|
||||||
public List<INode> Children => new List<INode>();
|
public List<INode> Children => new();
|
||||||
|
|
||||||
public Macro(string name, string contents) {
|
public Macro(string name, string contents) {
|
||||||
this.Id = Guid.NewGuid();
|
this.Id = Guid.NewGuid();
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
InputAssemblies="@(InputAssemblies)"
|
InputAssemblies="@(InputAssemblies)"
|
||||||
TargetKind="Dll"
|
TargetKind="Dll"
|
||||||
TargetPlatformVersion="v4"
|
TargetPlatformVersion="v4"
|
||||||
LibraryPath="$(OutputPath)"
|
LibraryPath="$(OutputPath);$(AppData)\XIVLauncher\addon\Hooks\dev"
|
||||||
OutputFile="$(OutputPath)\$(AssemblyName).dll"/>
|
OutputFile="$(OutputPath)\$(AssemblyName).dll"/>
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using Dalamud.Game.Internal;
|
using Dalamud.Game.Internal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Channels;
|
using System.Threading.Channels;
|
||||||
|
@ -9,7 +10,7 @@ using System.Threading.Tasks;
|
||||||
namespace Macrology {
|
namespace Macrology {
|
||||||
public class MacroHandler {
|
public class MacroHandler {
|
||||||
private bool _ready;
|
private bool _ready;
|
||||||
private static readonly Regex Wait = new Regex(@"<wait\.(\d+(?:\.\d+)?)>", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
private static readonly Regex Wait = new(@"<wait\.(\d+(?:\.\d+)?)>", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
private static readonly string[] FastCommands = {
|
private static readonly string[] FastCommands = {
|
||||||
"/ac",
|
"/ac",
|
||||||
|
@ -20,9 +21,9 @@ namespace Macrology {
|
||||||
|
|
||||||
private Macrology Plugin { get; }
|
private Macrology Plugin { get; }
|
||||||
private readonly Channel<string> _commands = Channel.CreateUnbounded<string>();
|
private readonly Channel<string> _commands = Channel.CreateUnbounded<string>();
|
||||||
public ConcurrentDictionary<Guid, Macro> Running { get; } = new ConcurrentDictionary<Guid, Macro>();
|
public ConcurrentDictionary<Guid, Macro> Running { get; } = new();
|
||||||
private readonly ConcurrentDictionary<Guid, bool> _cancelled = new ConcurrentDictionary<Guid, bool>();
|
private readonly ConcurrentDictionary<Guid, bool> _cancelled = new();
|
||||||
private readonly ConcurrentDictionary<Guid, bool> _paused = new ConcurrentDictionary<Guid, bool>();
|
private readonly ConcurrentDictionary<Guid, bool> _paused = new();
|
||||||
|
|
||||||
public MacroHandler(Macrology plugin) {
|
public MacroHandler(Macrology plugin) {
|
||||||
this.Plugin = plugin ?? throw new ArgumentNullException(nameof(plugin), "Macrology cannot be null");
|
this.Plugin = plugin ?? throw new ArgumentNullException(nameof(plugin), "Macrology cannot be null");
|
||||||
|
@ -155,7 +156,7 @@ namespace Macrology {
|
||||||
var match = matches[matches.Count - 1];
|
var match = matches[matches.Count - 1];
|
||||||
var waitTime = match.Groups[1].Captures[0].Value;
|
var waitTime = match.Groups[1].Captures[0].Value;
|
||||||
|
|
||||||
if (!double.TryParse(waitTime, out var seconds)) {
|
if (!double.TryParse(waitTime, NumberStyles.Number, CultureInfo.InvariantCulture, out var seconds)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Dalamud, Version=5.2.4.2, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="Dalamud, Version=5.2.4.3, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Dalamud.dll</HintPath>
|
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Dalamud.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|
Loading…
Reference in New Issue