cleanup: Remove unused code in PrimitiveManager.cs
This commit is contained in:
1 parent
fb3262edea
commit
eb102a5898
1 file changed
-27
@@ -17,7 +17,6 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
public class PrimitiveManager : IDataStreamFactory {
|
||||
private static PrimitiveManager mySelf;
|
||||
readonly List<string> myAssemblyNames = new();
|
||||
readonly Dictionary<string, Type> myTypeLookupTable = new();
|
||||
|
||||
@@ -121,32 +120,6 @@ public class PrimitiveManager : IDataStreamFactory {
|
||||
return result is not null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs and returns a ViewStream of type corresponding to the friendly name
|
||||
/// </summary>
|
||||
/// <param name="friendlyName">friendly primitive name </param>
|
||||
/// <param name="args">args can be null or an empty ICollection if the paramterless constructor
|
||||
/// is the desired one</param>
|
||||
/// <returns></returns>
|
||||
public ViewStream build(string friendlyName, ICollection args) {
|
||||
object[] constructorArgs = null;
|
||||
if (args != null && args.Count > 0) {
|
||||
constructorArgs = new object[args.Count];
|
||||
args.CopyTo(constructorArgs, 0);
|
||||
}
|
||||
if (myTypeLookupTable[friendlyName] == null)
|
||||
throw new ApplicationException(friendlyName + " is not the friendly name of any of the loaded types");
|
||||
try {
|
||||
return
|
||||
constructorArgs == null ?
|
||||
Activator.CreateInstance(myTypeLookupTable[friendlyName] as Type) as ViewStream :
|
||||
Activator.CreateInstance(myTypeLookupTable[friendlyName] as Type, constructorArgs) as ViewStream;
|
||||
} catch (Exception ex) {
|
||||
Log.Gen.warn($"PrimitiveManager failed to construct ViewStream type '{friendlyName}': {ex}");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ViewStream Create(string streamId, IEnumerable<(string Name, int? Index, object Value)> args) =>
|
||||
TryResolveType(streamId, out var type) ? Create(type, args) : null;
|
||||
|
||||
|
||||
Reference in new issue
Block a user