Exemple #1
0
        public static void ImageToCodons()
        {
            var bytes = File.ReadAllBytes(@"C:\Users\io\Pictures\4nDEjdHS2-c.jpg");

            //var asw = HexCodon.Encode(bytes).Select(x =>
            //    $"{x.Acid.Symbol.ToString().Pastel(getColorByAminoAcidsState(x.Acid.State))}");
            // Info($"acid map: {string.Join(" ", asw)}");
            Info(HexCodon.Encode(bytes).Length.ToString());
            //var res = string.Join("\n", string.Join("", HexCodon.Encode(bytes).SelectMany(x => x.Value)).Batch(3 * 25).Select(x => string.Join("", x)));
            //File.WriteAllText("./image.codons4", res);
        }
Exemple #2
0
        public static void StringToCodons()
        {
            var str = "Ты пошел нахуй";

            Info($"String: '{str.Pastel(Color.Gray)}', Length: {str.Length}");
            var asw = HexCodon.Encode(Encoding.UTF8.GetBytes(str)).Select(x =>
                                                                          $"{x.Acid.Symbol.ToString().Pastel(getColorByAminoAcidsState(x.Acid.State))}");

            Info($"acid map: {string.Join(" ", asw)}");
            Info($"");
            Info($"Detail table:");
            foreach (var codon in HexCodon.Encode(Encoding.UTF8.GetBytes(str)))
            {
                Info($"\t{codon.Value.Pastel(getColorByAminoAcidsState(codon.Acid.State))} {codon.Acid.FullName}/{codon.Acid.Symbol}");
            }
            Console.WriteLine();
        }