C# 将Instagram Id转换为Url段

C# 将Instagram Id转换为Url段,c#,coffeescript,C#,Coffeescript,目前,我正在尝试将coffee脚本从那里转换为C#,但我无法转换,因为我在coffee脚本中的exp较少。我需要做的很简单,但我猜不出算法。如果id为1038059720608660215,则值应为5n7dDmhTr3。在github上可以找到algo的完整代码。试试这个 static void Main(string[] args) { string[] convert = {

目前,我正在尝试将coffee脚本从那里转换为C#,但我无法转换,因为我在coffee脚本中的exp较少。我需要做的很简单,但我猜不出算法。如果id为
1038059720608660215
,则值应为
5n7dDmhTr3
。在github上可以找到algo的完整代码。

试试这个

       static void Main(string[] args)
        {
            string[] convert = {
                                 "A","B","C","D","E","F","G","H","I","J",
                                 "K","L","M","N","O","P","Q","R","S","T",
                                 "U","V","W","X","Y","Z","a","b","c","d",
                                 "e","f","g","h","i","j","k","l","m","n",
                                 "o","p","q","r","s","t","u","v","w","x",
                                 "y","z","0","1","2","3","4","5","6","7",
                                 "8","9","-","_"
                             };


            Int64 input = 1038059720608660215;
            string output = "";
            for (int i = 9; i >= 0; i--)
            {
                long digit = (input >> (6 * i)) & 0x3F;
                output += convert[digit];
            }

            Console.WriteLine(output);
            Console.ReadLine();


        }