revert to VB and update to new project file format

This commit is contained in:
schedpas
2020-09-25 09:04:15 +02:00
parent 04869b2814
commit 9feaf658be
313 changed files with 9895 additions and 17566 deletions

View File

@@ -1,113 +0,0 @@
using System;
namespace Pilz.Configuration
{
public class AutoSaveConfigurationManager : ConfigurationManager
{
private bool addedHandler = false;
private bool enableAutoSave = false;
private string _ConfigFilePath = string.Empty;
private bool _AutoLoadConfigOnAccess = false;
public string ConfigFilePath
{
get
{
return _ConfigFilePath;
}
set
{
_ConfigFilePath = value;
if (AutoLoadConfigOnAccess)
Load();
}
}
public bool AutoLoadConfigOnAccess
{
get
{
return _AutoLoadConfigOnAccess;
}
set
{
_AutoLoadConfigOnAccess = value;
if (value)
Load();
}
}
public bool AutoSaveConfigOnExit
{
get
{
return enableAutoSave;
}
set
{
if (enableAutoSave != value)
{
enableAutoSave = value;
switch (enableAutoSave)
{
case true:
{
AddAutoSaveHandler();
break;
}
case false:
{
RemoveAutoSaveHandler();
break;
}
}
}
}
}
private void AddAutoSaveHandler()
{
if (!addedHandler)
{
System.Windows.Forms.Application.ApplicationExit += AutoSaveSettingsOnExit;
addedHandler = true;
}
}
private void RemoveAutoSaveHandler()
{
System.Windows.Forms.Application.ApplicationExit -= AutoSaveSettingsOnExit;
addedHandler = false;
}
private void AutoSaveSettingsOnExit(object sender, EventArgs e)
{
Save();
}
private void Save()
{
if (!string.IsNullOrEmpty(ConfigFilePath) && Configuration is object)
{
Configuration.WriteToFile(ConfigFilePath);
}
}
private void Load()
{
if (!string.IsNullOrEmpty(ConfigFilePath))
{
Configuration.ReadFromFile(ConfigFilePath);
}
}
~AutoSaveConfigurationManager()
{
RemoveAutoSaveHandler();
}
}
}

View File

@@ -0,0 +1,78 @@
Public Class AutoSaveConfigurationManager
Inherits ConfigurationManager
Private addedHandler As Boolean = False
Private enableAutoSave As Boolean = False
Private _ConfigFilePath As String = String.Empty
Private _AutoLoadConfigOnAccess As Boolean = False
Public Property ConfigFilePath As String
Get
Return _ConfigFilePath
End Get
Set
_ConfigFilePath = Value
If AutoLoadConfigOnAccess Then Load()
End Set
End Property
Public Property AutoLoadConfigOnAccess As Boolean
Get
Return _AutoLoadConfigOnAccess
End Get
Set
_AutoLoadConfigOnAccess = Value
If Value Then Load()
End Set
End Property
Public Property AutoSaveConfigOnExit As Boolean
Get
Return enableAutoSave
End Get
Set
If enableAutoSave <> Value Then
enableAutoSave = Value
Select Case enableAutoSave
Case True
AddAutoSaveHandler()
Case False
RemoveAutoSaveHandler()
End Select
End If
End Set
End Property
Private Sub AddAutoSaveHandler()
If Not addedHandler Then
AddHandler Windows.Forms.Application.ApplicationExit, AddressOf AutoSaveSettingsOnExit
addedHandler = True
End If
End Sub
Private Sub RemoveAutoSaveHandler()
RemoveHandler Windows.Forms.Application.ApplicationExit, AddressOf AutoSaveSettingsOnExit
addedHandler = False
End Sub
Private Sub AutoSaveSettingsOnExit(sender As Object, e As EventArgs)
Save()
End Sub
Private Sub Save()
If Not String.IsNullOrEmpty(ConfigFilePath) AndAlso Configuration IsNot Nothing Then
Configuration.WriteToFile(ConfigFilePath)
End If
End Sub
Private Sub Load()
If Not String.IsNullOrEmpty(ConfigFilePath) Then
Configuration.ReadFromFile(ConfigFilePath)
End If
End Sub
Protected Overrides Sub Finalize()
RemoveAutoSaveHandler()
End Sub
End Class

View File

@@ -1,13 +0,0 @@
namespace Pilz.Configuration
{
public abstract class ConfigurationManager
{
public SimpleConfiguration Configuration { get; private set; }
internal void SetConfiguration(SimpleConfiguration configuration)
{
Configuration = configuration;
}
}
}

