Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Sep 13, 2023
1 parent 2e2959e commit 95c9792
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
Binary file modified src/NaughtyStrings.Bogus/Naughty.cs
Binary file not shown.
Binary file modified src/NaughtyStrings/TheNaughtyStrings.cs
Binary file not shown.
34 changes: 21 additions & 13 deletions src/Tests/Sync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,28 @@ public async Task SyncNaughtyStrings()

var categories = Parse(content).ToList();

var naughtyStringsPath = Path.GetFullPath("../../../../NaughtyStrings/TheNaughtyStrings.cs");
File.Delete(naughtyStringsPath);
using (var provider = CodeDomProvider.CreateProvider("CSharp"))
{
await using var writer = File.CreateText(naughtyStringsPath);
WriteNaughtyStrings(writer, provider, categories);
}
await WriteTheNaughtyStrings(categories);

var bogusPath = Path.GetFullPath("../../../../NaughtyStrings.Bogus/Naughty.cs");
File.Delete(bogusPath);
await using (var writer = File.CreateText(bogusPath))
{
WriteBogus(writer, categories);
}
await WriteNaughty(categories);
}

static async Task WriteNaughty(List<Category> categories)
{
var path = Path.GetFullPath("../../../../NaughtyStrings.Bogus/Naughty.cs");
File.Delete(path);
await using var stream = File.Create(path);
await using var writer = new StreamWriter(stream, encoding: Encoding.Unicode);
WriteBogus(writer, categories);
}

static async Task WriteTheNaughtyStrings(List<Category> categories)
{
var path = Path.GetFullPath("../../../../NaughtyStrings/TheNaughtyStrings.cs");
File.Delete(path);
using var provider = CodeDomProvider.CreateProvider("CSharp");
await using var stream = File.Create(path);
await using var writer = new StreamWriter(stream, encoding: Encoding.Unicode);
WriteNaughtyStrings(writer, provider, categories);
}

static void WriteBogus(StreamWriter writer, List<Category> categories)
Expand Down

0 comments on commit 95c9792

Please sign in to comment.