Commit Graph
45 Commits
Author SHA1 Message Date
Kenneth SkovhedeandGitHub 99d0cb3c57 Merge pull request #3953 from warwickmm/make_fields_readonly
Mark fields that don't need to be reassigned as readonly
2019-10-21 08:36:17 +02:00
Kenneth Hsu 2aa76881a5 Mark fields that don't need to be reassigned as readonly.
This makes it explicit at compile-time that these fields should not be
reassigned outside the constructor.
2019-10-19 13:59:22 -07:00
Kenneth Hsu afab61a05b Use pattern matching to simplify casts. 2019-10-19 10:15:38 -07:00
Kenneth Hsu 5ee8aad226 Disable warning about unused class. 2019-05-12 10:18:19 -07:00
Kenneth Hsu 6ebaa0ff53 Disable warning about unused constructor. 2019-05-12 10:18:19 -07:00
Kenneth Hsu cdf200a7e0 Disable warning about unused constructor. 2019-05-12 10:18:19 -07:00
Kenneth Hsu ffaaa55f2f Use AsyncHttpRequest to handle async HttpWebRequests.
For some reason, when using HttpWebRequest.GetRequestStreamAsync, the
Amazon Cloud Drive and Box backends would fail when attempting to upload
larger amounts of data (these are the only backends that use the
PostMultipartAsync method).

This fixes issue #3756.
2019-05-04 16:38:36 -07:00
Sean Templeton b02b19e683 Change Put method name to PutAsync 2019-03-17 18:28:45 -05:00
Sean Templeton b1c6e9798d Update Amazon Cloud Drive backend for async Put 2019-03-05 21:08:14 -06:00
Sean Templeton 0c122ff550 Change IBackend and IStreamingBackend to return Task for Put() 2019-03-03 21:43:10 -06:00
Kenneth Hsu 0a37b9075d Remove condition that always evaluates to true. 2018-12-15 14:23:02 -08:00
verhoek b2cc18426c Renamed Library.IO to Library.Common.IO.
Moved basic Platform functions to Library.Common.Platform.
Turned IO_OS into property within Library.Common.
2018-11-02 21:34:07 +01:00
verhoek 52916b935b Replaced System.IO.Path with wrapper call to Alphaleonis. 2018-10-28 12:08:09 +01:00
verhoek bc053df294 Moved basic IO helper functions to Library.IO. 2018-10-27 12:17:07 +02:00
Kenneth SkovhedeandGitHub 0ec49d3a87 Merge pull request #3393 from warwickmm/fix_append_dir_separator
Fix behavior of AppendDirSeparator utility method
2018-09-28 22:24:11 +02:00
Kenneth Hsu d4d1945faf Use utility method to append trailing slash.
This removes some duplicated code.
2018-09-22 10:19:45 -07:00
Kenneth Hsu 18aae7a5c4 Simplify method resolution by removing default parameters.
The previous implementations resulted in an overload being hidden by one
without a default parameter, making it unclear which method was being
called.  For example, consider the following signatures:

public MultipartItem(string content, string contenttype = null, string name = null, string filename = null)
public MultipartItem(string contenttype, string name = null, string filename = null)

From https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/named-and-optional-arguments,

> If two candidates are judged to be equally good, preference goes to a
> candidate that does not have optional parameters for which arguments
> were omitted in the call. This is a consequence of a general preference
> in overload resolution for candidates that have fewer parameters.
2018-09-20 19:30:49 -07:00
fgonzalez 74cd646fa6 Codacy changes 2018-06-25 09:08:15 +02:00
fgonzalez f4885a0ede Code cleaning 2018-06-22 09:06:28 +02:00
fgonzalez 3a8f958ba8 - No need to handle first attempt
- Default delay to 30s. 15s is not enough
2018-06-22 08:59:40 +02:00
fgonzalez 6ae5267e07 Case not covered 2018-06-21 16:52:28 +02:00
fgonzalez dc760d2895 Amazon cloud drive delay problems (amzcd-consistency-delay)
- time delay between instances of AmzCD class was not respected
2018-06-21 16:08:18 +02:00
Kenneth Hsu f12858e6a5 Mark fields that shouldn't be reassigned as readonly.
This makes it explicit at compile-time that these fields should not be
reassigned outside the constructor.
2018-05-25 10:04:52 -07:00
Kenneth Skovhede 842fd96543 Implemented a new logging system that is more transparent and allows a more granular way of picking log messages.
Added ID's to each log message and each exception to allow later introduction of a Knowledgebase service that explains each error in more detail.
2018-03-15 09:12:34 +01:00
Kenneth Skovhede bd863016fa Added support for returning multiple DNS names for cache invalidation.
Updated most backends to return the actual DNS names for cache invalidation.
2018-02-26 11:37:10 +01:00
Rune Henriksen fc77b476fc changed from NYI to null returns. Added check to skip DNS check if no DNSName is provided 2018-02-21 22:38:01 +01:00
Rune Henriksen 00292953c3 added DNSName getter on Backend interface and added NotImplementedException methods on each backend class 2018-02-18 00:18:44 +01:00
Kenneth Hsu 8810e0130d Make string comparisons use ordinal (binary) sort rules.
These string comparisons should not be culture-aware.
2017-11-26 11:19:54 -08:00
Tyler Gill 38883285ee Change IBackend.List() to return IEnumerable instead of List
By changing to IEnumerable, it is possible to iterate only a portion of the list, which is useful when not all entries are needed (e.g., when testing a connection).
All existing backends have been updated, and any which were able to be changed to yield return results in a straightforward way now do.
Many backends had a try/catch in the List() method. Due to the fact that yield returns can't be placed within a try/catch block, these have been refactored to either scope the try/catch to the parts that (should) be the only places throwing exceptions, so that exceptions are still caught and handled.
Note that lazy evaluation may cause some changes in behavior - exceptions that were previously thrown at the point of invokation of List() may now be thrown while it is being enumerated.
I believe this will not be problematic though, as the only well-known exception seems to be FolderMissingException, which should be thrown by Test(), but TestList() attempts to enumerate the list to force this exception.
Any places that require the legacy behavior can get it by simply converting the lazy enumerable to a List()
2017-09-25 23:17:45 -06:00
Tyler Gill 83a1dcfb64 Replace all instances of InvariantCultureIgnoreCase with OrdinalIgnoreCase in string comparisons.
InvariantCulture is useful when comparing / sorting human language strings in a culturely correct way. It handles things like accented letters in a way that makes sense to humans (e.g., 'a' should be sorted next to 'á', rather than after 'z').
Ordinal looks just at the raw code points of the characters. As such, it is recommended for use in cases when comparing system strings (file paths, command line parameters, config settings, etc.). Since it doesn't need to use the culture specific sorting rules, this method can often be faster.

