Ejemplo n.º 1
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            //Newtonsoft.Json.Linq.JObject obj = await pan.acquireFileInfo_byPath("/online.ts.ppt");
            //Title = $"{obj["size"].ToString()}";

            var curdir = await pan.listdir("/backup");

            listView.ItemsSource = curdir.Children;
            workdir = curdir;
        }
Ejemplo n.º 2
0
        public async Task <VDirectory> listdir(string path)
        {
            VDirectory baseDir = new VDirectory();

            var ls = await acquireAllChildren(path);

            //VFileBase vf;
            ObservableCollection <VDirectory> dirs  = new ObservableCollection <VDirectory>();
            ObservableCollection <VFile>      files = new ObservableCollection <VFile>();

            foreach (var f in ls)
            {
                var isDir = f["directory"].ToObject <bool>();
                var name  = f["name"].ToString();
                var mtime = f["mtime"].ToString();
                var id    = f["identity"].ToString();
                var share = f["share"].ToObject <bool>();
                var size  = f["size"].ToObject <long>();
                if (isDir)
                {
                    var x = new VDirectory()
                    {
                        id           = new Guid(id),
                        Name         = name,
                        ModifiedTime = new DateTime(long.Parse(mtime))
                    };
                    dirs.Add(x);
                }
                else
                {
                    var x = new VFile()
                    {
                        id           = new Guid(id),
                        Name         = name,
                        ModifiedTime = new DateTime(long.Parse(mtime)),
                        Size         = size
                    };
                    files.Add(x);
                }
            }
            baseDir.SubDirs = dirs;
            baseDir.Files   = files;
            return(baseDir);
        }