Example #1
0
        private async Task List(string dir_name)
        {
            if (!IsFileSystemReady)
            {
                ShowErrorMessage("File system is not open", PPError.Failed);
                return;
            }

            //using (var fileRef = new FileRef(fileSystem, dir_name))
            //{
            var fileRef = new FileRef(fileSystem, dir_name);

            var listResult = await fileRef.ReadDirectoryEntriesAsync();

            if (listResult.Result != PPError.Ok)
            {
                ShowErrorMessage("List failed", listResult.Result);
                return;
            }

            var entries = new List <string>();

            foreach (var entry in listResult.Entries)
            {
                Console.WriteLine(entry.FileRef.Name);
                entries.Add(entry.FileRef.Name);
            }

            PostArrayMessage("LIST", entries.ToArray());
            ShowStatusMessage("List success");


            //}
        }