View File

@@ -0,0 +1,9 @@
Public MustInherit Class ConfigurationManager
Public ReadOnly Property Configuration As SimpleConfiguration
Friend Sub SetConfiguration(configuration As SimpleConfiguration)
_Configuration = configuration
End Sub
End Class

View File

@@ -1,104 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using global::Pilz.GeneralEventArgs;
namespace Pilz.Configuration
{
public class ConfigurationManagerList : IList<ConfigurationManager>
{
public event GettingParentManagerEventHandler GettingParentManager;
public delegate void GettingParentManagerEventHandler(object sender, GetValueEventArgs<SimpleConfiguration> e);
private readonly List<ConfigurationManager> myList = new List<ConfigurationManager>();
private object GetParentManager()
{
var args = new GetValueEventArgs<SimpleConfiguration>();
GettingParentManager?.Invoke(this, args);
return args.Value;
}
public ConfigurationManager this[int index]
{
get
{
return myList[index];
}
set
{
myList[index] = value;
}
}
public int Count
{
get
{
return myList.Count;
}
}
public bool IsReadOnly
{
get
{
return false;
}
}
public void Insert(int index, ConfigurationManager item)
{
myList.Insert(index, item);
item.SetConfiguration((SimpleConfiguration)GetParentManager());
}
public void RemoveAt(int index)
{
}
public void Add(ConfigurationManager item)
{
item.SetConfiguration((SimpleConfiguration)GetParentManager());
}
public void Clear()
{
foreach (ConfigurationManager item in myList)
item.SetConfiguration(null);
myList.Clear();
}
public void CopyTo(ConfigurationManager[] array, int arrayIndex)
{
myList.CopyTo(array, arrayIndex);
}
public int IndexOf(ConfigurationManager item)
{
return myList.IndexOf(item);
}
public bool Contains(ConfigurationManager item)
{
return myList.Contains(item);
}
public bool Remove(ConfigurationManager item)
{
item.SetConfiguration(null);
return myList.Remove(item);
}
public IEnumerator<ConfigurationManager> GetEnumerator()
{
return GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return myList.GetEnumerator();
}
}
}

View File

@@ -0,0 +1,83 @@
Imports Pilz.Configuration
Imports Pilz.GeneralEventArgs
Public Class ConfigurationManagerList
Implements IList(Of ConfigurationManager)
Public Event GettingParentManager(sender As Object, e As GetValueEventArgs(Of SimpleConfiguration))
Private ReadOnly myList As New List(Of ConfigurationManager)
Private Function GetParentManager()
Dim args As New GetValueEventArgs(Of SimpleConfiguration)
RaiseEvent GettingParentManager(Me, args)
Return args.Value
End Function
Default Public Property Item(index As Integer) As ConfigurationManager Implements IList(Of ConfigurationManager).Item
Get
Return myList(index)
End Get
Set(value As ConfigurationManager)
myList(index) = value
End Set
End Property
Public ReadOnly Property Count As Integer Implements ICollection(Of ConfigurationManager).Count
Get
Return myList.Count
End Get
End Property
Public ReadOnly Property IsReadOnly As Boolean Implements ICollection(Of ConfigurationManager).IsReadOnly
Get
Return False
End Get
End Property
Public Sub Insert(index As Integer, item As ConfigurationManager) Implements IList(Of ConfigurationManager).Insert
myList.Insert(index, item)
item.SetConfiguration(GetParentManager)
End Sub
Public Sub RemoveAt(index As Integer) Implements IList(Of ConfigurationManager).RemoveAt
End Sub
Public Sub Add(item As ConfigurationManager) Implements ICollection(Of ConfigurationManager).Add
item.SetConfiguration(GetParentManager)
End Sub
Public Sub Clear() Implements ICollection(Of ConfigurationManager).Clear
For Each item As ConfigurationManager In myList
item.SetConfiguration(Nothing)
Next
myList.Clear()
End Sub
Public Sub CopyTo(array() As ConfigurationManager, arrayIndex As Integer) Implements ICollection(Of ConfigurationManager).CopyTo
myList.CopyTo(array, arrayIndex)
End Sub
Public Function IndexOf(item As ConfigurationManager) As Integer Implements IList(Of ConfigurationManager).IndexOf
Return myList.IndexOf(item)
End Function
Public Function Contains(item As ConfigurationManager) As Boolean Implements ICollection(Of ConfigurationManager).Contains
Return myList.Contains(item)
End Function
Public Function Remove(item As ConfigurationManager) As Boolean Implements ICollection(Of ConfigurationManager).Remove
item.SetConfiguration(Nothing)
Return myList.Remove(item)
End Function
Public Function GetEnumerator() As IEnumerator(Of ConfigurationManager) Implements IEnumerable(Of ConfigurationManager).GetEnumerator
Return IEnumerable_GetEnumerator()
End Function
Private Function IEnumerable_GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
Return myList.GetEnumerator
End Function
End Class

