summaryrefslogtreecommitdiff
path: root/WinKeyRecover/keyManager/ReplaceMissings.cs
diff options
context:
space:
mode:
Diffstat (limited to 'WinKeyRecover/keyManager/ReplaceMissings.cs')
-rw-r--r--WinKeyRecover/keyManager/ReplaceMissings.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/WinKeyRecover/keyManager/ReplaceMissings.cs b/WinKeyRecover/keyManager/ReplaceMissings.cs
new file mode 100644
index 0000000..6e5e1ae
--- /dev/null
+++ b/WinKeyRecover/keyManager/ReplaceMissings.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WinKeyRecover
+{
+ internal class ReplaceMissings
+ {
+ private readonly string key;
+ private readonly List<int> missingPosition;
+
+ public ReplaceMissings(string key, List<int> missingPosition)
+ {
+ this.key = key;
+ this.missingPosition = missingPosition;
+ }
+
+ public string Replace(string pattern)
+ {
+ char[] finalKey = new List<char>(key).ToArray();
+
+ for (int i = 0; i < pattern.Length; i++)
+ {
+ finalKey[missingPosition[i]] = pattern[i];
+ }
+
+ return new string(finalKey);
+ }
+ }
+}