summaryrefslogtreecommitdiff
path: root/WinKeyRecover/keyManager/ReplaceMissings.cs
blob: 6e5e1ae903171f30ebc4d3feea78ef7d7cc3277a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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);
        }
    }
}