Skip to content

Commit aa873bc

Browse files
authored
Merge pull request #98 from Tynab/develop
Develop
2 parents 418936c + cb6e2e8 commit aa873bc

File tree

12 files changed

+550
-57
lines changed

12 files changed

+550
-57
lines changed

README.md

Lines changed: 488 additions & 48 deletions
Large diffs are not rendered by default.

lib/YANLib/Footer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[Home](Home) |
66
[Repository](https://github.com/tynab/YANLib) |
77
[Releases](https://github.com/tynab/YANLib/releases) |
8-
[Package](https://www.nuget.org/packages/YANLib)
8+
[Package](https://www.nuget.org/packages/Tynab.YANLib)
99

1010
<sub>YANLib © 2023 - Documentation last updated: May 4, 2025</sub>
1111

lib/YANLib/Home.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ public Customer PrepareCustomerData(Customer customer)
212212
{
213213
// Create a copy and normalize the data
214214
var normalizedCustomer = customer.Copy();
215+
215216
normalizedCustomer.Name = normalizedCustomer.Name.CleanSpace().FormatName();
216217
normalizedCustomer.Email = normalizedCustomer.Email.Lower();
217218
normalizedCustomer.PhoneNumber = normalizedCustomer.PhoneNumber.FilterNumber();

lib/YANLib/YANExpression.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ public object GetPropertyValue<T>(T obj, string propertyName)
145145
{
146146
var expression = YANExpression.PropertyExpression<T>("x", propertyName);
147147
var func = expression.Compile();
148+
148149
return func(obj);
149150
}
150151

@@ -164,6 +165,7 @@ Use with LINQ to create dynamic queries:
164165
public IQueryable<T> OrderBy<T>(IQueryable<T> source, string propertyName)
165166
{
166167
var expression = YANExpression.PropertyExpression<T>("x", propertyName);
168+
167169
return source.OrderBy(expression);
168170
}
169171

@@ -183,16 +185,19 @@ public object TryGetPropertyValue<T>(T obj, string propertyName)
183185
{
184186
var expression = YANExpression.PropertyExpression<T>("x", propertyName);
185187
var func = expression.Compile();
188+
186189
return func(obj);
187190
}
188191
catch (ArgumentException ex) when (ex.Message.Contains("does not contain a property named"))
189192
{
190193
Console.WriteLine($"Property '{propertyName}' does not exist on type {typeof(T).Name}");
194+
191195
return null;
192196
}
193197
catch (Exception ex)
194198
{
195199
Console.WriteLine($"Error accessing property: {ex.Message}");
200+
196201
return null;
197202
}
198203
}
@@ -225,13 +230,15 @@ public static Action<T, TProperty> CreatePropertySetter<T, TProperty>(string pro
225230
var valueParameter = Expression.Parameter(typeof(TProperty), "value");
226231

227232
var property = typeof(T).GetProperty(propertyName);
233+
228234
if (property == null)
229235
throw new ArgumentException($"Type {typeof(T).Name} does not contain a property named {propertyName}");
230236

231237
var propertyAccess = Expression.Property(parameter, property);
232238
var assign = Expression.Assign(propertyAccess, valueParameter);
233239

234240
var lambda = Expression.Lambda<Action<T, TProperty>>(assign, parameter, valueParameter);
241+
235242
return lambda.Compile();
236243
}
237244

lib/YANLib/YANJson.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ public T SafeDeserialize<T>(string json) where T : class
260260
catch (Exception ex)
261261
{
262262
Console.WriteLine($"Error deserializing JSON: {ex.Message}");
263+
263264
return null;
264265
}
265266
}

lib/YANLib/YANLib.csproj

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,21 @@
99
<Title>YANLib</Title>
1010
<Authors>Yami An</Authors>
1111
<Company>YAN</Company>
12-
<Description>YANLib is an optimized .NET library that enhances data processing tasks. It offers various extension utilities to improve the handling of datetimes, numbers, text, passwords, JSON, and more. With a focus on large-scale data processing, YANLib provides efficient solutions for managing and manipulating data in .NET applications.</Description>
12+
<Description>YANLib (YAMI AN NEPHILIM LIBRARY) is a comprehensive .NET utility library providing powerful extension methods that enhance developer productivity. Built on .NET 6.0 LTS, it offers high-performance utilities for JSON serialization, text manipulation, object validation, task coordination, mathematical operations, DateTime handling, and more.
13+
14+
Key features:
15+
• YANJson: High-performance JSON serialization with robust error handling
16+
• YANText: String manipulation, validation, and transformation with null safety
17+
• YANObject: Object validation, property analysis, and deep copying
18+
• YANTask: Enhanced task coordination with conditional waiting and error handling
19+
• YANUnmanaged: Type parsing and conversion with built-in error handling
20+
• YANRandom: Random value generation for various types and collections
21+
• YANMath: Mathematical operations with null handling and type conversion
22+
• YANDateTime: Time zone conversion and date calculations
23+
• YANProcess: Process management utilities
24+
• YANExpression: Dynamic property access and expression tree utilities
25+
26+
All components feature fluent APIs, robust null handling, collection support, and performance optimizations. YANLib simplifies common programming tasks while maintaining high performance, making it an essential toolkit for .NET developers.</Description>
1327
<Copyright>Copyright © 2023</Copyright>
1428
<PackageIcon>icon.png</PackageIcon>
1529
<PackageProjectUrl>https://github.com/Tynab</PackageProjectUrl>
@@ -18,15 +32,30 @@
1832
<PackAsTool>False</PackAsTool>
1933
<PackageReadmeFile>README.md</PackageReadmeFile>
2034
<RepositoryType>git</RepositoryType>
21-
<PackageReleaseNotes>
22-
Update
23-
- DateTime
24-
- Enumerable
25-
</PackageReleaseNotes>
35+
<PackageReleaseNotes>## YANLib 8.0.0 - Complete Rebuild for .NET 8
36+
37+
### Breaking Changes
38+
- Complete rebuild targeting .NET 8
39+
- All previous extensions are now obsolete
40+
- New namespace structure and API design
41+
- Not backward compatible with previous versions
42+
43+
### New Features
44+
- Rebuilt components with modern architecture: YANJson, YANUnmanaged, YANRandom, YANTask, YANText, YANObject, YANProcess, YANMath, YANDateTime, YANExpression
45+
- Consistent null handling and collection operations
46+
- Enhanced generic type support
47+
- Thread-safety improvements
48+
49+
### Performance
50+
- Significant performance improvements across all components
51+
- Reduced memory allocations
52+
- Optimized algorithms and caching strategies
53+
54+
See full documentation at: https://github.com/Tynab/YANLib/wiki</PackageReleaseNotes>
2655
<PackageLicenseExpression>MIT</PackageLicenseExpression>
2756
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
2857
<PackageId>Tynab.YANLib</PackageId>
29-
<Version>4.0.1</Version>
58+
<Version>8.0.0</Version>
3059
<LangVersion>preview</LangVersion>
3160
<ProduceReferenceAssembly>True</ProduceReferenceAssembly>
3261
<IsPackable>true</IsPackable>

lib/YANLib/YANProcess.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ await YANProcess.KillAllProcessesByNames("chrome", "firefox", "edge");
2323

2424
// Kill processes from a collection of names
2525
List<string> processesToKill = ["notepad", "calc", "mspaint"];
26+
2627
await processesToKill.KillAllProcessesByNames();
2728
```
2829

@@ -58,6 +59,7 @@ await YANProcess.KillAllProcessesByNames("chrome", "firefox", "edge", "opera");
5859

5960
// Terminate processes from a collection
6061
List<string> backgroundProcesses = ["svhost", "wininit", "lsass"];
62+
6163
await backgroundProcesses.KillAllProcessesByNames();
6264
```
6365

@@ -135,6 +137,7 @@ public class SystemManager
135137
{
136138
// Terminate processes that might be consuming too many resources
137139
List<string> resourceHungryProcesses = GetResourceIntensiveProcesses();
140+
138141
await resourceHungryProcesses.KillAllProcessesByNames();
139142
}
140143

lib/YANLib/YANRandom.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ public class PerformanceTester
281281
var result = data.Select(x => Math.Pow(x, 2)).Sum();
282282

283283
stopwatch.Stop();
284+
284285
return stopwatch.Elapsed;
285286
}
286287
}
@@ -294,6 +295,7 @@ public class PasswordGenerator
294295
public string GenerateRandomPassword(int length)
295296
{
296297
var random = new Random();
298+
297299
return new string(Enumerable.Range(0, length)
298300
.Select(_ => random.NextChar())
299301
.ToArray());

lib/YANLib/YANTask.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ public async Task<string> FindFirstValidUrl(IEnumerable<string> potentialUrls)
9999
try
100100
{
101101
using var client = new HttpClient();
102+
102103
var response = await client.GetAsync(url);
104+
103105
return new { Url = url, IsValid = response.IsSuccessStatusCode };
104106
}
105107
catch
@@ -109,6 +111,7 @@ public async Task<string> FindFirstValidUrl(IEnumerable<string> potentialUrls)
109111
});
110112