For more information, see https://stackoverflow.com/questions/492799/difference-between-invariantculture-and-ordinal-string-comparison (and other related questions)
2017-09-18 23:55:08 -06:00
Kenneth Skovhede 5068e51ea7 Fixed the buffer avoidance flag for Delete in AMZCD. 2017-05-17 10:59:47 +02:00
Kenneth Skovhede 015a92343f Avoids inserting delays if the same operation is performed repeatedly on AMZCD.
This should help with #1893
2017-04-21 12:55:29 +02:00
Kenneth Skovhede a029890409 Implemented better default error messsages 2017-01-09 11:35:38 +01:00
AndersGron 5a03d65b97 Refactoring amazon cloud drive consistency delay
Refactoring amazon cloud drive consistency delay
2016-10-17 21:22:22 +02:00
AndersGron cf3c567144 Amazon cloud drive consistency delay
Use delay for Delete, Rename, GetCurrentDirectory and Get. Calculate the
delay from the completion of the operations instead of the start. I have
no idea if this is correct or not, but it seems to fix my issues with
consistency.
2016-10-16 22:07:32 +02:00
Kenneth Skovhede 0c68daff6c Fixed all whitespace to be 4 spaces instead of tabs 2016-09-15 11:39:27 +02:00
Xelio Cheong 62653c74f1 Fix the escaping of special characters of Amazon Cloud Drive API filtering
For filtering parameters, prepend \ to special characters + - & | ! ( ) { } [ ] ^ ' " ~ * ? : \ and space according to Amazon Cloud Drive API documentation, and encode space as %20 instead of + to avoid mistaking space as plus sign in filtering parameter.

Amazon Cloud Drive API documentation on escaping special characters of filtering parameters:
https://developer.amazon.com/public/apis/experience/cloud-drive/content/nodes#Filtering
2016-05-21 18:40:09 +08:00
Kenneth Skovhede 5f7e63ae78 Fixed the timeout issue 2016-04-16 17:51:44 +02:00
Kenneth Skovhede d0711011a2 Rewrote all WebRequest code to use AsyncHttpRequest, and normalized usage such that WebResponse objects are always correctly disposed. 2016-04-16 11:12:28 +02:00
Kenneth Skovhede 997ffca114 Implemented a list delay to work around the eventually consistent issue.
This fixes #1546
2016-03-13 18:01:01 +01:00
Kenneth Skovhede 1ff57b5578 Fixed an issue with Amazon Cloud Drive where deleted files were put in the root folder instead of being deleted.
Actually files cannot be deleted on Amazon Cloud Drive, but now they are put into trash instead of being put into the root folder.
This improves issue #1546
2016-03-13 17:25:05 +01:00
Kenneth Skovhede 766458da9b Removed unused variable 2016-01-12 09:52:30 +01:00
Kenneth Skovhede 98dc741dbd Minor cleanup for amzcd, and switched to the new multi-part upload method 2015-12-07 09:53:47 +01:00
Kenneth Skovhede 1708dfd581 Optimization for AmzCD: don't load files unless required. 2015-12-05 14:21:21 +01:00
Kenneth Skovhede 27c697eec6 Added Amazon Cloud Drive backend as requested in issue #598 2015-12-05 11:25:26 +01:00