public static void Main(string[] args) { StringAnalizis sa = new StringAnalizis(); sa.CountLetters(); foreach (var a in sa.Encrypt()) { Console.WriteLine(a.Key + " " + a.Value); } Console.ReadLine(); }
public async Task Archive() { await Task.Run(() => { BitArray storage = new BitArray(memFile); storage = storage.Xor(storage); StringAnalizis sa = new StringAnalizis(memFile); sa.CountLetters(); var dictionary = sa.Encrypt(); int offset = 0; foreach (var b in memFile) { for (int i = 0; i < dictionary[b].Length; i++) { storage.Set(offset, dictionary[b].Get(i)); offset++; } LoadChanged?.Invoke((double)offset / (double)(memFile.Length * 8)); } BitArray final = new BitArray(offset + (8 - (offset % 8))); for (int i = 0; i < offset; i++) { final.Set(i, storage[i]); } finalFile = new byte[final.Length / 8]; final.CopyTo(finalFile, 0); fileSize = offset; LogDictionary(dictionary); SaveDictionary(new InfoBox() { Keys = dictionary.Keys.ToArray(), Snippets = dictionary.Values.ToArray(), size = fileSize }); }); }