111113
var result = await tasks.WaitAnyWithCondition(r => r.IsValid);
114+
112115
return result?.Url ?? string.Empty;
113116
}
114117
```
@@ -122,6 +125,7 @@ public async Task<int> ProcessDataWithFilter(IEnumerable<string> dataFiles)
122125
{
123126
var data = await File.ReadAllTextAsync(file);
124127
var processedValue = ProcessData(data);
128+
125129
return processedValue;
126130
});
127131

@@ -145,6 +149,7 @@ public async Task<T> ExecuteWithTimeoutAndFallback<T>(
145149
TimeSpan timeout)
146150
{
147151
var cts = new CancellationTokenSource();
152+
148153
cts.CancelAfter(timeout);
149154

150155
try

lib/YANLib/YANText.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,18 @@ Work safely with nullable characters:
126126
```csharp
127127
// Null checking
128128
char? nullChar = null;
129+
129130
nullChar.IsNullEmpty(); // Returns true
130131
131132
// Character type checking with null safety
132133
char? c = 'a';
134+
133135
c.IsAlphabetic(); // Returns true
134136
nullChar.IsAlphabetic(); // Returns false
135137
136138
// Case conversion with null safety
137139
char? upper = 'A';
140+
138141
upper.Lower(); // Returns 'a'
139142
nullChar.Lower(); // Returns null
140143
```

0 commit comments

Comments
 (0)