mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Make implicit StringEventArgs bidirectional
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
- Separate out StringEventArgs
|
||||
- Use StringEventArgs more broadly
|
||||
- Make StringEventArgs more complete
|
||||
- Make implicit StringEventArgs bidirectional
|
||||
|
||||
### 3.1.9a (2024-05-21)
|
||||
|
||||
|
||||
@@ -30,8 +30,23 @@ namespace MPF.Core.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Results can be compared to boolean values based on the success value
|
||||
/// Event arguments are just the value of the string contained within
|
||||
/// </summary>
|
||||
public static implicit operator string(StringEventArgs args) => args._value;
|
||||
|
||||
/// <summary>
|
||||
/// Event arguments are just the value of the string contained within
|
||||
/// </summary>
|
||||
public static implicit operator StringBuilder(StringEventArgs args) => new StringBuilder(args._value);
|
||||
|
||||
/// <summary>
|
||||
/// Event arguments are just the value of the string contained within
|
||||
/// </summary>
|
||||
public static implicit operator StringEventArgs(string? str) => new(str);
|
||||
|
||||
/// <summary>
|
||||
/// Event arguments are just the value of the string contained within
|
||||
/// </summary>
|
||||
public static implicit operator StringEventArgs(StringBuilder? sb) => new(sb);
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ namespace MPF.Core
|
||||
/// <summary>
|
||||
/// Process the outputs in the queue
|
||||
/// </summary>
|
||||
private void ProcessOutputs(string nextOutput) => ReportStatus?.Invoke(this, new StringEventArgs(nextOutput));
|
||||
private void ProcessOutputs(string nextOutput) => ReportStatus?.Invoke(this, nextOutput);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace MPF.Core.Utilities
|
||||
catch { }
|
||||
finally
|
||||
{
|
||||
handler?.Invoke(baseClass, new StringEventArgs(sb));
|
||||
handler?.Invoke(baseClass, sb);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace MPF.Core.Utilities
|
||||
if (i == 0)
|
||||
{
|
||||
sb.Append(split[i]);
|
||||
handler?.Invoke(baseClass, new StringEventArgs(sb));
|
||||
handler?.Invoke(baseClass, sb);
|
||||
sb = new();
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace MPF.Core.Utilities
|
||||
// For everything else, directly write out
|
||||
else
|
||||
{
|
||||
handler?.Invoke(baseClass, new StringEventArgs(split[i]));
|
||||
handler?.Invoke(baseClass, split[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ namespace MPF.Core.Utilities
|
||||
|
||||
// Append and log the first
|
||||
sb.Append(split[0]);
|
||||
handler?.Invoke(baseClass, new StringEventArgs(sb));
|
||||
handler?.Invoke(baseClass, sb);
|
||||
sb = new();
|
||||
|
||||
// Append the last
|
||||
|
||||
Reference in New Issue
Block a user