Bleeding out Swan.Tiny

This commit is contained in:
BlubbFish 2019-12-10 20:01:19 +01:00
parent b4ae02a85f
commit b2f110b8d6
59 changed files with 254 additions and 200 deletions

View File

@ -9,7 +9,7 @@ namespace Swan.Configuration {
/// <seealso cref="System.Attribute" />
[AttributeUsage(AttributeTargets.Property)]
public sealed class PropertyDisplayAttribute : Attribute {
/// <summary>
/*/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>
@ -37,7 +37,7 @@ namespace Swan.Configuration {
/// </value>
public String GroupName {
get; set;
}
}*/
/// <summary>
/// Gets or sets the default value.

View File

@ -62,7 +62,7 @@ namespace Swan {
#endregion
/// <summary>
/*/// <summary>
/// Contains all basic types, including string, date time, and all of their nullable counterparts.
/// </summary>
/// <value>
@ -90,7 +90,7 @@ namespace Swan {
/// </value>
public static IReadOnlyCollection<Type> AllNumericValueTypes {
get;
} = new ReadOnlyCollection<Type>(BasicTypesInfo.Value.Where(kvp => kvp.Value.IsNumeric && !kvp.Value.IsNullableValueType).Select(kvp => kvp.Key).ToArray());
} = new ReadOnlyCollection<Type>(BasicTypesInfo.Value.Where(kvp => kvp.Value.IsNumeric && !kvp.Value.IsNullableValueType).Select(kvp => kvp.Key).ToArray());*/
/// <summary>
/// Contains all basic value types. i.e. excludes string and nullables.
@ -102,7 +102,7 @@ namespace Swan {
get;
} = new ReadOnlyCollection<Type>(BasicTypesInfo.Value.Where(kvp => kvp.Value.IsValueType).Select(kvp => kvp.Key).ToArray());
/// <summary>
/*/// <summary>
/// Contains all basic value types including the string type. i.e. excludes nullables.
/// </summary>
/// <value>
@ -120,6 +120,6 @@ namespace Swan {
/// </value>
public static IReadOnlyCollection<Type> AllBasicNullableValueTypes {
get;
} = new ReadOnlyCollection<Type>(BasicTypesInfo.Value.Where(kvp => kvp.Value.IsNullableValueType).Select(kvp => kvp.Key).ToArray());
} = new ReadOnlyCollection<Type>(BasicTypesInfo.Value.Where(kvp => kvp.Value.IsNullableValueType).Select(kvp => kvp.Key).ToArray());*/
}
}

View File

@ -5,6 +5,7 @@ namespace Swan {
/// <summary>
/// Contains useful constants and definitions.
/// </summary>
// [Obsolete("NEED", false)]
public static partial class Definitions {
/// <summary>
/// The MS Windows codepage 1252 encoding used in some legacy scenarios

View File

@ -10,12 +10,12 @@ namespace Swan.DependencyInjection {
/// </summary>
/// <seealso cref="System.IDisposable" />
public partial class DependencyContainer : IDisposable {
private readonly Object _autoRegisterLock = new Object();
/*private readonly Object _autoRegisterLock = new Object();*/
private Boolean _disposed;
static DependencyContainer() {
}
/*static DependencyContainer() {
}*/
/// <summary>
/// Initializes a new instance of the <see cref="DependencyContainer"/> class.
@ -25,7 +25,7 @@ namespace Swan.DependencyInjection {
_ = this.Register(this);
}
private DependencyContainer(DependencyContainer parent) : this() => this.Parent = parent;
/*private DependencyContainer(DependencyContainer parent) : this() => this.Parent = parent;*/
/// <summary>
/// Lazy created Singleton instance of the container for simple scenarios.
@ -55,15 +55,15 @@ namespace Swan.DependencyInjection {
GC.SuppressFinalize(this);
}
/// <summary>
/*/// <summary>
/// Gets the child container.
/// </summary>
/// <returns>A new instance of the <see cref="DependencyContainer"/> class.</returns>
public DependencyContainer GetChildContainer() => new DependencyContainer(this);
public DependencyContainer GetChildContainer() => new DependencyContainer(this);*/
#region Registration
/// <summary>
/*/// <summary>
/// Attempt to automatically register all non-generic classes and interfaces in the current app domain.
/// Types will only be registered if they pass the supplied registration predicate.
/// </summary>
@ -138,7 +138,7 @@ namespace Swan.DependencyInjection {
/// <param name="registerImplementation">Type to instantiate that implements RegisterType.</param>
/// <param name="name">Name of registration.</param>
/// <returns>RegisterOptions for fluent API.</returns>
public RegisterOptions Register(Type registerType, Type registerImplementation, String name = "") => this.RegisteredTypes.Register(registerType, name, GetDefaultObjectFactory(registerType, registerImplementation));
public RegisterOptions Register(Type registerType, Type registerImplementation, String name = "") => this.RegisteredTypes.Register(registerType, name, GetDefaultObjectFactory(registerType, registerImplementation));*/
/// <summary>
/// Creates/replaces a named container class registration with a specific, strong referenced, instance.
@ -149,7 +149,7 @@ namespace Swan.DependencyInjection {
/// <returns>RegisterOptions for fluent API.</returns>
public RegisterOptions Register(Type registerType, Object instance, String name = "") => this.RegisteredTypes.Register(registerType, name, new InstanceFactory(registerType, registerType, instance));
/// <summary>
/*/// <summary>
/// Creates/replaces a named container class registration with a specific, strong referenced, instance.
/// </summary>
/// <param name="registerType">Type to register.</param>
@ -183,7 +183,7 @@ namespace Swan.DependencyInjection {
/// <typeparam name="TRegisterImplementation">Type to instantiate that implements RegisterType.</typeparam>
/// <param name="name">Name of registration.</param>
/// <returns>RegisterOptions for fluent API.</returns>
public RegisterOptions Register<TRegister, TRegisterImplementation>(String name = "") where TRegister : class where TRegisterImplementation : class, TRegister => this.Register(typeof(TRegister), typeof(TRegisterImplementation), name);
public RegisterOptions Register<TRegister, TRegisterImplementation>(String name = "") where TRegister : class where TRegisterImplementation : class, TRegister => this.Register(typeof(TRegister), typeof(TRegisterImplementation), name);*/
/// <summary>
/// Creates/replaces a named container class registration with a specific, strong referenced, instance.
@ -192,9 +192,10 @@ namespace Swan.DependencyInjection {
/// <param name="instance">Instance of RegisterType to register.</param>
/// <param name="name">Name of registration.</param>
/// <returns>RegisterOptions for fluent API.</returns>
// [Obsolete("NEED", false)]
public RegisterOptions Register<TRegister>(TRegister instance, String name = "") where TRegister : class => this.Register(typeof(TRegister), instance, name);
/// <summary>
/*/// <summary>
/// Creates/replaces a named container class registration with a specific, strong referenced, instance.
/// </summary>
/// <typeparam name="TRegister">Type to register.</typeparam>
@ -257,13 +258,13 @@ namespace Swan.DependencyInjection {
List<RegisterOptions> registerOptions = implementationTypes.Select(type => this.Register(registrationType, type, type.FullName)).ToList();
return new MultiRegisterOptions(registerOptions);
}
}*/
#endregion
#region Unregistration
/// <summary>
/*/// <summary>
/// Remove a named container class registration.
/// </summary>
/// <typeparam name="TRegister">Type to unregister.</typeparam>
@ -277,7 +278,7 @@ namespace Swan.DependencyInjection {
/// <param name="registerType">Type to unregister.</param>
/// <param name="name">Name of registration.</param>
/// <returns><c>true</c> if the registration is successfully found and removed; otherwise, <c>false</c>.</returns>
public Boolean Unregister(Type registerType, String name = "") => this.RegisteredTypes.RemoveRegistration(new TypeRegistration(registerType, name));
public Boolean Unregister(Type registerType, String name = "") => this.RegisteredTypes.RemoveRegistration(new TypeRegistration(registerType, name));*/
#endregion
@ -294,6 +295,7 @@ namespace Swan.DependencyInjection {
/// <param name="options">Resolution options.</param>
/// <returns>Instance of type.</returns>
/// <exception cref="DependencyContainerResolutionException">Unable to resolve the type.</exception>
// [Obsolete("NEED", false)]
public Object Resolve(Type resolveType, String name = null, DependencyContainerResolveOptions options = null) => this.RegisteredTypes.ResolveInternal(new TypeRegistration(resolveType, name), options ?? DependencyContainerResolveOptions.Default);
/// <summary>
@ -307,6 +309,7 @@ namespace Swan.DependencyInjection {
/// <param name="options">Resolution options.</param>
/// <returns>Instance of type.</returns>
/// <exception cref="DependencyContainerResolutionException">Unable to resolve the type.</exception>
// [Obsolete("NEED", false)]
public TResolveType Resolve<TResolveType>(String name = null, DependencyContainerResolveOptions options = null) where TResolveType : class => (TResolveType)this.Resolve(typeof(TResolveType), name, options);
/// <summary>
@ -321,6 +324,7 @@ namespace Swan.DependencyInjection {
/// <returns>
/// Bool indicating whether the type can be resolved.
/// </returns>
// [Obsolete("NEED", false)]
public Boolean CanResolve(Type resolveType, String name = null, DependencyContainerResolveOptions options = null) => this.RegisteredTypes.CanResolve(new TypeRegistration(resolveType, name), options);
/// <summary>
@ -335,9 +339,10 @@ namespace Swan.DependencyInjection {
/// <param name="name">Name of registration.</param>
/// <param name="options">Resolution options.</param>
/// <returns>Bool indicating whether the type can be resolved.</returns>
// [Obsolete("NEED", false)]
public Boolean CanResolve<TResolveType>(String name = null, DependencyContainerResolveOptions options = null) where TResolveType : class => this.CanResolve(typeof(TResolveType), name, options);
/// <summary>
/*/// <summary>
/// Attempts to resolve a type using the default options.
/// </summary>
/// <param name="resolveType">Type to resolve.</param>
@ -508,7 +513,7 @@ namespace Swan.DependencyInjection {
// Catch any resolution errors and ignore them
}
}
}
}*/
#endregion
@ -532,7 +537,7 @@ namespace Swan.DependencyInjection {
return true;
}
private static Boolean IsIgnoredAssembly(Assembly assembly) {
/*private static Boolean IsIgnoredAssembly(Assembly assembly) {
// TODO - find a better way to remove "system" assemblies from the auto registration
List<Func<Assembly, Boolean>> ignoreChecks = new List<Func<Assembly, Boolean>>
{
@ -568,7 +573,7 @@ namespace Swan.DependencyInjection {
return ignoreChecks.Any(check => check(type));
}
private static ObjectFactoryBase GetDefaultObjectFactory(Type registerType, Type registerImplementation) => registerType.IsInterface || registerType.IsAbstract ? (ObjectFactoryBase)new SingletonFactory(registerType, registerImplementation) : new MultiInstanceFactory(registerType, registerImplementation);
private static ObjectFactoryBase GetDefaultObjectFactory(Type registerType, Type registerImplementation) => registerType.IsInterface || registerType.IsAbstract ? (ObjectFactoryBase)new SingletonFactory(registerType, registerImplementation) : new MultiInstanceFactory(registerType, registerImplementation);*/
#endregion
}

View File

@ -10,15 +10,15 @@ namespace Swan.DependencyInjection {
public class DependencyContainerRegistrationException : Exception {
private const String ConvertErrorText = "Cannot convert current registration of {0} to {1}";
private const String RegisterErrorText = "Cannot register type {0} - abstract classes or interfaces are not valid implementation types for {1}.";
private const String ErrorText = "Duplicate implementation of type {0} found ({1}).";
/*private const String ErrorText = "Duplicate implementation of type {0} found ({1}).";*/
/// <summary>
/*/// <summary>
/// Initializes a new instance of the <see cref="DependencyContainerRegistrationException"/> class.
/// </summary>
/// <param name="registerType">Type of the register.</param>
/// <param name="types">The types.</param>
public DependencyContainerRegistrationException(Type registerType, IEnumerable<Type> types) : base(String.Format(ErrorText, registerType, GetTypesString(types))) {
}
}*/
/// <summary>
/// Initializes a new instance of the <see cref="DependencyContainerRegistrationException" /> class.
@ -29,6 +29,6 @@ namespace Swan.DependencyInjection {
public DependencyContainerRegistrationException(Type type, String method, Boolean isTypeFactory = false) : base(isTypeFactory ? String.Format(RegisterErrorText, type.FullName, method) : String.Format(ConvertErrorText, type.FullName, method)) {
}
private static String GetTypesString(IEnumerable<Type> types) => String.Join(",", types.Select(type => type.FullName));
/*private static String GetTypesString(IEnumerable<Type> types) => String.Join(",", types.Select(type => type.FullName));*/
}
}

View File

@ -84,7 +84,7 @@ namespace Swan.DependencyInjection {
Fail,
}
/// <summary>
/*/// <summary>
/// Enumerates duplicate definition actions.
/// </summary>
public enum DependencyContainerDuplicateImplementationAction {
@ -102,5 +102,5 @@ namespace Swan.DependencyInjection {
/// The fail
/// </summary>
Fail,
}
}*/
}

View File

@ -107,8 +107,7 @@ namespace Swan.DependencyInjection {
public override Type CreatesType => this._registerImplementation;
public override ObjectFactoryBase SingletonVariant =>
new SingletonFactory(this._registerType, this._registerImplementation);
public override ObjectFactoryBase SingletonVariant => new SingletonFactory(this._registerType, this._registerImplementation);
public override ObjectFactoryBase MultiInstanceVariant => this;
@ -130,9 +129,7 @@ namespace Swan.DependencyInjection {
private readonly Func<DependencyContainer, Dictionary<String, Object>, Object> _factory;
public DelegateFactory(
Type registerType,
Func<DependencyContainer, Dictionary<String, Object>, Object> factory) {
public DelegateFactory( Type registerType, Func<DependencyContainer, Dictionary<String, Object>, Object> factory) {
this._factory = factory ?? throw new ArgumentNullException(nameof(factory));
this._registerType = registerType;
@ -316,13 +313,9 @@ namespace Swan.DependencyInjection {
public override ObjectFactoryBase SingletonVariant => this;
public override ObjectFactoryBase MultiInstanceVariant =>
new MultiInstanceFactory(this._registerType, this._registerImplementation);
public override ObjectFactoryBase MultiInstanceVariant => new MultiInstanceFactory(this._registerType, this._registerImplementation);
public override Object GetObject(
Type requestedType,
DependencyContainer container,
DependencyContainerResolveOptions options) {
public override Object GetObject( Type requestedType, DependencyContainer container, DependencyContainerResolveOptions options) {
if(options.ConstructorParameters.Count != 0) {
throw new ArgumentException("Cannot specify parameters for singleton types");
}
@ -336,10 +329,7 @@ namespace Swan.DependencyInjection {
return this._current;
}
public override ObjectFactoryBase GetFactoryForChildContainer(
Type type,
DependencyContainer parent,
DependencyContainer child) {
public override ObjectFactoryBase GetFactoryForChildContainer( Type type, DependencyContainer parent, DependencyContainer child) {
// We make sure that the singleton is constructed before the child container takes the factory.
// Otherwise the results would vary depending on whether or not the parent container had resolved
// the type before the child container does.

View File

@ -20,7 +20,7 @@ namespace Swan.DependencyInjection {
this._registration = registration;
}
/// <summary>
/*/// <summary>
/// Make registration a singleton (single instance) if possible.
/// </summary>
/// <returns>A registration options for fluent API.</returns>
@ -78,14 +78,14 @@ namespace Swan.DependencyInjection {
}
return this._registeredTypes.AddUpdateRegistration(this._registration, currentFactory.StrongReferenceVariant);
}
}*/
}
/// <summary>
/*/// <summary>
/// Registration options for "fluent" API when registering multiple implementations.
/// </summary>
public sealed class MultiRegisterOptions {
private IEnumerable<RegisterOptions> _registerOptions;
/*private IEnumerable<RegisterOptions> _registerOptions;
/// <summary>
/// Initializes a new instance of the <see cref="MultiRegisterOptions"/> class.
@ -113,7 +113,6 @@ namespace Swan.DependencyInjection {
return this;
}
private IEnumerable<RegisterOptions> ExecuteOnAllRegisterOptions(
Func<RegisterOptions, RegisterOptions> action) => this._registerOptions.Select(action).ToList();
}
private IEnumerable<RegisterOptions> ExecuteOnAllRegisterOptions( Func<RegisterOptions, RegisterOptions> action) => this._registerOptions.Select(action).ToList();
}*/
}

View File

@ -24,7 +24,7 @@ namespace Swan.DependencyInjection {
/// <returns>The built object.</returns>
public delegate Object ObjectConstructor(params Object?[] parameters);
internal IEnumerable<Object> Resolve(Type resolveType, Boolean includeUnnamed) {
/*internal IEnumerable<Object> Resolve(Type resolveType, Boolean includeUnnamed) {
IEnumerable<DependencyContainer.TypeRegistration> registrations = this.Keys.Where(tr => tr.Type == resolveType).Concat(this.GetParentRegistrationsForType(resolveType)).Distinct();
if(!includeUnnamed) {
@ -38,7 +38,7 @@ namespace Swan.DependencyInjection {
_ = this.TryGetValue(registration, out ObjectFactoryBase? current);
return current!;
}
}*/
internal RegisterOptions Register(Type registerType, String name, ObjectFactoryBase factory) => this.AddUpdateRegistration(new DependencyContainer.TypeRegistration(registerType, name), factory);
@ -48,8 +48,9 @@ namespace Swan.DependencyInjection {
return new RegisterOptions(this, typeRegistration);
}
internal Boolean RemoveRegistration(DependencyContainer.TypeRegistration typeRegistration) => this.TryRemove(typeRegistration, out _);
/*internal Boolean RemoveRegistration(DependencyContainer.TypeRegistration typeRegistration) => this.TryRemove(typeRegistration, out _);*/
// [Obsolete("NEED", false)]
internal Object ResolveInternal(DependencyContainer.TypeRegistration registration, DependencyContainerResolveOptions? options = null) {
if(options == null) {
options = DependencyContainerResolveOptions.Default;
@ -102,6 +103,7 @@ namespace Swan.DependencyInjection {
return isValid && !registration.Type.IsAbstract && !registration.Type.IsInterface ? this.ConstructType(registration.Type, null, options) : throw new DependencyContainerResolutionException(registration.Type);
}
// [Obsolete("NEED", false)]
internal Boolean CanResolve(DependencyContainer.TypeRegistration registration, DependencyContainerResolveOptions? options = null) {
if(options == null) {
options = DependencyContainerResolveOptions.Default;

View File

@ -6,6 +6,7 @@ namespace Swan.Diagnostics {
/// Provides access to a high-resolution, time measuring device.
/// </summary>
/// <seealso cref="Stopwatch" />
// [Obsolete("NEED", false)]
public class HighResolutionTimer : Stopwatch {
/// <summary>
/// Initializes a new instance of the <see cref="HighResolutionTimer"/> class.
@ -22,9 +23,9 @@ namespace Swan.Diagnostics {
/// </summary>
public static Double MicrosecondsPerTick { get; } = 1000000d / Frequency;
/// <summary>
/*/// <summary>
/// Gets the elapsed microseconds.
/// </summary>
public Int64 ElapsedMicroseconds => (Int64)(this.ElapsedTicks * MicrosecondsPerTick);
public Int64 ElapsedMicroseconds => (Int64)(this.ElapsedTicks * MicrosecondsPerTick);*/
}
}

View File

@ -1,7 +1,10 @@
namespace Swan {
using System;
namespace Swan {
/// <summary>
/// Enumeration of Operating Systems.
/// </summary>
// [Obsolete("NEED", false)]
public enum OperatingSystem {
/// <summary>
/// Unknown OS

View File

@ -12,7 +12,7 @@ namespace Swan {
/// Provides various extension methods for byte arrays and streams.
/// </summary>
public static class ByteArrayExtensions {
/// <summary>
/*/// <summary>
/// Converts an array of bytes to its lower-case, hexadecimal representation.
/// </summary>
/// <param name="bytes">The bytes.</param>
@ -43,7 +43,7 @@ namespace Swan {
/// A string of hexadecimal pairs separated by hyphens, where each pair represents
/// the corresponding element in value; for example, "7F-2C-4A-00".
/// </returns>
public static String ToDashedHex(this Byte[] bytes) => BitConverter.ToString(bytes);
public static String ToDashedHex(this Byte[] bytes) => BitConverter.ToString(bytes);*/
/// <summary>
/// Converts an array of bytes to a base-64 encoded string.
@ -70,7 +70,7 @@ namespace Swan {
return Enumerable.Range(0, @this.Length / 2).Select(x => Convert.ToByte(@this.Substring(x * 2, 2), 16)).ToArray();
}
/// <summary>
/*/// <summary>
/// Gets the bit value at the given offset.
/// </summary>
/// <param name="this">The b.</param>
@ -493,6 +493,6 @@ namespace Swan {
}
return $"{(addPrefix ? "0x" : String.Empty)}{sb}";
}
}*/
}
}

View File

@ -65,7 +65,7 @@ namespace Swan {
return dict[key];
}
/// <summary>
/*/// <summary>
/// Executes the item action for each element in the Dictionary.
/// </summary>
/// <typeparam name="TKey">The type of the key.</typeparam>
@ -81,6 +81,6 @@ namespace Swan {
foreach(KeyValuePair<TKey, TValue> kvp in dict) {
itemAction(kvp.Key, kvp.Value);
}
}
}*/
}
}

View File

@ -7,7 +7,7 @@ namespace Swan {
/// Functional programming extension methods.
/// </summary>
public static class FunctionalExtensions {
/// <summary>
/*/// <summary>
/// Whens the specified condition.
/// </summary>
/// <typeparam name="T">The type of IQueryable.</typeparam>
@ -38,7 +38,7 @@ namespace Swan {
}
return condition() ? fn(list) : list;
}
}*/
/// <summary>
/// Whens the specified condition.
@ -73,7 +73,7 @@ namespace Swan {
return condition() ? fn(list) : list;
}
/// <summary>
/*/// <summary>
/// Adds the value when the condition is true.
/// </summary>
/// <typeparam name="T">The type of IList element.</typeparam>
@ -168,6 +168,6 @@ namespace Swan {
}
return list;
}
}*/
}
}

View File

@ -21,7 +21,7 @@ namespace Swan {
#region Assembly Extensions
/// <summary>
/*/// <summary>
/// Gets all types within an assembly in a safe manner.
/// </summary>
/// <param name="assembly">The assembly.</param>
@ -39,7 +39,7 @@ namespace Swan {
} catch(ReflectionTypeLoadException e) {
return e.Types.Where(t => t != null);
}
}
}*/
#endregion
@ -61,7 +61,7 @@ namespace Swan {
return type.IsValueType ? Activator.CreateInstance(type) : default;
}
/// <summary>
/*/// <summary>
/// Determines whether this type is compatible with ICollection.
/// </summary>
/// <param name="sourceType">The type.</param>
@ -117,7 +117,7 @@ namespace Swan {
.Where(mi => mi.GetParameters().Select(pi => pi.ParameterType).SequenceEqual(parameterTypes)).ToList();
return methods.Count > 1 ? throw new AmbiguousMatchException() : methods.FirstOrDefault();
}
}*/
/// <summary>
/// Determines whether [is i enumerable request].
@ -281,7 +281,7 @@ namespace Swan {
return true;
}
/// <summary>
/*/// <summary>
/// Gets property actual value or <c>PropertyDisplayAttribute.DefaultValue</c> if presented.
///
/// If the <c>PropertyDisplayAttribute.Format</c> value is presented, the property value
@ -312,7 +312,7 @@ namespace Swan {
} catch {
return null;
}
}
}*/
/// <summary>
/// Gets a MethodInfo from a Property Get method.
@ -368,7 +368,7 @@ namespace Swan {
return false;
}
/// <summary>
/*/// <summary>
/// Creates a property proxy that stores getter and setter delegates.
/// </summary>
/// <param name="this">The property information.</param>
@ -384,7 +384,7 @@ namespace Swan {
Type genericType = typeof(PropertyProxy<,>).MakeGenericType(@this.DeclaringType!, @this.PropertyType);
return Activator.CreateInstance(genericType, @this) as IPropertyProxy;
}
}*/
/// <summary>
/// Convert a object to a boolean.
@ -395,7 +395,7 @@ namespace Swan {
/// </returns>
public static Boolean ToBoolean(this Object value) => value.ToStringInvariant().ToBoolean();
private static String ConvertObjectAndFormat(Type propertyType, Object value, String format) =>
/*private static String ConvertObjectAndFormat(Type propertyType, Object value, String format) =>
propertyType == typeof(DateTime) || propertyType == typeof(DateTime?)
? Convert.ToDateTime(value, CultureInfo.InvariantCulture).ToString(format)
: propertyType == typeof(Int32) || propertyType == typeof(Int32?)
@ -406,6 +406,6 @@ namespace Swan {
? Convert.ToDouble(value, CultureInfo.InvariantCulture).ToString(format)
: propertyType == typeof(Byte) || propertyType == typeof(Byte?)
? Convert.ToByte(value, CultureInfo.InvariantCulture).ToString(format)
: value?.ToString() ?? String.Empty;
: value?.ToString() ?? String.Empty;*/
}
}

View File

@ -16,11 +16,11 @@ namespace Swan {
private const RegexOptions StandardRegexOptions = RegexOptions.Multiline | RegexOptions.Compiled | RegexOptions.CultureInvariant;
private static readonly String[] ByteSuffixes = { "B", "KB", "MB", "GB", "TB" };
/*private static readonly String[] ByteSuffixes = { "B", "KB", "MB", "GB", "TB" };*/
private static readonly Lazy<Regex> SplitLinesRegex = new Lazy<Regex>(() => new Regex("\r\n|\r|\n", StandardRegexOptions));
private static readonly Lazy<Regex> UnderscoreRegex = new Lazy<Regex>(() => new Regex(@"_", StandardRegexOptions));
/*private static readonly Lazy<Regex> UnderscoreRegex = new Lazy<Regex>(() => new Regex(@"_", StandardRegexOptions));
private static readonly Lazy<Regex> CamelCaseRegEx = new Lazy<Regex>(() => new Regex(@"[a-z][A-Z]", StandardRegexOptions));
@ -29,7 +29,7 @@ namespace Swan {
return x[0] + " " + x[1..];
});
private static readonly Lazy<String[]> InvalidFilenameChars = new Lazy<String[]>(() => Path.GetInvalidFileNameChars().Select(c => c.ToString()).ToArray());
private static readonly Lazy<String[]> InvalidFilenameChars = new Lazy<String[]>(() => Path.GetInvalidFileNameChars().Select(c => c.ToString()).ToArray());*/
#endregion
@ -69,6 +69,7 @@ namespace Swan {
/// A string that represents the current object.
/// </returns>
/// <exception cref="ArgumentNullException">input.</exception>
// [Obsolete("NEED", false)]
public static String RemoveControlCharsExcept(this String value, params Char[]? excludeChars) {
if(value == null) {
throw new ArgumentNullException(nameof(value));
@ -81,7 +82,7 @@ namespace Swan {
return new String(value.Where(c => Char.IsControl(c) == false || excludeChars.Contains(c)).ToArray());
}
/// <summary>
/*/// <summary>
/// Removes all control characters from a string, including new line sequences.
/// </summary>
/// <param name="value">The input.</param>
@ -95,7 +96,7 @@ namespace Swan {
/// <param name="this">The object.</param>
/// <param name="format">if set to <c>true</c> format the output.</param>
/// <returns>A <see cref="String" /> that represents the current object.</returns>
public static String ToJson(this Object @this, Boolean format = true) => @this == null ? String.Empty : Json.Serialize(@this, format);
public static String ToJson(this Object @this, Boolean format = true) => @this == null ? String.Empty : Json.Serialize(@this, format);*/
/// <summary>
/// Returns text representing the properties of the specified object in a human-readable format.
@ -104,6 +105,7 @@ namespace Swan {
/// </summary>
/// <param name="this">The object.</param>
/// <returns>A <see cref="String" /> that represents the current object.</returns>
// [Obsolete("NEED", false)]
public static String Stringify(this Object @this) {
if(@this == null) {
return "(null)";
@ -147,6 +149,7 @@ namespace Swan {
/// <param name="startIndex">The start index.</param>
/// <param name="length">The length.</param>
/// <returns>Retrieves a substring from this instance.</returns>
// [Obsolete("NEED", false)]
public static String SliceLength(this String @this, Int32 startIndex, Int32 length) {
if(@this == null) {
return String.Empty;
@ -168,7 +171,7 @@ namespace Swan {
/// </returns>
public static String[] ToLines(this String @this) => @this == null ? Array.Empty<String>() : SplitLinesRegex.Value.Split(@this);
/// <summary>
/*/// <summary>
/// Humanizes (make more human-readable) an identifier-style string
/// in either camel case or snake case. For example, CamelCase will be converted to
/// Camel Case and Snake_Case will be converted to Snake Case.
@ -203,7 +206,7 @@ namespace Swan {
String stringValue => stringValue.Humanize(),
Boolean boolValue => boolValue.Humanize(),
_ => value.Stringify()
};
};*/
/// <summary>
/// Indents the specified multi-line text with the given amount of leading spaces
@ -212,6 +215,7 @@ namespace Swan {
/// <param name="value">The text.</param>
/// <param name="spaces">The spaces.</param>
/// <returns>A <see cref="String" /> that represents the current object.</returns>
// [Obsolete("NEED", false)]
public static String Indent(this String value, Int32 spaces = 4) {
if(value == null) {
value = String.Empty;
@ -267,7 +271,7 @@ namespace Swan {
return Tuple.Create(lineIndex + 1, colNumber);
}
/// <summary>
/*/// <summary>
/// Makes the file name system safe.
/// </summary>
/// <param name="value">The s.</param>
@ -359,6 +363,6 @@ namespace Swan {
/// </summary>
/// <param name="value">The c.</param>
/// <returns>Converted integer.</returns>
public static Int32 Hex2Int(this Char value) => value >= '0' && value <= '9' ? value - '0' : value >= 'A' && value <= 'F' ? value - 'A' + 10 : value >= 'a' && value <= 'f' ? value - 'a' + 10 : -1;
public static Int32 Hex2Int(this Char value) => value >= '0' && value <= '9' ? value - '0' : value >= 'A' && value <= 'F' ? value - 'A' + 10 : value >= 'a' && value <= 'f' ? value - 'a' + 10 : -1;*/
}
}

View File

@ -9,6 +9,7 @@ namespace Swan {
/// Provides various extension methods for value types and structs.
/// </summary>
public static class ValueTypeExtensions {
/// <summary>
/// Clamps the specified value between the minimum and the maximum.
/// </summary>
@ -17,6 +18,7 @@ namespace Swan {
/// <param name="min">The minimum.</param>
/// <param name="max">The maximum.</param>
/// <returns>A value that indicates the relative order of the objects being compared.</returns>
// [Obsolete("NEED", false)]
public static T Clamp<T>(this T @this, T min, T max) where T : struct, IComparable => @this.CompareTo(min) < 0 ? min : @this.CompareTo(max) > 0 ? max : @this;
/// <summary>
@ -26,8 +28,9 @@ namespace Swan {
/// <param name="min">The minimum.</param>
/// <param name="max">The maximum.</param>
/// <returns>A value that indicates the relative order of the objects being compared.</returns>
// [Obsolete("NEED",false)]
public static Int32 Clamp(this Int32 @this, Int32 min, Int32 max) => @this < min ? min : (@this > max ? max : @this);
/*
/// <summary>
/// Determines whether the specified value is between a minimum and a maximum value.
/// </summary>
@ -131,5 +134,6 @@ namespace Swan {
return data;
}
*/
}
}

View File

@ -27,7 +27,7 @@ namespace Swan {
/// </returns>
public static Int32 CopyPropertiesTo<T>(this T source, Object? target, params String[]? ignoreProperties) where T : class => ObjectMapper.Copy(source, target, GetCopyableProperties(target), ignoreProperties);
/// <summary>
/*/// <summary>
/// Iterates over the public, instance, readable properties of the source and
/// tries to write a compatible value to a public, instance, writable property in the destination.
/// </summary>
@ -37,7 +37,7 @@ namespace Swan {
/// <returns>
/// Number of properties that were successfully copied.
/// </returns>
public static Int32 CopyOnlyPropertiesTo(this Object source, Object target, params String[]? propertiesToCopy) => ObjectMapper.Copy(source, target, propertiesToCopy);
public static Int32 CopyOnlyPropertiesTo(this Object source, Object target, params String[]? propertiesToCopy) => ObjectMapper.Copy(source, target, propertiesToCopy);*/
/// <summary>
/// Copies the properties to new instance of T.
@ -60,7 +60,7 @@ namespace Swan {
return target;
}
/// <summary>
/*/// <summary>
/// Copies the only properties to new instance of T.
/// </summary>
/// <typeparam name="T">Object Type.</typeparam>
@ -161,7 +161,7 @@ namespace Swan {
}
throw new AggregateException(exceptions);
}
}*/
/// <summary>
/// Gets the copyable properties.

View File

@ -15,8 +15,7 @@ namespace Swan.Formatters {
/// serializer such as the beloved Json.NET.
/// </summary>
public class SerializerOptions {
private static readonly ConcurrentDictionary<Type, Dictionary<Tuple<String, String>, MemberInfo>>
TypeCache = new ConcurrentDictionary<Type, Dictionary<Tuple<String, String>, MemberInfo>>();
private static readonly ConcurrentDictionary<Type, Dictionary<Tuple<String, String>, MemberInfo>> TypeCache = new ConcurrentDictionary<Type, Dictionary<Tuple<String, String>, MemberInfo>>();
private readonly String[]? _includeProperties;
private readonly String[]? _excludeProperties;

View File

@ -99,7 +99,7 @@ namespace Swan.Formatters {
/// </example>
public static String Serialize(Object? obj, Boolean format = false, String? typeSpecifier = null, Boolean includeNonPublic = false, String[]? includedNames = null, params String[] excludedNames) => Serialize(obj, format, typeSpecifier, includeNonPublic, includedNames, excludedNames, null, JsonSerializerCase.None);
/// <summary>
/*/// <summary>
/// Serializes the specified object into a JSON string.
/// </summary>
/// <param name="obj">The object.</param>
@ -109,7 +109,7 @@ namespace Swan.Formatters {
/// <returns>
/// A <see cref="System.String" /> that represents the current object.
/// </returns>
public static String Serialize(Object? obj, JsonSerializerCase jsonSerializerCase, Boolean format = false, String? typeSpecifier = null) => Serialize(obj, format, typeSpecifier, false, null, null, null, jsonSerializerCase);
public static String Serialize(Object? obj, JsonSerializerCase jsonSerializerCase, Boolean format = false, String? typeSpecifier = null) => Serialize(obj, format, typeSpecifier, false, null, null, null, jsonSerializerCase);*/
/// <summary>
/// Serializes the specified object into a JSON string.
@ -145,7 +145,7 @@ namespace Swan.Formatters {
/// </returns>
public static String Serialize(Object? obj, SerializerOptions options) => Serializer.Serialize(obj, 0, options);
/// <summary>
/*/// <summary>
/// Serializes the specified object only including the specified property names.
/// </summary>
/// <param name="obj">The object.</param>
@ -205,7 +205,7 @@ namespace Swan.Formatters {
/// }
/// </code>
/// </example>
public static String SerializeExcluding(Object? obj, Boolean format, params String[] excludeNames) => Serialize(obj, new SerializerOptions(format, null, null, excludeNames));
public static String SerializeExcluding(Object? obj, Boolean format, params String[] excludeNames) => Serialize(obj, new SerializerOptions(format, null, null, excludeNames));*/
/// <summary>
/// Deserializes the specified json string as either a Dictionary[string, object] or as a List[object]
@ -258,7 +258,7 @@ namespace Swan.Formatters {
/// </code></example>
public static Object? Deserialize(String? json) => Deserialize(json, JsonSerializerCase.None);
/// <summary>
/*/// <summary>
/// Deserializes the specified JSON string and converts it to the specified object type.
/// Non-public constructors and property setters are ignored.
/// </summary>
@ -304,7 +304,7 @@ namespace Swan.Formatters {
/// <returns>
/// Type of the current conversion from json result.
/// </returns>
public static Object? Deserialize(String json, Type resultType, Boolean includeNonPublic = false, JsonSerializerCase jsonSerializerCase = JsonSerializerCase.None) => Converter.FromJsonResult(Deserializer.DeserializeInternal(json), jsonSerializerCase, resultType, includeNonPublic);
public static Object? Deserialize(String json, Type resultType, Boolean includeNonPublic = false, JsonSerializerCase jsonSerializerCase = JsonSerializerCase.None) => Converter.FromJsonResult(Deserializer.DeserializeInternal(json), jsonSerializerCase, resultType, includeNonPublic);*/
#endregion

View File

@ -7,7 +7,7 @@ namespace Swan.Formatters {
/// <seealso cref="Attribute" />
[AttributeUsage(AttributeTargets.Property)]
public sealed class JsonPropertyAttribute : Attribute {
/// <summary>
/*/// <summary>
/// Initializes a new instance of the <see cref="JsonPropertyAttribute" /> class.
/// </summary>
/// <param name="propertyName">Name of the property.</param>
@ -15,7 +15,7 @@ namespace Swan.Formatters {
public JsonPropertyAttribute(String propertyName, Boolean ignored = false) {
this.PropertyName = propertyName ?? throw new ArgumentNullException(nameof(propertyName));
this.Ignored = ignored;
}
}*/
/// <summary>
/// Gets or sets the name of the property.

View File

@ -6,6 +6,7 @@ namespace Swan.Logging {
/// Represents a Console implementation of <c>ILogger</c>.
/// </summary>
/// <seealso cref="ILogger" />
// [Obsolete("NEED", false)]
public class ConsoleLogger : TextLogger, ILogger {
/// <summary>
/// Initializes a new instance of the <see cref="ConsoleLogger"/> class.
@ -122,6 +123,7 @@ namespace Swan.Logging {
public LogLevel LogLevel { get; set; } = DebugLogger.IsDebuggerAttached ? LogLevel.Trace : LogLevel.Info;
/// <inheritdoc />
// [Obsolete("NEED", false)]
public void Log(LogMessageReceivedEventArgs logEvent) {
// Select the writer based on the message type
TerminalWriters writer = logEvent.MessageType == LogLevel.Error ? TerminalWriters.StandardError : TerminalWriters.StandardOutput;

View File

@ -7,6 +7,7 @@ namespace Swan.Logging {
/// Debug console using System.Diagnostics.Debug.
/// </summary>
/// <seealso cref="ILogger" />
// [Obsolete("NEED", false)]
public class DebugLogger : TextLogger, ILogger {
/// <summary>
/// Initializes a new instance of the <see cref="DebugLogger"/> class.
@ -35,6 +36,7 @@ namespace Swan.Logging {
public LogLevel LogLevel { get; set; } = IsDebuggerAttached ? LogLevel.Trace : LogLevel.None;
/// <inheritdoc/>
// [Obsolete("NEED", false)]
public void Log(LogMessageReceivedEventArgs logEvent) {
(String outputMessage, ConsoleColor _) = this.GetOutputAndColor(logEvent);

View File

@ -4,6 +4,7 @@ namespace Swan.Logging {
/// <summary>
/// Interface for a logger implementation.
/// </summary>
// [Obsolete("NEED", false)]
public interface ILogger : IDisposable {
/// <summary>
/// Gets the log level.

View File

@ -8,6 +8,7 @@ namespace Swan {
/// your logger of choice.
/// </summary>
/// <seealso cref="System.EventArgs" />
// [Obsolete("NEED", false)]
public class LogMessageReceivedEventArgs : EventArgs {
/// <summary>
/// Initializes a new instance of the <see cref="LogMessageReceivedEventArgs" /> class.

View File

@ -10,11 +10,14 @@ namespace Swan.Logging {
/// loggers instances. By default, the <c>ConsoleLogger</c> is registered.
/// </summary>
public static class Logger {
private static readonly Object SyncLock = new Object();
/*private static readonly Object SyncLock = new Object();*/
// [Obsolete("NEED", false)]
private static readonly List<ILogger> Loggers = new List<ILogger>();
// [Obsolete("NEED", false)]
private static UInt64 _loggingSequence;
// [Obsolete("NEED", false)]
static Logger() {
if(Terminal.IsConsolePresent) {
Loggers.Add(ConsoleLogger.Instance);
@ -25,7 +28,7 @@ namespace Swan.Logging {
}
}
#region Standard Public API
/*#region Standard Public API
/// <summary>
/// Registers the logger.
@ -298,11 +301,11 @@ namespace Swan.Logging {
#endregion
#endregion
#endregion*/
#region Extended Public API
/// <summary>
/*/// <summary>
/// Logs the specified message.
/// </summary>
/// <param name="message">The message.</param>
@ -324,7 +327,7 @@ namespace Swan.Logging {
/// <param name="callerMemberName">Name of the caller member.</param>
/// <param name="callerFilePath">The caller file path.</param>
/// <param name="callerLineNumber">The caller line number.</param>
public static void Log(this String message, Type source, LogLevel messageType, Object extendedData = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(messageType, message, source?.FullName, extendedData, callerMemberName, callerFilePath, callerLineNumber);
public static void Log(this String message, Type source, LogLevel messageType, Object extendedData = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(messageType, message, source?.FullName, extendedData, callerMemberName, callerFilePath, callerLineNumber);*/
/// <summary>
/// Logs an error message to the console's standard error.
@ -335,9 +338,10 @@ namespace Swan.Logging {
/// <param name="callerMemberName">Name of the caller member. This is automatically populated.</param>
/// <param name="callerFilePath">The caller file path. This is automatically populated.</param>
/// <param name="callerLineNumber">The caller line number. This is automatically populated.</param>
// [Obsolete("NEED", false)]
public static void Log(this Exception ex, String source = null, String message = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Error, message ?? ex.Message, source ?? ex.Source, ex, callerMemberName, callerFilePath, callerLineNumber);
/// <summary>
/*/// <summary>
/// Logs an error message to the console's standard error.
/// </summary>
/// <param name="ex">The ex.</param>
@ -384,11 +388,11 @@ namespace Swan.Logging {
String message = $"{text} ({obj.GetType()}): {Environment.NewLine}{obj.Stringify().Indent(5)}";
LogMessage(LogLevel.Trace, message, source?.FullName, obj, callerMemberName, callerFilePath, callerLineNumber);
}
}*/
#endregion
private static void RemoveLogger(Func<ILogger, Boolean> criteria) {
/*private static void RemoveLogger(Func<ILogger, Boolean> criteria) {
lock(SyncLock) {
ILogger loggerInstance = Loggers.FirstOrDefault(criteria);
@ -400,8 +404,9 @@ namespace Swan.Logging {
_ = Loggers.Remove(loggerInstance);
}
}
}*/
// [Obsolete("NEED", false)]
private static void LogMessage(LogLevel logLevel, String message, String sourceName, Object extendedData, String callerMemberName, String callerFilePath, Int32 callerLineNumber) {
UInt64 sequence = _loggingSequence;
DateTime date = DateTime.UtcNow;

View File

@ -5,6 +5,7 @@ namespace Swan.Lite.Logging {
/// <summary>
/// Use this class for text-based logger.
/// </summary>
// [Obsolete("NEED", false)]
public abstract class TextLogger {
/// <summary>
/// Gets or sets the logging time format.
@ -22,6 +23,7 @@ namespace Swan.Lite.Logging {
/// <returns>
/// The output message formatted and the color of the console to be used.
/// </returns>
// [Obsolete("NEED", false)]
protected (String outputMessage, ConsoleColor color) GetOutputAndColor(LogMessageReceivedEventArgs logEvent) {
(String prefix, ConsoleColor color) = GetConsoleColorAndPrefix(logEvent.MessageType);

View File

@ -33,7 +33,7 @@ namespace Swan.Mappers {
get;
}
/// <summary>
/*/// <summary>
/// Maps the property.
/// </summary>
/// <typeparam name="TDestinationProperty">The type of the destination property.</typeparam>
@ -104,6 +104,6 @@ namespace Swan.Mappers {
}
return sourceMembers;
}
}*/
}
}

View File

@ -1,4 +1,4 @@
using System;
/*using System;
using System.Collections.Generic;
using System.Reflection;
@ -17,4 +17,4 @@ namespace Swan.Mappers {
public Int32 GetHashCode(PropertyInfo obj) => obj.Name.GetHashCode() + obj.PropertyType.Name.GetHashCode();
}
}
}
}*/

View File

@ -79,17 +79,17 @@ namespace Swan.Mappers {
/// </code>
/// </example>
public partial class ObjectMapper {
private static readonly Lazy<ObjectMapper> LazyInstance = new Lazy<ObjectMapper>(() => new ObjectMapper());
/*private static readonly Lazy<ObjectMapper> LazyInstance = new Lazy<ObjectMapper>(() => new ObjectMapper());
private readonly List<IObjectMap> _maps = new List<IObjectMap>();
private readonly List<IObjectMap> _maps = new List<IObjectMap>();*/
/// <summary>
/*/// <summary>
/// Gets the current.
/// </summary>
/// <value>
/// The current.
/// </value>
public static ObjectMapper Current => LazyInstance.Value;
public static ObjectMapper Current => LazyInstance.Value;*/
/// <summary>
/// Copies the specified source.
@ -145,7 +145,7 @@ namespace Swan.Mappers {
return CopyInternal(target, source.ToDictionary(x => x.Key.ToLowerInvariant(), x => Tuple.Create(typeof(Object), x.Value)), propertiesToCopy, ignoreProperties);
}
/// <summary>
/*/// <summary>
/// Creates the map.
/// </summary>
/// <typeparam name="TSource">The type of the source.</typeparam>
@ -215,7 +215,7 @@ namespace Swan.Mappers {
}
return destination;
}
}*/
private static Int32 CopyInternal(Object target, Dictionary<String, Tuple<Type, Object>> sourceProperties, IEnumerable<String>? propertiesToCopy, IEnumerable<String>? ignoreProperties) {
// Filter properties

View File

@ -1,4 +1,4 @@
using System;
/*using System;
using System.Threading.Tasks;
using System.Collections.Generic;
@ -93,4 +93,4 @@ namespace Swan.Net.Dns {
Task<DnsClientResponse> Request(DnsClientRequest request);
}
}
}
}*/

View File

@ -1,4 +1,5 @@
#nullable enable
/*
#nullable enable
using Swan.Formatters;
using System;
using System.Collections.Generic;
@ -555,4 +556,4 @@ namespace Swan.Net.Dns {
}
}
}
}
}*/

View File

@ -1,4 +1,4 @@
using Swan.Formatters;
/*using Swan.Formatters;
using System;
using System.Collections.Generic;
using System.IO;
@ -341,4 +341,4 @@ namespace Swan.Net.Dns {
}
}
}
}
}*/

View File

@ -1,4 +1,4 @@
using Swan.Formatters;
/*using Swan.Formatters;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@ -171,4 +171,4 @@ namespace Swan.Net.Dns {
}
}
}
}
}*/

View File

@ -1,4 +1,4 @@
using System;
/*using System;
using System.Collections.Generic;
using System.Linq;
#nullable enable
@ -62,4 +62,4 @@ namespace Swan.Net.Dns {
return request.Resolve();
}
}
}
}*/

View File

@ -1,4 +1,4 @@
#nullable enable
/*#nullable enable
using System;
namespace Swan.Net.Dns {
@ -26,3 +26,4 @@ namespace Swan.Net.Dns {
private static String Format(DnsClient.IDnsResponse response) => $"Invalid response received with code {response.ResponseCode}";
}
}
*/

View File

@ -1,4 +1,4 @@
namespace Swan.Net.Dns {
/*namespace Swan.Net.Dns {
using System.Collections.Generic;
/// <summary>
@ -128,3 +128,4 @@
public IList<DnsRecord> AuthorityRecords => this._mAuthorityRecords;
}
}
*/

View File

@ -1,4 +1,4 @@
using System;
/*using System;
using System.Net;
using System.Text;
@ -237,3 +237,4 @@ namespace Swan.Net.Dns {
}
}
}
*/

View File

@ -1,4 +1,4 @@
// ReSharper disable InconsistentNaming
/*// ReSharper disable InconsistentNaming
namespace Swan.Net.Dns {
/// <summary>
/// Enumerates the different DNS record types.
@ -165,3 +165,4 @@ namespace Swan.Net.Dns {
NotZone,
}
}
*/

View File

@ -1,4 +1,4 @@
using Swan.Net.Dns;
//using Swan.Net.Dns;
using System;
using System.Collections.Generic;
using System.Linq;
@ -15,7 +15,7 @@ namespace Swan.Net {
/// a DNS client to query DNS records of any kind, and an NTP client.
/// </summary>
public static class Network {
/// <summary>
/*/// <summary>
/// The DNS default port.
/// </summary>
public const Int32 DnsDefaultPort = 53;
@ -23,7 +23,7 @@ namespace Swan.Net {
/// <summary>
/// The NTP default port.
/// </summary>
public const Int32 NtpDefaultPort = 123;
public const Int32 NtpDefaultPort = 123;*/
/// <summary>
/// Gets the name of the host.
@ -31,9 +31,10 @@ namespace Swan.Net {
/// <value>
/// The name of the host.
/// </value>
// [Obsolete("NEED", false)]
public static String HostName => IPGlobalProperties.GetIPGlobalProperties().HostName;
/// <summary>
/*/// <summary>
/// Gets the name of the network domain.
/// </summary>
/// <value>
@ -284,6 +285,6 @@ namespace Swan.Net {
return await GetNetworkTimeUtcAsync(addresses.First(), port).ConfigureAwait(false);
}
#endregion
#endregion*/
}
}

View File

@ -5,6 +5,7 @@ namespace Swan {
/// Represents the text of the standard output and standard error
/// of a process, including its exit code.
/// </summary>
// [Obsolete("NEED", false)]
public class ProcessResult {
/// <summary>
/// Initializes a new instance of the <see cref="ProcessResult" /> class.

View File

@ -19,6 +19,7 @@ namespace Swan {
/// </summary>
/// <param name="processData">The process data.</param>
/// <param name="process">The process.</param>
// [Obsolete("NEED", false)]
public delegate void ProcessDataReceivedCallback(Byte[] processData, Process process);
/// <summary>
@ -53,12 +54,13 @@ namespace Swan {
/// }
/// </code>
/// </example>
// [Obsolete("NEED", false)]
public static async Task<String> GetProcessOutputAsync(String filename, String arguments = "", String? workingDirectory = null, CancellationToken cancellationToken = default) {
ProcessResult result = await GetProcessResultAsync(filename, arguments, workingDirectory, cancellationToken: cancellationToken).ConfigureAwait(false);
return result.ExitCode == 0 ? result.StandardOutput : result.StandardError;
}
/// <summary>
/*/// <summary>
/// Runs the process asynchronously and if the exit code is 0,
/// returns all of the standard output text. If the exit code is something other than 0
/// it returns the contents of standard error.
@ -75,7 +77,7 @@ namespace Swan {
public static async Task<String> GetProcessEncodedOutputAsync(String filename, String arguments = "", Encoding? encoding = null, CancellationToken cancellationToken = default) {
ProcessResult result = await GetProcessResultAsync(filename, arguments, null, encoding, cancellationToken).ConfigureAwait(false);
return result.ExitCode == 0 ? result.StandardOutput : result.StandardError;
}
}*/
/// <summary>
/// Executes a process asynchronously and returns the text of the standard output and standard error streams
@ -89,6 +91,7 @@ namespace Swan {
/// Text of the standard output and standard error streams along with the exit code as a <see cref="ProcessResult" /> instance.
/// </returns>
/// <exception cref="ArgumentNullException">filename.</exception>
// [Obsolete("NEED", false)]
public static Task<ProcessResult> GetProcessResultAsync(String filename, String arguments = "", CancellationToken cancellationToken = default) => GetProcessResultAsync(filename, arguments, null, Definitions.CurrentAnsiEncoding, cancellationToken);
/// <summary>
@ -128,6 +131,7 @@ namespace Swan {
/// }
/// }
/// </code></example>
// [Obsolete("NEED", false)]
public static async Task<ProcessResult> GetProcessResultAsync(String filename, String arguments, String? workingDirectory, Encoding? encoding = null, CancellationToken cancellationToken = default) {
if(filename == null) {
throw new ArgumentNullException(nameof(filename));
@ -163,6 +167,7 @@ namespace Swan {
/// <returns>
/// Value type will be -1 for forceful termination of the process.
/// </returns>
// [Obsolete("NEED", false)]
public static Task<Int32> RunProcessAsync(String filename, String arguments, String? workingDirectory, ProcessDataReceivedCallback onOutputData, ProcessDataReceivedCallback? onErrorData, Encoding encoding, Boolean syncEvents = true, CancellationToken cancellationToken = default) {
if(filename == null) {
throw new ArgumentNullException(nameof(filename));
@ -273,6 +278,7 @@ namespace Swan {
/// }
/// </code>
/// </example>
// [Obsolete("NEED", false)]
public static Task<Int32> RunProcessAsync(String filename, String arguments, ProcessDataReceivedCallback onOutputData, ProcessDataReceivedCallback? onErrorData, Boolean syncEvents = true, CancellationToken cancellationToken = default) => RunProcessAsync(filename, arguments, null, onOutputData, onErrorData, Definitions.CurrentAnsiEncoding, syncEvents, cancellationToken);
/// <summary>
@ -284,6 +290,7 @@ namespace Swan {
/// <param name="syncEvents">if set to <c>true</c> [synchronize events].</param>
/// <param name="ct">The cancellation token.</param>
/// <returns>Total copies stream.</returns>
// [Obsolete("NEED", false)]
private static Task<UInt64> CopyStreamAsync(Process process, Stream baseStream, ProcessDataReceivedCallback? onDataCallback, Boolean syncEvents, CancellationToken ct) => Task.Run(async () => {
// define some state variables
Byte[] swapBuffer = new Byte[2048]; // the buffer to copy data from one stream to the next

View File

@ -37,7 +37,7 @@ namespace Swan.Reflection {
get;
}
/// <summary>
/*/// <summary>
/// Determines whether [contains] [the specified member].
/// </summary>
/// <typeparam name="T">The type of the attribute to be retrieved.</typeparam>
@ -79,7 +79,7 @@ namespace Swan.Reflection {
}
return this.Retrieve(new Tuple<Object, Type>(member, type), t => member.GetCustomAttributes(type, inherit));
}
}*/
/// <summary>
/// Gets one attribute of a specific type from a member.
@ -98,7 +98,7 @@ namespace Swan.Reflection {
return ConvertToAttribute<T>(attr);
}
/// <summary>
/*/// <summary>
/// Gets one attribute of a specific type from a generic type.
/// </summary>
/// <typeparam name="TAttribute">The type of the attribute.</typeparam>
@ -146,7 +146,7 @@ namespace Swan.Reflection {
}
return this.PropertyTypeCache.RetrieveAllProperties<T>(true).ToDictionary(x => x, x => this.Retrieve(x, attributeType, inherit));
}
}*/
private static T ConvertToAttribute<T>(IEnumerable<Object> attr) where T : Attribute => attr?.Any() != true ? (default!) : attr.Count() == 1 ? (T)Convert.ChangeType(attr.First(), typeof(T)) : throw new AmbiguousMatchException("Multiple custom attributes of the same type found.");

View File

@ -17,7 +17,7 @@ namespace Swan.Lite.Reflection {
/// </value>
public static Lazy<ConstructorTypeCache> DefaultCache { get; } = new Lazy<ConstructorTypeCache>(() => new ConstructorTypeCache());
/// <summary>
/*/// <summary>
/// Retrieves all constructors order by the number of parameters ascending.
/// </summary>
/// <typeparam name="T">The type to inspect.</typeparam>
@ -25,7 +25,7 @@ namespace Swan.Lite.Reflection {
/// <returns>
/// A collection with all the constructors in the given type.
/// </returns>
public IEnumerable<Tuple<ConstructorInfo, ParameterInfo[]>> RetrieveAllConstructors<T>(Boolean includeNonPublic = false) => this.Retrieve<T>(GetConstructors(includeNonPublic));
public IEnumerable<Tuple<ConstructorInfo, ParameterInfo[]>> RetrieveAllConstructors<T>(Boolean includeNonPublic = false) => this.Retrieve<T>(GetConstructors(includeNonPublic));*/
/// <summary>
/// Retrieves all constructors order by the number of parameters ascending.

View File

@ -235,13 +235,13 @@ namespace Swan.Reflection {
// placeholder
}
/// <summary>
/*/// <summary>
/// Converts this instance to its string representation,
/// trying to use the CultureInfo.InvariantCulture
/// IFormat provider if the overload is available.
/// </summary>
/// <param name="instance">The instance.</param>
/// <returns>A <see cref="System.String" /> that represents the current object.</returns>
public String ToStringInvariant(T instance) => base.ToStringInvariant(instance);
public String ToStringInvariant(T instance) => base.ToStringInvariant(instance);*/
}
}

View File

@ -1,4 +1,4 @@
using System;
/*using System;
namespace Swan.Reflection {
/// <summary>
@ -19,4 +19,4 @@ namespace Swan.Reflection {
/// <param name="value">The value.</param>
void SetValue(Object instance, Object value);
}
}
}*/

View File

@ -1,4 +1,4 @@
using System;
/*using System;
using System.Reflection;
using System.Runtime.CompilerServices;
@ -41,4 +41,4 @@ namespace Swan.Reflection {
[MethodImpl(MethodImplOptions.AggressiveInlining)]
void IPropertyProxy.SetValue(Object instance, Object value) => this._setter(instance as TClass, (TProperty)value);
}
}
}*/

View File

@ -16,7 +16,7 @@ namespace Swan.Reflection {
/// </value>
public static Lazy<PropertyTypeCache> DefaultCache { get; } = new Lazy<PropertyTypeCache>(() => new PropertyTypeCache());
/// <summary>
/*/// <summary>
/// Retrieves all properties.
/// </summary>
/// <typeparam name="T">The type to inspect.</typeparam>
@ -24,7 +24,7 @@ namespace Swan.Reflection {
/// <returns>
/// A collection with all the properties in the given type.
/// </returns>
public IEnumerable<PropertyInfo> RetrieveAllProperties<T>(Boolean onlyPublic = false) => this.Retrieve<T>(onlyPublic ? GetAllPublicPropertiesFunc() : GetAllPropertiesFunc());
public IEnumerable<PropertyInfo> RetrieveAllProperties<T>(Boolean onlyPublic = false) => this.Retrieve<T>(onlyPublic ? GetAllPublicPropertiesFunc() : GetAllPropertiesFunc());*/
/// <summary>
/// Retrieves all properties.

View File

@ -13,7 +13,7 @@ namespace Swan.Reflection {
/// </summary>
/// <typeparam name="T">The type of Member to be cached.</typeparam>
public abstract class TypeCache<T> : CollectionCacheRepository<T> {
/// <summary>
/*/// <summary>
/// Determines whether the cache contains the specified type.
/// </summary>
/// <typeparam name="TOut">The type of the out.</typeparam>
@ -30,7 +30,7 @@ namespace Swan.Reflection {
/// <typeparam name="TOut">The type of the out.</typeparam>
/// <param name="factory">The factory.</param>
/// <returns>An array of the properties stored for the specified type.</returns>
public IEnumerable<T> Retrieve<TOut>(Func<Type, IEnumerable<T>> factory) => this.Retrieve(typeof(TOut), factory);
public IEnumerable<T> Retrieve<TOut>(Func<Type, IEnumerable<T>> factory) => this.Retrieve(typeof(TOut), factory);*/
}
/// <summary>
@ -48,14 +48,14 @@ namespace Swan.Reflection {
/// </value>
public static Lazy<FieldTypeCache> DefaultCache { get; } = new Lazy<FieldTypeCache>(() => new FieldTypeCache());
/// <summary>
/*/// <summary>
/// Retrieves all fields.
/// </summary>
/// <typeparam name="T">The type to inspect.</typeparam>
/// <returns>
/// A collection with all the fields in the given type.
/// </returns>
public IEnumerable<FieldInfo> RetrieveAllFields<T>() => this.Retrieve<T>(GetAllFieldsFunc());
public IEnumerable<FieldInfo> RetrieveAllFields<T>() => this.Retrieve<T>(GetAllFieldsFunc());*/
/// <summary>
/// Retrieves all fields.

View File

@ -1,6 +1,7 @@
using System;
namespace Swan {
// [Obsolete("NEED", false)]
/// <summary>
/// Represents a singleton pattern abstract class.
/// </summary>
@ -20,6 +21,7 @@ namespace Swan {
/// <value>
/// The instance.
/// </value>
// [Obsolete("NEED", false)]
public static T Instance => LazyInstance.Value;
/// <inheritdoc />

View File

@ -1,4 +1,4 @@
using System;
/*using System;
namespace Swan {
/// <summary>
@ -24,4 +24,4 @@ namespace Swan {
get;
}
}
}
}*/

View File

@ -9,7 +9,7 @@ namespace Swan {
/// Provides utility methods to retrieve information about the current application.
/// </summary>
public static class SwanRuntime {
private static readonly Lazy<Assembly> EntryAssemblyLazy = new Lazy<Assembly>(Assembly.GetEntryAssembly);
/*private static readonly Lazy<Assembly> EntryAssemblyLazy = new Lazy<Assembly>(Assembly.GetEntryAssembly);
private static readonly Lazy<String> CompanyNameLazy = new Lazy<String>(() => {
AssemblyCompanyAttribute attribute = EntryAssembly.GetCustomAttribute(typeof(AssemblyCompanyAttribute)) as AssemblyCompanyAttribute;
@ -28,18 +28,19 @@ namespace Swan {
private static readonly String ApplicationMutexName = "Global\\{{" + EntryAssembly.FullName + "}}";
private static readonly Object SyncLock = new Object();
private static readonly Object SyncLock = new Object();*/
// [Obsolete("NEED", false)]
private static OperatingSystem? _oS;
#region Properties
#region Properties
/// <summary>
/// Gets the current Operating System.
/// </summary>
/// <value>
/// The os.
/// </value>
// [Obsolete("NEED", false)]
public static OperatingSystem OS {
get {
if(_oS.HasValue == false) {
@ -54,7 +55,7 @@ namespace Swan {
}
/// <summary>
/*/// <summary>
/// Checks if this application (including version number) is the only instance currently running.
/// </summary>
/// <value>
@ -171,11 +172,11 @@ namespace Swan {
return returnPath;
}
}
}*/
#endregion
#region Methods
/*#region Methods
/// <summary>
/// Build a full path pointing to the current user's desktop with the given filename.
@ -195,6 +196,6 @@ namespace Swan {
return Path.GetFullPath(pathWithFilename);
}
#endregion
#endregion*/
}
}

View File

@ -7,7 +7,7 @@ namespace Swan {
/// This class is thread-safe :).
/// </summary>
public static partial class Terminal {
/// <summary>
/*/// <summary>
/// Writes a character a number of times, optionally adding a new line at the end.
/// </summary>
/// <param name="charCode">The character code.</param>
@ -32,7 +32,7 @@ namespace Swan {
EnqueueOutput(context);
}
}
}*/
/// <summary>
/// Writes the specified text in the given color.
@ -40,6 +40,7 @@ namespace Swan {
/// <param name="text">The text.</param>
/// <param name="color">The color.</param>
/// <param name="writerFlags">The writer flags.</param>
// [Obsolete("NEED", false)]
public static void Write(String? text, ConsoleColor? color = null, TerminalWriters writerFlags = TerminalWriters.StandardOutput) {
if(text == null) {
return;
@ -57,7 +58,7 @@ namespace Swan {
}
}
/// <summary>
/*/// <summary>
/// Writes a New Line Sequence to the standard output.
/// </summary>
/// <param name="writerFlags">The writer flags.</param>
@ -83,6 +84,6 @@ namespace Swan {
Write($"\r{text ?? String.Empty}", color, writerFlags);
Flush();
CursorLeft = 0;
}
}*/
}
}

View File

@ -18,7 +18,7 @@ namespace Swan {
/// </value>
public static ConsoleColor DefaultColor { get; set; } = Console.ForegroundColor;
/// <summary>
/*/// <summary>
/// Gets the color of the border.
/// </summary>
/// <value>
@ -40,7 +40,7 @@ namespace Swan {
/// <value>
/// The user option text.
/// </value>
public static String UserOptionText { get; set; } = " Option: ";
public static String UserOptionText { get; set; } = " Option: ";*/
}
}
}

View File

@ -12,15 +12,20 @@ namespace Swan {
/// </summary>
public static partial class Terminal {
#region Private Declarations
// [Obsolete("NEED", false)]
private const Int32 OutputFlushInterval = 15;
// [Obsolete("NEED", false)]
private static readonly ExclusiveTimer DequeueOutputTimer;
// [Obsolete("NEED", false)]
private static readonly Object SyncLock = new Object();
// [Obsolete("NEED", false)]
private static readonly ConcurrentQueue<OutputContext> OutputQueue = new ConcurrentQueue<OutputContext>();
// [Obsolete("NEED", false)]
private static readonly ManualResetEventSlim OutputDone = new ManualResetEventSlim(false);
// [Obsolete("NEED", false)]
private static readonly ManualResetEventSlim InputDone = new ManualResetEventSlim(true);
// [Obsolete("NEED", false)]
private static Boolean? _isConsolePresent;
#endregion
@ -30,6 +35,7 @@ namespace Swan {
/// <summary>
/// Initializes static members of the <see cref="Terminal"/> class.
/// </summary>
// [Obsolete("NEED", false)]
static Terminal() {
lock(SyncLock) {
if(DequeueOutputTimer != null) {
@ -48,7 +54,7 @@ namespace Swan {
#endregion
#region Synchronized Cursor Movement
/*#region Synchronized Cursor Movement
/// <summary>
/// Gets or sets the cursor left position.
@ -108,7 +114,7 @@ namespace Swan {
}
}
#endregion
#endregion*/
#region Properties
@ -118,6 +124,7 @@ namespace Swan {
/// <value>
/// <c>true</c> if this instance is console present; otherwise, <c>false</c>.
/// </value>
// [Obsolete("NEED", false)]
public static Boolean IsConsolePresent {
get {
if(_isConsolePresent == null) {
@ -140,6 +147,7 @@ namespace Swan {
/// <value>
/// The available writers.
/// </value>
// [Obsolete("NEED", false)]
public static TerminalWriters AvailableWriters => IsConsolePresent ? TerminalWriters.StandardError | TerminalWriters.StandardOutput : TerminalWriters.None;
/// <summary>
@ -148,6 +156,7 @@ namespace Swan {
/// <value>
/// The output encoding.
/// </value>
// [Obsolete("NEED", false)]
public static Encoding OutputEncoding {
get => Console.OutputEncoding;
set => Console.OutputEncoding = value;
@ -157,7 +166,7 @@ namespace Swan {
#region Methods
/// <summary>
/*/// <summary>
/// Waits for all of the queued output messages to be written out to the console.
/// Call this method if it is important to display console text before
/// quitting the application such as showing usage or help.
@ -224,7 +233,7 @@ namespace Swan {
public static void WriteWelcomeBanner(ConsoleColor color = ConsoleColor.Gray) {
WriteLine($"{SwanRuntime.CompanyName} {SwanRuntime.ProductName} [Version {SwanRuntime.EntryAssemblyVersion}]", color);
WriteLine($"{SwanRuntime.ProductTrademark}", color);
}
}*/
/// <summary>
/// Enqueues the output to be written to the console
@ -232,6 +241,7 @@ namespace Swan {
/// Please note that if AvailableWriters is None, then no output will be enqueued.
/// </summary>
/// <param name="context">The context.</param>
// [Obsolete("NEED", false)]
private static void EnqueueOutput(OutputContext context) {
lock(SyncLock) {
TerminalWriters availableWriters = AvailableWriters;
@ -253,6 +263,7 @@ namespace Swan {
/// <summary>
/// Runs a Terminal I/O cycle in the <see cref="ThreadPool"/> thread.
/// </summary>
// [Obsolete("NEED", false)]
private static void DequeueOutputCycle() {
if(AvailableWriters == TerminalWriters.None) {
OutputDone.Set();
@ -302,6 +313,7 @@ namespace Swan {
/// <summary>
/// Represents an asynchronous output context.
/// </summary>
// [Obsolete("NEED", false)]
private sealed class OutputContext {
/// <summary>
/// Initializes a new instance of the <see cref="OutputContext"/> class.

View File

@ -54,7 +54,7 @@ namespace Swan.Threading {
/// </returns>
public static Boolean operator !=(AtomicTypeBase<T> a, T b) => a?.Equals(b) == false;
/// <summary>
/*/// <summary>
/// Implements the operator &gt;.
/// </summary>
/// <param name="a">a.</param>
@ -142,7 +142,7 @@ namespace Swan.Threading {
public static AtomicTypeBase<T> operator -(AtomicTypeBase<T> instance, Int64 operand) {
instance.BackingValue -= operand;
return instance;
}
}*/
/// <summary>
/// Compares the value to the other instance.

View File

@ -29,7 +29,7 @@ namespace Swan.Threading {
this._backingTimer = new Timer(this.InternalCallback, state ?? this, dueTime, Timeout.Infinite);
}
/// <summary>
/*/// <summary>
/// Initializes a new instance of the <see cref="ExclusiveTimer"/> class.
/// </summary>
/// <param name="timerCallback">The timer callback.</param>
@ -38,15 +38,15 @@ namespace Swan.Threading {
/// <param name="period">The period.</param>
public ExclusiveTimer(TimerCallback timerCallback, Object state, TimeSpan dueTime, TimeSpan period) : this(timerCallback, state, Convert.ToInt32(dueTime.TotalMilliseconds), Convert.ToInt32(period.TotalMilliseconds)) {
// placeholder
}
}*/
/// <summary>
/*/// <summary>
/// Initializes a new instance of the <see cref="ExclusiveTimer"/> class.
/// </summary>
/// <param name="timerCallback">The timer callback.</param>
public ExclusiveTimer(TimerCallback timerCallback) : this(timerCallback, null, Timeout.Infinite, Timeout.Infinite) {
// placeholder
}
}*/
/// <summary>
/// Initializes a new instance of the <see cref="ExclusiveTimer"/> class.
@ -58,7 +58,7 @@ namespace Swan.Threading {
// placeholder
}
/// <summary>
/*/// <summary>
/// Initializes a new instance of the <see cref="ExclusiveTimer"/> class.
/// </summary>
/// <param name="timerCallback">The timer callback.</param>
@ -66,12 +66,13 @@ namespace Swan.Threading {
/// <param name="period">The period.</param>
public ExclusiveTimer(Action timerCallback, TimeSpan dueTime, TimeSpan period) : this(s => timerCallback?.Invoke(), null, dueTime, period) {
// placeholder
}
}*/
/// <summary>
/// Initializes a new instance of the <see cref="ExclusiveTimer"/> class.
/// </summary>
/// <param name="timerCallback">The timer callback.</param>
// [Obsolete("NEED", false)]
public ExclusiveTimer(Action timerCallback) : this(timerCallback, Timeout.Infinite, Timeout.Infinite) {
// placeholder
}
@ -92,7 +93,7 @@ namespace Swan.Threading {
/// </value>
public Boolean IsDisposed => this._isDisposed.Value;
/// <summary>
/*/// <summary>
/// Waits until the time is elapsed.
/// </summary>
/// <param name="untilDate">The until date.</param>
@ -112,15 +113,15 @@ namespace Swan.Threading {
while(!cancellationToken.IsCancellationRequested && DateTime.UtcNow < untilDate) {
delayLock.Wait();
}
}
}*/
/// <summary>
/*/// <summary>
/// Waits the specified wait time.
/// </summary>
/// <param name="waitTime">The wait time.</param>
/// <param name="cancellationToken">The cancellation token.</param>
public static void Wait(TimeSpan waitTime, CancellationToken cancellationToken = default) =>
WaitUntil(DateTime.UtcNow.Add(waitTime), cancellationToken);
WaitUntil(DateTime.UtcNow.Add(waitTime), cancellationToken);*/
/// <summary>
/// Changes the start time and the interval between method invocations for the internal timer.
@ -133,24 +134,25 @@ namespace Swan.Threading {
_ = this._backingTimer.Change(dueTime, Timeout.Infinite);
}
/// <summary>
/*/// <summary>
/// Changes the start time and the interval between method invocations for the internal timer.
/// </summary>
/// <param name="dueTime">The due time.</param>
/// <param name="period">The period.</param>
public void Change(TimeSpan dueTime, TimeSpan period) => this.Change(Convert.ToInt32(dueTime.TotalMilliseconds), Convert.ToInt32(period.TotalMilliseconds));
public void Change(TimeSpan dueTime, TimeSpan period) => this.Change(Convert.ToInt32(dueTime.TotalMilliseconds), Convert.ToInt32(period.TotalMilliseconds));*/
/// <summary>
/// Changes the interval between method invocations for the internal timer.
/// </summary>
/// <param name="period">The period.</param>
// [Obsolete("NEED", false)]
public void Resume(Int32 period) => this.Change(0, period);
/// <summary>
/*/// <summary>
/// Changes the interval between method invocations for the internal timer.
/// </summary>
/// <param name="period">The period.</param>
public void Resume(TimeSpan period) => this.Change(TimeSpan.Zero, period);
public void Resume(TimeSpan period) => this.Change(TimeSpan.Zero, period);*/
/// <summary>
/// Pauses this instance.

View File

@ -67,13 +67,13 @@ namespace Swan.Threading {
/// <returns>The Wait Event.</returns>
public static IWaitEvent CreateSlim(Boolean isCompleted) => new WaitEventSlim(isCompleted);
/// <summary>
/*/// <summary>
/// Creates a Wait Event backed by a ManualResetEventSlim.
/// </summary>
/// <param name="isCompleted">if initially set to completed. Generally true.</param>
/// <param name="useSlim">if set to <c>true</c> creates a slim version of the wait event.</param>
/// <returns>The Wait Event.</returns>
public static IWaitEvent Create(Boolean isCompleted, Boolean useSlim) => useSlim ? CreateSlim(isCompleted) : Create(isCompleted);
public static IWaitEvent Create(Boolean isCompleted, Boolean useSlim) => useSlim ? CreateSlim(isCompleted) : Create(isCompleted);*/
#endregion

View File

@ -1,5 +1,6 @@
using System;
using System.Linq;
using Swan;
namespace Unosquare.RaspberryIO.Camera {