Closed BryanWilhite closed 2 years ago
compiler warnings:
/SonghayCore/SonghayCore/Security/SymmetricCrypt.cs(24,39): warning SYSLIB0021: 'AesCryptoServiceProvider' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.' [/SonghayCore/SonghayCore/SonghayCore.csproj]
/SonghayCore/SonghayCore/Security/SymmetricCrypt.cs(38,39): warning SYSLIB0021: 'AesCryptoServiceProvider' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.' [/SonghayCore/SonghayCore/SonghayCore.csproj]
/SonghayCore/SonghayCore/Security/SymmetricCrypt.cs(101,39): warning SYSLIB0021: 'AesCryptoServiceProvider' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.' [/SonghayCore/SonghayCore/SonghayCore.csproj]
/SonghayCore/SonghayCore/Security/SymmetricCrypt.cs(127,39): warning SYSLIB0021: 'AesCryptoServiceProvider' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.' [/SonghayCore/SonghayCore/SonghayCore.csproj]
/SonghayCore/SonghayCore/Security/SaltedHash.cs(33,24): warning SYSLIB0021: 'SHA256Managed' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.' [/SonghayCore/SonghayCore/SonghayCore.csproj]
/SonghayCore/SonghayCore/Security/SaltedHash.cs(56,30): warning SYSLIB0023: 'RNGCryptoServiceProvider' is obsolete: 'RNGCryptoServiceProvider is obsolete. To generate a random number, use one of the RandomNumberGenerator static methods instead.' [/SonghayCore/SonghayCore/SonghayCore.csproj]
/SonghayCore/SonghayCore/Cryptography/EncryptTransformer.cs(63,35): warning SYSLIB0021: 'DESCryptoServiceProvider' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.' [/SonghayCore/SonghayCore/SonghayCore.csproj]
/SonghayCore/SonghayCore/Cryptography/EncryptTransformer.cs(88,42): warning SYSLIB0021: 'TripleDESCryptoServiceProvider' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.' [/SonghayCore/SonghayCore/SonghayCore.csproj]
/SonghayCore/SonghayCore/Cryptography/EncryptTransformer.cs(113,35): warning SYSLIB0021: 'RC2CryptoServiceProvider' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.' [/SonghayCore/SonghayCore/SonghayCore.csproj]
/SonghayCore/SonghayCore/Cryptography/EncryptTransformer.cs(138,21): warning SYSLIB0022: 'Rijndael' is obsolete: 'The Rijndael and RijndaelManaged types are obsolete. Use Aes instead.' [/SonghayCore/SonghayCore/SonghayCore.csproj]
/SonghayCore/SonghayCore/Cryptography/EncryptTransformer.cs(138,45): warning SYSLIB0022: 'RijndaelManaged' is obsolete: 'The Rijndael and RijndaelManaged types are obsolete. Use Aes instead.' [/SonghayCore/SonghayCore/SonghayCore.csproj]
/SonghayCore/SonghayCore/Cryptography/DecryptTransformer.cs(36,35): warning SYSLIB0021: 'DESCryptoServiceProvider' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.' [/SonghayCore/SonghayCore/SonghayCore.csproj]
/SonghayCore/SonghayCore/Cryptography/DecryptTransformer.cs(44,42): warning SYSLIB0021: 'TripleDESCryptoServiceProvider' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.' [/SonghayCore/SonghayCore/SonghayCore.csproj]
/SonghayCore/SonghayCore/Cryptography/DecryptTransformer.cs(50,35): warning SYSLIB0021: 'RC2CryptoServiceProvider' is obsolete: 'Derived cryptographic types are obsolete. Use the Create method on the base type instead.' [/SonghayCore/SonghayCore/SonghayCore.csproj]
/SonghayCore/SonghayCore/Cryptography/DecryptTransformer.cs(56,21): warning SYSLIB0022: 'Rijndael' is obsolete: 'The Rijndael and RijndaelManaged types are obsolete. Use Aes instead.' [/SonghayCore/SonghayCore/SonghayCore.csproj]
/SonghayCore/SonghayCore/Cryptography/DecryptTransformer.cs(56,45): warning SYSLIB0022: 'RijndaelManaged' is obsolete: 'The Rijndael and RijndaelManaged types are obsolete. Use Aes instead.' [/SonghayCore/SonghayCore/SonghayCore.csproj]
in response to this news, I will be removing the entire Security
and Cryptography
namespaces 🚜 🔥 which has the side effects of the removal of:
EncryptionMetadataExtensions
ProgramMetadataExtensions.GetConnectionStringWithDecryptedValue
all of these security features were not used by me since before .NET Core 2
first sweep 🧹 🚜 🔥 :
issue #135 will cover all of the Newtonsoft-related concerns here
this needs to be removed and thrown into a notebook later:
using System;
using System.Linq;
using System.Linq.Expressions;
namespace Songhay.Extensions
{
/// <summary>
/// Extensions of <see cref="System.Linq.Expressions.Expression"/>
/// </summary>
public static class ExpressionExtensions
{
/// <summary>
/// Ors the specified this expression.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="thisExpression">The this expression.</param>
/// <param name="expression">The expression.</param>
/// <returns></returns>
public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> thisExpression, Expression<Func<T, bool>> expression)
{
var invokedExpr = Expression.Invoke(expression, thisExpression.Parameters.Cast<Expression>());
return Expression.Lambda<Func<T, bool>>(Expression.OrElse(thisExpression.Body, invokedExpr), thisExpression.Parameters);
}
/// <summary>
/// Ands the specified this expression.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="thisExpression">The this expression.</param>
/// <param name="expression">The expression.</param>
/// <returns></returns>
public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> thisExpression, Expression<Func<T, bool>> expression)
{
var invokedExpr = Expression.Invoke(expression, thisExpression.Parameters.Cast<Expression>());
return Expression.Lambda<Func<T, bool>>(Expression.AndAlso(thisExpression.Body, invokedExpr), thisExpression.Parameters);
}
}
}
removing SonghayCore/Extensions/ObjectExtensions.GetProperties.cs
:
using System.Linq;
using System.Reflection;
namespace Songhay.Extensions
{
/// <summary>
/// Extensions of <see cref="object"/>.
/// </summary>
public static partial class ObjectExtensions
{
/// <summary>
/// Gets the properties.
/// </summary>
/// <param name="objectWithProperties">The object with properties.</param>
public static PropertyInfo[] GetProperties(this object objectWithProperties)
{
if (objectWithProperties == null) return Enumerable.Empty<PropertyInfo>().ToArray();
return objectWithProperties.GetType().GetProperties();
}
/// <summary>
/// Gets the property.
/// </summary>
/// <param name="objectWithProperties">The object with properties.</param>
/// <param name="propertyName">Name of the property.</param>
public static PropertyInfo GetProperty(this object objectWithProperties, string propertyName)
{
var props = objectWithProperties.GetProperties();
if (!props.Any()) return null;
return props.FirstOrDefault(i => i.Name == propertyName);
}
/// <summary>
/// Gets the property value.
/// </summary>
/// <param name="objectWithProperties">The object with properties.</param>
/// <param name="propertyName">Name of the property.</param>
/// <remarks>
/// Very useful for an MVVM situation like this:
/// <code>
/// var command = this.DataContext.GetPropertyValue("MyCommand") as ICommand;
/// </code>
///
/// Note that this member uses <c>property.GetValue(objectWithProperties, index: null)</c>.
/// Passing null is “fine for normal simple properties, this will fail with indexer properties,
/// which take a non-null argument list as specified by <c>PropertyInfo.GetIndexParameters</c>.”
/// [https://stackoverflow.com/a/1355110/22944]
/// </remarks>
public static object GetPropertyValue(this object objectWithProperties, string propertyName)
{
var property = objectWithProperties.GetProperty(propertyName);
if (property == null) return null;
return property.GetValue(objectWithProperties, index: null);
}
}
}
i have decided to keep IEnumerableOfTExtensions
but my remarks referring to MoreLinq [ :octocat: https://github.com/morelinq/MoreLINQ ] are added
i have decided to get rid of IIdentityExtensions
🔥 as I expect to run into this need rarely or in PowerShell
more expression stuff to go in a notebook:
using System;
using System.Linq.Expressions;
namespace Songhay;
/// <summary>
/// Seeds of <see cref="System.Linq.Expressions.Expression"/>
/// </summary>
public static class ExpressionSeed
{
/// <summary>
/// <see cref="System.Linq.Expressions.Expression"/> <c>true</c>.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public static Expression<Func<T, bool>> True<T>() { return f => true; }
/// <summary>
/// <see cref="System.Linq.Expressions.Expression"/> <c>false</c>.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public static Expression<Func<T, bool>> False<T>() { return f => false; }
}
using System;
namespace Songhay;
/// <summary>
/// Functor seeds
/// </summary>
public static class FuncSeed
{
/// <summary>
/// Predicate Functor for <c>true</c>.
/// </summary>
/// <typeparam name="T"></typeparam>
public static Func<T, bool> True<T>() { return f => true; }
/// <summary>
/// Predicate Functor for <c>false</c>.
/// </summary>
/// <typeparam name="T"></typeparam>
public static Func<T, bool> False<T>() { return f => false; }
}
Extensions.ObjectExtensions.IsType<TClass>
can be removed in favor of the new pattern matching features of C#:
should there be a .NET 6 version of
SonghayCore
the following legacy load should be droppedCollections/ObservableSortingCollection.cs
ComponentModel/BackgroundWorkerUtility.cs
Cryptography/*
(andSecurity/*
)Extensions/FuncExtensions.cs
(withExpressionExtensions
,ExpressionSeed.cs
andFuncSeed.cs
)Extensions/ICommunicationObjectExtensions.cs
Extensions/IConfigurationBuilderExtensions.cs
Extensions/IContractResolverExtensions.cs
Newtonsoft.Json
should no longer be considered a Core asset; consider moving to a Jupyter notebookExtensions/IDictionaryExtensions.Obsolete.cs
Extensions/IEnumerableOfTExtensions.cs
Obsolete
with replacements in, say, MoreLinq [GitHub]Extensions/IIdentityExtensions.cs
Extensions/JObjectExtensions.cs
Newtonsoft.Json
should no longer be considered a Core asset; attempt to replace all read operations withSystem.Text.Json
equivalents; consider moving the rest to a Jupyter notebookExtensions/JsonSerializerSettingsExtensions.cs
Newtonsoft.Json
should no longer be considered a Core asset; attempt to replace all operations withSystem.Text.Json
equivalents; consider moving the rest to a Jupyter notebookExtensions/JTokenExtensions.cs
Newtonsoft.Json
should no longer be considered a Core asset; attempt to replace all operations withSystem.Text.Json
equivalents; consider moving the rest to a Jupyter notebookExtensions/NullableExtensions.cs
these assets need to be reviewed for contemporary usefulness[see #137 ]Extensions/ObjectExtensions.cs
Extensions/ObjectExtensions.GetProperties.cs
Extensions/OpenAuthorizationDataExtensions.cs
Songhay.Social
level; Twitter has for years not been regarded as a Core assetStringExtensions.WrapForRiaEndpoint
JsonSerializationUtility.cs
Newtonsoft.Json
should no longer be considered a Core assetOpcReferencedTypeStrategy.cs
andOpcUtility.cs
ProgramFileUtility.Obsolete.cs
Songhay.Models.EditableObjectCache
Models/IControlInteractionMessage.cs
Models/HierarchicalNameValuePair
andNameValuePair | replaced by
KeyValuePair<TKey, TValue>`ProgramUtility.InteropServices.cs
These changes imply that:
Songhay.Mvvm
)Newtonsoft.Json
is being replaced bySystem.Text.Json
equivalentsObsolete
(because they had replacements) should finally disappearThese changes are still avoiding revisiting the
Songhay.Xml
namespace. And is not answering questions around whetherIObservable
patterns play a role in the future UI work of this Studio.