Esempio n. 1
0
 public void addLetter()
 {
     foreach (var letter in enteredText)
     {
         if (!LZWArray.ContainsKey(letter + ""))
         {
             index++;
             LZWArray.Add(letter + "", index);
         }
     }
 }
Esempio n. 2
0
 public bool checkInArray(string str)
 {
     if (LZWArray.ContainsKey(str))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 3
0
        public void decodelwz()
        {
            int[] mas = secondCode.Split(' ').Where(y => y != "" && y != " ").Select(x => int.Parse(x)).ToArray();


            decodeLWZ = "";
            foreach (var num in mas)
            {
                decodeLWZ += LZWArray.FirstOrDefault(x => x.Value == num).Key;
            }
        }
Esempio n. 4
0
        public bool addToArray(string preStr)
        {
            string str = "";

            if (preStr.Length > 1)
            {
                str = preStr.Substring(0, preStr.Length - 1);
            }
            else
            {
                str = preStr;
            }

            if (!checkInArray(str))
            {
                index++;
                LZWArray.Add(str, index);
                return(true);
            }
            else
            {
                return(false);
            }
        }