示例#1
0
文件: Program.cs 项目: yudevan/napkin
        //
        // SD Card
        //

        private void SDCardTest()
        {
            Debug.Print("MEM: " + Debug.GC(false));

            string[] vols = Mainboard.GetStorageDeviceVolumeNames();
            foreach (string vol in vols)
            {
                Debug.Print("volume: " + vol);
                bool result = Mainboard.MountStorageDevice(vol);
                Debug.Print("mounted: " + result);
            }
            Debug.Print("MEM: " + Debug.GC(false));

            VolumeInfo[] volInfos = VolumeInfo.GetVolumes();
            foreach (VolumeInfo volInfo in volInfos)
            {
                Thread.Sleep(50);
                Debug.Print("MEM: " + Debug.GC(false));

                string rootDir = volInfo.RootDirectory;
                Debug.Print("root dir: " + rootDir);

                string[] fileNames = Directory.GetFiles(rootDir);
                foreach (string fileName in fileNames)
                {
                    Thread.Sleep(50);
                    Debug.Print("MEM: " + Debug.GC(false));

                    Debug.Print("file name: " + fileName);

                    String filePath = Path.Combine(rootDir, fileName);
                    Debug.Print("file path: " + fileName);

                    Thread.Sleep(50);
                    Debug.Print("MEM: " + Debug.GC(false));

                    string fileText = GetFileText(filePath);
                    Debug.Print(">>>");
                    Debug.Print(fileText);
                    Debug.Print("<<<");
                }
            }

            Debug.Print("Program Started");
        }