View File

@@ -1,139 +0,0 @@
using global::System.IO;
using global::Newtonsoft.Json;
using global::Pilz.GeneralEventArgs;
namespace Pilz.Configuration
{
public static class ConfigurationSerializer
{
public static event GettingJsonSerializerEventHandler GettingJsonSerializer;
public delegate void GettingJsonSerializerEventHandler(object instance, GetValueEventArgs<JsonSerializer> e);
private static JsonSerializer GetJsonSerializer(SimpleConfiguration instance)
{
var args = new GetValueEventArgs<JsonSerializer>(JsonSerializer.CreateDefault());
GettingJsonSerializer?.Invoke(instance, args);
return args.Value;
}
/// <summary>
/// Writes the given instance to a string and return it.
/// </summary>
/// <param name="instance">The configuration instance that should be serialized.</param>
/// <returns>The content of the configuration instance as string.</returns>
public static string WriteToString(SimpleConfiguration instance)
{
var tw = new StringWriter();
GetJsonSerializer(instance).Serialize(tw, instance);
string txt = tw.ToString();
tw.Close();
return txt;
}
/// <summary>
/// Write the given instance to a given stream.
/// </summary>
/// <param name="instance">The configuration instance that should be serialized.</param>
/// <param name="stream">The stream where the content should be written to.</param>
public static void WriteToStream(SimpleConfiguration instance, Stream stream)
{
var sr = new StreamWriter(stream);
sr.Write(WriteToString(instance));
}
/// <summary>
/// Writes the given instance to the given filePath as text file.
/// </summary>
/// <param name="instance">The configuration instance that should be serialized.</param>
/// <param name="filePath">The file path where the content should be written to. The file will be created or overwritten.</param>
public static void WriteToFile(SimpleConfiguration instance, string filePath)
{
var fs = new FileStream(filePath, FileMode.Create, FileAccess.ReadWrite);
WriteToStream(instance, fs);
fs.Close();
}
/// <summary>
/// Reads a configuratin from the given string and returns an instance of it.
/// </summary>
/// <typeparam name="T">The type of the configuration class to instance.</typeparam>
/// <param name="content">The content of the configuration as string.</param>
/// <returns></returns>
public static T ReadFromString<T>(string content) where T : SimpleConfiguration
{
var sr = new StringReader(content);
T instance = (T)GetJsonSerializer(null).Deserialize(sr, typeof(T));
sr.Close();
return instance;
}
/// <summary>
/// Read a configuration from the given string and put them to the given instance.
/// </summary>
/// <param name="instance">The instance to populate with the configuration.</param>
/// <param name="content">The content of the configuration as string.</param>
public static void ReadFromString(SimpleConfiguration instance, string content)
{
var sr = new StringReader(content);
GetJsonSerializer(null).Populate(sr, content);
sr.Close();
}
/// <summary>
/// Reads a configuratin from the given string and returns an instance of it.
/// </summary>
/// <typeparam name="T">The type of the configuration class to instance.</typeparam>
/// <param name="stream">The stream with the content of the configuration.</param>
/// <returns></returns>
public static T ReadFromStream<T>(Stream stream) where T : SimpleConfiguration
{
return ReadFromString<T>(GetContentOfStream(stream));
}
/// <summary>
/// Read a configuration from the given string and put them to the given instance.
/// </summary>
/// <param name="instance">The instance to populate with the configuration.</param>
/// <param name="stream">The stream with the content of the configuration.</param>
public static void ReadFromStream(SimpleConfiguration instance, Stream stream)
{
ReadFromString(instance, GetContentOfStream(stream));
}
/// <summary>
/// Reads a configuratin from the given string and returns an instance of it.
/// </summary>
/// <typeparam name="T">The type of the configuration class to instance.</typeparam>
/// <param name="filePath">The path to the file with the content of the configuration.</param>
/// <returns></returns>
public static T ReadFromFile<T>(string filePath) where T : SimpleConfiguration
{
return ReadFromString<T>(GetContentOfFile(filePath));
}
/// <summary>
/// Read a configuration from the given string and put them to the given instance.
/// </summary>
/// <param name="instance">The instance to populate with the configuration.</param>
/// <param name="filePath">The path to the file with the content of the configuration.</param>
public static void ReadFromFile(SimpleConfiguration instance, string filePath)
{
ReadFromString(instance, GetContentOfFile(filePath));
}
private static string GetContentOfStream(Stream stream)
{
var sr = new StreamReader(stream);
return sr.ReadToEnd();
}
private static string GetContentOfFile(string filePath)
{
var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
string content = GetContentOfStream(fs);
fs.Close();
return content;
}
}
}

