Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<AnalysisLevel>latest</AnalysisLevel>
<AnalysisMode>Default</AnalysisMode>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>

<IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
</PropertyGroup>
Expand Down Expand Up @@ -59,28 +60,43 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<!--
<PackageReference Include="Roslynator.Analyzers" Version="4.3.0">
<PackageReference Include="Meziantou.Polyfill" Version="1.0.25">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="AsyncFixer" Version="1.6.0">
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="IDisposableAnalyzers" Version="4.0.6">
<PackageReference Include="Roslynator.Analyzers" Version="4.4.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Roslynator.Formatting.Analyzers" Version="4.4.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="ReflectionAnalyzers" Version="0.3.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Meziantou.Analyzer" Version="2.0.68">
<PackageReference Include="Nullable.Extended.Analyzer" Version="1.10.4539">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<!--
<PackageReference Include="Meziantou.Analyzer" Version="2.0.80">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="IDisposableAnalyzers" Version="4.0.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="AsyncFixer" Version="1.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
-->
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions FileUploader/FileUpload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private static async Task Main(string[] args)
Console.WriteLine(ex.Message);
}

if (IsWindows()) Console.ReadLine();
if (IsWindows()) _ = Console.ReadLine();
}

/// <summary>
Expand Down Expand Up @@ -96,7 +96,7 @@ private static async Task Run(IMinioClient minio)
.WithObject(objectName)
.WithFileName(filePath)
.WithContentType(contentType);
await minio.PutObjectAsync(putObjectArgs).ConfigureAwait(false);
_ = await minio.PutObjectAsync(putObjectArgs).ConfigureAwait(false);
Console.WriteLine($"\nSuccessfully uploaded {objectName}\n");
}
catch (Exception e)
Expand All @@ -106,6 +106,6 @@ private static async Task Run(IMinioClient minio)

