0
A
답변
1
는 OpenFileDialog를이 기능을 제공하며, 여기 당신을위한 바이트 배열에 바이트를 읽어내는 간단한 기능의 4
을 통해 2에서 실버 라이트 버전에서 동일하게 작동합니다.
OpenFileDialog ofd = new OpenFileDialog()
{
Multiselect = false,
};
if (ofd.ShowDialog() == true)
{
FileInfo file = ofd.File;
byte[] bytes;
using (FileStream fs = file.OpenRead())
{
bytes = new byte[fs.Length];
int l = (int)fs.Length;
int r = 0;
while (l > 0)
{
int read = fs.Read(bytes, r, l);
if (read != 0)
{
r += read;
l -= read;
}
}
}
// All the bytes of the file are now in the "bytes" array
}
http://msdn.microsoft.com/en-us/library/system.windows.controls.openfiledialog(VS.95).aspx
당신은 하나의 문장으로 압착 너무 많은 개념 모호성, 더 디테일을 추가 할 수 있습니다. – AnthonyWJones별도의 페이지에서 파일을 열고 파일 내용을 바이트 형식으로 클릭하여 파일을 여는 실버 라이트 응용 프로그램을 만들고 싶습니다. 파일을 열거 나 보여 주려면 어떻게해야합니까? 바이트 형식은 .avi, .mpeg, .mp3, .doc, .xls, .pdf 등이 될 수 있습니다. – xscape