View File

@@ -0,0 +1,123 @@
Imports System.IO
Imports Newtonsoft.Json
Imports Pilz.GeneralEventArgs
Public Module ConfigurationSerializer
Public Event GettingJsonSerializer(instance As Object, e As GetValueEventArgs(Of JsonSerializer))
Private Function GetJsonSerializer(instance As SimpleConfiguration) As JsonSerializer
Dim args As New GetValueEventArgs(Of JsonSerializer)(JsonSerializer.CreateDefault)
RaiseEvent GettingJsonSerializer(instance, args)
Return args.Value
End Function
''' <summary>
''' Writes the given instance to a string and return it.
''' </summary>
''' <param name="instance">The configuration instance that should be serialized.</param>
''' <returns>The content of the configuration instance as string.</returns>
Public Function WriteToString(instance As SimpleConfiguration) As String
Dim tw As New StringWriter
GetJsonSerializer(instance).Serialize(tw, instance)
Dim txt = tw.ToString
tw.Close()
Return txt
End Function
''' <summary>
''' Write the given instance to a given stream.
''' </summary>
''' <param name="instance">The configuration instance that should be serialized.</param>
''' <param name="stream">The stream where the content should be written to.</param>
Public Sub WriteToStream(instance As SimpleConfiguration, stream As Stream)
Dim sr As New StreamWriter(stream)
sr.Write(WriteToString(instance))
End Sub
''' <summary>
''' Writes the given instance to the given filePath as text file.
''' </summary>
''' <param name="instance">The configuration instance that should be serialized.</param>
''' <param name="filePath">The file path where the content should be written to. The file will be created or overwritten.</param>
Public Sub WriteToFile(instance As SimpleConfiguration, filePath As String)
Dim fs As New FileStream(filePath, FileMode.Create, FileAccess.ReadWrite)
WriteToStream(instance, fs)
fs.Close()
End Sub
''' <summary>
''' Reads a configuratin from the given string and returns an instance of it.
''' </summary>
''' <typeparam name="T">The type of the configuration class to instance.</typeparam>
''' <param name="content">The content of the configuration as string.</param>
''' <returns></returns>
Public Function ReadFromString(Of T As SimpleConfiguration)(content As String) As T
Dim sr As New StringReader(content)
Dim instance As T = GetJsonSerializer(Nothing).Deserialize(sr, GetType(T))
sr.Close()
Return instance
End Function
''' <summary>
''' Read a configuration from the given string and put them to the given instance.
''' </summary>
''' <param name="instance">The instance to populate with the configuration.</param>
''' <param name="content">The content of the configuration as string.</param>
Public Sub ReadFromString(instance As SimpleConfiguration, content As String)
Dim sr As New StringReader(content)
GetJsonSerializer(Nothing).Populate(sr, content)
sr.Close()
End Sub
''' <summary>
''' Reads a configuratin from the given string and returns an instance of it.
''' </summary>
''' <typeparam name="T">The type of the configuration class to instance.</typeparam>
''' <param name="stream">The stream with the content of the configuration.</param>
''' <returns></returns>
Public Function ReadFromStream(Of T As SimpleConfiguration)(stream As Stream) As T
Return ReadFromString(Of T)(GetContentOfStream(stream))
End Function
''' <summary>
''' Read a configuration from the given string and put them to the given instance.
''' </summary>
''' <param name="instance">The instance to populate with the configuration.</param>
''' <param name="stream">The stream with the content of the configuration.</param>
Public Sub ReadFromStream(instance As SimpleConfiguration, stream As Stream)
ReadFromString(instance, GetContentOfStream(stream))
End Sub
''' <summary>
''' Reads a configuratin from the given string and returns an instance of it.
''' </summary>
''' <typeparam name="T">The type of the configuration class to instance.</typeparam>
''' <param name="filePath">The path to the file with the content of the configuration.</param>
''' <returns></returns>
Public Function ReadFromFile(Of T As SimpleConfiguration)(filePath As String) As T
Return ReadFromString(Of T)(GetContentOfFile(filePath))
End Function
''' <summary>
''' Read a configuration from the given string and put them to the given instance.
''' </summary>
''' <param name="instance">The instance to populate with the configuration.</param>
''' <param name="filePath">The path to the file with the content of the configuration.</param>
Public Sub ReadFromFile(instance As SimpleConfiguration, filePath As String)
ReadFromString(instance, GetContentOfFile(filePath))
End Sub
Private Function GetContentOfStream(stream As Stream) As String
Dim sr As New StreamReader(stream)
Return sr.ReadToEnd
End Function
Private Function GetContentOfFile(filePath As String) As String
Dim fs As New FileStream(filePath, FileMode.Open, FileAccess.Read)
Dim content = GetContentOfStream(fs)
fs.Close()
Return content
End Function
End Module

