public void addLetter() { foreach (var letter in enteredText) { if (!LZWArray.ContainsKey(letter + "")) { index++; LZWArray.Add(letter + "", index); } } }
public bool checkInArray(string str) { if (LZWArray.ContainsKey(str)) { return(true); } else { return(false); } }
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; } }
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); } }