Skip to content

Commit

Permalink
Add String Modifier to remove Remapped char collisions within origina…
Browse files Browse the repository at this point in the history
…l stirng
  • Loading branch information
marcussacana committed Jul 16, 2023
1 parent 2b7aadd commit 3a4610e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions StringReloads/Engine/SRL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ where typeof(IPlugin).IsAssignableFrom(Typ) && !Typ.IsInterface

internal IStringModifier[] _ReloadModifiers = null;
public IStringModifier[] ReloadModifiers => _ReloadModifiers ??= new IStringModifier[] {
new AntiIlegalChar(this),
new MonoWordWrap(this),
new Remaper(this),
new RemaperAlt(this),
Expand Down
1 change: 1 addition & 0 deletions StringReloads/SRL.ini
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ RemapAlt=false
UndoRemap=false

[Modifiers]
AntiIlegalChar=false
AcceptableRangeMinify=false
Escape=false
MonoWordWrap=false
Expand Down
38 changes: 38 additions & 0 deletions StringReloads/StringModifier/AntiIlegalChar.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using StringReloads.Engine;
using StringReloads.Engine.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StringReloads.StringModifier
{
internal class AntiIlegalChar : IStringModifier
{
public AntiIlegalChar(SRL Engine)
{
Illegals = Engine.CharRemap.Values.ToArray();
}
public string Name => "AntiIlegalChar";

public bool CanRestore => false;


char[] Illegals;

public string Apply(string String, string Original)
{
foreach (var Char in Illegals)
if (String.Contains(Char))
String = String.Replace(Char.ToString(), "");

return String;
}

public string Restore(string String)
{
throw new NotImplementedException();
}
}
}

0 comments on commit 3a4610e

Please sign in to comment.