View File

@@ -1,12 +0,0 @@
namespace Pilz.Configuration
{
public interface ISettingsManager
{
string ConfigFilePath { get; set; }
void Save();
void Load();
void Reset();
}
}

View File

@@ -0,0 +1,6 @@
Public Interface ISettingsManager
Property ConfigFilePath As String
Sub Save()
Sub Load()
Sub Reset()
End Interface

View File

@@ -1,11 +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>
// ------------------------------------------------------------------------------

View File

@@ -0,0 +1,13 @@
'------------------------------------------------------------------------------
' <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

View File

@@ -1,192 +0,0 @@
// 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.Configuration.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 */

View File

@@ -1,253 +0,0 @@
// 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.Configuration.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;
}
}
}

View File

@@ -1,14 +0,0 @@
// 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
{
}
}

View File

@@ -0,0 +1,63 @@
'------------------------------------------------------------------------------
' <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.Configuration.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

View File

@@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <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.Configuration.My.MySettings
Get
Return Global.Pilz.Configuration.My.MySettings.Default
End Get
End Property
End Module
End Namespace

View File

@@ -2,15 +2,9 @@
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFramework>net48</TargetFramework>
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
<LangVersion>latest</LangVersion>
<AssemblyTitle>Pilz.Configuration</AssemblyTitle>
<Company>DRSN</Company>
<Product>Pilz.Configuration</Product>
<Copyright>Copyright © DRSN 2019</Copyright>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DocumentationFile>Pilz.Configuration.xml</DocumentationFile>
<DefineTrace>true</DefineTrace>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineDebug>true</DefineDebug>
@@ -31,11 +25,13 @@
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Data.DataSetExtensions" Version="4.*" />
<PackageReference Include="System.Net.Http" Version="4.*" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
@@ -50,44 +46,41 @@
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Update="My Project\Application.Designer.cs">
<Compile Update="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Update="Resources.Designer.cs">
<Compile Update="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Update="Properties\Settings.Designer.cs">
<Compile Update="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<CustomToolNamespace>Pilz.Configuration.My.Resources</CustomToolNamespace>
<EmbeddedResource Update="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.cs</LastGenOutput>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="Properties\Settings.settings">
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>Pilz.Configuration.My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Pilz\Pilz.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<ProjectReference Include="..\Pilz\Pilz.vbproj" />
</ItemGroup>
</Project>

View File

@@ -1,8 +0,0 @@
using global::System;
using global::System.Reflection;
using global::System.Runtime.InteropServices;
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
[assembly: Guid("3980caa6-d118-4166-8f0d-e91c9dc07e3c")]

View File

@@ -1,26 +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>
//------------------------------------------------------------------------------
namespace Pilz.Configuration.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;
}
}
}
}

View File

@@ -1,69 +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>
// ------------------------------------------------------------------------------
using System.Diagnostics;
using Microsoft.VisualBasic;
namespace Pilz.Configuration.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.Configuration.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;
}
}
}
}

View File

@@ -1,117 +0,0 @@
<?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>

View File

@@ -1,26 +0,0 @@
using global::Newtonsoft.Json;
namespace Pilz.Configuration
{
public abstract class SettingsBase
{
public SettingsBase()
{
ResetValues();
}
[JsonIgnore]
internal ISettingsManager _settingsManager;
[JsonIgnore]
public ISettingsManager SettingsManager
{
get
{
return _settingsManager;
}
}
public abstract void ResetValues();
}
}

View File

@@ -0,0 +1,20 @@
Imports Newtonsoft.Json
Public MustInherit Class SettingsBase
Public Sub New()
ResetValues()
End Sub
<JsonIgnore>
Friend _settingsManager As ISettingsManager
<JsonIgnore>
Public ReadOnly Property SettingsManager As ISettingsManager
Get
Return _settingsManager
End Get
End Property
Public MustOverride Sub ResetValues()
End Class

