From 53b46fee6313ef431accb94cc17098b3b6cdf776 Mon Sep 17 00:00:00 2001 From: konard Date: Fri, 12 Sep 2025 22:23:06 +0300 Subject: [PATCH 1/4] Initial commit with task details for issue #85 Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: https://github.com/linksplatform/IO/issues/85 --- CLAUDE.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..152715f --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,5 @@ +Issue to solve: https://github.com/linksplatform/IO/issues/85 +Your prepared branch: issue-85-fa03ac14 +Your prepared working directory: /tmp/gh-issue-solver-1757704980998 + +Proceed. \ No newline at end of file From bf01703b3e181208773863e12c4f161ee73463f4 Mon Sep 17 00:00:00 2001 From: konard Date: Fri, 12 Sep 2025 22:34:03 +0300 Subject: [PATCH 2/4] Add static constructor to TemporaryFiles class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Adds static constructor that calls DeleteAllPreviouslyUsed() - Ensures automatic cleanup of temporary files from previous runs - Static constructor is called when the class is first accessed - Includes bilingual documentation (English/Russian) Fixes #85 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- csharp/Platform.IO/TemporaryFiles.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/csharp/Platform.IO/TemporaryFiles.cs b/csharp/Platform.IO/TemporaryFiles.cs index 7a719df..879217f 100644 --- a/csharp/Platform.IO/TemporaryFiles.cs +++ b/csharp/Platform.IO/TemporaryFiles.cs @@ -13,6 +13,15 @@ public class TemporaryFiles private const string UserFilesListFileNamePrefix = ".used-temporary-files.txt"; private static readonly object UsedFilesListLock = new(); private static readonly string UsedFilesListFilename = Assembly.GetExecutingAssembly().Location + UserFilesListFileNamePrefix; + + /// + /// Static constructor that cleans up all previously used temporary files. + /// Статический конструктор, который очищает все ранее использованные временные файлы. + /// + static TemporaryFiles() + { + DeleteAllPreviouslyUsed(); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void AddToUsedFilesList(string filename) { From 594bbd628bed2c5334ae9936216412af84e2cc2b Mon Sep 17 00:00:00 2001 From: konard Date: Fri, 12 Sep 2025 22:34:51 +0300 Subject: [PATCH 3/4] 'Auto-commit changes made by Claude MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude ' --- .../_vds2816548_2025-09-12_22_28_36.trx | 40 +++++++++++++++++++ examples/StaticConstructorTest/Program.cs | 22 ++++++++++ .../StaticConstructorTest.csproj | 14 +++++++ examples/test_static_constructor.cs | 28 +++++++++++++ 4 files changed, 104 insertions(+) create mode 100644 csharp/test-results/_vds2816548_2025-09-12_22_28_36.trx create mode 100644 examples/StaticConstructorTest/Program.cs create mode 100644 examples/StaticConstructorTest/StaticConstructorTest.csproj create mode 100644 examples/test_static_constructor.cs diff --git a/csharp/test-results/_vds2816548_2025-09-12_22_28_36.trx b/csharp/test-results/_vds2816548_2025-09-12_22_28_36.trx new file mode 100644 index 0000000..85c90ec --- /dev/null +++ b/csharp/test-results/_vds2816548_2025-09-12_22_28_36.trx @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [xUnit.net 00:00:00.01] xUnit.net VSTest Adapter v2.4.3+1b45f5407b (64-bit .NET 8.0.19) +[xUnit.net 00:00:01.97] Discovering: Platform.IO.Tests +[xUnit.net 00:00:02.20] Discovered: Platform.IO.Tests +[xUnit.net 00:00:02.23] Starting: Platform.IO.Tests +[xUnit.net 00:00:02.69] Finished: Platform.IO.Tests + + + + \ No newline at end of file diff --git a/examples/StaticConstructorTest/Program.cs b/examples/StaticConstructorTest/Program.cs new file mode 100644 index 0000000..5451672 --- /dev/null +++ b/examples/StaticConstructorTest/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.IO; +using Platform.IO; + +// Create a simple test to verify static constructor is called +class Program +{ + static void Main() + { + Console.WriteLine("Testing TemporaryFiles static constructor..."); + Console.WriteLine("Creating first temporary file (this will trigger static constructor)..."); + var temp1 = TemporaryFiles.UseNew(); + Console.WriteLine($"First temp file: {temp1}"); + Console.WriteLine($"First temp file exists: {File.Exists(temp1)}"); + + Console.WriteLine("\nTest completed successfully!"); + Console.WriteLine("The static constructor was called when TemporaryFiles.UseNew() was first accessed."); + + // Clean up the test file + File.Delete(temp1); + } +} diff --git a/examples/StaticConstructorTest/StaticConstructorTest.csproj b/examples/StaticConstructorTest/StaticConstructorTest.csproj new file mode 100644 index 0000000..924a3ee --- /dev/null +++ b/examples/StaticConstructorTest/StaticConstructorTest.csproj @@ -0,0 +1,14 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + diff --git a/examples/test_static_constructor.cs b/examples/test_static_constructor.cs new file mode 100644 index 0000000..83bc010 --- /dev/null +++ b/examples/test_static_constructor.cs @@ -0,0 +1,28 @@ +using System; +using System.IO; +using Platform.IO; + +// Create a simple test to verify static constructor is called +class Program +{ + static void Main() + { + Console.WriteLine("Creating first temporary file..."); + var temp1 = TemporaryFiles.UseNew(); + Console.WriteLine($"First temp file: {temp1}"); + Console.WriteLine($"First temp file exists: {File.Exists(temp1)}"); + + Console.WriteLine("\nCreating second temporary file..."); + var temp2 = TemporaryFiles.UseNew(); + Console.WriteLine($"Second temp file: {temp2}"); + Console.WriteLine($"Second temp file exists: {File.Exists(temp2)}"); + + Console.WriteLine("\nCalling DeleteAllPreviouslyUsed manually..."); + TemporaryFiles.DeleteAllPreviouslyUsed(); + + Console.WriteLine($"First temp file exists after cleanup: {File.Exists(temp1)}"); + Console.WriteLine($"Second temp file exists after cleanup: {File.Exists(temp2)}"); + + Console.WriteLine("\nTest completed successfully!"); + } +} \ No newline at end of file From 6f01ac46f471dfe8154f647ee37d8753a5b60f6f Mon Sep 17 00:00:00 2001 From: konard Date: Fri, 12 Sep 2025 22:34:53 +0300 Subject: [PATCH 4/4] Remove CLAUDE.md - Claude command completed --- CLAUDE.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index 152715f..0000000 --- a/CLAUDE.md +++ /dev/null @@ -1,5 +0,0 @@ -Issue to solve: https://github.com/linksplatform/IO/issues/85 -Your prepared branch: issue-85-fa03ac14 -Your prepared working directory: /tmp/gh-issue-solver-1757704980998 - -Proceed. \ No newline at end of file