Skip to content

Commit

Permalink
replaces the incorrect IsWindows() code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ersan Bozduman committed Dec 1, 2023
1 parent 16f697f commit 6dfc606
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 1 addition & 3 deletions FileUploader/FileUpload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

using System.Net;
using System.Runtime.InteropServices;
using Minio;
using Minio.DataModel.Args;

Expand All @@ -32,8 +31,7 @@ public static class FileUpload
{
private static bool IsWindows()
{
return System.OSPlatform.Windows;

return OperatingSystem.IsWindows();
}

private static async Task Main(string[] args)
Expand Down
4 changes: 1 addition & 3 deletions Minio.Examples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Net;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using Minio.DataModel;
Expand Down Expand Up @@ -282,7 +281,6 @@ await SetBucketReplication.Run(minioClient, bucketName, destBucketName, replicat
File.Delete(smallFileName);
File.Delete(bigFileName);

if (System.OSPlatform.Windows;) _ = Console.ReadLine();

if (OperatingSystem.IsWindows()) _ = Console.ReadLine();
}
}
8 changes: 5 additions & 3 deletions Minio.Functional.Tests/FunctionalTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Net;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
Expand Down Expand Up @@ -4817,7 +4816,10 @@ internal static async Task GetObject_3_OffsetLength_Tests(IMinioClient minio)
#else
await File.WriteAllLinesAsync(tempSource, line).ConfigureAwait(false);
#endif
using (var filestream = File.Open(tempSource, FileMode.Open, FileAccess.Read, FileShare.Read))
FileStream filestream = null;
await
using ((filestream = File.Open(tempSource, FileMode.Open, FileAccess.Read, FileShare.Read))
.ConfigureAwait(false))
{
var objectSize = (int)filestream.Length;
var expectedFileSize = lengthToBeRead;
Expand All @@ -4826,7 +4828,7 @@ internal static async Task GetObject_3_OffsetLength_Tests(IMinioClient minio)
{
expectedFileSize = objectSize - offsetToStartFrom;
var noOfCtrlChars = 1;
if (System.OSPlatform.Windows) noOfCtrlChars = 2;
if (OperatingSystem.IsWindows()) noOfCtrlChars = 2;

expectedContent = string.Concat(line)
.Substring(offsetToStartFrom, expectedFileSize - noOfCtrlChars);
Expand Down

0 comments on commit 6dfc606

Please sign in to comment.