Exemplo n.º 1
0
        public async void SyncFiles()
        {
            string        rootFolderPath = GetRootPath();
            List <Folder> folderResponse = await api.GetFolders("");

            for (int i = 0; i < folderResponse.Count; i++)
            {
                Folder folder     = folderResponse[i];
                string folderPath = rootFolderPath + folder.Path.Replace("/", "\\");
                if (Helper.GetItemType(folder.Name) == "folder")
                {
                    if (!Directory.Exists(folderPath))
                    {
                        Directory.CreateDirectory(folderPath);
                    }
                }
                if (Helper.GetItemType(folder.Name) == "file")
                {
                    if (!File.Exists(folderPath))
                    {
                        api.DownloadFileEmpty(folder.Path, folderPath);
                    }
                }
            }
        }