View File

@@ -1,161 +0,0 @@
using System;
using global::System.IO;
using global::Newtonsoft.Json.Linq;
namespace Pilz.Configuration
{
public sealed class SettingsManager<T> : ISettingsManager where T : SettingsBase
{
public event EventHandler AutoSavingSettings;
public event EventHandler SavingSettings;
public event EventHandler SavedSettings;
private T defaultInstance = null;
private bool enableAutoSave = false;
private bool addedHandler = false;
public string ConfigFilePath { get; set; }
public bool AutoSaveOnExit
{
get
{
return enableAutoSave;
}
set
{
if (enableAutoSave != value)
{
enableAutoSave = value;
switch (enableAutoSave)
{
case true:
{
if (!addedHandler)
{
AddAutoSaveHandler();
}
break;
}
case false:
{
if (addedHandler)
{
RemoveAutoSaveHandler();
}
break;
}
}
}
}
}
private void AddAutoSaveHandler()
{
System.Windows.Forms.Application.ApplicationExit += AutoSaveSettingsOnExit;
addedHandler = true;
}
private void RemoveAutoSaveHandler()
{
System.Windows.Forms.Application.ApplicationExit -= AutoSaveSettingsOnExit;
addedHandler = false;
}
public T Instance
{
get
{
if (defaultInstance is null)
{
Load();
}
return defaultInstance;
}
}
public SettingsManager()
{
ConfigFilePath = "";
AutoSaveOnExit = false;
}
public SettingsManager(string fileName, bool autoSaveOnExit)
{
ConfigFilePath = fileName;
AutoSaveOnExit = autoSaveOnExit;
}
private void AutoSaveSettingsOnExit(object sender, EventArgs e)
{
AutoSavingSettings?.Invoke(this, new EventArgs());
Save();
}
public void Save()
{
if (!string.IsNullOrEmpty(ConfigFilePath) && defaultInstance is object)
{
SavePrivate();
}
}
public void Load()
{
if (!string.IsNullOrEmpty(ConfigFilePath) && File.Exists(ConfigFilePath))
{
LoadPrivate();
}
else
{
CreateNewInstance();
}
if (defaultInstance is object)
{
defaultInstance._settingsManager = this;
}
}
public void Reset()
{
Instance.ResetValues();
}
private void CreateNewInstance()
{
var ctor = typeof(T).GetConstructor(Array.Empty<Type>());
if (ctor is object)
{
defaultInstance = (T)ctor.Invoke(Array.Empty<object>());
defaultInstance.ResetValues();
}
else
{
throw new Exception("The base type has no constructor with no parameters.");
}
}
private void LoadPrivate()
{
defaultInstance = JObject.Parse(File.ReadAllText(ConfigFilePath)).ToObject<T>();
}
private void SavePrivate()
{
SavingSettings?.Invoke(this, new EventArgs());
var obj = JObject.FromObject(defaultInstance);
if (obj is object)
{
File.WriteAllText(ConfigFilePath, obj.ToString());
}
SavedSettings?.Invoke(this, new EventArgs());
}
}
}

View File

