示例#1
0
        /*
         * Recently changed to String, not void to fix remap items
         */

        public String createMapping(LinkedList <Password> PWS)
        {
            // Uses the linked list used in the listbox to create the mappings.
            // Backwards loop, because items are put into the final string from top to bottom.
            // ALSO THIS LL ITERATION IS DOGSHIT

            this.PWS = PWS;
            for (int i = PWS.Count - 1; i >= 0; i--)
            {
                MappedPassword finishedMP = createSingleMapping(PWS.ElementAt(i));
                mappings.AddFirst(finishedMP.getID1() + " " + finishedMP.getLineMap());
                oneLongFuckingString += finishedMP.getID1() + " " + finishedMP.getLineMap() + '\n';
                //System.Diagnostics.Debug.WriteLine(finishedMP.getID1() + " " + PWS.ElementAt(i).ID2 + " " + finishedMP.getLineMap());
            }

            return(oneLongFuckingString);
        }
示例#2
0
        private MappedPassword createSingleMapping(Password pw)
        {
            string[] ID1Arr = pw.ID1.Split(' '); // creates name in the PW file i.e. World_of_Tanks
            string   fullID = "";

            for (int i = 0; i < ID1Arr.Length; i++)
            {
                if (i + 1 == ID1Arr.Length)
                {
                    fullID += ID1Arr[i];
                }
                else
                {
                    fullID += ID1Arr[i] + "_";
                }
            }

            //System.Diagnostics.Debug.WriteLine(fullID);

            int actualLettersLength = letters.Length;

            for (int i = 0; i < letters.Length; i++)
            {
                if (letters[i] == null)
                {
                    actualLettersLength = i;
                    break;
                }
            }

            MappedPassword MP = new MappedPassword(fullID);

            char[]        pwChars      = pw.ID2.ToCharArray();
            LetterCoord[] pwCharsCoord = new LetterCoord[pwChars.Length];

            for (int i = 0; i < pwChars.Length; i++)
            {
                for (int j = 0; j < actualLettersLength; j++)
                {
                    try
                    {
                        if (pwChars[i] == letters[j].Let)
                        {
                            LetterCoord tmp = letters[j].useLocCoord();
                            pwCharsCoord[i] = new LetterCoord(tmp.getIntegerNumber(), tmp.getLetterID());
                            break;
                        }
                    }
                    catch (NullReferenceException)
                    {
                        continue;
                    }

                    if (j == actualLettersLength - 1)
                    {
                        pwCharsCoord[i] = new LetterCoord(-1, -1);
                        break;
                    }
                }
            }

            MP.createLineMap(pwCharsCoord);

            return(MP);
        }