Skip to content

Commit

Permalink
Renamed namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
SammyROCK committed Jul 3, 2024
1 parent 104c471 commit d7072b3
Show file tree
Hide file tree
Showing 21 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31912.275
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NeoAttributedConfiguration", "AttributedConfiguration\NeoAttributedConfiguration.csproj", "{6CAAE115-0B00-4ECB-B9E8-39BE0758087F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NeoAttributedConfiguration", "NeoAttributedConfiguration\NeoAttributedConfiguration.csproj", "{6CAAE115-0B00-4ECB-B9E8-39BE0758087F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{640A49F2-D1F0-4007-8F63-2EAB5921416E}"
ProjectSection(SolutionItems) = preProject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace AttributedConfiguration {
namespace NeoAttributedConfiguration {
public static class ArrayExtensions {
public static Array ToTypeArray<T>(this T[] values, Type type) {
var typeArray = Array.CreateInstance(type, values.Length);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.Extensions.Configuration;
using System;

namespace AttributedConfiguration {
namespace NeoAttributedConfiguration {
public abstract class ConfigurationException : Exception {
private readonly Lazy<string> message;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.Extensions.Configuration;
using System;

namespace AttributedConfiguration {
namespace NeoAttributedConfiguration {
public class ConfigurationFormatException : ConfigurationException {
public ConfigurationFormatException(IConfiguration configuration, string key, Type targetType, Exception? innerException = null)
: base(configuration, key, innerException) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.Extensions.Configuration;

namespace AttributedConfiguration {
namespace NeoAttributedConfiguration {
public class ConfigurationNotFoundException : ConfigurationException {
public ConfigurationNotFoundException(IConfiguration configuration, string key)
: base(configuration, key) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace AttributedConfiguration {
namespace NeoAttributedConfiguration {
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public class ConfigureAttribute : Attribute {
public ConfigureAttribute(string? section = null, Type? serviceType = null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace AttributedConfiguration {
namespace NeoAttributedConfiguration {
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class DefaultAttribute : OptionalAttribute {
public DefaultAttribute(object? defaultValue = null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using System.Linq;
using System.Reflection;

namespace AttributedConfiguration {
namespace NeoAttributedConfiguration {
public static class IConfigurationExtensions {
public static T Resolve<T>(this IConfiguration configuration) {
var type = typeof(T);
Expand Down Expand Up @@ -216,15 +216,15 @@ public static Array GetMany(this IConfiguration configuration, string key, Type

public static string[] GetStrings(this IConfiguration configuration, string key)
=> configuration.GetSections(key)
.Select(section => section.Value)
.Select(section => section.Value!)
.ToArray();

public static TimeSpan[] GetManyTimeSpan(this IConfiguration configuration, string key)
=> Enum.GetValues(typeof(TimeSource)).Cast<TimeSource>()
.SelectMany(
timeSource => configuration.GetSections($"{key}{timeSource}")
.Select(
section => timeSource.Parse(section.Value)
section => timeSource.Parse(section.Value!)
)
).ToArray();

Expand All @@ -248,7 +248,7 @@ public static IDictionary GetDict(this IConfiguration configuration, string key,
},
section => {
if(valueType.IsEnum) {
return Enum.Parse(valueType, section.Value, true);
return Enum.Parse(valueType, section.Value!, true);
}
if(valueType == typeof(string)) { return section.Value; }
if(valueType.IsPrimitive || valueType == typeof(decimal)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Microsoft.Extensions.Configuration;
using System;

namespace AttributedConfiguration {
namespace NeoAttributedConfiguration {
public static class IConfigurationSectionExtensions {
public static TimeSpan ResolveTimeSpan(this IConfigurationSection section) {
var timeSource = section.Key.GetTimeSource();
return timeSource.Parse(section.Value);
return timeSource.Parse(section.Value!);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;

namespace AttributedConfiguration {
namespace NeoAttributedConfiguration {
public static class IEnumerableExtensions {
public static Array ToTypeArray<T>(this IEnumerable<T> enumerable, Type type)
=> enumerable.ToArray().ToTypeArray(type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System;
using System.Linq;

namespace AttributedConfiguration {
namespace NeoAttributedConfiguration {
public static class IServiceCollectionExtensions {
public static IServiceCollection AddAttributedConfigurations(this IServiceCollection serviceCollection, IConfiguration configuration) {
foreach(var (type, configureAttribute) in AppDomain.CurrentDomain.EnumerateTypesWithAttribute<ConfigureAttribute>()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace AttributedConfiguration {
namespace NeoAttributedConfiguration {
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
public class NameAttribute : Attribute {
public NameAttribute(string name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace AttributedConfiguration {
namespace NeoAttributedConfiguration {
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class OptionalAttribute : Attribute {
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace AttributedConfiguration {
namespace NeoAttributedConfiguration {
public static class StringExtensions {
public static TimeSource GetTimeSource(this string key) {
if(key.IsFromTimeSource(TimeSource.InDays)) { return TimeSource.InDays; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AttributedConfiguration {
namespace NeoAttributedConfiguration {
public enum TimeSource {
Undefined = 0,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace AttributedConfiguration {
namespace NeoAttributedConfiguration {
public static class TimeSourceExtensions {
public static TimeSpan Parse(this TimeSource timeSource, string stringValue) {
var doubleValue = double.Parse(stringValue);
Expand Down
2 changes: 1 addition & 1 deletion Sample/NestedConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#nullable disable warnings
using AttributedConfiguration;
using NeoAttributedConfiguration;
using Microsoft.Extensions.Configuration;

namespace Sample {
Expand Down
2 changes: 1 addition & 1 deletion Sample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// See https://aka.ms/new-console-template for more information
using AttributedConfiguration;
using NeoAttributedConfiguration;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
Expand Down
2 changes: 1 addition & 1 deletion Sample/RootConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#nullable disable warnings
using AttributedConfiguration;
using NeoAttributedConfiguration;
using Microsoft.Extensions.Configuration;

namespace Sample {
Expand Down
2 changes: 1 addition & 1 deletion Sample/Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AttributedConfiguration\NeoAttributedConfiguration.csproj" />
<ProjectReference Include="..\NeoAttributedConfiguration\NeoAttributedConfiguration.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit d7072b3

Please sign in to comment.