제품‎ > ‎

BIN2B64

파일을 base64로 변환합니다. 변환된 내용은 파일이름.b64로 내보내집니다.
Convert files to base64. Converted files will be exported to filename.b64.

MainModule.vb

Imports System.IO
Imports System.IO.Path

Module MainModule

  Sub Main()
    Dim Args = My.Application.CommandLineArgs
    If Args.Count = 0 Then
      Console.WriteLine("There is no file to convert.")
      Console.WriteLine("Usage: BIN2B64  [[[Filename2] Filename3] [...]]")
    End If
    For Each Arg In Args
      Try
        Console.WriteLine("Reading {0}...", GetFileNameWithoutExtension(Arg))
        Dim I = File.ReadAllBytes(Arg)
        Console.WriteLine("Converting {0} to base64...", GetFileNameWithoutExtension(Arg))
        File.WriteAllText(Combine(GetDirectoryName(Arg), GetFileNameWithoutExtension(Arg) & ".b64"), Convert.ToBase64String(I, Base64FormattingOptions.None))
        Console.WriteLine("{0} was converted successfully.", GetFileNameWithoutExtension(Arg))
      Catch ex As Exception
        Console.WriteLine("Conversion failed.")
      End Try
      Console.WriteLine()
    Next
    Console.WriteLine("Completed.")
  End Sub
End Module

ċ
Mayuki Minano,
2011. 12. 30. 오후 7:54