public GoogleDriveStream(GoogleDriveStorage storage, Google.Apis.Drive.v2.Data.File file) { this.storage = storage; this.file = file; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(file.DownloadUrl)); request.Headers.Add("Authorization", storage.Credential.Token.TokenType + " " + storage.Credential.Token.AccessToken); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); if (response.StatusCode != HttpStatusCode.OK) { throw new Exception("Could not retrieve file stream"); } using (Stream responseStream = response.GetResponseStream()) responseStream.CopyTo(dataStream); dataStream.Seek(0, SeekOrigin.Begin); }
public GoogleDriveDirectory(GoogleDriveStorage storage, GoogleDriveDirectory parent, Google.Apis.Drive.v2.Data.File folder) { this.storage = storage; this.parent = parent; this.folder = folder; }
public GoogleDriveFile(GoogleDriveStorage storage, GoogleDriveDirectory parent, Google.Apis.Drive.v2.Data.File file) { this.storage = storage; this.parent = parent; this.file = file; }