@@ -0,0 +1,119 @@
Imports System.IO
Imports System.Reflection
Imports Newtonsoft.Json.Linq
Public NotInheritable Class SettingsManager(Of T As SettingsBase)
Implements ISettingsManager
Public Event AutoSavingSettings As EventHandler
Public Event SavingSettings As EventHandler
Public Event SavedSettings As EventHandler
Private defaultInstance As T = Nothing
Private enableAutoSave As Boolean = False
Private addedHandler As Boolean = False
Public Property ConfigFilePath As String Implements ISettingsManager.ConfigFilePath
Public Property AutoSaveOnExit As Boolean
Get
Return enableAutoSave
End Get
Set
If enableAutoSave <> Value Then
enableAutoSave = Value
Select Case enableAutoSave
Case True
If Not addedHandler Then
AddAutoSaveHandler()
End If
Case False
If addedHandler Then
RemoveAutoSaveHandler()
End If
End Select
End If
End Set
End Property
Private Sub AddAutoSaveHandler()
AddHandler Windows.Forms.Application.ApplicationExit, AddressOf AutoSaveSettingsOnExit
addedHandler = True
End Sub
Private Sub RemoveAutoSaveHandler()
RemoveHandler Windows.Forms.Application.ApplicationExit, AddressOf AutoSaveSettingsOnExit
addedHandler = False
End Sub
Public ReadOnly Property Instance As T
Get
If defaultInstance Is Nothing Then
Load()
End If
Return defaultInstance
End Get
End Property
Public Sub New()
ConfigFilePath = ""
AutoSaveOnExit = False
End Sub
Public Sub New(fileName As String, autoSaveOnExit As Boolean)
ConfigFilePath = fileName
Me.AutoSaveOnExit = autoSaveOnExit
End Sub
Private Sub AutoSaveSettingsOnExit(sender As Object, e As EventArgs)
RaiseEvent AutoSavingSettings(Me, New EventArgs)
Save()
End Sub
Public Sub Save() Implements ISettingsManager.Save
If Not String.IsNullOrEmpty(ConfigFilePath) AndAlso defaultInstance IsNot Nothing Then
SavePrivate()
End If
End Sub
Public Sub Load() Implements ISettingsManager.Load
If Not String.IsNullOrEmpty(ConfigFilePath) AndAlso File.Exists(ConfigFilePath) Then
LoadPrivate()
Else
CreateNewInstance()
End If
If defaultInstance IsNot Nothing Then
defaultInstance._settingsManager = Me
End If
End Sub
Public Sub Reset() Implements ISettingsManager.Reset
Instance.ResetValues()
End Sub
Private Sub CreateNewInstance()
Dim ctor As ConstructorInfo = GetType(T).GetConstructor({})
If ctor IsNot Nothing Then
defaultInstance = ctor.Invoke({})
defaultInstance.ResetValues()
Else
Throw New Exception("The base type has no constructor with no parameters.")
End If
End Sub
Private Sub LoadPrivate()
defaultInstance = JObject.Parse(File.ReadAllText(ConfigFilePath)).ToObject(Of T)
End Sub
Private Sub SavePrivate()
RaiseEvent SavingSettings(Me, New EventArgs)
Dim obj As JObject = JObject.FromObject(defaultInstance)
If obj IsNot Nothing Then
File.WriteAllText(ConfigFilePath, obj.ToString)
End If
RaiseEvent SavedSettings(Me, New EventArgs)
End Sub
End Class

View File

@@ -1,112 +0,0 @@
using global::System.IO;
using global::Newtonsoft.Json;
using global::Pilz.GeneralEventArgs;
namespace Pilz.Configuration
{
public class SimpleConfiguration
{
[JsonIgnore]
public readonly ConfigurationManagerList Managers = new ConfigurationManagerList();
public SimpleConfiguration()
{
Managers.GettingParentManager += Managers_GettingParentManager;
}
private void Managers_GettingParentManager(object sender, GetValueEventArgs<SimpleConfiguration> e)
{
if (ReferenceEquals(sender, Managers))
{
e.Value = this;
}
}
/// <summary>
/// Writes this instance to a string and return it.
/// </summary>
/// <returns>The content of the configuration instance as string.</returns>
public string WriteToString()
{
return ConfigurationSerializer.WriteToString(this);
}
/// <summary>
/// Write this instance to a given stream.
/// </summary>
/// <param name="stream">The stream where the content should be written to.</param>
public void WriteToStream(Stream stream)
{
ConfigurationSerializer.WriteToStream(this, stream);
}
/// <summary>
/// Writes this instance to the given filePath as text file.
/// </summary>
/// <param name="filePath">The file path where the content should be written to. The file will be created or overwritten.</param>
public void WriteToFile(string filePath)
{
ConfigurationSerializer.WriteToFile(this, filePath);
}
/// <summary>
/// Reads a configuratin from the given string and returns an instance of it.
/// </summary>
/// <typeparam name="T">The type of the configuration class to instance.</typeparam>
/// <param name="content">The content of the configuration as string.</param>
/// <returns></returns>
public static T ReadFromString<T>(string content) where T : SimpleConfiguration
{
return ConfigurationSerializer.ReadFromString<T>(content);
}
/// <summary>
/// Read a configuration from the given string and put them to this instance.
/// </summary>
/// <param name="content">The content of the configuration as string.</param>
public void ReadFromString(string content)
{
ConfigurationSerializer.ReadFromString(this, content);
}
/// <summary>
/// Reads a configuratin from the given string and returns an instance of it.
/// </summary>
/// <typeparam name="T">The type of the configuration class to instance.</typeparam>
/// <param name="stream">The stream with the content of the configuration.</param>
/// <returns></returns>
public static T ReadFromStream<T>(Stream stream) where T : SimpleConfiguration
{
return ConfigurationSerializer.ReadFromStream<T>(stream);
}
/// <summary>
/// Read a configuration from the given string and put them to this instance.
/// </summary>
/// <param name="stream">The stream with the content of the configuration.</param>
public void ReadFromStream(Stream stream)
{
ConfigurationSerializer.ReadFromStream(this, stream);
}
/// <summary>
/// Reads a configuratin from the given string and returns an instance of it.
/// </summary>
/// <typeparam name="T">The type of the configuration class to instance.</typeparam>
/// <param name="filePath">The path to the file with the content of the configuration.</param>
/// <returns></returns>
public static T ReadFromFile<T>(string filePath) where T : SimpleConfiguration
{
return ConfigurationSerializer.ReadFromFile<T>(filePath);
}
/// <summary>
/// Read a configuration from the given string and put them to this instance.
/// </summary>
/// <param name="filePath">The path to the file with the content of the configuration.</param>
public void ReadFromFile(string filePath)
{
ConfigurationSerializer.ReadFromFile(this, filePath);
}
}
}

