Commit 09364d30 authored by Uwe Wienkop's avatar Uwe Wienkop

2020-06-22a

parent 609ffc2e
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>_10_UebgMsgServer</RootNamespace>
</PropertyGroup>
</Project>
using System;
/*
* Gegeben ist das folgende Programm als Grundgerüst eines Nachrichtendienstes.
* Dabei soll gelten: Ein Nachrichtenserver bietet eine Schnittstelle (Delegate), an der beliebig viele
* Nachrichtenempfangsmethoden anderer Klassen andocken können. Bevor Nachrichten jedoch versendet werden,
* können diese mit Hilfe einer oder mehrerer kundenspezifischer Modifikationsfunktionen bearbeitet werden
* (hier wir als Beispiel ein alter Firmenname durch den neuen Firmennamen ersetzt sowie an die Nachrichten
* wird noch ein Anhängsel (Signatur) angehängt.
*/
namespace _10_UebgMsgServer
{
delegate void Callback(_____________________________________________);
delegate void Transform(_____________________________________________);
class MsgServer
{
public event Callback notify;
public event Transform transformations;
public void SendMsg(string msg)
{
Console.WriteLine($"\n\n\nNeue Nachricht (Original): {msg}");
if (transformations != null)
transformations(ref msg);
if (notify != null)
notify(msg);
}
}
class Client
{
public string Name { get; }
public Client(string Name) { this.Name = Name; }
public void Listener(string text)
{
Console.WriteLine($" {Name}: {text}");
}
}
class Program
{
static void Signature(ref string text)
{
text += "\nMessage via Magic MsgServer, AAA Corporation";
}
static void OldNewCorp(ref string text)
{
text = text.Replace("ZZZ Corporation", "AAA Corporation");
}
static void Main(string[] args)
{
MsgServer server1 = new MsgServer();
server1.transformations += OldNewCorp;
server1.transformations += Signature;
Client mueller = new Client("Müller");
Client meier = new Client("Meier");
Client huber = new Client("Huber");
server1.notify += mueller.Listener;
server1.notify += meier.Listener;
server1.SendMsg("Herzlich Willkommen, liebe Kunden! ZZZ Corporation");
server1.notify += huber.Listener;
server1.notify -= mueller.Listener;
server1.SendMsg("Wir wünschen einen erfolgreichen Tag, ZZZ Corporation");
}
}
}
{
"format": 1,
"restore": {
"C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\10 UebgMsgServer\\10 UebgMsgServer.csproj": {}
},
"projects": {
"C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\10 UebgMsgServer\\10 UebgMsgServer.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\10 UebgMsgServer\\10 UebgMsgServer.csproj",
"projectName": "10 UebgMsgServer",
"projectPath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\10 UebgMsgServer\\10 UebgMsgServer.csproj",
"packagesPath": "C:\\Users\\wienkop\\.nuget\\packages\\",
"outputPath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\10 UebgMsgServer\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\wienkop\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"netcoreapp3.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netcoreapp3.1": {
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netcoreapp3.1": {
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.301\\RuntimeIdentifierGraph.json"
}
}
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\wienkop\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.6.0</NuGetToolVersion>
</PropertyGroup>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
</Project>
\ No newline at end of file
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")]
//------------------------------------------------------------------------------
// <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;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("10 UebgMsgServer")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("10 UebgMsgServer")]
[assembly: System.Reflection.AssemblyTitleAttribute("10 UebgMsgServer")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Von der MSBuild WriteCodeFragment-Klasse generiert.
{
"version": 3,
"targets": {
".NETCoreApp,Version=v3.1": {}
},
"libraries": {},
"projectFileDependencyGroups": {
".NETCoreApp,Version=v3.1": []
},
"packageFolders": {
"C:\\Users\\wienkop\\.nuget\\packages\\": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\10 UebgMsgServer\\10 UebgMsgServer.csproj",
"projectName": "10 UebgMsgServer",
"projectPath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\10 UebgMsgServer\\10 UebgMsgServer.csproj",
"packagesPath": "C:\\Users\\wienkop\\.nuget\\packages\\",
"outputPath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\10 UebgMsgServer\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\wienkop\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"netcoreapp3.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netcoreapp3.1": {
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netcoreapp3.1": {
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.301\\RuntimeIdentifierGraph.json"
}
}
}
}
\ No newline at end of file
{
"version": 2,
"dgSpecHash": "/Sp7c7J/8RkCY6K1VtUtsnY1ht4Ap8MWZNJoZn6+kcygYXnDfW+kU/Z2I9zIg1wEpKNXuFMoskaCXF4lvT9M+A==",
"success": true,
"projectFilePath": "C:\\Users\\wienkop\\source\\repos\\prog2-ss2020-wienkop\\10 UebgMsgServer\\10 UebgMsgServer.csproj",
"expectedPackageFiles": [],
"logs": []
}
\ No newline at end of file
......@@ -110,7 +110,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "09 UebgDiMailVerteilung", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "09 DelegateVerkettung", "09 DelegateVerkettung\09 DelegateVerkettung.csproj", "{17A26633-0F72-4889-B31E-9A29A80CE4A5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "09DataDriven", "09DataDriven\09DataDriven.csproj", "{4E2ED939-4FFF-4A44-8ACD-13E0CF23E1FB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "09DataDriven", "09DataDriven\09DataDriven.csproj", "{4E2ED939-4FFF-4A44-8ACD-13E0CF23E1FB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "10 UebgMsgServer", "10 UebgMsgServer\10 UebgMsgServer.csproj", "{6B7A3A19-6CE7-4F20-9F03-7B091C00B9BE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......@@ -326,6 +328,10 @@ Global
{4E2ED939-4FFF-4A44-8ACD-13E0CF23E1FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E2ED939-4FFF-4A44-8ACD-13E0CF23E1FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E2ED939-4FFF-4A44-8ACD-13E0CF23E1FB}.Release|Any CPU.Build.0 = Release|Any CPU
{6B7A3A19-6CE7-4F20-9F03-7B091C00B9BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6B7A3A19-6CE7-4F20-9F03-7B091C00B9BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6B7A3A19-6CE7-4F20-9F03-7B091C00B9BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6B7A3A19-6CE7-4F20-9F03-7B091C00B9BE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment