Skip to content

Instantly share code, notes, and snippets.

@radiaku
Created September 18, 2020 06:27
Show Gist options
  • Save radiaku/303f71c479cf63cb766aea12134a7d2c to your computer and use it in GitHub Desktop.
Save radiaku/303f71c479cf63cb766aea12134a7d2c to your computer and use it in GitHub Desktop.
ToHumanLanguage.cs FUCK
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DevConsolas
{
class Program
{
static void Main(string[] args)
{
var ArrayStrBinary = new string[] {
"01100110",
"01101001",
"01101110",
"01100100",
"00100000",
"01100001",
"00100000",
"01101000",
"01101111",
"01100010",
"01100010",
"01111001",
"00100000",
"01100110",
"01101111",
"01110010",
"00100000",
"01100111",
"01101111",
"01100100",
"00100111",
"01110011",
"00100000",
"01110011",
"01100001",
"01101011",
"01100101"
};
Console.WriteLine("Array : ");
Console.WriteLine("[{0}]", string.Join(", ", ArrayStrBinary));
string singleLine = string.Join("", ArrayStrBinary);
Console.WriteLine("Language of GOD");
Console.WriteLine(singleLine);
string ConvertToHumanLanguage = BinaryToString(singleLine);
Console.WriteLine("Translate it");
Console.WriteLine(ConvertToHumanLanguage);
Console.ReadLine();
}
public static string StringToBinary(string data)
{
StringBuilder sb = new StringBuilder();
foreach (char c in data.ToCharArray())
{
sb.Append(Convert.ToString(c, 2).PadLeft(8, '0'));
}
return sb.ToString();
}
public static string BinaryToString(string data)
{
List<Byte> byteList = new List<Byte>();
for (int i = 0; i < data.Length; i += 8)
{
byteList.Add(Convert.ToByte(data.Substring(i, 8), 2));
}
return Encoding.ASCII.GetString(byteList.ToArray());
}
}
}
@radiaku
Copy link
Author

radiaku commented Sep 19, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment