7. October 2009 17:35
By
Flame
In
Windows Mobile
В Windows Mobile, для того чтобы выяснить как называется съемный диск в системе можно воспользоваться следующим методом:
private string GetStorageCard()
{
//initialize the path as an empty string
string firstCard = "";
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo("\\");
System.IO.FileSystemInfo[] fsi = di.GetFileSystemInfos();
//iterate through them
for (int x = 0; x < fsi.Length; x++)
{
//check to see if this is a temporary storage card (e.g. SD card)
if ((fsi[x].Attributes & System.IO.FileAttributes.Temporary) == System.IO.FileAttributes.Temporary)
{
//if so, return the path
firstCard = fsi[x].FullName;
}
}
return firstCard;
}
P.S.
Не забываем подключать using System.IO;