예제 #1
0
        public void OnPathChange(DbxFileSystem fileSystem, DbxPath registeredPath, DbxFileSystem.PathListenerMode registeredMode)
        {
            Tracing.Log("AndroidDropboxService - OnPathChange - path: {0}", registeredPath.Name);

            if (OnCloudPathChanged != null)
                OnCloudPathChanged(registeredPath.Name);

            //Task.Factory.StartNew(() =>
            //{
            //    var fileInfos = fileSystem.ListFolder(registeredPath);
            //    foreach(var fileInfo in fileInfos)
            //    {
            //        Tracing.Log("AndroidDropboxService - OnPathChange - path: {0} size: {1} modifiedTime: {2} isFolder: {3}", fileInfo.Path.Name, fileInfo.Size, fileInfo.ModifiedTime, fileInfo.IsFolder);
            //    }
            //});
        }
예제 #2
0
        public void UploadFile(string path, byte[] data)
        {
            ThrowExceptionIfAppNotLinked();

            DbxFile file = null;
            try
            {
                var dbxPath = new DbxPath(path);
                bool fileExists = _fileSystem.Exists(dbxPath);
                file = fileExists ? _fileSystem.Open(dbxPath) : _fileSystem.Create(dbxPath);
                file.WriteStream.Write(data, 0, data.Length);
            }
            finally
            {
                if (file != null)
                    file.Close();
            }
        }