private static string GetHexString()

in toolkit/DllConvertToStream/Program.cs [79:94]


        private static string GetHexString(string assemblyPath)
        {
            StringBuilder builder = new StringBuilder("0x");

            using (FileStream stream = new FileStream(assemblyPath, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                int currentByte = stream.ReadByte();
                while (currentByte > -1)
                {
                    builder.Append(currentByte.ToString("X2", System.Globalization.CultureInfo.InvariantCulture));
                    currentByte = stream.ReadByte();
                }
            }

            return builder.ToString();
        }