From 92698f4309f1a65bfb213a3f8996987d01d33a45 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Thu, 24 Jun 2021 23:25:14 +0600 Subject: [PATCH 001/138] Add TemporaryFileExsitsTest() --- .../Platform.IO.Tests/TemporaryFileTests.cs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 csharp/Platform.IO.Tests/TemporaryFileTests.cs diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs new file mode 100644 index 0000000..1dc640d --- /dev/null +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -0,0 +1,30 @@ +using System; +using Xunit; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Platform.IO; +using System.IO; +using System.Diagnostics; + +namespace Platform.IO.Tests +{ + public class TemporaryFileTests + { + [Fact] + public void TemporaryFileExistsTest() + { + using Process process = new Process(); + process.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory; + process.StartInfo.UseShellExecute = false; + process.StartInfo.RedirectStandardOutput = true; + process.Start(); + + Console.WriteLine(process.StandardOutput.ReadToEnd()); + + process.WaitForExit(); + } + + } +} From 587c89685a3a2b60801b77368809f1e41d49c9ac Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Thu, 24 Jun 2021 23:27:31 +0600 Subject: [PATCH 002/138] The beginning --- csharp/Platform.IO/TemporaryFile.cs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 csharp/Platform.IO/TemporaryFile.cs diff --git a/csharp/Platform.IO/TemporaryFile.cs b/csharp/Platform.IO/TemporaryFile.cs new file mode 100644 index 0000000..9948837 --- /dev/null +++ b/csharp/Platform.IO/TemporaryFile.cs @@ -0,0 +1,28 @@ +using Platform.Disposables; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Platform.IO +{ + public class TemporaryFile : DisposableBase + { + public readonly string Filename; + + public TemporaryFile() + { + Filename = TemporaryFiles.UseNew(); + } + + protected override void Dispose(bool manual, bool wasDisposed) + { + if (!wasDisposed) + { + File.Delete(Filename); + } + } + } +} From 206978b89c17d166cbc5ad1bac585da22536a482 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Thu, 24 Jun 2021 23:27:46 +0600 Subject: [PATCH 003/138] The beginning --- csharp/Platform.IO/TemporaryFiles.cs | 59 ++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 csharp/Platform.IO/TemporaryFiles.cs diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs new file mode 100644 index 0000000..4dadc9b --- /dev/null +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace Platform.IO +{ + class TemporaryFiles + { + private const string UserFilesListFileNamePrefix = ".used-temporary-files.txt"; + static private readonly object UsedFilesListLock = new object(); + + private static string GetUsedFilesListFilename() + { + return Assembly.GetEntryAssembly().Location + UserFilesListFileNamePrefix; + } + + private static void AddToUsedFilesList(string filename) + { + lock (UsedFilesListLock) + { + using var writer = File.AppendText(GetUsedFilesListFilename()); + writer.WriteLine(filename); + } + } + + public static string UseNew() + { + var filename = Path.GetTempFileName(); + AddToUsedFilesList(filename); + return filename; + } + + public static void DeleteAllPreviouslyUsed() + { + lock (UsedFilesListLock) + { + var usedFilesListFilename = GetUsedFilesListFilename(); + + if (!File.Exists(usedFilesListFilename)) return; + + using (var listFile = File.Open(usedFilesListFilename, FileMode.Open)) + using (var reader = new StreamReader(listFile)) + { + string tempFileToDelete; + while ((tempFileToDelete = reader.ReadLine()) != null) + { + if (File.Exists(tempFileToDelete)) File.Delete(tempFileToDelete); + } + } + + using (File.Open(usedFilesListFilename, FileMode.Truncate)) { } + } + } + } +} From 83da4679a8e381713b88ab1001d42158e61e0bac Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Thu, 24 Jun 2021 23:28:03 +0600 Subject: [PATCH 004/138] Add console app for tests --- csharp/TemporaryFileTest/Program.cs | 19 +++++++++++++++++++ .../TemporaryFileTest.csproj | 12 ++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 csharp/TemporaryFileTest/Program.cs create mode 100644 csharp/TemporaryFileTest/TemporaryFileTest.csproj diff --git a/csharp/TemporaryFileTest/Program.cs b/csharp/TemporaryFileTest/Program.cs new file mode 100644 index 0000000..7b704c0 --- /dev/null +++ b/csharp/TemporaryFileTest/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Platform.IO; +using System.IO; + +namespace TemporaryFileTest +{ + class Program + { + static void Main(string[] args) + { + TemporaryFile tempFile = new TemporaryFile(); + Console.WriteLine($"File exists? {File.Exists(tempFile.Filename)}"); + } + } +} diff --git a/csharp/TemporaryFileTest/TemporaryFileTest.csproj b/csharp/TemporaryFileTest/TemporaryFileTest.csproj new file mode 100644 index 0000000..ab44ca3 --- /dev/null +++ b/csharp/TemporaryFileTest/TemporaryFileTest.csproj @@ -0,0 +1,12 @@ + + + + Exe + net5.0 + + + + + + + From c707ffc6b243bd7f2dfdf7f1f2234a408cc366f6 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Mon, 28 Jun 2021 11:35:38 +0600 Subject: [PATCH 005/138] Add XUnit output --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 1dc640d..564bfa6 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -7,11 +7,17 @@ using Platform.IO; using System.IO; using System.Diagnostics; +using Xunit.Abstractions; namespace Platform.IO.Tests { public class TemporaryFileTests { + private readonly ITestOutputHelper output; + public TemporaryFileTests(ITestOutputHelper output) + { + this.output = output; + } [Fact] public void TemporaryFileExistsTest() { From 01dabe75b9e35423fc3d3e2f30c773a3cd438747 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Mon, 28 Jun 2021 16:14:44 +0600 Subject: [PATCH 006/138] Output file existence and path --- csharp/TemporaryFileTest/Program.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/csharp/TemporaryFileTest/Program.cs b/csharp/TemporaryFileTest/Program.cs index 7b704c0..aef82ae 100644 --- a/csharp/TemporaryFileTest/Program.cs +++ b/csharp/TemporaryFileTest/Program.cs @@ -13,7 +13,8 @@ class Program static void Main(string[] args) { TemporaryFile tempFile = new TemporaryFile(); - Console.WriteLine($"File exists? {File.Exists(tempFile.Filename)}"); + Console.WriteLine(File.Exists(tempFile.Filename)); + Console.WriteLine(tempFile.Filename); } } } From 27383188219c8b7ed231b28e22fb92257bf25e35 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Mon, 28 Jun 2021 16:14:58 +0600 Subject: [PATCH 007/138] Add TemporaryFileTest project --- Platform.IO.sln | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Platform.IO.sln b/Platform.IO.sln index ab7ac1a..2de15e4 100644 --- a/Platform.IO.sln +++ b/Platform.IO.sln @@ -5,7 +5,9 @@ VisualStudioVersion = 16.0.29102.190 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Platform.IO", "csharp\Platform.IO\Platform.IO.csproj", "{E301688F-3737-4455-B5FC-A654A6A6D5A9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Platform.IO.Tests", "csharp\Platform.IO.Tests\Platform.IO.Tests.csproj", "{A3ACEE51-4281-4024-8558-24E5ED8D5E1A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Platform.IO.Tests", "csharp\Platform.IO.Tests\Platform.IO.Tests.csproj", "{A3ACEE51-4281-4024-8558-24E5ED8D5E1A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TemporaryFileTest", "csharp\TemporaryFileTest\TemporaryFileTest.csproj", "{DCA635ED-E76E-4548-BE1F-6B87E64E5AB2}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,6 +23,10 @@ Global {A3ACEE51-4281-4024-8558-24E5ED8D5E1A}.Debug|Any CPU.Build.0 = Debug|Any CPU {A3ACEE51-4281-4024-8558-24E5ED8D5E1A}.Release|Any CPU.ActiveCfg = Release|Any CPU {A3ACEE51-4281-4024-8558-24E5ED8D5E1A}.Release|Any CPU.Build.0 = Release|Any CPU + {DCA635ED-E76E-4548-BE1F-6B87E64E5AB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DCA635ED-E76E-4548-BE1F-6B87E64E5AB2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DCA635ED-E76E-4548-BE1F-6B87E64E5AB2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DCA635ED-E76E-4548-BE1F-6B87E64E5AB2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From f0a7d018ad5cfbd900c1b7f5922e3a466791314c Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Mon, 28 Jun 2021 16:25:40 +0600 Subject: [PATCH 008/138] Output only path --- csharp/TemporaryFileTest/Program.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/csharp/TemporaryFileTest/Program.cs b/csharp/TemporaryFileTest/Program.cs index aef82ae..5eb7498 100644 --- a/csharp/TemporaryFileTest/Program.cs +++ b/csharp/TemporaryFileTest/Program.cs @@ -13,7 +13,6 @@ class Program static void Main(string[] args) { TemporaryFile tempFile = new TemporaryFile(); - Console.WriteLine(File.Exists(tempFile.Filename)); Console.WriteLine(tempFile.Filename); } } From 150e49bc6f92fc12642debddb82c42cd276bcdba Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Mon, 28 Jun 2021 16:26:05 +0600 Subject: [PATCH 009/138] Check file existence and disposing --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 564bfa6..709fe7e 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -19,17 +19,19 @@ public TemporaryFileTests(ITestOutputHelper output) this.output = output; } [Fact] - public void TemporaryFileExistsTest() + public void TemporaryFileTest() { using Process process = new Process(); - process.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory; + process.StartInfo.FileName = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..\..\TemporaryFileTest\bin\Debug\net5.0\TemporaryFileTest.exe")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.Start(); - Console.WriteLine(process.StandardOutput.ReadToEnd()); - + string path = process.StandardOutput.ReadLine(); + Assert.True(File.Exists(path)); process.WaitForExit(); + + Assert.False(File.Exists(path)); } } From 299d658cce51c49edf91a202d24f488aca00f31e Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Mon, 28 Jun 2021 22:27:21 +0600 Subject: [PATCH 010/138] Update package --- csharp/Platform.IO/Platform.IO.csproj | 77 +++++++++++++-------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/csharp/Platform.IO/Platform.IO.csproj b/csharp/Platform.IO/Platform.IO.csproj index 2b668c1..9382b7d 100644 --- a/csharp/Platform.IO/Platform.IO.csproj +++ b/csharp/Platform.IO/Platform.IO.csproj @@ -1,46 +1,45 @@  - - LinksPlatform's Platform.IO Class Library - Konstantin Diachenko - Platform.IO - 0.2.1 - Konstantin Diachenko - net472;netstandard2.0;netstandard2.1 - Platform.IO - Platform.IO - LinksPlatform;IO;ConsoleCancellation;ConsoleHelpers;FileHelpers;StreamExtensions - https://raw.githubusercontent.com/linksplatform/Documentation/18469f4d033ee9a5b7b84caab9c585acab2ac519/doc/Avatar-rainbow-icon-64x64.png - https://linksplatform.github.io/IO - MIT - true - git - git://github.com/linksplatform/IO - false - false - true - true - true - true - snupkg - latest - Platform.Threading dependency updated from 0.2.0 to 0.2.1. -Platform.Unsafe dependency updated from 0.4.0 to 0.4.1. -ConsoleHelpers.Debug method with single string argument added. -Refactoring, issues fix. - + + LinksPlatform's Platform.IO Class Library + Konstantin Diachenko + Platform.IO + 0.2.2 + Konstantin Diachenko + net472;netstandard2.0;netstandard2.1 + Platform.IO + Platform.IO + LinksPlatform;IO;ConsoleCancellation;ConsoleHelpers;FileHelpers;StreamExtensions + https://raw.githubusercontent.com/linksplatform/Documentation/18469f4d033ee9a5b7b84caab9c585acab2ac519/doc/Avatar-rainbow-icon-64x64.png + https://linksplatform.github.io/IO + MIT + true + git + git://github.com/linksplatform/IO + false + false + true + true + true + true + snupkg + latest + + TemporaryFiles, TemporaryFile classes are added. + + - - - + + + - - - + + + - - - - + + + + From 74f6533fd7c11cb5cec825fbc83579a27503105d Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 12:00:52 +0600 Subject: [PATCH 011/138] Update FileName --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 709fe7e..3890770 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -22,7 +22,7 @@ public TemporaryFileTests(ITestOutputHelper output) public void TemporaryFileTest() { using Process process = new Process(); - process.StartInfo.FileName = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..\..\TemporaryFileTest\bin\Debug\net5.0\TemporaryFileTest.exe")); + process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), @"..\..\..\..\TemporaryFileTest\bin\Debug\net5.0\TemporaryFileTest.exe")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.Start(); From 83228b11bdd23a00ea752b43da454924bb2259ed Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 12:05:12 +0600 Subject: [PATCH 012/138] Just use relative path for process filename --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 3890770..c9628d7 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -22,7 +22,7 @@ public TemporaryFileTests(ITestOutputHelper output) public void TemporaryFileTest() { using Process process = new Process(); - process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), @"..\..\..\..\TemporaryFileTest\bin\Debug\net5.0\TemporaryFileTest.exe")); + process.StartInfo.FileName = @"..\..\..\..\TemporaryFileTest\bin\Debug\net5.0\TemporaryFileTest.exe"; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.Start(); From 9fd5b0cd829cc9906b6ae780d2f2e81e362b7d0c Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 18:29:35 +0600 Subject: [PATCH 013/138] Output exe directory content --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index c9628d7..5078e48 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -8,6 +8,7 @@ using System.IO; using System.Diagnostics; using Xunit.Abstractions; +using System.Runtime.InteropServices; namespace Platform.IO.Tests { @@ -21,11 +22,16 @@ public TemporaryFileTests(ITestOutputHelper output) [Fact] public void TemporaryFileTest() { + bool isWindows = System.Runtime.InteropServices.RuntimeInformation + .IsOSPlatform(OSPlatform.Windows); + bool isLinux = System.Runtime.InteropServices.RuntimeInformation + .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = @"..\..\..\..\TemporaryFileTest\bin\Debug\net5.0\TemporaryFileTest.exe"; + //process.StartInfo.FileName = @"..\..\..\..\TemporaryFileTest\bin\Debug\net5.0\TemporaryFileTest.exe"; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; - process.Start(); + Process.Start(@"cd ..\..\..\..\TemporaryFileTest\bin\Debug\net5.0 && ls"); + output.WriteLine(process.StartInfo.FileName); string path = process.StandardOutput.ReadLine(); Assert.True(File.Exists(path)); From 3866b526e1af59757dc09c405f34e0e0c30fa439 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 18:37:06 +0600 Subject: [PATCH 014/138] Output if file exists --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 5078e48..386d7e1 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,11 +27,12 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - //process.StartInfo.FileName = @"..\..\..\..\TemporaryFileTest\bin\Debug\net5.0\TemporaryFileTest.exe"; + process.StartInfo.FileName = @"..\..\..\..\TemporaryFileTest\bin\Debug\net5.0\TemporaryFileTest.exe"; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; - Process.Start(@"cd ..\..\..\..\TemporaryFileTest\bin\Debug\net5.0 && ls"); + process.Start(); output.WriteLine(process.StartInfo.FileName); + output.WriteLine($"{File.Exists(process.StartInfo.FileName)}"); string path = process.StandardOutput.ReadLine(); Assert.True(File.Exists(path)); From 70fad1b19e114f413b2f795837a24365159d8f9b Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 18:38:12 +0600 Subject: [PATCH 015/138] Do not start process --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 386d7e1..a24615a 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -30,7 +30,7 @@ public void TemporaryFileTest() process.StartInfo.FileName = @"..\..\..\..\TemporaryFileTest\bin\Debug\net5.0\TemporaryFileTest.exe"; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; - process.Start(); + //process.Start(); output.WriteLine(process.StartInfo.FileName); output.WriteLine($"{File.Exists(process.StartInfo.FileName)}"); From 5927044ccfc8e279a2cc4dd1d3e415e61b69d744 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 18:59:56 +0600 Subject: [PATCH 016/138] Use path combine --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index a24615a..9cebeb5 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,7 +27,7 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = @"..\..\..\..\TemporaryFileTest\bin\Debug\net5.0\TemporaryFileTest.exe"; + process.StartInfo.FileName = Path.Combine(Directory.GetCurrentDirectory(), @"..\..\..\..\TemporaryFileTest\bin\Debug\net5.0\TemporaryFileTest.exe"); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; //process.Start(); From 750fb419ca35db55c616e71776727e182235f953 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 19:02:17 +0600 Subject: [PATCH 017/138] Use forward slashes in the path --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 9cebeb5..56f4a02 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,7 +27,7 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = Path.Combine(Directory.GetCurrentDirectory(), @"..\..\..\..\TemporaryFileTest\bin\Debug\net5.0\TemporaryFileTest.exe"); + process.StartInfo.FileName = Path.Combine(Directory.GetCurrentDirectory(), @"../../../../TemporaryFileTest\bin\Debug\net5.0\TemporaryFileTest.exe"); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; //process.Start(); From 8db929632e3ebb0b335d73e676a66b7424239bee Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 19:04:43 +0600 Subject: [PATCH 018/138] Use forward slashes in the path --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 56f4a02..4da1f64 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,7 +27,7 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = Path.Combine(Directory.GetCurrentDirectory(), @"../../../../TemporaryFileTest\bin\Debug\net5.0\TemporaryFileTest.exe"); + process.StartInfo.FileName = Path.Combine(Directory.GetCurrentDirectory(), "../../../../TemporaryFileTest/bin/Debug/net5.0/TemporaryFileTest.exe"); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; //process.Start(); From 2296690e0101adb2db0ae3a4752b2edfcff4e678 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 19:18:35 +0600 Subject: [PATCH 019/138] Use string array in path combine --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 4da1f64..fe94216 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,7 +27,7 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = Path.Combine(Directory.GetCurrentDirectory(), "../../../../TemporaryFileTest/bin/Debug/net5.0/TemporaryFileTest.exe"); + process.StartInfo.FileName = Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5.0", "TemporaryFileTest.exe"); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; //process.Start(); From 14839a6558b8022245dfebdfadf7d6c8ecff18e2 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 19:21:11 +0600 Subject: [PATCH 020/138] Add ./ in path combine --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index fe94216..0620d68 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,7 +27,7 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5.0", "TemporaryFileTest.exe"); + process.StartInfo.FileName = Path.Combine(Directory.GetCurrentDirectory(), "./", "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5.0", "TemporaryFileTest.exe"); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; //process.Start(); From 809c1e0e48020dc4ecb92a6e3724d3839a4a854f Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 19:21:34 +0600 Subject: [PATCH 021/138] Use . instead of ./ in path combine --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 0620d68..cec0f5e 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,7 +27,7 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = Path.Combine(Directory.GetCurrentDirectory(), "./", "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5.0", "TemporaryFileTest.exe"); + process.StartInfo.FileName = Path.Combine(Directory.GetCurrentDirectory(), ".", "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5.0", "TemporaryFileTest.exe"); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; //process.Start(); From b288a542b1c4bc02693e6d2cf6c88939594fe5ca Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 19:27:53 +0600 Subject: [PATCH 022/138] Use GetFullPath --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index cec0f5e..873a998 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,7 +27,7 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = Path.Combine(Directory.GetCurrentDirectory(), ".", "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5.0", "TemporaryFileTest.exe"); + process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5.0", "TemporaryFileTest.exe")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; //process.Start(); From cade8e87f929fe6b305603edb17af2ba7e339b7b Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 19:30:03 +0600 Subject: [PATCH 023/138] Do not use exe --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 873a998..e5793e3 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,7 +27,7 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5.0", "TemporaryFileTest.exe")); + process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5.0", "TemporaryFileTest")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; //process.Start(); From 40cf9c93747cae5080748764e7e939a4cf488c08 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 19:36:33 +0600 Subject: [PATCH 024/138] Output build directory files --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index e5793e3..a25e98c 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,12 +27,16 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5.0", "TemporaryFileTest")); + process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5.0")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; //process.Start(); output.WriteLine(process.StartInfo.FileName); output.WriteLine($"{File.Exists(process.StartInfo.FileName)}"); + foreach (var item in Directory.GetFiles(process.StartInfo.FileName)) + { + output.WriteLine(item); + } string path = process.StandardOutput.ReadLine(); Assert.True(File.Exists(path)); From 1851aa251dc30374f3c586b2dcff81057d47a7c7 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 19:41:29 +0600 Subject: [PATCH 025/138] Output TemporaryFileTest directory files --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index a25e98c..f83faa1 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,7 +27,7 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5.0")); + process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; //process.Start(); From 620fb0961b280bc6ff0d219228c8740b9826020a Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 22:55:34 +0600 Subject: [PATCH 026/138] Output files from net5.0 build folder --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index f83faa1..a25e98c 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,7 +27,7 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest")); + process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5.0")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; //process.Start(); From 6cf45993e6a232bfcac983aa0291aeb23584cff2 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 23:13:08 +0600 Subject: [PATCH 027/138] Output TemporaryFileTest files --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index a25e98c..f83faa1 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,7 +27,7 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5.0")); + process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; //process.Start(); From c9ff3da1c6684cc218014ec83e5ba91e2794718e Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 23:15:13 +0600 Subject: [PATCH 028/138] Output directories --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index f83faa1..bf6b372 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -33,7 +33,7 @@ public void TemporaryFileTest() //process.Start(); output.WriteLine(process.StartInfo.FileName); output.WriteLine($"{File.Exists(process.StartInfo.FileName)}"); - foreach (var item in Directory.GetFiles(process.StartInfo.FileName)) + foreach (var item in Directory.GetDirectories(process.StartInfo.FileName)) { output.WriteLine(item); } From 00bec414ab3adeab45a133c18c3b72ad5b32e5a1 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 23:17:15 +0600 Subject: [PATCH 029/138] Output obj directory files --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index bf6b372..5760879 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,13 +27,13 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest")); + process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "obj")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; //process.Start(); output.WriteLine(process.StartInfo.FileName); output.WriteLine($"{File.Exists(process.StartInfo.FileName)}"); - foreach (var item in Directory.GetDirectories(process.StartInfo.FileName)) + foreach (var item in Directory.GetFiles(process.StartInfo.FileName)) { output.WriteLine(item); } From 763fade605bd927090f60316cd9e9a6594973401 Mon Sep 17 00:00:00 2001 From: FreePhoenix888 <66206278+FreePhoenix888@users.noreply.github.com> Date: Tue, 29 Jun 2021 23:35:33 +0600 Subject: [PATCH 030/138] Add dotnet build --- .github/workflows/CD.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index b8e14b0..05ecfe5 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -19,7 +19,9 @@ jobs: with: submodules: true - name: Test - run: dotnet test -c Release -f net5 + run: | + dotnet build + dotnet test -c Release -f net5 - name: Generate PDF with CSharp code if: github.event_name == 'push' run: | From 9656bcb671dd93555cc4d2569efa6d2cef498410 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 23:36:52 +0600 Subject: [PATCH 031/138] Output directories --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 5760879..bf6b372 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,13 +27,13 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "obj")); + process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; //process.Start(); output.WriteLine(process.StartInfo.FileName); output.WriteLine($"{File.Exists(process.StartInfo.FileName)}"); - foreach (var item in Directory.GetFiles(process.StartInfo.FileName)) + foreach (var item in Directory.GetDirectories(process.StartInfo.FileName)) { output.WriteLine(item); } From bdf9c4e68e7d8bf907e8e4d178e5bc524a67c91e Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 23:46:30 +0600 Subject: [PATCH 032/138] Output build files --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index bf6b372..b47c729 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,13 +27,13 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest")); + process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; //process.Start(); output.WriteLine(process.StartInfo.FileName); output.WriteLine($"{File.Exists(process.StartInfo.FileName)}"); - foreach (var item in Directory.GetDirectories(process.StartInfo.FileName)) + foreach (var item in Directory.GetFiles(process.StartInfo.FileName)) { output.WriteLine(item); } From af7e9006d41cb006115fd4f38aa5eb6fd64f8370 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 23:48:25 +0600 Subject: [PATCH 033/138] Output bin files --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index b47c729..f41034a 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,7 +27,7 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5")); + process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; //process.Start(); From eb8bf75d1104529382fc866a29a95e22cc2249a5 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 23:54:15 +0600 Subject: [PATCH 034/138] Output files in all project subdirectories --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index f41034a..1ece0f7 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -33,7 +33,7 @@ public void TemporaryFileTest() //process.Start(); output.WriteLine(process.StartInfo.FileName); output.WriteLine($"{File.Exists(process.StartInfo.FileName)}"); - foreach (var item in Directory.GetFiles(process.StartInfo.FileName)) + foreach (var item in Directory.GetFiles(process.StartInfo.FileName, "*.*", SearchOption.AllDirectories)) { output.WriteLine(item); } From bc78e3bd92246a8bf8f43018cbc666a9fac9e2e2 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Tue, 29 Jun 2021 23:58:50 +0600 Subject: [PATCH 035/138] Start build executale file --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 1ece0f7..8e2aed1 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,10 +27,10 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin")); + process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "bin", "Debug", "net5.0", "TemporaryFileTest")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; - //process.Start(); + process.Start(); output.WriteLine(process.StartInfo.FileName); output.WriteLine($"{File.Exists(process.StartInfo.FileName)}"); foreach (var item in Directory.GetFiles(process.StartInfo.FileName, "*.*", SearchOption.AllDirectories)) From 38e748dabed3a23c9c24d2e0f7fedaf974631a13 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 00:00:58 +0600 Subject: [PATCH 036/138] Check executable file existence --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 8e2aed1..a553348 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -30,13 +30,12 @@ public void TemporaryFileTest() process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "bin", "Debug", "net5.0", "TemporaryFileTest")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; - process.Start(); + output.WriteLine(""); output.WriteLine(process.StartInfo.FileName); output.WriteLine($"{File.Exists(process.StartInfo.FileName)}"); - foreach (var item in Directory.GetFiles(process.StartInfo.FileName, "*.*", SearchOption.AllDirectories)) - { - output.WriteLine(item); - } + output.WriteLine(""); + process.Start(); + string path = process.StandardOutput.ReadLine(); Assert.True(File.Exists(path)); From 6752e426b4579eb1d71d1b892e45a6377e2482bd Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 00:04:41 +0600 Subject: [PATCH 037/138] Remove bin twink in path --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index a553348..e7932c6 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -27,7 +27,7 @@ public void TemporaryFileTest() bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); - process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "bin", "Debug", "net5.0", "TemporaryFileTest")); + process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5.0", "TemporaryFileTest")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; output.WriteLine(""); From 684d05185301e914fe801e760cfd20965e5d8085 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 10:14:26 +0600 Subject: [PATCH 038/138] Remove output. Format --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index e7932c6..9887156 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -14,29 +14,15 @@ namespace Platform.IO.Tests { public class TemporaryFileTests { - private readonly ITestOutputHelper output; - public TemporaryFileTests(ITestOutputHelper output) - { - this.output = output; - } [Fact] public void TemporaryFileTest() { - bool isWindows = System.Runtime.InteropServices.RuntimeInformation - .IsOSPlatform(OSPlatform.Windows); - bool isLinux = System.Runtime.InteropServices.RuntimeInformation - .IsOSPlatform(OSPlatform.Linux); using Process process = new Process(); process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5.0", "TemporaryFileTest")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; - output.WriteLine(""); - output.WriteLine(process.StartInfo.FileName); - output.WriteLine($"{File.Exists(process.StartInfo.FileName)}"); - output.WriteLine(""); process.Start(); - string path = process.StandardOutput.ReadLine(); Assert.True(File.Exists(path)); process.WaitForExit(); @@ -45,4 +31,5 @@ public void TemporaryFileTest() } } + } From 9b4f3cf2aa01553356ccd6bbe3a45fe418c36301 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 10:16:24 +0600 Subject: [PATCH 039/138] Format --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 9887156..94fbfff 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -29,7 +29,5 @@ public void TemporaryFileTest() Assert.False(File.Exists(path)); } - } - -} +} \ No newline at end of file From ef2f0b349c9e7a68fc1b0d01bb6ba2852f3455e1 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 10:34:45 +0600 Subject: [PATCH 040/138] Add class XML doc --- csharp/Platform.IO/TemporaryFile.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/csharp/Platform.IO/TemporaryFile.cs b/csharp/Platform.IO/TemporaryFile.cs index 9948837..cc4fb9f 100644 --- a/csharp/Platform.IO/TemporaryFile.cs +++ b/csharp/Platform.IO/TemporaryFile.cs @@ -8,6 +8,10 @@ namespace Platform.IO { + /// + /// Represents a self-deleting temporary file. + /// Представляет самоудаляющийся временный файл. + /// public class TemporaryFile : DisposableBase { public readonly string Filename; From 3b678b4e576cbd4deed2c0e7341ad4ece29870d3 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 10:35:07 +0600 Subject: [PATCH 041/138] Add Filename field XML doc --- csharp/Platform.IO/TemporaryFile.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/csharp/Platform.IO/TemporaryFile.cs b/csharp/Platform.IO/TemporaryFile.cs index cc4fb9f..ee03951 100644 --- a/csharp/Platform.IO/TemporaryFile.cs +++ b/csharp/Platform.IO/TemporaryFile.cs @@ -14,6 +14,10 @@ namespace Platform.IO /// public class TemporaryFile : DisposableBase { + /// + /// Temp file path. + /// Путь к временному файлу. + /// public readonly string Filename; public TemporaryFile() From 374d346bf72df3f9edf50e1d272e0a55f77fd7b6 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 10:40:17 +0600 Subject: [PATCH 042/138] Update Filename field XML doc --- csharp/Platform.IO/TemporaryFile.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFile.cs b/csharp/Platform.IO/TemporaryFile.cs index ee03951..660a294 100644 --- a/csharp/Platform.IO/TemporaryFile.cs +++ b/csharp/Platform.IO/TemporaryFile.cs @@ -15,8 +15,8 @@ namespace Platform.IO public class TemporaryFile : DisposableBase { /// - /// Temp file path. - /// Путь к временному файлу. + /// Gets a temp file path. + /// Возвращает путь к временному файлу. /// public readonly string Filename; From b06519cf76c1c113ff40fb94790fbda2390119f5 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 10:41:45 +0600 Subject: [PATCH 043/138] Add TemporaryFile() XML doc --- csharp/Platform.IO/TemporaryFile.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/csharp/Platform.IO/TemporaryFile.cs b/csharp/Platform.IO/TemporaryFile.cs index 660a294..fd66b1b 100644 --- a/csharp/Platform.IO/TemporaryFile.cs +++ b/csharp/Platform.IO/TemporaryFile.cs @@ -20,6 +20,10 @@ public class TemporaryFile : DisposableBase /// public readonly string Filename; + /// + /// Gets a instance. + /// Возвращает экземпляр класса . + /// public TemporaryFile() { Filename = TemporaryFiles.UseNew(); From d20c61f698ae5124321f24431456ef253407b285 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 10:43:56 +0600 Subject: [PATCH 044/138] Add Dispose() XML doc --- csharp/Platform.IO/TemporaryFile.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/csharp/Platform.IO/TemporaryFile.cs b/csharp/Platform.IO/TemporaryFile.cs index fd66b1b..8c8abe9 100644 --- a/csharp/Platform.IO/TemporaryFile.cs +++ b/csharp/Platform.IO/TemporaryFile.cs @@ -29,6 +29,18 @@ public TemporaryFile() Filename = TemporaryFiles.UseNew(); } + /// + /// Deletes the temp file. + /// Удаляет временный файл. + /// + /// + /// A value that determines whether the disposal was triggered manually (by the developer's code) or was executed automatically without an explicit indication from a developer. + /// Значение типа , определяющие было ли высвобождение вызвано вручную (кодом разработчика) или же выполнилось автоматически без явного указания со стороны разработчика. + /// + /// + /// A value that determines whether the was released before a call to this method. + /// Значение типа , определяющие были ли освобождены ресурсы, используемые до вызова данного метода. + /// protected override void Dispose(bool manual, bool wasDisposed) { if (!wasDisposed) From fd286f7a7c864bb872be6602d1f4d378c4e8c224 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 10:45:52 +0600 Subject: [PATCH 045/138] Add class XML doc --- csharp/Platform.IO/TemporaryFiles.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 4dadc9b..9724bc3 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -8,6 +8,10 @@ namespace Platform.IO { + /// + /// Represents the set of helper methods to work with temp files. + /// Представляет набор вспомогательных методов для работы с временными файлами. + /// class TemporaryFiles { private const string UserFilesListFileNamePrefix = ".used-temporary-files.txt"; From c49f1ef4b6b2520e7cc223261e1d01474c0279c7 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 10:50:05 +0600 Subject: [PATCH 046/138] Add output --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 94fbfff..56e5778 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -14,6 +14,12 @@ namespace Platform.IO.Tests { public class TemporaryFileTests { + private readonly ITestOutputHelper output; + public TemporaryFileTests(ITestOutputHelper output) + { + this.output = output; + } + [Fact] public void TemporaryFileTest() { From 8b9d77588283388bf9d56d6d5087246ad8432b24 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 11:09:59 +0600 Subject: [PATCH 047/138] Remove output --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 56e5778..9ca334e 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -14,12 +14,6 @@ namespace Platform.IO.Tests { public class TemporaryFileTests { - private readonly ITestOutputHelper output; - public TemporaryFileTests(ITestOutputHelper output) - { - this.output = output; - } - [Fact] public void TemporaryFileTest() { @@ -30,6 +24,7 @@ public void TemporaryFileTest() process.Start(); string path = process.StandardOutput.ReadLine(); + Assert.True(File.Exists(path)); process.WaitForExit(); From 446d338ff4bde48498508dba2c0e87c9ca98f92f Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 11:10:11 +0600 Subject: [PATCH 048/138] Change net5.0 to net5 --- csharp/TemporaryFileTest/TemporaryFileTest.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/TemporaryFileTest/TemporaryFileTest.csproj b/csharp/TemporaryFileTest/TemporaryFileTest.csproj index ab44ca3..0c0c485 100644 --- a/csharp/TemporaryFileTest/TemporaryFileTest.csproj +++ b/csharp/TemporaryFileTest/TemporaryFileTest.csproj @@ -2,7 +2,7 @@ Exe - net5.0 + net5 From 403dc4c48c456b0e4a35aaf3449438cc04bf1da7 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 11:39:43 +0600 Subject: [PATCH 049/138] Add GetUsedFilesListFilename() XML doc --- csharp/Platform.IO/TemporaryFiles.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 9724bc3..bb31f77 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -17,6 +17,14 @@ class TemporaryFiles private const string UserFilesListFileNamePrefix = ".used-temporary-files.txt"; static private readonly object UsedFilesListLock = new object(); + /// + /// Returns used files list file location. + /// Возвращает местоположение файла содержащего лист использованных файлов. + /// + /// + /// Used files list file location. + /// Местоположение файла содержащего лист использованных файлов. + /// private static string GetUsedFilesListFilename() { return Assembly.GetEntryAssembly().Location + UserFilesListFileNamePrefix; From 65bc3f1e0bef5f8c608cdebf2709afe3eab2fdea Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 11:42:23 +0600 Subject: [PATCH 050/138] Update console app fileaname --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 9ca334e..db24e54 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -18,7 +18,7 @@ public class TemporaryFileTests public void TemporaryFileTest() { using Process process = new Process(); - process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5.0", "TemporaryFileTest")); + process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5", "TemporaryFileTest")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.Start(); From 4d8d16ab0842b7e39e726c481f8144c15e7c9f19 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 11:45:35 +0600 Subject: [PATCH 051/138] Add AddToUsedFilesList() XML Doc --- csharp/Platform.IO/TemporaryFiles.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index bb31f77..19e3764 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -30,6 +30,14 @@ private static string GetUsedFilesListFilename() return Assembly.GetEntryAssembly().Location + UserFilesListFileNamePrefix; } + /// + /// Adds a filename to the used files list. + /// Добавляет путь к файлу в список использованных файлов. + /// + /// + /// The filename to be added to the used files list. + /// Путь к файлу для добавления в список использованных файлов. + /// private static void AddToUsedFilesList(string filename) { lock (UsedFilesListLock) From da72771c2a9477aa736c97672098c1aca3a212a1 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 11:45:52 +0600 Subject: [PATCH 052/138] Add GetUsedFilesListFilename() XML doc --- csharp/Platform.IO/TemporaryFiles.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 19e3764..04cc804 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -19,11 +19,11 @@ class TemporaryFiles /// /// Returns used files list file location. - /// Возвращает местоположение файла содержащего лист использованных файлов. + /// Возвращает местоположение файла содержащего список использованных файлов. /// /// /// Used files list file location. - /// Местоположение файла содержащего лист использованных файлов. + /// Местоположение файла содержащего список использованных файлов. /// private static string GetUsedFilesListFilename() { From a07857f562f45d3fdd7c6bdb696bcb93888bef2a Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 11:48:28 +0600 Subject: [PATCH 053/138] Add UseNew() XML Doc --- csharp/Platform.IO/TemporaryFiles.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 04cc804..a977576 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -47,6 +47,14 @@ private static void AddToUsedFilesList(string filename) } } + /// + /// Gets temp file and adds it to the used files list. + /// Получает временный файл и добавляет его в список использованных файлов. + /// + /// + /// Temp file path. + /// Путь временного файла. + /// public static string UseNew() { var filename = Path.GetTempFileName(); From 74135dcdff474a40dd806e6f43d00c14a89e4095 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Wed, 30 Jun 2021 11:50:31 +0600 Subject: [PATCH 054/138] Add DeleteAllPreviouslyUsed() XML Doc --- csharp/Platform.IO/TemporaryFiles.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index a977576..1e2353f 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -62,6 +62,10 @@ public static string UseNew() return filename; } + /// + /// Deletes used files and clears the used files list. + /// Удаляет использованные файлы и очищает список использованных файлов + /// public static void DeleteAllPreviouslyUsed() { lock (UsedFilesListLock) From e61c9d7d68507bded511bdde7a10cd04e877a18a Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 15:10:27 +0600 Subject: [PATCH 055/138] Use spaces instead of tabs --- csharp/Platform.IO/Platform.IO.csproj | 76 +++++++++++++-------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/csharp/Platform.IO/Platform.IO.csproj b/csharp/Platform.IO/Platform.IO.csproj index fb72527..ea50335 100644 --- a/csharp/Platform.IO/Platform.IO.csproj +++ b/csharp/Platform.IO/Platform.IO.csproj @@ -1,45 +1,45 @@  - - LinksPlatform's Platform.IO Class Library - Konstantin Diachenko - Platform.IO - 0.2.2 - Konstantin Diachenko - net472;netstandard2.0;netstandard2.1;net5 - Platform.IO - Platform.IO - LinksPlatform;IO;ConsoleCancellation;ConsoleHelpers;FileHelpers;StreamExtensions - https://raw.githubusercontent.com/linksplatform/Documentation/18469f4d033ee9a5b7b84caab9c585acab2ac519/doc/Avatar-rainbow-icon-64x64.png - https://linksplatform.github.io/IO - MIT - true - git - git://github.com/linksplatform/IO - false - false - true - true - true - true - snupkg - latest - - TemporaryFiles, TemporaryFile classes are added. - - + + LinksPlatform's Platform.IO Class Library + Konstantin Diachenko + Platform.IO + 0.2.2 + Konstantin Diachenko + net472;netstandard2.0;netstandard2.1;net5 + Platform.IO + Platform.IO + LinksPlatform;IO;ConsoleCancellation;ConsoleHelpers;FileHelpers;StreamExtensions + https://raw.githubusercontent.com/linksplatform/Documentation/18469f4d033ee9a5b7b84caab9c585acab2ac519/doc/Avatar-rainbow-icon-64x64.png + https://linksplatform.github.io/IO + MIT + true + git + git://github.com/linksplatform/IO + false + false + true + true + true + true + snupkg + latest + + TemporaryFiles, TemporaryFile classes are added. + + - - - + + + - - - + + + - - - - + + + + From 58582d78fba64ac27c9e650b93424c1dd4a7785f Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 15:11:36 +0600 Subject: [PATCH 056/138] Update XML Docs - Temp -> Temporary --- csharp/Platform.IO/TemporaryFile.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFile.cs b/csharp/Platform.IO/TemporaryFile.cs index 8c8abe9..b64b992 100644 --- a/csharp/Platform.IO/TemporaryFile.cs +++ b/csharp/Platform.IO/TemporaryFile.cs @@ -15,7 +15,7 @@ namespace Platform.IO public class TemporaryFile : DisposableBase { /// - /// Gets a temp file path. + /// Gets a temporary file path. /// Возвращает путь к временному файлу. /// public readonly string Filename; @@ -30,7 +30,7 @@ public TemporaryFile() } /// - /// Deletes the temp file. + /// Deletes the temporary file. /// Удаляет временный файл. /// /// From 9122705c75644ab5d24fbc55992cd09d8b3f1c82 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 15:12:20 +0600 Subject: [PATCH 057/138] Update XML Docs --- csharp/Platform.IO/TemporaryFile.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFile.cs b/csharp/Platform.IO/TemporaryFile.cs index b64b992..71f607a 100644 --- a/csharp/Platform.IO/TemporaryFile.cs +++ b/csharp/Platform.IO/TemporaryFile.cs @@ -38,8 +38,8 @@ public TemporaryFile() /// Значение типа , определяющие было ли высвобождение вызвано вручную (кодом разработчика) или же выполнилось автоматически без явного указания со стороны разработчика. /// /// - /// A value that determines whether the was released before a call to this method. - /// Значение типа , определяющие были ли освобождены ресурсы, используемые до вызова данного метода. + /// A value that determines whether the was released before a call to this method. + /// Значение типа , определяющие были ли освобождены ресурсы, используемые до вызова данного метода. /// protected override void Dispose(bool manual, bool wasDisposed) { From 982a5140bbc1b76aa76d1813c63c968f737bd27f Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 15:13:02 +0600 Subject: [PATCH 058/138] Remove private methods XML Docs --- csharp/Platform.IO/TemporaryFiles.cs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 1e2353f..7b8c89c 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -17,27 +17,11 @@ class TemporaryFiles private const string UserFilesListFileNamePrefix = ".used-temporary-files.txt"; static private readonly object UsedFilesListLock = new object(); - /// - /// Returns used files list file location. - /// Возвращает местоположение файла содержащего список использованных файлов. - /// - /// - /// Used files list file location. - /// Местоположение файла содержащего список использованных файлов. - /// private static string GetUsedFilesListFilename() { return Assembly.GetEntryAssembly().Location + UserFilesListFileNamePrefix; } - /// - /// Adds a filename to the used files list. - /// Добавляет путь к файлу в список использованных файлов. - /// - /// - /// The filename to be added to the used files list. - /// Путь к файлу для добавления в список использованных файлов. - /// private static void AddToUsedFilesList(string filename) { lock (UsedFilesListLock) From b19d2f1d72a6d7d038c4daed46ac8fc1db1c2739 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 15:13:52 +0600 Subject: [PATCH 059/138] Use shorthand for GetUsedFilesListFileName() --- csharp/Platform.IO/TemporaryFiles.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 7b8c89c..92cbaa2 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -17,11 +17,7 @@ class TemporaryFiles private const string UserFilesListFileNamePrefix = ".used-temporary-files.txt"; static private readonly object UsedFilesListLock = new object(); - private static string GetUsedFilesListFilename() - { - return Assembly.GetEntryAssembly().Location + UserFilesListFileNamePrefix; - } - + private static string GetUsedFilesListFilename() => Assembly.GetEntryAssembly().Location + UserFilesListFileNamePrefix; private static void AddToUsedFilesList(string filename) { lock (UsedFilesListLock) From 35996b82abf0222d818025a7044c01d885f07ed1 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 15:14:51 +0600 Subject: [PATCH 060/138] Update XML Docs - Temp -> Temporary --- csharp/Platform.IO/TemporaryFiles.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 92cbaa2..06ae794 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -9,7 +9,7 @@ namespace Platform.IO { /// - /// Represents the set of helper methods to work with temp files. + /// Represents the set of helper methods to work with temporary files. /// Представляет набор вспомогательных методов для работы с временными файлами. /// class TemporaryFiles @@ -28,11 +28,11 @@ private static void AddToUsedFilesList(string filename) } /// - /// Gets temp file and adds it to the used files list. + /// Gets temporary file and adds it to the used files list. /// Получает временный файл и добавляет его в список использованных файлов. /// /// - /// Temp file path. + /// Temporary file path. /// Путь временного файла. /// public static string UseNew() From ae0216f7d3a51d1005c120f985f414b9661f808a Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 15:15:41 +0600 Subject: [PATCH 061/138] Update XML Docs - Articles --- csharp/Platform.IO/TemporaryFiles.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 06ae794..1642c39 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -28,11 +28,11 @@ private static void AddToUsedFilesList(string filename) } /// - /// Gets temporary file and adds it to the used files list. + /// Gets a temporary file and adds it to the used files list. /// Получает временный файл и добавляет его в список использованных файлов. /// /// - /// Temporary file path. + /// The temporary file path. /// Путь временного файла. /// public static string UseNew() @@ -43,7 +43,7 @@ public static string UseNew() } /// - /// Deletes used files and clears the used files list. + /// Deletes the used files and clears the used files list. /// Удаляет использованные файлы и очищает список использованных файлов /// public static void DeleteAllPreviouslyUsed() From 9b900dec832fcf77aafa670f9b7faf3720c13854 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 15:16:38 +0600 Subject: [PATCH 062/138] Update XML Docs --- csharp/Platform.IO/TemporaryFiles.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 1642c39..c007992 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -43,8 +43,8 @@ public static string UseNew() } /// - /// Deletes the used files and clears the used files list. - /// Удаляет использованные файлы и очищает список использованных файлов + /// Deletes all previously used temporary files and clears the files list. + /// Удаляет использованные файлы и очищает список использованных файлов. /// public static void DeleteAllPreviouslyUsed() { From b41aee76edf3d1feafdbd8dae8dcf61e8a7104ac Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 15:17:36 +0600 Subject: [PATCH 063/138] Update XML Docs --- csharp/Platform.IO/TemporaryFile.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFile.cs b/csharp/Platform.IO/TemporaryFile.cs index 71f607a..442a156 100644 --- a/csharp/Platform.IO/TemporaryFile.cs +++ b/csharp/Platform.IO/TemporaryFile.cs @@ -21,8 +21,8 @@ public class TemporaryFile : DisposableBase public readonly string Filename; /// - /// Gets a instance. - /// Возвращает экземпляр класса . + /// Initializes a instance. + /// Инициализирует экземпляр класса . /// public TemporaryFile() { From 2e17371affebd9cdabe5968b34657dcf50c73334 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 15:18:27 +0600 Subject: [PATCH 064/138] Use shorthand for constructor --- csharp/Platform.IO/TemporaryFile.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFile.cs b/csharp/Platform.IO/TemporaryFile.cs index 442a156..a214bc6 100644 --- a/csharp/Platform.IO/TemporaryFile.cs +++ b/csharp/Platform.IO/TemporaryFile.cs @@ -24,10 +24,7 @@ public class TemporaryFile : DisposableBase /// Initializes a instance. /// Инициализирует экземпляр класса . /// - public TemporaryFile() - { - Filename = TemporaryFiles.UseNew(); - } + public TemporaryFile() => Filename = TemporaryFiles.UseNew(); /// /// Deletes the temporary file. From e0542febb8397ade7d801459040a90035d570cb5 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 16:18:52 +0600 Subject: [PATCH 065/138] Format --- csharp/Platform.IO/TemporaryFiles.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index c007992..39638e9 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -18,6 +18,7 @@ class TemporaryFiles static private readonly object UsedFilesListLock = new object(); private static string GetUsedFilesListFilename() => Assembly.GetEntryAssembly().Location + UserFilesListFileNamePrefix; + private static void AddToUsedFilesList(string filename) { lock (UsedFilesListLock) From a4a378ba143b13c0329d2333dd614d3467029951 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 16:19:53 +0600 Subject: [PATCH 066/138] Update XML Docs --- csharp/Platform.IO/TemporaryFiles.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 39638e9..b8ca98e 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -45,7 +45,7 @@ public static string UseNew() /// /// Deletes all previously used temporary files and clears the files list. - /// Удаляет использованные файлы и очищает список использованных файлов. + /// Удаляет все ранее использованные временные файлы и очищает список файлов. /// public static void DeleteAllPreviouslyUsed() { From ec005dc8b22d0db2bd20d7f20afbfae81a84ef40 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 16:20:30 +0600 Subject: [PATCH 067/138] Use brackets for if condition --- csharp/Platform.IO/TemporaryFiles.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index b8ca98e..573c4f1 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -61,7 +61,10 @@ public static void DeleteAllPreviouslyUsed() string tempFileToDelete; while ((tempFileToDelete = reader.ReadLine()) != null) { - if (File.Exists(tempFileToDelete)) File.Delete(tempFileToDelete); + if (File.Exists(tempFileToDelete)) + { + File.Delete(tempFileToDelete); + } } } From 6ac9bbea416f6be5e6128aecabbbe3414c1c5635 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 16:21:03 +0600 Subject: [PATCH 068/138] Remove empty lines --- csharp/Platform.IO/TemporaryFiles.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 573c4f1..5581302 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -67,7 +67,6 @@ public static void DeleteAllPreviouslyUsed() } } } - using (File.Open(usedFilesListFilename, FileMode.Truncate)) { } } } From 494f27fbc5ed7d455b80370817da8d49475f6591 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 16:30:51 +0600 Subject: [PATCH 069/138] Add output to test --- csharp/TemporaryFileTest/Program.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/csharp/TemporaryFileTest/Program.cs b/csharp/TemporaryFileTest/Program.cs index 5eb7498..2b640ae 100644 --- a/csharp/TemporaryFileTest/Program.cs +++ b/csharp/TemporaryFileTest/Program.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Platform.IO; using System.IO; +using System.Reflection; namespace TemporaryFileTest { @@ -14,6 +15,9 @@ static void Main(string[] args) { TemporaryFile tempFile = new TemporaryFile(); Console.WriteLine(tempFile.Filename); + Console.WriteLine(Assembly.GetEntryAssembly().Location); + Console.WriteLine(Directory.GetCurrentDirectory()); + Console.WriteLine(Environment.CurrentDirectory); } } } From 0a089ab18a7a9a623b985b452ad3c359043251cc Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 16:44:34 +0600 Subject: [PATCH 070/138] Use outputs to improve code --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 8 ++++++++ csharp/Platform.IO/TemporaryFiles.cs | 2 +- csharp/TemporaryFileTest/Program.cs | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index db24e54..6cded70 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -9,11 +9,17 @@ using System.Diagnostics; using Xunit.Abstractions; using System.Runtime.InteropServices; +using System.Reflection; namespace Platform.IO.Tests { public class TemporaryFileTests { + private readonly ITestOutputHelper output; + public TemporaryFileTests(ITestOutputHelper output) + { + this.output = output; + } [Fact] public void TemporaryFileTest() { @@ -22,6 +28,8 @@ public void TemporaryFileTest() process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.Start(); + output.WriteLine(Environment.CurrentDirectory); + output.WriteLine(Assembly.GetExecutingAssembly().Location); string path = process.StandardOutput.ReadLine(); diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 5581302..a491fcd 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -17,7 +17,7 @@ class TemporaryFiles private const string UserFilesListFileNamePrefix = ".used-temporary-files.txt"; static private readonly object UsedFilesListLock = new object(); - private static string GetUsedFilesListFilename() => Assembly.GetEntryAssembly().Location + UserFilesListFileNamePrefix; + private static string GetUsedFilesListFilename() => Assembly.GetExecutingAssembly().Location + UserFilesListFileNamePrefix; private static void AddToUsedFilesList(string filename) { diff --git a/csharp/TemporaryFileTest/Program.cs b/csharp/TemporaryFileTest/Program.cs index 2b640ae..8b2ceca 100644 --- a/csharp/TemporaryFileTest/Program.cs +++ b/csharp/TemporaryFileTest/Program.cs @@ -18,6 +18,7 @@ static void Main(string[] args) Console.WriteLine(Assembly.GetEntryAssembly().Location); Console.WriteLine(Directory.GetCurrentDirectory()); Console.WriteLine(Environment.CurrentDirectory); + Console.WriteLine(Assembly.GetExecutingAssembly().Location); } } } From 8b616c47b6fcee7f1eb1c72a7691355e0be671d0 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 16:52:12 +0600 Subject: [PATCH 071/138] Format --- csharp/Platform.IO/Platform.IO.csproj | 76 +++++++++++++-------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/csharp/Platform.IO/Platform.IO.csproj b/csharp/Platform.IO/Platform.IO.csproj index ea50335..4f108e6 100644 --- a/csharp/Platform.IO/Platform.IO.csproj +++ b/csharp/Platform.IO/Platform.IO.csproj @@ -1,45 +1,45 @@  - - LinksPlatform's Platform.IO Class Library - Konstantin Diachenko - Platform.IO - 0.2.2 - Konstantin Diachenko - net472;netstandard2.0;netstandard2.1;net5 - Platform.IO - Platform.IO - LinksPlatform;IO;ConsoleCancellation;ConsoleHelpers;FileHelpers;StreamExtensions - https://raw.githubusercontent.com/linksplatform/Documentation/18469f4d033ee9a5b7b84caab9c585acab2ac519/doc/Avatar-rainbow-icon-64x64.png - https://linksplatform.github.io/IO - MIT - true - git - git://github.com/linksplatform/IO - false - false - true - true - true - true - snupkg - latest - - TemporaryFiles, TemporaryFile classes are added. - - + + LinksPlatform's Platform.IO Class Library + Konstantin Diachenko + Platform.IO + 0.2.2 + Konstantin Diachenko + net472;netstandard2.0;netstandard2.1;net5 + Platform.IO + Platform.IO + LinksPlatform;IO;ConsoleCancellation;ConsoleHelpers;FileHelpers;StreamExtensions + https://raw.githubusercontent.com/linksplatform/Documentation/18469f4d033ee9a5b7b84caab9c585acab2ac519/doc/Avatar-rainbow-icon-64x64.png + https://linksplatform.github.io/IO + MIT + true + git + git://github.com/linksplatform/IO + false + false + true + true + true + true + snupkg + latest + + TemporaryFiles, TemporaryFile classes are added. + + - - - + + + - - - + + + - - - - + + + + From 8cce87aa34fa9b3ac9534fa19cc485ce31611052 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 16:58:43 +0600 Subject: [PATCH 072/138] Format --- csharp/Platform.IO/Platform.IO.csproj | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/csharp/Platform.IO/Platform.IO.csproj b/csharp/Platform.IO/Platform.IO.csproj index 4f108e6..cbb8403 100644 --- a/csharp/Platform.IO/Platform.IO.csproj +++ b/csharp/Platform.IO/Platform.IO.csproj @@ -24,9 +24,7 @@ true snupkg latest - - TemporaryFiles, TemporaryFile classes are added. - + TemporaryFiles, TemporaryFile classes are added. From fee3ddcd8b8a22f17e7b1a03cdd7f7f46927c534 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:00:02 +0600 Subject: [PATCH 073/138] Add new test --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 6cded70..4d4f328 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -38,5 +38,19 @@ public void TemporaryFileTest() Assert.False(File.Exists(path)); } + + [Fact] + public void TemporaryFileTestWithoutConsoleApp() + { + string fileName; + using (TemporaryFile tempFile = new TemporaryFile()) + { + fileName = tempFile.Filename; + Assert.True(File.Exists(fileName)); + } + output.WriteLine(Environment.CurrentDirectory); + output.WriteLine(Assembly.GetExecutingAssembly().Location); + Assert.False(File.Exists(fileName)); + } } } \ No newline at end of file From 31941123572f9820d35c4d6c889a928d4786217a Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:00:15 +0600 Subject: [PATCH 074/138] Format --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 4d4f328..73847e5 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -30,12 +30,9 @@ public void TemporaryFileTest() process.Start(); output.WriteLine(Environment.CurrentDirectory); output.WriteLine(Assembly.GetExecutingAssembly().Location); - string path = process.StandardOutput.ReadLine(); - Assert.True(File.Exists(path)); process.WaitForExit(); - Assert.False(File.Exists(path)); } From 858d6a79fdf0f304c3c4c3b882aa92e3d170a32b Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:06:13 +0600 Subject: [PATCH 075/138] Use field instead GetUsedFilesListFilename --- csharp/Platform.IO/TemporaryFiles.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index a491fcd..492b615 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -17,13 +17,13 @@ class TemporaryFiles private const string UserFilesListFileNamePrefix = ".used-temporary-files.txt"; static private readonly object UsedFilesListLock = new object(); - private static string GetUsedFilesListFilename() => Assembly.GetExecutingAssembly().Location + UserFilesListFileNamePrefix; + private static readonly string UsedFilesListFilename = Assembly.GetExecutingAssembly().Location + UserFilesListFileNamePrefix; private static void AddToUsedFilesList(string filename) { lock (UsedFilesListLock) { - using var writer = File.AppendText(GetUsedFilesListFilename()); + using var writer = File.AppendText(UsedFilesListFilename); writer.WriteLine(filename); } } @@ -51,7 +51,7 @@ public static void DeleteAllPreviouslyUsed() { lock (UsedFilesListLock) { - var usedFilesListFilename = GetUsedFilesListFilename(); + var usedFilesListFilename = UsedFilesListFilename; if (!File.Exists(usedFilesListFilename)) return; From 9f6dcf76cbaf6b06b1c9cb118791bd573583d0ad Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:06:53 +0600 Subject: [PATCH 076/138] Format --- csharp/Platform.IO/TemporaryFiles.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 492b615..85733e7 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -15,7 +15,7 @@ namespace Platform.IO class TemporaryFiles { private const string UserFilesListFileNamePrefix = ".used-temporary-files.txt"; - static private readonly object UsedFilesListLock = new object(); + private static readonly object UsedFilesListLock = new object(); private static readonly string UsedFilesListFilename = Assembly.GetExecutingAssembly().Location + UserFilesListFileNamePrefix; From 77d89088d3d4470a9fb4f5eda2ffae7b891b9a8d Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:07:29 +0600 Subject: [PATCH 077/138] Format --- csharp/Platform.IO/TemporaryFiles.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 85733e7..26a5c68 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -16,7 +16,6 @@ class TemporaryFiles { private const string UserFilesListFileNamePrefix = ".used-temporary-files.txt"; private static readonly object UsedFilesListLock = new object(); - private static readonly string UsedFilesListFilename = Assembly.GetExecutingAssembly().Location + UserFilesListFileNamePrefix; private static void AddToUsedFilesList(string filename) From 84bb2a094eab704c7fbc827d67fa6dbdebc66f58 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:08:02 +0600 Subject: [PATCH 078/138] Make class public --- csharp/Platform.IO/TemporaryFiles.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 26a5c68..5de8599 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -12,7 +12,7 @@ namespace Platform.IO /// Represents the set of helper methods to work with temporary files. /// Представляет набор вспомогательных методов для работы с временными файлами. /// - class TemporaryFiles + public class TemporaryFiles { private const string UserFilesListFileNamePrefix = ".used-temporary-files.txt"; private static readonly object UsedFilesListLock = new object(); From 94041e40f1afd961f3d5fca281e22676d795669b Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:09:40 +0600 Subject: [PATCH 079/138] Add brackets to condition --- csharp/Platform.IO/TemporaryFiles.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 5de8599..5d6d23c 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -52,7 +52,10 @@ public static void DeleteAllPreviouslyUsed() { var usedFilesListFilename = UsedFilesListFilename; - if (!File.Exists(usedFilesListFilename)) return; + if (!File.Exists(usedFilesListFilename)) + { + return; + }; using (var listFile = File.Open(usedFilesListFilename, FileMode.Open)) using (var reader = new StreamReader(listFile)) From c7b836066dc0f3f2bfd74287e5faa9ef90039611 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:09:54 +0600 Subject: [PATCH 080/138] Remove empty lines --- csharp/Platform.IO/TemporaryFiles.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 5d6d23c..3320aee 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -51,12 +51,10 @@ public static void DeleteAllPreviouslyUsed() lock (UsedFilesListLock) { var usedFilesListFilename = UsedFilesListFilename; - if (!File.Exists(usedFilesListFilename)) { return; }; - using (var listFile = File.Open(usedFilesListFilename, FileMode.Open)) using (var reader = new StreamReader(listFile)) { From 775a8be21965247beacf2f966a67a46258b65586 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:13:41 +0600 Subject: [PATCH 081/138] Add Truncate() --- csharp/Platform.IO/FileHelpers.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index eb58d89..241cb59 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -290,5 +290,11 @@ public static void DeleteAll(string directory, string searchPattern, SearchOptio File.Delete(file); } } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Truncate(string filename) + { + File.Open(filename, FileMode.Truncate); + } } } From d17ecd909a822826787a57cba7b2fb1c9936a436 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:15:08 +0600 Subject: [PATCH 082/138] Add MethodImpl --- csharp/Platform.IO/TemporaryFile.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/csharp/Platform.IO/TemporaryFile.cs b/csharp/Platform.IO/TemporaryFile.cs index a214bc6..d0ea089 100644 --- a/csharp/Platform.IO/TemporaryFile.cs +++ b/csharp/Platform.IO/TemporaryFile.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; @@ -24,6 +25,7 @@ public class TemporaryFile : DisposableBase /// Initializes a instance. /// Инициализирует экземпляр класса . /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public TemporaryFile() => Filename = TemporaryFiles.UseNew(); /// @@ -38,6 +40,7 @@ public class TemporaryFile : DisposableBase /// A value that determines whether the was released before a call to this method. /// Значение типа , определяющие были ли освобождены ресурсы, используемые до вызова данного метода. /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] protected override void Dispose(bool manual, bool wasDisposed) { if (!wasDisposed) From 7498852033bb0e1cd4745c474b8a176b78a3a425 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:15:35 +0600 Subject: [PATCH 083/138] Add MethodImpl --- csharp/Platform.IO/TemporaryFiles.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 3320aee..c822f63 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; @@ -18,6 +19,7 @@ public class TemporaryFiles private static readonly object UsedFilesListLock = new object(); private static readonly string UsedFilesListFilename = Assembly.GetExecutingAssembly().Location + UserFilesListFileNamePrefix; + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void AddToUsedFilesList(string filename) { lock (UsedFilesListLock) @@ -35,6 +37,7 @@ private static void AddToUsedFilesList(string filename) /// The temporary file path. /// Путь временного файла. /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string UseNew() { var filename = Path.GetTempFileName(); @@ -46,6 +49,7 @@ public static string UseNew() /// Deletes all previously used temporary files and clears the files list. /// Удаляет все ранее использованные временные файлы и очищает список файлов. /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void DeleteAllPreviouslyUsed() { lock (UsedFilesListLock) From 8389895ceabdfcc7975b2a18e0a85a8a63f351e4 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:22:46 +0600 Subject: [PATCH 084/138] Use FileHelpers.Truncate --- csharp/Platform.IO/TemporaryFiles.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index c822f63..53fd0e0 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -71,7 +71,7 @@ public static void DeleteAllPreviouslyUsed() } } } - using (File.Open(usedFilesListFilename, FileMode.Truncate)) { } + FileHelpers.Truncate(usedFilesListFilename); } } } From 1cc4953ba407114f7042b01558f233a35c4d4645 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:22:56 +0600 Subject: [PATCH 085/138] Add Truncate() --- csharp/Platform.IO/FileHelpers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index 241cb59..994a687 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -294,7 +294,7 @@ public static void DeleteAll(string directory, string searchPattern, SearchOptio [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Truncate(string filename) { - File.Open(filename, FileMode.Truncate); + using (File.Open(filename, FileMode.Truncate)) ; } } } From 6926c848b190e3d01c94d29e4e574899ad6ed250 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:40:39 +0600 Subject: [PATCH 086/138] Update Truncate() --- csharp/Platform.IO/FileHelpers.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index 994a687..cd098ce 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -291,10 +291,12 @@ public static void DeleteAll(string directory, string searchPattern, SearchOptio } } + /// + /// + /// + /// + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Truncate(string filename) - { - using (File.Open(filename, FileMode.Truncate)) ; - } + public static void Truncate(string filename) => File.Open(filename, FileMode.Truncate).Dispose(); } } From 14effb6bf15842f34417ad1c4dac39760a3a60d8 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:44:19 +0600 Subject: [PATCH 087/138] Do not use unrequired condition --- csharp/Platform.IO/TemporaryFiles.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 53fd0e0..dfe877a 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -65,10 +65,7 @@ public static void DeleteAllPreviouslyUsed() string tempFileToDelete; while ((tempFileToDelete = reader.ReadLine()) != null) { - if (File.Exists(tempFileToDelete)) - { - File.Delete(tempFileToDelete); - } + File.Delete(tempFileToDelete); } } FileHelpers.Truncate(usedFilesListFilename); From 579337e0547ddddd13c50ceb458a987c6dd093eb Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:48:03 +0600 Subject: [PATCH 088/138] Rename --- csharp/Platform.IO/TemporaryFiles.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index dfe877a..986319e 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -54,13 +54,13 @@ public static void DeleteAllPreviouslyUsed() { lock (UsedFilesListLock) { - var usedFilesListFilename = UsedFilesListFilename; - if (!File.Exists(usedFilesListFilename)) + var listFilename = UsedFilesListFilename; + if (!File.Exists(listFilename)) { return; }; - using (var listFile = File.Open(usedFilesListFilename, FileMode.Open)) - using (var reader = new StreamReader(listFile)) + using (var file = File.Open(listFilename, FileMode.Open)) + using (var reader = new StreamReader(file)) { string tempFileToDelete; while ((tempFileToDelete = reader.ReadLine()) != null) @@ -68,7 +68,7 @@ public static void DeleteAllPreviouslyUsed() File.Delete(tempFileToDelete); } } - FileHelpers.Truncate(usedFilesListFilename); + FileHelpers.Truncate(listFilename); } } } From af215db5c53cb7fec6d7aff0c8c3599ed06371f4 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:49:12 +0600 Subject: [PATCH 089/138] Remove unnecessary semicolon --- csharp/Platform.IO/TemporaryFiles.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 986319e..5e49081 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -58,7 +58,7 @@ public static void DeleteAllPreviouslyUsed() if (!File.Exists(listFilename)) { return; - }; + } using (var file = File.Open(listFilename, FileMode.Open)) using (var reader = new StreamReader(file)) { From 0586e232779cfa33f742e6cb67931b084cd6abd1 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:52:04 +0600 Subject: [PATCH 090/138] Rename --- csharp/Platform.IO/TemporaryFiles.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 5e49081..6bd1f9f 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -59,13 +59,13 @@ public static void DeleteAllPreviouslyUsed() { return; } - using (var file = File.Open(listFilename, FileMode.Open)) - using (var reader = new StreamReader(file)) + using (var listFile = File.Open(listFilename, FileMode.Open)) + using (var reader = new StreamReader(listFile)) { - string tempFileToDelete; - while ((tempFileToDelete = reader.ReadLine()) != null) + string temporaryFile; + while ((temporaryFile = reader.ReadLine()) != null) { - File.Delete(tempFileToDelete); + File.Delete(temporaryFile); } } FileHelpers.Truncate(listFilename); From 34ee97704c146131398e12a0440de94d8d058edf Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:53:47 +0600 Subject: [PATCH 091/138] Update XML Docs --- csharp/Platform.IO/FileHelpers.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index cd098ce..e29e107 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -292,10 +292,13 @@ public static void DeleteAll(string directory, string searchPattern, SearchOptio } /// - /// - /// + /// Trincates the . + /// Очищает содержимое . /// - /// + /// + /// A filename to be truncated. + /// Путь к файлу для очистки содержимого. + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Truncate(string filename) => File.Open(filename, FileMode.Truncate).Dispose(); } From 6f68ca1615580360c216dda51c9d2aa43035a076 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:55:50 +0600 Subject: [PATCH 092/138] Remove unused usings --- csharp/Platform.IO/TemporaryFile.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFile.cs b/csharp/Platform.IO/TemporaryFile.cs index d0ea089..579952c 100644 --- a/csharp/Platform.IO/TemporaryFile.cs +++ b/csharp/Platform.IO/TemporaryFile.cs @@ -1,11 +1,7 @@ using Platform.Disposables; using System; -using System.Collections.Generic; using System.IO; -using System.Linq; using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; namespace Platform.IO { From a180125ade79d3d07923e37937866500020163f7 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:56:08 +0600 Subject: [PATCH 093/138] Use explicit type --- csharp/Platform.IO/TemporaryFiles.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 6bd1f9f..352df0a 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -59,7 +59,7 @@ public static void DeleteAllPreviouslyUsed() { return; } - using (var listFile = File.Open(listFilename, FileMode.Open)) + using (FileStream listFile = File.Open(listFilename, FileMode.Open)) using (var reader = new StreamReader(listFile)) { string temporaryFile; From 6bb6aba212a467c5d6bae6d4f6d1423398725abf Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:56:36 +0600 Subject: [PATCH 094/138] Remove unused usings --- csharp/Platform.IO/TemporaryFiles.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 352df0a..0083cfd 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -1,11 +1,6 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; +using System.IO; using System.Reflection; using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; namespace Platform.IO { From a254de54de21e56e57e351c2aea7ed39e1349740 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:56:48 +0600 Subject: [PATCH 095/138] Remove unused usings --- csharp/TemporaryFileTest/Program.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/csharp/TemporaryFileTest/Program.cs b/csharp/TemporaryFileTest/Program.cs index 8b2ceca..d167df9 100644 --- a/csharp/TemporaryFileTest/Program.cs +++ b/csharp/TemporaryFileTest/Program.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Platform.IO; using System.IO; using System.Reflection; From b0b731d8e162bb8a3844aa847db3cb9a364f2180 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:57:16 +0600 Subject: [PATCH 096/138] Remove unused Console outputs --- csharp/TemporaryFileTest/Program.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/csharp/TemporaryFileTest/Program.cs b/csharp/TemporaryFileTest/Program.cs index d167df9..d13b7a7 100644 --- a/csharp/TemporaryFileTest/Program.cs +++ b/csharp/TemporaryFileTest/Program.cs @@ -11,10 +11,6 @@ static void Main(string[] args) { TemporaryFile tempFile = new TemporaryFile(); Console.WriteLine(tempFile.Filename); - Console.WriteLine(Assembly.GetEntryAssembly().Location); - Console.WriteLine(Directory.GetCurrentDirectory()); - Console.WriteLine(Environment.CurrentDirectory); - Console.WriteLine(Assembly.GetExecutingAssembly().Location); } } } From 85e10fff7357ed6e04fc097c70cfc5ec8621878c Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:57:34 +0600 Subject: [PATCH 097/138] Remove output --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 73847e5..765a29b 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -15,11 +15,6 @@ namespace Platform.IO.Tests { public class TemporaryFileTests { - private readonly ITestOutputHelper output; - public TemporaryFileTests(ITestOutputHelper output) - { - this.output = output; - } [Fact] public void TemporaryFileTest() { From 9dfb7cbef65516b13739b29c4ff528216199957b Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:57:45 +0600 Subject: [PATCH 098/138] Remove output --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 765a29b..2e36692 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -23,8 +23,6 @@ public void TemporaryFileTest() process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.Start(); - output.WriteLine(Environment.CurrentDirectory); - output.WriteLine(Assembly.GetExecutingAssembly().Location); string path = process.StandardOutput.ReadLine(); Assert.True(File.Exists(path)); process.WaitForExit(); @@ -40,8 +38,6 @@ public void TemporaryFileTestWithoutConsoleApp() fileName = tempFile.Filename; Assert.True(File.Exists(fileName)); } - output.WriteLine(Environment.CurrentDirectory); - output.WriteLine(Assembly.GetExecutingAssembly().Location); Assert.False(File.Exists(fileName)); } } From dd5ecca499efae8554255fd1a76f5931031a2bcc Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 17:57:57 +0600 Subject: [PATCH 099/138] Remove unused usings --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 2e36692..e0c7ed3 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -1,15 +1,6 @@ -using System; -using Xunit; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Platform.IO; +using Xunit; using System.IO; using System.Diagnostics; -using Xunit.Abstractions; -using System.Runtime.InteropServices; -using System.Reflection; namespace Platform.IO.Tests { From 7e68843c4d73da1ec6f4563ff05a1cc4e126ca14 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 18:05:47 +0600 Subject: [PATCH 100/138] Add AppendLine() --- csharp/Platform.IO/FileHelpers.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index e29e107..770e9bd 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -301,5 +301,24 @@ public static void DeleteAll(string directory, string searchPattern, SearchOptio /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Truncate(string filename) => File.Open(filename, FileMode.Truncate).Dispose(); + + /// + /// Appends to the . + /// Добавляет в конец . + /// + /// + /// The filename to be appended by . + /// Путь к файлу для добавления в конец файла. + /// + /// + /// The content to be appended to . + /// Контент для добавления в конец . + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void AppendLine(string filename, string content) + { + using var writer = File.AppendText(filename); + writer.WriteLine(content); + } } } From f2b493afef6e725dca5179bd7d495fb84de24b96 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 18:09:07 +0600 Subject: [PATCH 101/138] Use FileHelpers.AppendLine() --- csharp/Platform.IO/TemporaryFiles.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 0083cfd..4e5f4a8 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -19,8 +19,7 @@ private static void AddToUsedFilesList(string filename) { lock (UsedFilesListLock) { - using var writer = File.AppendText(UsedFilesListFilename); - writer.WriteLine(filename); + FileHelpers.AppendLine(UsedFilesListFilename, filename); } } From c9d140e2734b0b059447c6be6ac81eef40b9030d Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 18:18:55 +0600 Subject: [PATCH 102/138] Update DeleteAllPreviouslyUsed() --- csharp/Platform.IO/TemporaryFiles.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 4e5f4a8..1e5b159 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -53,8 +53,7 @@ public static void DeleteAllPreviouslyUsed() { return; } - using (FileStream listFile = File.Open(listFilename, FileMode.Open)) - using (var reader = new StreamReader(listFile)) + using (var reader = new StreamReader(listFilename)) { string temporaryFile; while ((temporaryFile = reader.ReadLine()) != null) From e8bce4972996d024260ce0b57b8fb5f5c94c382e Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 18:44:35 +0600 Subject: [PATCH 103/138] Add EachLine() --- csharp/Platform.IO/FileHelpers.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index 770e9bd..cb41b15 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -320,5 +320,15 @@ public static void AppendLine(string filename, string content) using var writer = File.AppendText(filename); writer.WriteLine(content); } + + public static void EachLine(string path, Action action) + { + using var reader = new StreamReader(path); + string line; + while ((line = reader.ReadLine()) != null) + { + action(line); + } + } } } From 1481be8440fff9beeba0cc2be30d6616cd3ad6ce Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 18:45:19 +0600 Subject: [PATCH 104/138] Use FileHelpers.EachLine() --- csharp/Platform.IO/TemporaryFiles.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 1e5b159..44981fd 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -53,14 +53,7 @@ public static void DeleteAllPreviouslyUsed() { return; } - using (var reader = new StreamReader(listFilename)) - { - string temporaryFile; - while ((temporaryFile = reader.ReadLine()) != null) - { - File.Delete(temporaryFile); - } - } + FileHelpers.EachLine(listFilename, File.Delete); FileHelpers.Truncate(listFilename); } } From 3835e71c64b78c520185b77eef92820f8b1af381 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 18:47:34 +0600 Subject: [PATCH 105/138] Reduce code size --- csharp/Platform.IO/TemporaryFiles.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 44981fd..ebe9d14 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -49,12 +49,11 @@ public static void DeleteAllPreviouslyUsed() lock (UsedFilesListLock) { var listFilename = UsedFilesListFilename; - if (!File.Exists(listFilename)) + if (File.Exists(listFilename)) { - return; + FileHelpers.EachLine(listFilename, File.Delete); + FileHelpers.Truncate(listFilename); } - FileHelpers.EachLine(listFilename, File.Delete); - FileHelpers.Truncate(listFilename); } } } From af63561326872f870f2fbc1dbb5135dbc7eccb98 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 18:59:18 +0600 Subject: [PATCH 106/138] Update XML Docs --- csharp/Platform.IO/FileHelpers.cs | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index cb41b15..0637f20 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -303,24 +303,32 @@ public static void DeleteAll(string directory, string searchPattern, SearchOptio public static void Truncate(string filename) => File.Open(filename, FileMode.Truncate).Dispose(); /// - /// Appends to the . - /// Добавляет в конец . + /// Appends the to the . + /// Добавляет в конец . /// - /// - /// The filename to be appended by . - /// Путь к файлу для добавления в конец файла. + /// + /// The path to a file to be appended by the . + /// Путь к файлу для добавления содержимого в конец файла. /// /// - /// The content to be appended to . - /// Контент для добавления в конец . + /// A content to be appended to the file at the . + /// Содержимое для добавления в конец файла по пути . /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void AppendLine(string filename, string content) + public static void AppendLine(string path, string content) { - using var writer = File.AppendText(filename); + using var writer = File.AppendText(path); writer.WriteLine(content); } + /// + /// + /// + /// + /// + /// + /// + /// public static void EachLine(string path, Action action) { using var reader = new StreamReader(path); From 90f523e36d3df67f766da6fa885c5b2d122dec7a Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:00:02 +0600 Subject: [PATCH 107/138] Update XML Docs --- csharp/Platform.IO/FileHelpers.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index 0637f20..65ed9a4 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -292,15 +292,15 @@ public static void DeleteAll(string directory, string searchPattern, SearchOptio } /// - /// Trincates the . - /// Очищает содержимое . + /// Trincates the . + /// Очищает содержимое . /// - /// - /// A filename to be truncated. + /// + /// A path to a file to be truncated. /// Путь к файлу для очистки содержимого. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Truncate(string filename) => File.Open(filename, FileMode.Truncate).Dispose(); + public static void Truncate(string path) => File.Open(path, FileMode.Truncate).Dispose(); /// /// Appends the to the . From 55032f7ded1648326d0bbf6a2c91bc1ff7453fa9 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:03:09 +0600 Subject: [PATCH 108/138] Update XML Docs --- csharp/Platform.IO/FileHelpers.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index 65ed9a4..42e466c 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -303,15 +303,15 @@ public static void DeleteAll(string directory, string searchPattern, SearchOptio public static void Truncate(string path) => File.Open(path, FileMode.Truncate).Dispose(); /// - /// Appends the to the . - /// Добавляет в конец . + /// Appends the to the file at . + /// Добавляет в конец файла по пути . /// /// /// The path to a file to be appended by the . /// Путь к файлу для добавления содержимого в конец файла. /// /// - /// A content to be appended to the file at the . + /// A content to be appended to the file at the file at . /// Содержимое для добавления в конец файла по пути . /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -324,7 +324,10 @@ public static void AppendLine(string path, string content) /// /// /// - /// + /// + /// A path to a file to be read + /// + /// /// /// /// From 09bff4e55a24f2a57492fb127f4473cd96c141a9 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:04:04 +0600 Subject: [PATCH 109/138] Update XML Docs --- csharp/Platform.IO/FileHelpers.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index 42e466c..624789f 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -292,8 +292,8 @@ public static void DeleteAll(string directory, string searchPattern, SearchOptio } /// - /// Trincates the . - /// Очищает содержимое . + /// Trincates the file at the . + /// Очищает содержимое файла по пути . /// /// /// A path to a file to be truncated. From 3adeb3a17a11ef6060bdea367911db635f963d56 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:04:14 +0600 Subject: [PATCH 110/138] Update XML Docs --- csharp/Platform.IO/FileHelpers.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index 624789f..fb5d895 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -303,7 +303,7 @@ public static void DeleteAll(string directory, string searchPattern, SearchOptio public static void Truncate(string path) => File.Open(path, FileMode.Truncate).Dispose(); /// - /// Appends the to the file at . + /// Appends the to the file at the . /// Добавляет в конец файла по пути . /// /// @@ -311,7 +311,7 @@ public static void DeleteAll(string directory, string searchPattern, SearchOptio /// Путь к файлу для добавления содержимого в конец файла. /// /// - /// A content to be appended to the file at the file at . + /// A content to be appended to the file at the file at the . /// Содержимое для добавления в конец файла по пути . /// [MethodImpl(MethodImplOptions.AggressiveInlining)] From d75433f8faaac9b9dd2de3478890b7ecb42f668a Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:17:11 +0600 Subject: [PATCH 111/138] Update XML Docs --- csharp/Platform.IO/FileHelpers.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index fb5d895..d62b5c0 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -322,15 +322,16 @@ public static void AppendLine(string path, string content) } /// - /// + /// Performs the for each line of the file at the . + /// Выполняет для каждой строчки файла по пути . /// /// - /// A path to a file to be read - /// + /// A path to a file to perform the for each line of the file. + /// Путь к файлу для выполнения для каждой строки файла. /// /// - /// - /// + /// An action to be performed for each line of a file at the . + /// Действие выполняемое для каждой строчки файла по пути . /// public static void EachLine(string path, Action action) { From 4372eca81374850a594f9dd43bbc6700c77b5921 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:20:01 +0600 Subject: [PATCH 112/138] Update XML Docs --- csharp/Platform.IO/FileHelpers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index d62b5c0..20fc7b1 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -303,7 +303,7 @@ public static void DeleteAll(string directory, string searchPattern, SearchOptio public static void Truncate(string path) => File.Open(path, FileMode.Truncate).Dispose(); /// - /// Appends the to the file at the . + /// Appends the to a file at the . /// Добавляет в конец файла по пути . /// /// From a3fa337671378319c9ca58d7ac89ccdc0f0664be Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:20:22 +0600 Subject: [PATCH 113/138] Update XML Docs --- csharp/Platform.IO/FileHelpers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index 20fc7b1..112af52 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -308,7 +308,7 @@ public static void DeleteAll(string directory, string searchPattern, SearchOptio /// /// /// The path to a file to be appended by the . - /// Путь к файлу для добавления содержимого в конец файла. + /// Путь к файлу для добавления в конец файла. /// /// /// A content to be appended to the file at the file at the . From 0cce2c77ecc4c1cd813ee85aae877f258dce2242 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:20:49 +0600 Subject: [PATCH 114/138] Update XML Docs --- csharp/Platform.IO/FileHelpers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index 112af52..859f2e9 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -311,7 +311,7 @@ public static void DeleteAll(string directory, string searchPattern, SearchOptio /// Путь к файлу для добавления в конец файла. /// /// - /// A content to be appended to the file at the file at the . + /// A content to be appended to a file at the file at the . /// Содержимое для добавления в конец файла по пути . /// [MethodImpl(MethodImplOptions.AggressiveInlining)] From 5313f0aed499104a86566360e789f16b6f306a73 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:21:16 +0600 Subject: [PATCH 115/138] Update XML Docs --- csharp/Platform.IO/FileHelpers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index 859f2e9..9f38055 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -322,7 +322,7 @@ public static void AppendLine(string path, string content) } /// - /// Performs the for each line of the file at the . + /// Performs the for each line of a file at the . /// Выполняет для каждой строчки файла по пути . /// /// From 8f1bf2d145a931e6b55f5e017d9d15f4927b4f1d Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:21:44 +0600 Subject: [PATCH 116/138] Add MethodImpl --- csharp/Platform.IO/FileHelpers.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/csharp/Platform.IO/FileHelpers.cs b/csharp/Platform.IO/FileHelpers.cs index 9f38055..da15c16 100644 --- a/csharp/Platform.IO/FileHelpers.cs +++ b/csharp/Platform.IO/FileHelpers.cs @@ -333,6 +333,7 @@ public static void AppendLine(string path, string content) /// An action to be performed for each line of a file at the . /// Действие выполняемое для каждой строчки файла по пути . /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void EachLine(string path, Action action) { using var reader = new StreamReader(path); From e7f8b2afc515bbf111ce998dcb1cd23a18265f98 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:24:47 +0600 Subject: [PATCH 117/138] Add empty line to end --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index e0c7ed3..35eb4d3 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -32,4 +32,4 @@ public void TemporaryFileTestWithoutConsoleApp() Assert.False(File.Exists(fileName)); } } -} \ No newline at end of file +} From 21900b0328e762dbf1a4e8c6e26c9f05b3f3e431 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:31:56 +0600 Subject: [PATCH 118/138] Add string operator --- csharp/Platform.IO/TemporaryFile.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/csharp/Platform.IO/TemporaryFile.cs b/csharp/Platform.IO/TemporaryFile.cs index 579952c..5c20310 100644 --- a/csharp/Platform.IO/TemporaryFile.cs +++ b/csharp/Platform.IO/TemporaryFile.cs @@ -17,6 +17,8 @@ public class TemporaryFile : DisposableBase /// public readonly string Filename; + public static implicit operator string(TemporaryFile file) => file.Filename; + /// /// Initializes a instance. /// Инициализирует экземпляр класса . From 97a850aaec21930e27f43092e51c1be9df058780 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:39:28 +0600 Subject: [PATCH 119/138] Update XML Docs --- csharp/Platform.IO/TemporaryFile.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/csharp/Platform.IO/TemporaryFile.cs b/csharp/Platform.IO/TemporaryFile.cs index 5c20310..c976718 100644 --- a/csharp/Platform.IO/TemporaryFile.cs +++ b/csharp/Platform.IO/TemporaryFile.cs @@ -17,6 +17,11 @@ public class TemporaryFile : DisposableBase /// public readonly string Filename; + /// + /// Converts the instance to using the field value. + /// Преобразует экземпляр в используя поле . + /// + /// public static implicit operator string(TemporaryFile file) => file.Filename; /// From ea69040dd125e443d4e5eabfd61ed3c223d833aa Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:40:24 +0600 Subject: [PATCH 120/138] Update XML Docs --- csharp/Platform.IO/TemporaryFile.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/csharp/Platform.IO/TemporaryFile.cs b/csharp/Platform.IO/TemporaryFile.cs index c976718..40c4b48 100644 --- a/csharp/Platform.IO/TemporaryFile.cs +++ b/csharp/Platform.IO/TemporaryFile.cs @@ -21,7 +21,10 @@ public class TemporaryFile : DisposableBase /// Converts the instance to using the field value. /// Преобразует экземпляр в используя поле . /// - /// + /// + /// A instance. + /// Экземпляр . + /// public static implicit operator string(TemporaryFile file) => file.Filename; /// From c0ada882db8a974bbee2594d478b00ac794c04b2 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:52:17 +0600 Subject: [PATCH 121/138] Use conversion instead of field --- csharp/TemporaryFileTest/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/TemporaryFileTest/Program.cs b/csharp/TemporaryFileTest/Program.cs index d13b7a7..6781aa7 100644 --- a/csharp/TemporaryFileTest/Program.cs +++ b/csharp/TemporaryFileTest/Program.cs @@ -10,7 +10,7 @@ class Program static void Main(string[] args) { TemporaryFile tempFile = new TemporaryFile(); - Console.WriteLine(tempFile.Filename); + Console.WriteLine(tempFile); } } } From beeea517d4854458fe3753e1bb2eef556a1f5400 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:52:50 +0600 Subject: [PATCH 122/138] Use conversion instead of field --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 35eb4d3..d74c78f 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -26,7 +26,7 @@ public void TemporaryFileTestWithoutConsoleApp() string fileName; using (TemporaryFile tempFile = new TemporaryFile()) { - fileName = tempFile.Filename; + fileName = tempFile; Assert.True(File.Exists(fileName)); } Assert.False(File.Exists(fileName)); From 42057008b9ed47b7b39129c170ba4ab7b9561870 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:58:37 +0600 Subject: [PATCH 123/138] Update ReleaseNotes --- csharp/Platform.IO/Platform.IO.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/csharp/Platform.IO/Platform.IO.csproj b/csharp/Platform.IO/Platform.IO.csproj index cbb8403..a91a8bb 100644 --- a/csharp/Platform.IO/Platform.IO.csproj +++ b/csharp/Platform.IO/Platform.IO.csproj @@ -24,7 +24,8 @@ true snupkg latest - TemporaryFiles, TemporaryFile classes are added. + TemporaryFiles, TemporaryFile classes are added. + Truncate, AppendLine, EachLine methods are added to the FileHelpers class. From 8cdcff1fbe6697740489ae9473e8fce2bbe69a79 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:59:09 +0600 Subject: [PATCH 124/138] Use implicit type --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index d74c78f..2ea724f 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -24,7 +24,7 @@ public void TemporaryFileTest() public void TemporaryFileTestWithoutConsoleApp() { string fileName; - using (TemporaryFile tempFile = new TemporaryFile()) + using (var tempFile = new TemporaryFile()) { fileName = tempFile; Assert.True(File.Exists(fileName)); From 8a37e54633767aff9b85aaf4ca9316ecf5478020 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 19:59:47 +0600 Subject: [PATCH 125/138] Use implicit type and using statement --- csharp/TemporaryFileTest/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/TemporaryFileTest/Program.cs b/csharp/TemporaryFileTest/Program.cs index 6781aa7..862abec 100644 --- a/csharp/TemporaryFileTest/Program.cs +++ b/csharp/TemporaryFileTest/Program.cs @@ -9,7 +9,7 @@ class Program { static void Main(string[] args) { - TemporaryFile tempFile = new TemporaryFile(); + using var tempFile = new TemporaryFile(); Console.WriteLine(tempFile); } } From 6770b6acc0ff9628f1632c20e4fea0aac12c4e55 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 20:00:30 +0600 Subject: [PATCH 126/138] Use implicit type --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 2ea724f..2a369ac 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -9,7 +9,7 @@ public class TemporaryFileTests [Fact] public void TemporaryFileTest() { - using Process process = new Process(); + using var process = new Process(); process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5", "TemporaryFileTest")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; From c690965916016e38ad58a758a568cc6e4ac7324c Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 20:01:27 +0600 Subject: [PATCH 127/138] Use implicit type --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 2a369ac..94e0fc6 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -14,7 +14,7 @@ public void TemporaryFileTest() process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.Start(); - string path = process.StandardOutput.ReadLine(); + var path = process.StandardOutput.ReadLine(); Assert.True(File.Exists(path)); process.WaitForExit(); Assert.False(File.Exists(path)); From 668098e87bad39f28d69129d9f640ccdb96b6833 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 20:05:02 +0600 Subject: [PATCH 128/138] Use instance initialization shorthand --- csharp/TemporaryFileTest/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/TemporaryFileTest/Program.cs b/csharp/TemporaryFileTest/Program.cs index 862abec..504c919 100644 --- a/csharp/TemporaryFileTest/Program.cs +++ b/csharp/TemporaryFileTest/Program.cs @@ -9,7 +9,7 @@ class Program { static void Main(string[] args) { - using var tempFile = new TemporaryFile(); + using TemporaryFile tempFile = new(); Console.WriteLine(tempFile); } } From 3c00fb4f1ae1ed413dab4fd5d4c39c9899fbf1e1 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 20:05:36 +0600 Subject: [PATCH 129/138] Use instance initialization shorthand --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 94e0fc6..4d216ac 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -24,7 +24,7 @@ public void TemporaryFileTest() public void TemporaryFileTestWithoutConsoleApp() { string fileName; - using (var tempFile = new TemporaryFile()) + using (TemporaryFile tempFile = new()) { fileName = tempFile; Assert.True(File.Exists(fileName)); From a1853e1147ddd39d7b52fdc1930e8d59bb55b924 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 20:07:39 +0600 Subject: [PATCH 130/138] Use instance initialization shorthand --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 4d216ac..37e1c2a 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -9,7 +9,7 @@ public class TemporaryFileTests [Fact] public void TemporaryFileTest() { - using var process = new Process(); + using Process Process = new(); process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5", "TemporaryFileTest")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; From 3e1b84d719458f65dfd4f8589c4bd1e8ab8fa58f Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 20:08:19 +0600 Subject: [PATCH 131/138] Rename back --- csharp/Platform.IO.Tests/TemporaryFileTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO.Tests/TemporaryFileTests.cs b/csharp/Platform.IO.Tests/TemporaryFileTests.cs index 37e1c2a..c79ac39 100644 --- a/csharp/Platform.IO.Tests/TemporaryFileTests.cs +++ b/csharp/Platform.IO.Tests/TemporaryFileTests.cs @@ -9,7 +9,7 @@ public class TemporaryFileTests [Fact] public void TemporaryFileTest() { - using Process Process = new(); + using Process process = new(); process.StartInfo.FileName = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "TemporaryFileTest", "bin", "Debug", "net5", "TemporaryFileTest")); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; From 063d0c836614c798f917f2f91a53f43db3f8a716 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 20:09:03 +0600 Subject: [PATCH 132/138] Use instance initialization shorthand --- csharp/Platform.IO/TemporaryFiles.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index ebe9d14..8f9061c 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -11,7 +11,7 @@ namespace Platform.IO public class TemporaryFiles { private const string UserFilesListFileNamePrefix = ".used-temporary-files.txt"; - private static readonly object UsedFilesListLock = new object(); + private static readonly object UsedFilesListLock = new(); private static readonly string UsedFilesListFilename = Assembly.GetExecutingAssembly().Location + UserFilesListFileNamePrefix; [MethodImpl(MethodImplOptions.AggressiveInlining)] From 0770642cc67b9144c04b2e27654d738fe430d66b Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 20:09:30 +0600 Subject: [PATCH 133/138] Remove comments warning disable --- csharp/Platform.IO/ConsoleCancellation.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/csharp/Platform.IO/ConsoleCancellation.cs b/csharp/Platform.IO/ConsoleCancellation.cs index 2160094..a40bf09 100644 --- a/csharp/Platform.IO/ConsoleCancellation.cs +++ b/csharp/Platform.IO/ConsoleCancellation.cs @@ -4,8 +4,6 @@ using Platform.Disposables; using Platform.Threading; -#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - namespace Platform.IO { /// From d0e88c694b33d54cad1e3cca6282659c0a97844d Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 20:09:52 +0600 Subject: [PATCH 134/138] Remove unused Main() args --- csharp/TemporaryFileTest/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/TemporaryFileTest/Program.cs b/csharp/TemporaryFileTest/Program.cs index 504c919..c33e962 100644 --- a/csharp/TemporaryFileTest/Program.cs +++ b/csharp/TemporaryFileTest/Program.cs @@ -7,7 +7,7 @@ namespace TemporaryFileTest { class Program { - static void Main(string[] args) + static void Main() { using TemporaryFile tempFile = new(); Console.WriteLine(tempFile); From cca393fc4abf18b46bdb43a796258abe158d8673 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 20:28:59 +0600 Subject: [PATCH 135/138] Format --- csharp/Platform.IO/Platform.IO.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp/Platform.IO/Platform.IO.csproj b/csharp/Platform.IO/Platform.IO.csproj index a91a8bb..23da85b 100644 --- a/csharp/Platform.IO/Platform.IO.csproj +++ b/csharp/Platform.IO/Platform.IO.csproj @@ -25,8 +25,8 @@ snupkg latest TemporaryFiles, TemporaryFile classes are added. - Truncate, AppendLine, EachLine methods are added to the FileHelpers class. - + Truncate, AppendLine, EachLine methods are added to the FileHelpers class. + From c076d8b87b55524aefe4bce1a798cdb73ecf98bb Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 20:39:04 +0600 Subject: [PATCH 136/138] Update XML Docs --- csharp/Platform.IO/TemporaryFile.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/csharp/Platform.IO/TemporaryFile.cs b/csharp/Platform.IO/TemporaryFile.cs index 40c4b48..212cc79 100644 --- a/csharp/Platform.IO/TemporaryFile.cs +++ b/csharp/Platform.IO/TemporaryFile.cs @@ -25,6 +25,10 @@ public class TemporaryFile : DisposableBase /// A instance. /// Экземпляр . /// + /// + /// Path to the temporary file. + /// Путь к временному файлу. + /// public static implicit operator string(TemporaryFile file) => file.Filename; /// From 72f4d77378a2c5fe68b34eb41216f88648fddd71 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 20:47:33 +0600 Subject: [PATCH 137/138] Format --- csharp/Platform.IO/Platform.IO.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csharp/Platform.IO/Platform.IO.csproj b/csharp/Platform.IO/Platform.IO.csproj index 23da85b..a9b3575 100644 --- a/csharp/Platform.IO/Platform.IO.csproj +++ b/csharp/Platform.IO/Platform.IO.csproj @@ -25,7 +25,7 @@ snupkg latest TemporaryFiles, TemporaryFile classes are added. - Truncate, AppendLine, EachLine methods are added to the FileHelpers class. + Truncate, AppendLine, EachLine methods are added to the FileHelpers class. From ec57ddb341b3478f37a83ee0a383d42bd61b9dba Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Fri, 2 Jul 2021 21:25:19 +0600 Subject: [PATCH 138/138] Format --- csharp/Platform.IO/Platform.IO.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp/Platform.IO/Platform.IO.csproj b/csharp/Platform.IO/Platform.IO.csproj index a9b3575..a16a8a1 100644 --- a/csharp/Platform.IO/Platform.IO.csproj +++ b/csharp/Platform.IO/Platform.IO.csproj @@ -25,8 +25,8 @@ snupkg latest TemporaryFiles, TemporaryFile classes are added. - Truncate, AppendLine, EachLine methods are added to the FileHelpers class. - +Truncate, AppendLine, EachLine methods are added to the FileHelpers class. +