Skip to content

Commit e38625a

Browse files
committed
Apply dotnet format fixes
Fix whitespace and import ordering in BatchProcessor, TagValidation, and FileOperations example.
1 parent 45a2901 commit e38625a

3 files changed

Lines changed: 24 additions & 34 deletions

File tree

examples/FileOperations/Program.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,43 @@
44
using TagLibSharp2.Core;
55
using TagLibSharp2.Id3.Id3v2;
66
using TagLibSharp2.Mpeg;
7-
using TagLibSharp2.Xiph;
87
using TagLibSharp2.Ogg;
8+
using TagLibSharp2.Xiph;
99

10-
Console.WriteLine("TagLibSharp2 File Operations Examples");
11-
Console.WriteLine(new string('=', 50));
10+
Console.WriteLine ("TagLibSharp2 File Operations Examples");
11+
Console.WriteLine (new string ('=', 50));
1212

1313
// Example 1: Auto-detect and read any supported format
14-
Console.WriteLine("\n1. Auto-Detect Format");
15-
Console.WriteLine("-".PadRight(30, '-'));
14+
Console.WriteLine ("\n1. Auto-Detect Format");
15+
Console.WriteLine ("-".PadRight (30, '-'));
1616

1717
await DemoAutoDetect ().ConfigureAwait (false);
1818

1919
// Example 2: Batch processing with progress
20-
Console.WriteLine("\n2. Batch Processing");
21-
Console.WriteLine("-".PadRight(30, '-'));
20+
Console.WriteLine ("\n2. Batch Processing");
21+
Console.WriteLine ("-".PadRight (30, '-'));
2222

2323
await DemoBatchProcessing ().ConfigureAwait (false);
2424

2525
// Example 3: Tag validation
26-
Console.WriteLine("\n3. Tag Validation");
27-
Console.WriteLine("-".PadRight(30, '-'));
26+
Console.WriteLine ("\n3. Tag Validation");
27+
Console.WriteLine ("-".PadRight (30, '-'));
2828

2929
DemoTagValidation ();
3030

3131
// Example 4: Cross-format tag copying
32-
Console.WriteLine("\n4. Cross-Format Tag Copying");
33-
Console.WriteLine("-".PadRight(30, '-'));
32+
Console.WriteLine ("\n4. Cross-Format Tag Copying");
33+
Console.WriteLine ("-".PadRight (30, '-'));
3434

3535
DemoTagCopy ();
3636

3737
// Example 5: Safe file operations
38-
Console.WriteLine("\n5. Safe File Operations");
39-
Console.WriteLine("-".PadRight(30, '-'));
38+
Console.WriteLine ("\n5. Safe File Operations");
39+
Console.WriteLine ("-".PadRight (30, '-'));
4040

4141
await DemoSafeFileOps ().ConfigureAwait (false);
4242

43-
Console.WriteLine("\nAll examples completed!");
43+
Console.WriteLine ("\nAll examples completed!");
4444

4545
// --- Example Implementations ---
4646

src/TagLibSharp2/Core/BatchProcessor.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,12 @@ public static async Task<IReadOnlyList<BatchResult<T>>> ProcessAsync<T> (
8484
try {
8585
var result = await operation (path, cancellationToken).ConfigureAwait (false);
8686
results[index] = BatchResult<T>.Success (path, result);
87-
}
88-
catch (OperationCanceledException) {
87+
} catch (OperationCanceledException) {
8988
results[index] = BatchResult<T>.Cancelled (path);
9089
throw;
91-
}
92-
catch (Exception ex) {
90+
} catch (Exception ex) {
9391
results[index] = BatchResult<T>.Failure (path, ex);
94-
}
95-
finally {
92+
} finally {
9693
semaphore.Release ();
9794
var count = Interlocked.Increment (ref completed);
9895
progress?.Report (new BatchProgress (count, pathList.Count, path));
@@ -102,8 +99,7 @@ public static async Task<IReadOnlyList<BatchResult<T>>> ProcessAsync<T> (
10299

103100
try {
104101
await Task.WhenAll (tasks).ConfigureAwait (false);
105-
}
106-
catch (OperationCanceledException) {
102+
} catch (OperationCanceledException) {
107103
// Some tasks may have been cancelled, results will reflect this
108104
}
109105

@@ -147,11 +143,9 @@ public static IReadOnlyList<BatchResult<T>> Process<T> (
147143
try {
148144
var result = operation (path);
149145
results[i] = BatchResult<T>.Success (path, result);
150-
}
151-
catch (Exception ex) {
146+
} catch (Exception ex) {
152147
results[i] = BatchResult<T>.Failure (path, ex);
153-
}
154-
finally {
148+
} finally {
155149
var count = Interlocked.Increment (ref completed);
156150
progress?.Report (new BatchProgress (count, pathList.Count, path));
157151
}

src/TagLibSharp2/Core/TagValidation.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ public sealed class ValidationResult
9494
/// <summary>
9595
/// Gets a value indicating whether the tag has any errors.
9696
/// </summary>
97-
public bool HasErrors
98-
{
97+
public bool HasErrors {
9998
get {
10099
for (var i = 0; i < _issues.Count; i++) {
101100
if (_issues[i].Severity == ValidationSeverity.Error)
@@ -108,8 +107,7 @@ public bool HasErrors
108107
/// <summary>
109108
/// Gets a value indicating whether the tag has any warnings.
110109
/// </summary>
111-
public bool HasWarnings
112-
{
110+
public bool HasWarnings {
113111
get {
114112
for (var i = 0; i < _issues.Count; i++) {
115113
if (_issues[i].Severity == ValidationSeverity.Warning)
@@ -122,8 +120,7 @@ public bool HasWarnings
122120
/// <summary>
123121
/// Gets the number of errors.
124122
/// </summary>
125-
public int ErrorCount
126-
{
123+
public int ErrorCount {
127124
get {
128125
var count = 0;
129126
for (var i = 0; i < _issues.Count; i++) {
@@ -137,8 +134,7 @@ public int ErrorCount
137134
/// <summary>
138135
/// Gets the number of warnings.
139136
/// </summary>
140-
public int WarningCount
141-
{
137+
public int WarningCount {
142138
get {
143139
var count = 0;
144140
for (var i = 0; i < _issues.Count; i++) {

0 commit comments

Comments
 (0)