// Added for Windows folks. Without it, the window, tests
// run in, dissappears as soon as the test code completes.
if (IsWindows()) Console.ReadLine();
if (IsWindows()) _ = Console.ReadLine();
}
}
2 changes: 1 addition & 1 deletion Minio.Examples/Cases/CustomRequestLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static async Task Run(IMinioClient minio)
{
Console.WriteLine("Running example for: set custom request logger");
minio.SetTraceOn(new MyRequestLogger());
await minio.ListBucketsAsync().ConfigureAwait(false);
_ = await minio.ListBucketsAsync().ConfigureAwait(false);
minio.SetTraceOff();
Console.WriteLine();
}
Expand Down
2 changes: 1 addition & 1 deletion Minio.Examples/Cases/FGetObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static async Task Run(IMinioClient minio,
.WithObject(objectName)
.WithFile(fileName)
.WithServerSideEncryption(sse);
await minio.GetObjectAsync(args).ConfigureAwait(false);
_ = await minio.GetObjectAsync(args).ConfigureAwait(false);
Console.WriteLine($"Downloaded the file {fileName} from bucket {bucketName}");
Console.WriteLine();
}
Expand Down
2 changes: 1 addition & 1 deletion Minio.Examples/Cases/FPutObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static async Task Run(IMinioClient minio,
.WithObject(objectName)
.WithContentType("application/octet-stream")
.WithFileName(fileName);
await minio.PutObjectAsync(args).ConfigureAwait(false);
_ = await minio.PutObjectAsync(args).ConfigureAwait(false);

Console.WriteLine($"Uploaded object {objectName} to bucket {bucketName}");
Console.WriteLine();
Expand Down
2 changes: 1 addition & 1 deletion Minio.Examples/Cases/GetObjectQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static async Task Run(IMinioClient minio,
.WithFile(fileName)
.WithMatchETag(matchEtag)
.WithModifiedSince(modifiedSince);
await minio.GetObjectAsync(args).ConfigureAwait(false);
_ = await minio.GetObjectAsync(args).ConfigureAwait(false);
Console.WriteLine(
$"Downloaded the file {fileName} for object {objectName} with given query parameters in bucket {bucketName}");
Console.WriteLine();
Expand Down
2 changes: 1 addition & 1 deletion Minio.Examples/Cases/GetObjectVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static async Task Run(IMinioClient minio,
.WithObject(objectName)
.WithVersionId(versionId)
.WithFile(fileName);
await minio.GetObjectAsync(args).ConfigureAwait(false);
_ = await minio.GetObjectAsync(args).ConfigureAwait(false);
Console.WriteLine(
$"Downloaded the file {fileName} for object {objectName} with version {versionId} in bucket {bucketName}");
Console.WriteLine();
Expand Down
6 changes: 3 additions & 3 deletions Minio.Examples/Cases/GetPartialObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static async Task Run(IMinioClient minio,
var statObjectArgs = new StatObjectArgs()
.WithBucket(bucketName)
.WithObject(objectName);
await minio.StatObjectAsync(statObjectArgs).ConfigureAwait(false);
_ = await minio.StatObjectAsync(statObjectArgs).ConfigureAwait(false);

// Get object content starting at byte position 1024 and length of 4096
var getObjectArgs = new GetObjectArgs()
Expand All @@ -45,7 +45,7 @@ public static async Task Run(IMinioClient minio,
.WithCallbackStream(async (stream, cancellationToken) =>
{
var fileStream = File.Create(fileName);
await stream.CopyToAsync(fileStream).ConfigureAwait(false);
await stream.CopyToAsync(fileStream, cancellationToken).ConfigureAwait(false);
await fileStream.DisposeAsync().ConfigureAwait(false);
var writtenInfo = new FileInfo(fileName);
var file_read_size = writtenInfo.Length;
Expand All @@ -55,7 +55,7 @@ public static async Task Run(IMinioClient minio,
$"Successfully downloaded object with requested offset and length {writtenInfo.Length} into file");
stream.Dispose();
});
await minio.GetObjectAsync(getObjectArgs).ConfigureAwait(false);
_ = await minio.GetObjectAsync(getObjectArgs).ConfigureAwait(false);
Console.WriteLine();
}
catch (Exception e)
Expand Down
12 changes: 6 additions & 6 deletions Minio.Examples/Cases/MyRequestLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ public void LogRequest(RequestToLog requestToLog, ResponseToLog responseToLog, d
{
var sb = new StringBuilder();

sb.AppendLine("My logger says:");
sb.Append("statusCode: ");
sb.AppendLine(responseToLog.StatusCode.ToString());
sb.AppendLine();
_ = sb.AppendLine("My logger says:");
_ = sb.Append("statusCode: ");
_ = sb.AppendLine(responseToLog.StatusCode.ToString());
_ = sb.AppendLine();

sb.AppendLine("Response: ");
sb.Append(responseToLog.Content);
_ = sb.AppendLine("Response: ");
_ = sb.Append(responseToLog.Content);

Console.WriteLine(sb.ToString());
}
Expand Down
2 changes: 1 addition & 1 deletion Minio.Examples/Cases/PutObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static async Task Run(IMinioClient minio,
.WithHeaders(metaData)
.WithProgress(progress)
.WithServerSideEncryption(sse);
await minio.PutObjectAsync(args).ConfigureAwait(false);
_ = await minio.PutObjectAsync(args).ConfigureAwait(false);

Console.WriteLine($"Uploaded object {objectName} to bucket {bucketName}");
Console.WriteLine();
Expand Down
2 changes: 1 addition & 1 deletion Minio.Examples/Cases/PutObjectWithTags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static async Task Run(IMinioClient minio,
.WithContentType("application/octet-stream")
.WithFileName(fileName)
.WithTagging(Tagging.GetObjectTags(tags));
await minio.PutObjectAsync(args).ConfigureAwait(false);
_ = await minio.PutObjectAsync(args).ConfigureAwait(false);

Console.WriteLine($"Uploaded object {objectName} to bucket {bucketName}");
Console.WriteLine();
Expand Down
6 changes: 3 additions & 3 deletions Minio.Examples/Cases/RetryPolicyObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static async Task Run(MinioClient minio,
2,
(r, i) => Console.WriteLine($"On retry #{i}. Result: {r.Exception?.Message}"));

minio.WithRetryPolicy(customPolicy);
_ = minio.WithRetryPolicy(customPolicy);

Console.WriteLine("Running example for API: RetryPolicyObject");

Expand All @@ -48,7 +48,7 @@ public static async Task Run(MinioClient minio,
.WithBucket("bad-bucket")
.WithObject("bad-file")
.WithCallbackStream(s => { });
await minio.GetObjectAsync(getObjectArgs).ConfigureAwait(false);
_ = await minio.GetObjectAsync(getObjectArgs).ConfigureAwait(false);
}
catch (BucketNotFoundException ex)
{
Expand All @@ -63,7 +63,7 @@ public static async Task Run(MinioClient minio,
}
finally
{
minio.WithRetryPolicy(null);
_ = minio.WithRetryPolicy(null);
}
}
}
14 changes: 7 additions & 7 deletions Minio.Examples/Cases/SelectObjectContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ public static async Task Run(IMinioClient minio,
Console.WriteLine("Running example for API: SelectObjectContentAsync");

var csvString = new StringBuilder();
csvString.AppendLine("Employee,Manager,Group");
csvString.AppendLine("Employee4,Employee2,500");
csvString.AppendLine("Employee3,Employee1,500");
csvString.AppendLine("Employee1,,1000");
csvString.AppendLine("Employee5,Employee1,500");
csvString.AppendLine("Employee2,Employee1,800");
_ = csvString.AppendLine("Employee,Manager,Group");
_ = csvString.AppendLine("Employee4,Employee2,500");
_ = csvString.AppendLine("Employee3,Employee1,500");
_ = csvString.AppendLine("Employee1,,1000");
_ = csvString.AppendLine("Employee5,Employee1,500");
_ = csvString.AppendLine("Employee2,Employee1,800");
ReadOnlyMemory<byte> csvBytes = Encoding.UTF8.GetBytes(csvString.ToString());
using var stream = csvBytes.AsStream();
var putObjectArgs = new PutObjectArgs()
.WithBucket(bucketName)
.WithObject(newObjectName)
.WithStreamData(stream)
.WithObjectSize(stream.Length);
await minio.PutObjectAsync(putObjectArgs).ConfigureAwait(false);
_ = await minio.PutObjectAsync(putObjectArgs).ConfigureAwait(false);

var queryType = QueryExpressionType.SQL;
var queryExpr = "select count(*) from s3object";
Expand Down
6 changes: 3 additions & 3 deletions Minio.Examples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static string GetRandomName()
{
var characters = "0123456789abcdefghijklmnopqrstuvwxyz";
var result = new StringBuilder(5);
for (var i = 0; i < 5; i++) result.Append(characters[rnd.Next(characters.Length)]);
for (var i = 0; i < 5; i++) _ = result.Append(characters[rnd.Next(characters.Length)]);
return "minio-dotnet-example-" + result;
}

Expand All @@ -69,7 +69,7 @@ public static async Task Main(string[] args)
{
port = int.Parse(endPoint.Substring(posColon + 1, endPoint.Length - posColon - 1), NumberStyles.Integer,
CultureInfo.InvariantCulture);
endPoint = endPoint.Substring(0, posColon);
endPoint = endPoint[..posColon];
}

accessKey = Environment.GetEnvironmentVariable("ACCESS_KEY");
Expand Down Expand Up @@ -280,6 +280,6 @@ await SetBucketReplication.Run(minioClient, bucketName, destBucketName, replicat
File.Delete(smallFileName);
File.Delete(bigFileName);

if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) Console.ReadLine();
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) _ = Console.ReadLine();
}
}
Loading