refactor: fix wait parse to be invariant
This commit is contained in:
parent
9dd61cbf78
commit
07f7ea581c
|
@ -15,7 +15,7 @@ namespace Macrology {
|
|||
|
||||
[JsonProperty]
|
||||
[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;
|
||||
|
||||
|
@ -86,7 +86,7 @@ namespace Macrology {
|
|||
public class Folder : INode {
|
||||
public Guid Id { 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) {
|
||||
this.Id = Guid.NewGuid();
|
||||
|
@ -111,7 +111,7 @@ namespace Macrology {
|
|||
public Guid Id { get; set; }
|
||||
public string Name { 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) {
|
||||
this.Id = Guid.NewGuid();
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
InputAssemblies="@(InputAssemblies)"
|
||||
TargetKind="Dll"
|
||||
TargetPlatformVersion="v4"
|
||||
LibraryPath="$(OutputPath)"
|
||||
LibraryPath="$(OutputPath);$(AppData)\XIVLauncher\addon\Hooks\dev"
|
||||
OutputFile="$(OutputPath)\$(AssemblyName).dll"/>
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using Dalamud.Game.Internal;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Channels;
|
||||
|
@ -9,7 +10,7 @@ using System.Threading.Tasks;
|
|||
namespace Macrology {
|
||||
public class MacroHandler {
|
||||
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 = {
|
||||
"/ac",
|
||||
|
@ -20,9 +21,9 @@ namespace Macrology {
|
|||
|
||||
private Macrology Plugin { get; }
|
||||
private readonly Channel<string> _commands = Channel.CreateUnbounded<string>();
|
||||
public ConcurrentDictionary<Guid, Macro> Running { get; } = new ConcurrentDictionary<Guid, Macro>();
|
||||
private readonly ConcurrentDictionary<Guid, bool> _cancelled = new ConcurrentDictionary<Guid, bool>();
|
||||
private readonly ConcurrentDictionary<Guid, bool> _paused = new ConcurrentDictionary<Guid, bool>();
|
||||
public ConcurrentDictionary<Guid, Macro> Running { get; } = new();
|
||||
private readonly ConcurrentDictionary<Guid, bool> _cancelled = new();
|
||||
private readonly ConcurrentDictionary<Guid, bool> _paused = new();
|
||||
|
||||
public MacroHandler(Macrology plugin) {
|
||||
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 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<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>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
|
|
Loading…
Reference in New Issue