Esempio n. 1
0
        public async Task<bool> downloadFileAsync(CommonDescriptor cd)
        {
            OneDriveCommunicationParser odcp = new OneDriveCommunicationParser();
            WindowsDownloadManager wdm = new WindowsDownloadManager();
            var _oneDriveClient = InitializeAPI.oneDriveClient;
            //_oneDriveClient.AuthenticateAsync();

            var fileId = cd.FileID;
            
            string extension = odcp.getExtension(cd.FileType); 
            try
            {
                var contentStream = await _oneDriveClient.Drive.Items[fileId].Content.Request().GetAsync();
                wdm.downloadFile((MemoryStream)contentStream, cd.FileName + extension);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return false;
            }

            return true;


        }
Esempio n. 2
0
        public void getExtensionTest()
        {
            OneDriveCommunicationParser odcp = new OneDriveCommunicationParser();
            string s = odcp.getExtension("anything");

            if (s != null)
            {
                Assert.Fail();
            }
        }