1. 程式人生 > >c# 枚舉安卓系統中所有目錄及文件名

c# 枚舉安卓系統中所有目錄及文件名

tco time exceptio try err ring oid cep env

using Android.App;
using Android.Widget;
using Android.OS;
using System.Runtime.InteropServices;

namespace App2
{
    [Activity(Label = "App2", MainLauncher = true, Icon = "@drawable/icon")]
    public class MainActivity : Activity
    {
        [DllImport("TestDynamicSharedLib.so")]
        public
extern static int getClickCount(); protected override void OnCreate(Bundle bundle) { var c = getClickCount(); //string folderPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.System); printAllSubFiles("/"); base
.OnCreate(bundle); // Set our view from the "main" layout resource // SetContentView (Resource.Layout.Main); } void printAllSubFiles(string path) { System.Diagnostics.Debug.Print("dir:" + path); var dir = new System.IO.DirectoryInfo(path);
try { foreach (var f in dir.GetFiles()) { System.Diagnostics.Debug.Print("file:" + f.FullName); } } catch { //throw; } try { foreach (var d in dir.GetDirectories()) { printAllSubFiles(d.FullName); } } catch (System.Exception) { //throw; } } } }

c# 枚舉安卓系統中所有目錄及文件名