convert VB to C#
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace Pilz.Reflection.PluginSystem.Attributes
|
||||
{
|
||||
public class PluginFunctionAttribute : Attribute
|
||||
{
|
||||
public string FunctionCode { get; private set; }
|
||||
public object[] Params { get; private set; }
|
||||
|
||||
/// <summary/>
|
||||
/// <param name="funcCode">The function code for this PluginFunction.</param>
|
||||
/// <param name="params">The parameters for this PluginFunction.</param>
|
||||
public PluginFunctionAttribute(string funcCode, params object[] @params)
|
||||
{
|
||||
FunctionCode = funcCode;
|
||||
Params = @params;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
Namespace Attributes
|
||||
|
||||
Public Class PluginFunctionAttribute
|
||||
Inherits Attribute
|
||||
|
||||
Public ReadOnly Property FunctionCode As String
|
||||
Public ReadOnly Property Params As Object()
|
||||
|
||||
''' <summary/>
|
||||
''' <param name="funcCode">The function code for this PluginFunction.</param>
|
||||
''' <param name="params">The parameters for this PluginFunction.</param>
|
||||
Public Sub New(funcCode As String, ParamArray params As Object())
|
||||
Me.FunctionCode = funcCode
|
||||
Me.Params = params
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace Pilz.Reflection.PluginSystem.Attributes
|
||||
{
|
||||
public class LoadMethodAttribute : Attribute
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
Namespace Attributes
|
||||
|
||||
Public Class LoadMethodAttribute
|
||||
Inherits Attribute
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
11
Pilz.Reflection.PluginSystem/My Project/Application.Designer.cs
generated
Normal file
11
Pilz.Reflection.PluginSystem/My Project/Application.Designer.cs
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.42000
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.42000
|
||||
'
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
Imports System
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
' Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
' die einer Assembly zugeordnet sind.
|
||||
|
||||
' Werte der Assemblyattribute überprüfen
|
||||
|
||||
<Assembly: AssemblyTitle("Pilz.Reflection.PluginSystem")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("Pascal Schedel")>
|
||||
<Assembly: AssemblyProduct("Pilz.Reflection.PluginSystem")>
|
||||
<Assembly: AssemblyCopyright("Copyright © Pascal Schedel 2019")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
|
||||
<Assembly: Guid("71d06604-a99f-4aa7-9dec-a2fe0d6b63d3")>
|
||||
|
||||
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
'
|
||||
' Hauptversion
|
||||
' Nebenversion
|
||||
' Buildnummer
|
||||
' Revision
|
||||
'
|
||||
' Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
192
Pilz.Reflection.PluginSystem/My Project/MyNamespace.Static.1.Designer.cs
generated
Normal file
192
Pilz.Reflection.PluginSystem/My Project/MyNamespace.Static.1.Designer.cs
generated
Normal file
@@ -0,0 +1,192 @@
|
||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualBasic;
|
||||
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
namespace Pilz.Reflection.PluginSystem.My
|
||||
{
|
||||
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia */
|
||||
internal partial class MyApplication : Microsoft.VisualBasic.ApplicationServices.ApplicationBase
|
||||
{
|
||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
}
|
||||
|
||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
internal partial class MyComputer : Microsoft.VisualBasic.Devices.Computer
|
||||
{
|
||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
[DebuggerHidden()]
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public MyComputer() : base()
|
||||
{
|
||||
}
|
||||
}
|
||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
[HideModuleName()]
|
||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
||||
internal static class MyProject
|
||||
{
|
||||
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
[System.ComponentModel.Design.HelpKeyword("My.Computer")]
|
||||
internal static MyComputer Computer
|
||||
{
|
||||
[DebuggerHidden()]
|
||||
get
|
||||
{
|
||||
return m_ComputerObjectProvider.GetInstance;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly static ThreadSafeObjectProvider<MyComputer> m_ComputerObjectProvider = new ThreadSafeObjectProvider<MyComputer>();
|
||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
[System.ComponentModel.Design.HelpKeyword("My.Application")]
|
||||
internal static MyApplication Application
|
||||
{
|
||||
[DebuggerHidden()]
|
||||
get
|
||||
{
|
||||
return m_AppObjectProvider.GetInstance;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly static ThreadSafeObjectProvider<MyApplication> m_AppObjectProvider = new ThreadSafeObjectProvider<MyApplication>();
|
||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
[System.ComponentModel.Design.HelpKeyword("My.User")]
|
||||
internal static Microsoft.VisualBasic.ApplicationServices.User User
|
||||
{
|
||||
[DebuggerHidden()]
|
||||
get
|
||||
{
|
||||
return m_UserObjectProvider.GetInstance;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly static ThreadSafeObjectProvider<Microsoft.VisualBasic.ApplicationServices.User> m_UserObjectProvider = new ThreadSafeObjectProvider<Microsoft.VisualBasic.ApplicationServices.User>();
|
||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
[System.ComponentModel.Design.HelpKeyword("My.WebServices")]
|
||||
internal static MyWebServices WebServices
|
||||
{
|
||||
[DebuggerHidden()]
|
||||
get
|
||||
{
|
||||
return m_MyWebServicesObjectProvider.GetInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
[MyGroupCollection("System.Web.Services.Protocols.SoapHttpClientProtocol", "Create__Instance__", "Dispose__Instance__", "")]
|
||||
internal sealed class MyWebServices
|
||||
{
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
[DebuggerHidden()]
|
||||
public override bool Equals(object o)
|
||||
{
|
||||
return base.Equals(o);
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
[DebuggerHidden()]
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
[DebuggerHidden()]
|
||||
internal new Type GetType()
|
||||
{
|
||||
return typeof(MyWebServices);
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
[DebuggerHidden()]
|
||||
public override string ToString()
|
||||
{
|
||||
return base.ToString();
|
||||
}
|
||||
|
||||
[DebuggerHidden()]
|
||||
private static T Create__Instance__<T>(T instance) where T : new()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
return new T();
|
||||
}
|
||||
else
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
[DebuggerHidden()]
|
||||
private void Dispose__Instance__<T>(ref T instance)
|
||||
{
|
||||
instance = default;
|
||||
}
|
||||
|
||||
[DebuggerHidden()]
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public MyWebServices() : base()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private readonly static ThreadSafeObjectProvider<MyWebServices> m_MyWebServicesObjectProvider = new ThreadSafeObjectProvider<MyWebServices>();
|
||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
[System.Runtime.InteropServices.ComVisible(false)]
|
||||
internal sealed class ThreadSafeObjectProvider<T> where T : new()
|
||||
{
|
||||
internal T GetInstance
|
||||
{
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
[DebuggerHidden()]
|
||||
get
|
||||
{
|
||||
var Value = m_Context.Value;
|
||||
if (Value == null)
|
||||
{
|
||||
Value = new T();
|
||||
m_Context.Value = Value;
|
||||
}
|
||||
|
||||
return Value;
|
||||
}
|
||||
/* TODO ERROR: Skipped ElseDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
}
|
||||
|
||||
[DebuggerHidden()]
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public ThreadSafeObjectProvider() : base()
|
||||
{
|
||||
}
|
||||
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
private readonly Microsoft.VisualBasic.MyServices.Internal.ContextValue<T> m_Context = new Microsoft.VisualBasic.MyServices.Internal.ContextValue<T>();
|
||||
/* TODO ERROR: Skipped ElseDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
}
|
||||
}
|
||||
}
|
||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
253
Pilz.Reflection.PluginSystem/My Project/MyNamespace.Static.2.Designer.cs
generated
Normal file
253
Pilz.Reflection.PluginSystem/My Project/MyNamespace.Static.2.Designer.cs
generated
Normal file
@@ -0,0 +1,253 @@
|
||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
// See Compiler::LoadXmlSolutionExtension
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.VisualBasic;
|
||||
using Microsoft.VisualBasic.CompilerServices;
|
||||
|
||||
namespace Pilz.Reflection.PluginSystem.My
|
||||
{
|
||||
[Embedded()]
|
||||
[DebuggerNonUserCode()]
|
||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
internal sealed class InternalXmlHelper
|
||||
{
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
private InternalXmlHelper()
|
||||
{
|
||||
}
|
||||
|
||||
public static string get_Value(IEnumerable<XElement> source)
|
||||
{
|
||||
foreach (XElement item in source)
|
||||
return item.Value;
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void set_Value(IEnumerable<XElement> source, string value)
|
||||
{
|
||||
foreach (XElement item in source)
|
||||
{
|
||||
item.Value = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static string get_AttributeValue(IEnumerable<XElement> source, XName name)
|
||||
{
|
||||
foreach (XElement item in source)
|
||||
return Conversions.ToString(item.Attribute(name));
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void set_AttributeValue(IEnumerable<XElement> source, XName name, string value)
|
||||
{
|
||||
foreach (XElement item in source)
|
||||
{
|
||||
item.SetAttributeValue(name, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static string get_AttributeValue(XElement source, XName name)
|
||||
{
|
||||
return Conversions.ToString(source.Attribute(name));
|
||||
}
|
||||
|
||||
public static void set_AttributeValue(XElement source, XName name, string value)
|
||||
{
|
||||
source.SetAttributeValue(name, value);
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public static XAttribute CreateAttribute(XName name, object value)
|
||||
{
|
||||
if (value is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new XAttribute(name, value);
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public static XAttribute CreateNamespaceAttribute(XName name, XNamespace ns)
|
||||
{
|
||||
var a = new XAttribute(name, ns.NamespaceName);
|
||||
a.AddAnnotation(ns);
|
||||
return a;
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public static object RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, object obj)
|
||||
{
|
||||
if (obj is object)
|
||||
{
|
||||
XElement elem = obj as XElement;
|
||||
if (elem is object)
|
||||
{
|
||||
return RemoveNamespaceAttributes(inScopePrefixes, inScopeNs, attributes, elem);
|
||||
}
|
||||
else
|
||||
{
|
||||
IEnumerable elems = obj as IEnumerable;
|
||||
if (elems is object)
|
||||
{
|
||||
return RemoveNamespaceAttributes(inScopePrefixes, inScopeNs, attributes, elems);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public static IEnumerable RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, IEnumerable obj)
|
||||
{
|
||||
if (obj is object)
|
||||
{
|
||||
IEnumerable<XElement> elems = obj as IEnumerable<XElement>;
|
||||
if (elems is object)
|
||||
{
|
||||
return elems.Select(new RemoveNamespaceAttributesClosure(inScopePrefixes, inScopeNs, attributes).ProcessXElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
return obj.Cast<object>().Select(new RemoveNamespaceAttributesClosure(inScopePrefixes, inScopeNs, attributes).ProcessObject);
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
[DebuggerNonUserCode()]
|
||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
private sealed class RemoveNamespaceAttributesClosure
|
||||
{
|
||||
private readonly string[] m_inScopePrefixes;
|
||||
private readonly XNamespace[] m_inScopeNs;
|
||||
private readonly List<XAttribute> m_attributes;
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
internal RemoveNamespaceAttributesClosure(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes)
|
||||
{
|
||||
m_inScopePrefixes = inScopePrefixes;
|
||||
m_inScopeNs = inScopeNs;
|
||||
m_attributes = attributes;
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
internal XElement ProcessXElement(XElement elem)
|
||||
{
|
||||
return RemoveNamespaceAttributes(m_inScopePrefixes, m_inScopeNs, m_attributes, elem);
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
internal object ProcessObject(object obj)
|
||||
{
|
||||
XElement elem = obj as XElement;
|
||||
if (elem is object)
|
||||
{
|
||||
return RemoveNamespaceAttributes(m_inScopePrefixes, m_inScopeNs, m_attributes, elem);
|
||||
}
|
||||
else
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public static XElement RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, XElement e)
|
||||
{
|
||||
if (e is object)
|
||||
{
|
||||
var a = e.FirstAttribute;
|
||||
while (a is object)
|
||||
{
|
||||
var nextA = a.NextAttribute;
|
||||
if (a.IsNamespaceDeclaration)
|
||||
{
|
||||
var ns = a.Annotation<XNamespace>();
|
||||
string prefix = a.Name.LocalName;
|
||||
if (ns is object)
|
||||
{
|
||||
if (inScopePrefixes is object && inScopeNs is object)
|
||||
{
|
||||
int lastIndex = inScopePrefixes.Length - 1;
|
||||
for (int i = 0, loopTo = lastIndex; i <= loopTo; i++)
|
||||
{
|
||||
string currentInScopePrefix = inScopePrefixes[i];
|
||||
var currentInScopeNs = inScopeNs[i];
|
||||
if (prefix.Equals(currentInScopePrefix))
|
||||
{
|
||||
if (ns == currentInScopeNs)
|
||||
{
|
||||
// prefix and namespace match. Remove the unneeded ns attribute
|
||||
a.Remove();
|
||||
}
|
||||
|
||||
// prefix is in scope but refers to something else. Leave the ns attribute.
|
||||
a = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (a is object)
|
||||
{
|
||||
// Prefix is not in scope
|
||||
// Now check whether it's going to be in scope because it is in the attributes list
|
||||
|
||||
if (attributes is object)
|
||||
{
|
||||
int lastIndex = attributes.Count - 1;
|
||||
for (int i = 0, loopTo1 = lastIndex; i <= loopTo1; i++)
|
||||
{
|
||||
var currentA = attributes[i];
|
||||
string currentInScopePrefix = currentA.Name.LocalName;
|
||||
var currentInScopeNs = currentA.Annotation<XNamespace>();
|
||||
if (currentInScopeNs is object)
|
||||
{
|
||||
if (prefix.Equals(currentInScopePrefix))
|
||||
{
|
||||
if (ns == currentInScopeNs)
|
||||
{
|
||||
// prefix and namespace match. Remove the unneeded ns attribute
|
||||
a.Remove();
|
||||
}
|
||||
|
||||
// prefix is in scope but refers to something else. Leave the ns attribute.
|
||||
a = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (a is object)
|
||||
{
|
||||
// Prefix is definitely not in scope
|
||||
a.Remove();
|
||||
// namespace is not defined either. Add this attributes list
|
||||
attributes.Add(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
a = nextA;
|
||||
}
|
||||
}
|
||||
|
||||
return e;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Pilz.Reflection.PluginSystem/My Project/MyNamespace.Static.3.Designer.cs
generated
Normal file
14
Pilz.Reflection.PluginSystem/My Project/MyNamespace.Static.3.Designer.cs
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.VisualBasic
|
||||
{
|
||||
[Embedded()]
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Module | AttributeTargets.Assembly, Inherited = false)]
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
||||
internal sealed class Embedded : Attribute
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.42000
|
||||
'
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
Imports System
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
|
||||
'-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||
'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||
'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||
'''<summary>
|
||||
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||
'''</summary>
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0"), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||
Friend Module Resources
|
||||
|
||||
Private resourceMan As Global.System.Resources.ResourceManager
|
||||
|
||||
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||
|
||||
'''<summary>
|
||||
''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||
Get
|
||||
If Object.ReferenceEquals(resourceMan, Nothing) Then
|
||||
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Pilz.Reflection.PluginSystem.Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||
''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set
|
||||
resourceCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
@@ -1,73 +0,0 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.42000
|
||||
'
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
|
||||
|
||||
#Region "Automatische My.Settings-Speicherfunktion"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
#End If
|
||||
#End Region
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As MySettings
|
||||
Get
|
||||
|
||||
#If _MyType = "WindowsForms" Then
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
#End If
|
||||
Return defaultInstance
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||
Friend Module MySettingsProperty
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
Friend ReadOnly Property Settings() As Global.Pilz.Reflection.PluginSystem.My.MySettings
|
||||
Get
|
||||
Return Global.Pilz.Reflection.PluginSystem.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
@@ -4,7 +4,7 @@
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{F7975470-4CA3-4FAB-BB6A-A3AF3978ABB7}</ProjectGuid>
|
||||
<ProjectGuid>{45B3D51B-80FB-005A-3932-69D15BEF9F17}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Pilz.Reflection.PluginSystem</RootNamespace>
|
||||
<AssemblyName>Pilz.Reflection.PluginSystem</AssemblyName>
|
||||
@@ -13,6 +13,8 @@
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -45,6 +47,7 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
@@ -65,46 +68,49 @@
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Attributes\FuncWithCodeMethodAttribute.vb" />
|
||||
<Compile Include="Attributes\LoadMethodAttribute.vb" />
|
||||
<Compile Include="Plugin.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<Compile Include="My Project\MyNamespace.Static.1.Designer.cs" />
|
||||
<Compile Include="My Project\MyNamespace.Static.2.Designer.cs" />
|
||||
<Compile Include="My Project\MyNamespace.Static.3.Designer.cs" />
|
||||
<Compile Include="Attributes\FuncWithCodeMethodAttribute.cs" />
|
||||
<Compile Include="Attributes\LoadMethodAttribute.cs" />
|
||||
<Compile Include="Plugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="My Project\Application.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<Compile Include="Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="PluginFunction.vb" />
|
||||
<Compile Include="PluginLoadException.vb" />
|
||||
<Compile Include="PluginManager.vb" />
|
||||
<Compile Include="PluginFunction.cs" />
|
||||
<Compile Include="PluginLoadException.cs" />
|
||||
<Compile Include="PluginManager.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<EmbeddedResource Include="Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<CustomToolNamespace>Pilz.Reflection.PluginSystem.My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
<LastGenOutput>Application.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<CustomToolNamespace>My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>Pilz.Reflection.PluginSystem.My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
152
Pilz.Reflection.PluginSystem/Plugin.cs
Normal file
152
Pilz.Reflection.PluginSystem/Plugin.cs
Normal file
@@ -0,0 +1,152 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using global::System.Reflection;
|
||||
using global::Pilz.Reflection.PluginSystem.Attributes;
|
||||
|
||||
namespace Pilz.Reflection.PluginSystem
|
||||
{
|
||||
public class Plugin
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// A collection of Methods that contains PluginFunctions that will be called automatically when loading the Plugin, as long as the property AutoCallMainFunctions is set to True.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IReadOnlyList<PluginFunction> MainFunctions { get; private set; }
|
||||
/// <summary>
|
||||
/// A collection of Methods with a FunctionCode (excluding all PluginFunctions from MainFunctions).
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IReadOnlyList<PluginFunction> PluginFunctions { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets the assembly that contains the PluginFunctions of this Plugin
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Assembly Assembly { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets the main module that contains the PluginFunctions of this Plugin
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Type MainModule { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Load a new Plugin and its PluginFunctions.
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <param name="autoCallMainFunction">If true, all MainMethods of a Plugin will be called as soon as a Plugin is loaded.</param>
|
||||
/// <param name="entryTypeName">The name of the type where to search for Methods when loading a new Plugin.</param>
|
||||
public Plugin(string filePath, bool autoCallMainFunction, string entryTypeName)
|
||||
{
|
||||
Assembly = Assembly.LoadFile(filePath);
|
||||
MainModule = Assembly.GetType(entryTypeName);
|
||||
if (MainModule is null)
|
||||
{
|
||||
throw new PluginLoadException("Plugin Modul not found!");
|
||||
}
|
||||
|
||||
// Define the attribute types to observe
|
||||
var entryMethodType = typeof(LoadMethodAttribute);
|
||||
var implementMethodType = typeof(PluginFunctionAttribute);
|
||||
|
||||
// Create the lists
|
||||
var mainMethods = new List<PluginFunction>();
|
||||
var implementMethods = new List<PluginFunction>();
|
||||
|
||||
// Search for PluginFunctions
|
||||
foreach (MethodInfo mi in MainModule.GetMethods())
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
// Check if the method has one of the defined attributes
|
||||
foreach (Attribute attr in Attribute.GetCustomAttributes(mi))
|
||||
{
|
||||
if (!found)
|
||||
{
|
||||
var t = attr.GetType();
|
||||
switch (t)
|
||||
{
|
||||
case var @case when @case == entryMethodType:
|
||||
{
|
||||
mainMethods.Add(new PluginFunction(mi, this));
|
||||
break;
|
||||
}
|
||||
|
||||
case var case1 when case1 == implementMethodType:
|
||||
{
|
||||
{
|
||||
var withBlock = (PluginFunctionAttribute)attr;
|
||||
implementMethods.Add(new PluginFunction(mi, this, withBlock.Params, withBlock.FunctionCode));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the collections
|
||||
MainFunctions = mainMethods;
|
||||
PluginFunctions = implementMethods;
|
||||
|
||||
// Call all PluginFunctions in MainFunctions
|
||||
if (autoCallMainFunction)
|
||||
{
|
||||
foreach (PluginFunction func in mainMethods)
|
||||
{
|
||||
var @params = func.Method.GetParameters();
|
||||
if (@params.Length == 1)
|
||||
{
|
||||
string startupExe = Assembly.GetEntryAssembly().Location;
|
||||
var args = new[] { startupExe, filePath };
|
||||
func.Invoke(new[] { args });
|
||||
}
|
||||
else if (!@params.Any())
|
||||
{
|
||||
func.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all PluginFunctions that have one of the given function codes.
|
||||
/// </summary>
|
||||
/// <param name="funcCodes"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<PluginFunction> GetFunctions(params string[] funcCodes)
|
||||
{
|
||||
var funcs = new List<PluginFunction>();
|
||||
foreach (PluginFunction func in PluginFunctions)
|
||||
{
|
||||
if (funcCodes.Contains(func.FunctionCode))
|
||||
{
|
||||
funcs.Add(func);
|
||||
}
|
||||
}
|
||||
|
||||
return funcs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the first PluginFunction that have the one of the given function codes.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public PluginFunction GetFunction(params string[] funcCodes)
|
||||
{
|
||||
PluginFunction f = null;
|
||||
foreach (PluginFunction func in PluginFunctions)
|
||||
{
|
||||
if (f is null && funcCodes.Contains(func.FunctionCode))
|
||||
{
|
||||
f = func;
|
||||
}
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
Imports System.IO
|
||||
Imports System.Reflection
|
||||
Imports Pilz.Reflection.PluginSystem.Attributes
|
||||
|
||||
Public Class Plugin
|
||||
|
||||
''' <summary>
|
||||
''' A collection of Methods that contains PluginFunctions that will be called automatically when loading the Plugin, as long as the property AutoCallMainFunctions is set to True.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property MainFunctions As IReadOnlyList(Of PluginFunction)
|
||||
''' <summary>
|
||||
''' A collection of Methods with a FunctionCode (excluding all PluginFunctions from MainFunctions).
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property PluginFunctions As IReadOnlyList(Of PluginFunction)
|
||||
''' <summary>
|
||||
''' Gets the assembly that contains the PluginFunctions of this Plugin
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property Assembly As Assembly
|
||||
''' <summary>
|
||||
''' Gets the main module that contains the PluginFunctions of this Plugin
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property MainModule As Type
|
||||
|
||||
''' <summary>
|
||||
''' Load a new Plugin and its PluginFunctions.
|
||||
''' </summary>
|
||||
''' <param name="filePath"></param>
|
||||
''' <param name="autoCallMainFunction">If true, all MainMethods of a Plugin will be called as soon as a Plugin is loaded.</param>
|
||||
''' <param name="entryTypeName">The name of the type where to search for Methods when loading a new Plugin.</param>
|
||||
Public Sub New(filePath As String, autoCallMainFunction As Boolean, entryTypeName As String)
|
||||
Assembly = Assembly.LoadFile(filePath)
|
||||
MainModule = Assembly.GetType(entryTypeName)
|
||||
|
||||
If MainModule Is Nothing Then
|
||||
Throw New PluginLoadException("Plugin Modul not found!")
|
||||
End If
|
||||
|
||||
'Define the attribute types to observe
|
||||
Dim entryMethodType As Type = GetType(LoadMethodAttribute)
|
||||
Dim implementMethodType As Type = GetType(PluginFunctionAttribute)
|
||||
|
||||
'Create the lists
|
||||
Dim mainMethods As New List(Of PluginFunction)
|
||||
Dim implementMethods As New List(Of PluginFunction)
|
||||
|
||||
'Search for PluginFunctions
|
||||
For Each mi As MethodInfo In MainModule.GetMethods
|
||||
Dim found As Boolean = False
|
||||
|
||||
'Check if the method has one of the defined attributes
|
||||
For Each attr As Attribute In Attribute.GetCustomAttributes(mi)
|
||||
If Not found Then
|
||||
Dim t As Type = attr.GetType
|
||||
|
||||
Select Case t
|
||||
Case entryMethodType
|
||||
mainMethods.Add(New PluginFunction(mi, Me))
|
||||
|
||||
Case implementMethodType
|
||||
With CType(attr, PluginFunctionAttribute)
|
||||
implementMethods.Add(New PluginFunction(mi, Me, .Params, .FunctionCode))
|
||||
End With
|
||||
|
||||
End Select
|
||||
|
||||
found = True
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
'Set the collections
|
||||
Me.MainFunctions = mainMethods
|
||||
Me.PluginFunctions = implementMethods
|
||||
|
||||
'Call all PluginFunctions in MainFunctions
|
||||
If autoCallMainFunction Then
|
||||
For Each func As PluginFunction In mainMethods
|
||||
Dim params As ParameterInfo() = func.Method.GetParameters
|
||||
If params.Length = 1 Then
|
||||
Dim startupExe As String = Assembly.GetEntryAssembly.Location
|
||||
Dim args As String() = {startupExe, filePath}
|
||||
func.Invoke({args})
|
||||
ElseIf Not params.Any Then
|
||||
func.Invoke()
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Get all PluginFunctions that have one of the given function codes.
|
||||
''' </summary>
|
||||
''' <param name="funcCodes"></param>
|
||||
''' <returns></returns>
|
||||
Public Function GetFunctions(ParamArray funcCodes As String()) As IEnumerable(Of PluginFunction)
|
||||
Dim funcs As New List(Of PluginFunction)
|
||||
|
||||
For Each func As PluginFunction In PluginFunctions
|
||||
If funcCodes.Contains(func.FunctionCode) Then
|
||||
funcs.Add(func)
|
||||
End If
|
||||
Next
|
||||
|
||||
Return funcs
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Get the first PluginFunction that have the one of the given function codes.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public Function GetFunction(ParamArray funcCodes As String()) As PluginFunction
|
||||
Dim f As PluginFunction = Nothing
|
||||
|
||||
For Each func As PluginFunction In PluginFunctions
|
||||
If f Is Nothing AndAlso funcCodes.Contains(func.FunctionCode) Then
|
||||
f = func
|
||||
End If
|
||||
Next
|
||||
|
||||
Return f
|
||||
End Function
|
||||
|
||||
End Class
|
||||
80
Pilz.Reflection.PluginSystem/PluginFunction.cs
Normal file
80
Pilz.Reflection.PluginSystem/PluginFunction.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using global::System.Reflection;
|
||||
|
||||
namespace Pilz.Reflection.PluginSystem
|
||||
{
|
||||
public class PluginFunction
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets the method to invoke when invoking this PluginFunction.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public MethodInfo Method { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the refered Plugin for this PluginFunction, if it has one.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Plugin Plugin { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Parameters that was given by the attribute.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public object[] Params { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the function code for this PluginFunction.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string FunctionCode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of a PluginFunction.
|
||||
/// </summary>
|
||||
/// <param name="method">The Method to invoke when invoking this PluginFunction.</param>
|
||||
/// <param name="plugin">The Plugin that is the Parent of this PluginFunction. This value can be NULL.</param>
|
||||
public PluginFunction(MethodInfo method, Plugin plugin)
|
||||
{
|
||||
Method = method;
|
||||
Plugin = plugin;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of a PluginFunction.
|
||||
/// </summary>
|
||||
/// <param name="method">The Method to invoke when invoking this PluginFunction..</param>
|
||||
/// <param name="plugin">The Plugin that is the Parent of this PluginFunction. This value can be NULL.</param>
|
||||
/// <param name="params">The Parameters that was given by the attribute.</param>
|
||||
/// <param name="funcCode">The function code for this PluginFunction.</param>
|
||||
public PluginFunction(MethodInfo method, Plugin plugin, object[] @params, string funcCode) : this(method, plugin)
|
||||
{
|
||||
Params = @params;
|
||||
FunctionCode = funcCode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the Method of the PluginFunction.
|
||||
/// </summary>
|
||||
public void Invoke()
|
||||
{
|
||||
Method.Invoke(null, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the Method of the PluginFunction.
|
||||
/// </summary>
|
||||
public void Invoke(params object[] @params)
|
||||
{
|
||||
Method.Invoke(null, @params);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the Method of the PluginFunction and returns the return value.
|
||||
/// </summary>
|
||||
public object InvokeGet(params object[] @params)
|
||||
{
|
||||
return Method.Invoke(null, @params);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
Imports System.Reflection
|
||||
|
||||
Public Class PluginFunction
|
||||
|
||||
''' <summary>
|
||||
''' Gets the method to invoke when invoking this PluginFunction.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property Method As MethodInfo
|
||||
|
||||
''' <summary>
|
||||
''' Gets the refered Plugin for this PluginFunction, if it has one.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property Plugin As Plugin
|
||||
|
||||
''' <summary>
|
||||
''' Gets the Parameters that was given by the attribute.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property Params As Object()
|
||||
|
||||
''' <summary>
|
||||
''' Gets the function code for this PluginFunction.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property FunctionCode As String
|
||||
|
||||
''' <summary>
|
||||
''' Creates a new instance of a PluginFunction.
|
||||
''' </summary>
|
||||
''' <param name="method">The Method to invoke when invoking this PluginFunction.</param>
|
||||
''' <param name="plugin">The Plugin that is the Parent of this PluginFunction. This value can be NULL.</param>
|
||||
Public Sub New(method As MethodInfo, plugin As Plugin)
|
||||
Me.Method = method
|
||||
Me.Plugin = plugin
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Creates a new instance of a PluginFunction.
|
||||
''' </summary>
|
||||
''' <param name="method">The Method to invoke when invoking this PluginFunction..</param>
|
||||
''' <param name="plugin">The Plugin that is the Parent of this PluginFunction. This value can be NULL.</param>
|
||||
''' <param name="params">The Parameters that was given by the attribute.</param>
|
||||
''' <param name="funcCode">The function code for this PluginFunction.</param>
|
||||
Public Sub New(method As MethodInfo, plugin As Plugin, params As Object(), funcCode As String)
|
||||
Me.New(method, plugin)
|
||||
Me.Params = params
|
||||
Me.FunctionCode = funcCode
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Invokes the Method of the PluginFunction.
|
||||
''' </summary>
|
||||
Public Sub Invoke()
|
||||
Method.Invoke(Nothing, Nothing)
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Invokes the Method of the PluginFunction.
|
||||
''' </summary>
|
||||
Public Sub Invoke(ParamArray params As Object())
|
||||
Method.Invoke(Nothing, params)
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Invokes the Method of the PluginFunction and returns the return value.
|
||||
''' </summary>
|
||||
Public Function InvokeGet(ParamArray params As Object()) As Object
|
||||
Return Method.Invoke(Nothing, params)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
15
Pilz.Reflection.PluginSystem/PluginLoadException.cs
Normal file
15
Pilz.Reflection.PluginSystem/PluginLoadException.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace Pilz.Reflection.PluginSystem
|
||||
{
|
||||
public class PluginLoadException : Exception
|
||||
{
|
||||
public PluginLoadException() : base()
|
||||
{
|
||||
}
|
||||
|
||||
public PluginLoadException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
Public Class PluginLoadException
|
||||
Inherits Exception
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New
|
||||
End Sub
|
||||
|
||||
Public Sub New(message As String)
|
||||
MyBase.New(message)
|
||||
End Sub
|
||||
End Class
|
||||
147
Pilz.Reflection.PluginSystem/PluginManager.cs
Normal file
147
Pilz.Reflection.PluginSystem/PluginManager.cs
Normal file
@@ -0,0 +1,147 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using global::System.IO;
|
||||
|
||||
namespace Pilz.Reflection.PluginSystem
|
||||
{
|
||||
public class PluginManager
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The name of the type where to search for Methods when loading a new Plugin.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string EntryTypeName { get; set; } = "Plugin";
|
||||
|
||||
/// <summary>
|
||||
/// If true, all MainMethods of a Plugin will be called as soon as a Plugin is loaded.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool AutoCallMainFunctions { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// A collection of all loaded Plugins.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Dictionary<string, Plugin> Plugins { get; private set; } = new Dictionary<string, Plugin>();
|
||||
|
||||
/// <summary>
|
||||
/// Loads Plugins that can be found at the given path and adds them to the Plugins-List.
|
||||
/// </summary>
|
||||
/// <param name="pluginPath">The path where to search for Plugins to load.</param>
|
||||
public IEnumerable<Plugin> LoadPlugins(string pluginPath)
|
||||
{
|
||||
return LoadPlugins(pluginPath, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads Plugins that can be found at the given path and adds them to the Plugins-List.
|
||||
/// </summary>
|
||||
/// <param name="pluginPath">The path where to search for Plugins to load.</param>
|
||||
/// <param name="addToList">If true, the Plugins will be added to Plugins-List after loading.</param>
|
||||
public IEnumerable<Plugin> LoadPlugins(string pluginPath, bool addToList)
|
||||
{
|
||||
return LoadPlugins(pluginPath, addToList, AutoCallMainFunctions, EntryTypeName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads Plugins that can be found at the given path and adds them to the Plugins-List.
|
||||
/// </summary>
|
||||
/// <param name="pluginPath">The path where to search for Plugins to load.</param>
|
||||
/// <param name="addToList">If true, the Plugins will be added to Plugins-List after loading.</param>
|
||||
/// <param name="autoCallMainFunction">If true, all MainMethods of a Plugin will be called as soon as a Plugin is loaded.</param>
|
||||
/// <param name="entryTypeName">The name of the type where to search for Methods when loading a new Plugin.</param>
|
||||
public IEnumerable<Plugin> LoadPlugins(string pluginPath, bool addToList, bool autoCallMainFunction, string entryTypeName)
|
||||
{
|
||||
var loaded = new List<Plugin>();
|
||||
foreach (string f in Directory.GetFiles(pluginPath, "*.dll", SearchOption.AllDirectories))
|
||||
{
|
||||
var p = LoadPlugin(f, addToList);
|
||||
if (p is object)
|
||||
{
|
||||
loaded.Add(p);
|
||||
}
|
||||
}
|
||||
|
||||
return loaded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads a Plugin and adds it to the Plugins-List.
|
||||
/// </summary>
|
||||
/// <param name="filePath">The path to the plugin to load.</param>
|
||||
/// <param name="addToList">If true, the Plugin will be added to Plugins-List after loading.</param>
|
||||
public Plugin LoadPlugin(string filePath, bool addToList)
|
||||
{
|
||||
return LoadPlugin(filePath, addToList, AutoCallMainFunctions, EntryTypeName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads a Plugin and adds it to the Plugins-List.
|
||||
/// </summary>
|
||||
/// <param name="filePath">The path to the plugin to load.</param>
|
||||
/// <param name="addToList">If true, the Plugin will be added to Plugins-List after loading.</param>
|
||||
/// <param name="autoCallMainFunction">If true, all MainMethods of a Plugin will be called as soon as a Plugin is loaded.</param>
|
||||
/// <param name="entryTypeName">The name of the type where to search for Methods when loading a new Plugin.</param>
|
||||
public Plugin LoadPlugin(string filePath, bool addToList, bool autoCallMainFunction, string entryTypeName)
|
||||
{
|
||||
try
|
||||
{
|
||||
var plugin = new Plugin(filePath, autoCallMainFunction, entryTypeName);
|
||||
if (addToList)
|
||||
Plugins.Add(filePath, plugin);
|
||||
return plugin;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads a Plugin and adds it to the Plugins-List.
|
||||
/// </summary>
|
||||
/// <param name="filePath">The path to the plugin to load.</param>
|
||||
public Plugin LoadPlugin(string filePath)
|
||||
{
|
||||
return LoadPlugin(filePath, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all PluginFunctions that have one of the given function codes.
|
||||
/// </summary>
|
||||
/// <param name="funcCodes"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<PluginFunction> GetFunctions(params string[] funcCodes)
|
||||
{
|
||||
var list = new List<PluginFunction>();
|
||||
foreach (var kvp in Plugins)
|
||||
list.AddRange(kvp.Value.GetFunctions(funcCodes));
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the first PluginFunction that have the one of the given function codes.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public PluginFunction GetFunction(params string[] funcCodes)
|
||||
{
|
||||
PluginFunction f = null;
|
||||
foreach (var kvp in Plugins)
|
||||
{
|
||||
if (f is null)
|
||||
{
|
||||
foreach (PluginFunction func in kvp.Value.GetFunctions(funcCodes))
|
||||
{
|
||||
if (f is null)
|
||||
{
|
||||
f = func;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
Imports System.IO
|
||||
|
||||
Public Class PluginManager
|
||||
|
||||
''' <summary>
|
||||
''' The name of the type where to search for Methods when loading a new Plugin.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public Property EntryTypeName As String = "Plugin"
|
||||
|
||||
''' <summary>
|
||||
''' If true, all MainMethods of a Plugin will be called as soon as a Plugin is loaded.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public Property AutoCallMainFunctions As Boolean = True
|
||||
|
||||
''' <summary>
|
||||
''' A collection of all loaded Plugins.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property Plugins As New Dictionary(Of String, Plugin)
|
||||
|
||||
''' <summary>
|
||||
''' Loads Plugins that can be found at the given path and adds them to the Plugins-List.
|
||||
''' </summary>
|
||||
''' <param name="pluginPath">The path where to search for Plugins to load.</param>
|
||||
Public Function LoadPlugins(pluginPath As String) As IEnumerable(Of Plugin)
|
||||
Return LoadPlugins(pluginPath, True)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Loads Plugins that can be found at the given path and adds them to the Plugins-List.
|
||||
''' </summary>
|
||||
''' <param name="pluginPath">The path where to search for Plugins to load.</param>
|
||||
''' <param name="addToList">If true, the Plugins will be added to Plugins-List after loading.</param>
|
||||
Public Function LoadPlugins(pluginPath As String, addToList As Boolean) As IEnumerable(Of Plugin)
|
||||
Return LoadPlugins(pluginPath, addToList, AutoCallMainFunctions, EntryTypeName)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Loads Plugins that can be found at the given path and adds them to the Plugins-List.
|
||||
''' </summary>
|
||||
''' <param name="pluginPath">The path where to search for Plugins to load.</param>
|
||||
''' <param name="addToList">If true, the Plugins will be added to Plugins-List after loading.</param>
|
||||
''' <param name="autoCallMainFunction">If true, all MainMethods of a Plugin will be called as soon as a Plugin is loaded.</param>
|
||||
''' <param name="entryTypeName">The name of the type where to search for Methods when loading a new Plugin.</param>
|
||||
Public Function LoadPlugins(pluginPath As String, addToList As Boolean, autoCallMainFunction As Boolean, entryTypeName As String) As IEnumerable(Of Plugin)
|
||||
Dim loaded As New List(Of Plugin)
|
||||
|
||||
For Each f As String In Directory.GetFiles(pluginPath, "*.dll", SearchOption.AllDirectories)
|
||||
Dim p As Plugin = LoadPlugin(f, addToList)
|
||||
If p IsNot Nothing Then
|
||||
loaded.Add(p)
|
||||
End If
|
||||
Next
|
||||
|
||||
Return loaded
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Loads a Plugin and adds it to the Plugins-List.
|
||||
''' </summary>
|
||||
''' <param name="filePath">The path to the plugin to load.</param>
|
||||
''' <param name="addToList">If true, the Plugin will be added to Plugins-List after loading.</param>
|
||||
Public Function LoadPlugin(filePath As String, addToList As Boolean) As Plugin
|
||||
Return LoadPlugin(filePath, addToList, AutoCallMainFunctions, EntryTypeName)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Loads a Plugin and adds it to the Plugins-List.
|
||||
''' </summary>
|
||||
''' <param name="filePath">The path to the plugin to load.</param>
|
||||
''' <param name="addToList">If true, the Plugin will be added to Plugins-List after loading.</param>
|
||||
''' <param name="autoCallMainFunction">If true, all MainMethods of a Plugin will be called as soon as a Plugin is loaded.</param>
|
||||
''' <param name="entryTypeName">The name of the type where to search for Methods when loading a new Plugin.</param>
|
||||
Public Function LoadPlugin(filePath As String, addToList As Boolean, autoCallMainFunction As Boolean, entryTypeName As String) As Plugin
|
||||
Try
|
||||
Dim plugin As New Plugin(filePath, autoCallMainFunction, entryTypeName)
|
||||
If addToList Then Plugins.Add(filePath, plugin)
|
||||
Return plugin
|
||||
Catch ex As Exception
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Loads a Plugin and adds it to the Plugins-List.
|
||||
''' </summary>
|
||||
''' <param name="filePath">The path to the plugin to load.</param>
|
||||
Public Function LoadPlugin(filePath As String) As Plugin
|
||||
Return LoadPlugin(filePath, True)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Get all PluginFunctions that have one of the given function codes.
|
||||
''' </summary>
|
||||
''' <param name="funcCodes"></param>
|
||||
''' <returns></returns>
|
||||
Public Function GetFunctions(ParamArray funcCodes As String()) As IEnumerable(Of PluginFunction)
|
||||
Dim list As New List(Of PluginFunction)
|
||||
|
||||
For Each kvp In Plugins
|
||||
list.AddRange(kvp.Value.GetFunctions(funcCodes))
|
||||
Next
|
||||
|
||||
Return list
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Get the first PluginFunction that have the one of the given function codes.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public Function GetFunction(ParamArray funcCodes As String()) As PluginFunction
|
||||
Dim f As PluginFunction = Nothing
|
||||
|
||||
For Each kvp In Plugins
|
||||
If f Is Nothing Then
|
||||
For Each func As PluginFunction In kvp.Value.GetFunctions(funcCodes)
|
||||
If f Is Nothing Then
|
||||
f = func
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
|
||||
Return f
|
||||
End Function
|
||||
|
||||
End Class
|
||||
35
Pilz.Reflection.PluginSystem/Properties/AssemblyInfo.cs
Normal file
35
Pilz.Reflection.PluginSystem/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using global::System;
|
||||
using global::System.Reflection;
|
||||
using global::System.Runtime.InteropServices;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
// die einer Assembly zugeordnet sind.
|
||||
|
||||
// Werte der Assemblyattribute überprüfen
|
||||
|
||||
[assembly: AssemblyTitle("Pilz.Reflection.PluginSystem")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyCompany("Pascal Schedel")]
|
||||
[assembly: AssemblyProduct("Pilz.Reflection.PluginSystem")]
|
||||
[assembly: AssemblyCopyright("Copyright © Pascal Schedel 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
|
||||
[assembly: Guid("71d06604-a99f-4aa7-9dec-a2fe0d6b63d3")]
|
||||
|
||||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
//
|
||||
// Hauptversion
|
||||
// Nebenversion
|
||||
// Buildnummer
|
||||
// Revision
|
||||
//
|
||||
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||
// übernehmen, indem Sie "*" eingeben:
|
||||
// <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
26
Pilz.Reflection.PluginSystem/Properties/Settings.Designer.cs
generated
Normal file
26
Pilz.Reflection.PluginSystem/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.42000
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Pilz.Reflection.PluginSystem.My {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
69
Pilz.Reflection.PluginSystem/Resources.Designer.cs
generated
Normal file
69
Pilz.Reflection.PluginSystem/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,69 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.42000
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualBasic;
|
||||
|
||||
namespace Pilz.Reflection.PluginSystem.My.Resources
|
||||
{
|
||||
|
||||
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
|
||||
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||
/// <summary>
|
||||
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||
/// </summary>
|
||||
[System.CodeDom.Compiler.GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[DebuggerNonUserCode()]
|
||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
||||
[HideModuleName()]
|
||||
internal static class Resources
|
||||
{
|
||||
private static System.Resources.ResourceManager resourceMan;
|
||||
private static System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
/// <summary>
|
||||
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||
/// </summary>
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ReferenceEquals(resourceMan, null))
|
||||
{
|
||||
var temp = new System.Resources.ResourceManager("Pilz.Reflection.PluginSystem.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
||||
/// </summary>
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
Pilz.Reflection.PluginSystem/Resources.resx
Normal file
117
Pilz.Reflection.PluginSystem/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
Reference in New Issue
Block a user