View File

@@ -0,0 +1,99 @@
Imports System.IO
Imports Newtonsoft.Json
Imports Pilz.Configuration
Imports Pilz.GeneralEventArgs
Public Class SimpleConfiguration
<JsonIgnore>
Public ReadOnly Managers As New ConfigurationManagerList
Public Sub New()
AddHandler Managers.GettingParentManager, AddressOf Managers_GettingParentManager
End Sub
Private Sub Managers_GettingParentManager(sender As Object, e As GetValueEventArgs(Of SimpleConfiguration))
If sender Is Managers Then
e.Value = Me
End If
End Sub
''' <summary>
''' Writes this instance to a string and return it.
''' </summary>
''' <returns>The content of the configuration instance as string.</returns>
Public Function WriteToString() As String
Return ConfigurationSerializer.WriteToString(Me)
End Function
''' <summary>
''' Write this instance to a given stream.
''' </summary>
''' <param name="stream">The stream where the content should be written to.</param>
Public Sub WriteToStream(stream As Stream)
ConfigurationSerializer.WriteToStream(Me, stream)
End Sub
''' <summary>
''' Writes this instance to the given filePath as text file.
''' </summary>
''' <param name="filePath">The file path where the content should be written to. The file will be created or overwritten.</param>
Public Sub WriteToFile(filePath As String)
ConfigurationSerializer.WriteToFile(Me, filePath)
End Sub
''' <summary>
''' Reads a configuratin from the given string and returns an instance of it.
''' </summary>
''' <typeparam name="T">The type of the configuration class to instance.</typeparam>
''' <param name="content">The content of the configuration as string.</param>
''' <returns></returns>
Public Shared Function ReadFromString(Of T As SimpleConfiguration)(content As String) As T
Return ConfigurationSerializer.ReadFromString(Of T)(content)
End Function
''' <summary>
''' Read a configuration from the given string and put them to this instance.
''' </summary>
''' <param name="content">The content of the configuration as string.</param>
Public Sub ReadFromString(content As String)
ConfigurationSerializer.ReadFromString(Me, content)
End Sub
''' <summary>
''' Reads a configuratin from the given string and returns an instance of it.
''' </summary>
''' <typeparam name="T">The type of the configuration class to instance.</typeparam>
''' <param name="stream">The stream with the content of the configuration.</param>
''' <returns></returns>
Public Shared Function ReadFromStream(Of T As SimpleConfiguration)(stream As Stream) As T
Return ConfigurationSerializer.ReadFromStream(Of T)(stream)
End Function
''' <summary>
''' Read a configuration from the given string and put them to this instance.
''' </summary>
''' <param name="stream">The stream with the content of the configuration.</param>
Public Sub ReadFromStream(stream As Stream)
ConfigurationSerializer.ReadFromStream(Me, stream)
End Sub
''' <summary>
''' Reads a configuratin from the given string and returns an instance of it.
''' </summary>
''' <typeparam name="T">The type of the configuration class to instance.</typeparam>
''' <param name="filePath">The path to the file with the content of the configuration.</param>
''' <returns></returns>
Public Shared Function ReadFromFile(Of T As SimpleConfiguration)(filePath As String) As T
Return ConfigurationSerializer.ReadFromFile(Of T)(filePath)
End Function
''' <summary>
''' Read a configuration from the given string and put them to this instance.
''' </summary>
''' <param name="filePath">The path to the file with the content of the configuration.</param>
Public Sub ReadFromFile(filePath As String)
ConfigurationSerializer.ReadFromFile(Me, filePath)
End Sub
End Class