diff --git a/.vs/prog2-ss2020-wienkop/v16/.suo b/.vs/prog2-ss2020-wienkop/v16/.suo index 24e0062c958a73862219b8a5960a5b77ed9334df..6ff42605d59a83a160ae31d50cf2f97904d82425 100644 Binary files a/.vs/prog2-ss2020-wienkop/v16/.suo and b/.vs/prog2-ss2020-wienkop/v16/.suo differ diff --git a/05HTMLEngine/HTMLEngine.cs b/05HTMLEngine/HTMLEngine.cs index 9ad58767159712e8a6e2f74d1d5053d216ac6f5d..b2a0a274c2f4402b5e1f8777b9604990ae4b68c7 100644 --- a/05HTMLEngine/HTMLEngine.cs +++ b/05HTMLEngine/HTMLEngine.cs @@ -1,16 +1,22 @@ namespace HTML -{ - // HTML engine for generation of a HTML string from an array of HTML tag elements: +{ + // HTML engine for generation of a HTML string from an array of HTML tag elements: - public interface ITagged { string TagId { get; } } // Used to define HTML tag element + public interface ITagged { string TagId { get; } } // Used to define HTML tag element - public interface INested { object[] Elements { get; } } // Used to "mark" a HTML tag element as nested + public interface INested { object[] Elements { get; } } // Used to "mark" a HTML tag element as nested + class Body : ITagged, INested + { + public string TagId => "body"; + public Body(params object[] Elements) { this.Elements = Elements; } + public object[] Elements { get; private set; } + } - public static class Engine - { - public static string Generate(params object[] elements) + public static class Engine { - // TODO: Your code for (recursive) generation of a HTML string from array "elements" here... + public static string Generate(params object[] elements) + { + // TODO: Your code for (recursive) generation of a HTML string from array "elements" here... + } } - } } \ No newline at end of file diff --git a/05HTMLEngine/Program.cs b/05HTMLEngine/Program.cs index 171fc20a82464fc85b8a4002cb5f254601a418c6..dbe68c2dd259ba7980327ea75b8c1e3d6ac81a77 100644 --- a/05HTMLEngine/Program.cs +++ b/05HTMLEngine/Program.cs @@ -67,6 +67,7 @@ class Program System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo("Example.html"); startInfo.UseShellExecute = true; System.Diagnostics.Process.Start(startInfo); + //System.Diagnostics.Process.Start("Example.html"); } } diff --git a/06 UebgDiExceptions/Program.cs b/06 UebgDiExceptions/Program.cs index 9022e20f8923bc28bcd1038e0ccaedae80b84cfe..9f7455b418718c0ceee6c81c47faf1d7a97dd8a4 100644 --- a/06 UebgDiExceptions/Program.cs +++ b/06 UebgDiExceptions/Program.cs @@ -42,9 +42,13 @@ namespace _06_UebgDiExceptions try { Funktion3(); + //Funktion3b(); + //if (errno != 0) + // Console.WriteLine("In Funktion 3b ist ein Fehler passiert"); Console.WriteLine("Letzte Anweisung des try-Blocks von Funktion 2"); } - catch(MyAppExceptions e) + catch(MyAppExceptions e) // Fängt MyAppExceptions und alle Exceptions, die + // von MyAppExceptions abgeleitet sind { Console.WriteLine($"catch in Funktion 2: {e.Message}, {e.fehlerwert}"); throw; @@ -60,7 +64,8 @@ namespace _06_UebgDiExceptions Console.WriteLine("Funktion3"); int x = 2; if (1 < x) - throw new MyAppExceptions("Fehler in Funktion3", 4711); + throw new DivideByZeroException("Fehler in F3"); + //throw new MyAppExceptions("Fehler in Funktion3", 4711); Console.WriteLine("Ende von Funktion3"); } static int errno=0; @@ -69,11 +74,25 @@ namespace _06_UebgDiExceptions int x = 0; errno = 9999; int y = 3 / x; - } static void Main(string[] args) { - Funktion1(); + bool fehler; + do + { + // Init ... + try + { + fehler = false; + Funktion1(); + } + catch (Exception) + { + Console.WriteLine("Allgemeiner Fehler"); + fehler = true; + // Neuinitialisierung ... + } + } while (fehler == true); } } } diff --git a/06 UebgDiExceptions/bin/Debug/netcoreapp3.1/06 UebgDiExceptions.dll b/06 UebgDiExceptions/bin/Debug/netcoreapp3.1/06 UebgDiExceptions.dll index 2493fa44bd27762cd19dcfc2cbbc2a6303fc58d4..e340b77ccfb301324c9dad5670f96e1ae04b3ee8 100644 Binary files a/06 UebgDiExceptions/bin/Debug/netcoreapp3.1/06 UebgDiExceptions.dll and b/06 UebgDiExceptions/bin/Debug/netcoreapp3.1/06 UebgDiExceptions.dll differ diff --git a/06 UebgDiExceptions/bin/Debug/netcoreapp3.1/06 UebgDiExceptions.pdb b/06 UebgDiExceptions/bin/Debug/netcoreapp3.1/06 UebgDiExceptions.pdb index c110f34e9e21b3d8d0e6c420ca493f46c50cc316..fba46e6611b0983845750958a4468cd122da961d 100644 Binary files a/06 UebgDiExceptions/bin/Debug/netcoreapp3.1/06 UebgDiExceptions.pdb and b/06 UebgDiExceptions/bin/Debug/netcoreapp3.1/06 UebgDiExceptions.pdb differ diff --git a/06 UebgDiExceptions/obj/Debug/netcoreapp3.1/06 UebgDiExceptions.csprojAssemblyReference.cache b/06 UebgDiExceptions/obj/Debug/netcoreapp3.1/06 UebgDiExceptions.csprojAssemblyReference.cache index 74fe67b1ca671095970d4a7fbcae2417231e8f41..d7dd684443de8ada82f92a8e0cf14a64b9096fd6 100644 Binary files a/06 UebgDiExceptions/obj/Debug/netcoreapp3.1/06 UebgDiExceptions.csprojAssemblyReference.cache and b/06 UebgDiExceptions/obj/Debug/netcoreapp3.1/06 UebgDiExceptions.csprojAssemblyReference.cache differ diff --git a/06 UebgDiExceptions/obj/Debug/netcoreapp3.1/06 UebgDiExceptions.dll b/06 UebgDiExceptions/obj/Debug/netcoreapp3.1/06 UebgDiExceptions.dll index 2493fa44bd27762cd19dcfc2cbbc2a6303fc58d4..e340b77ccfb301324c9dad5670f96e1ae04b3ee8 100644 Binary files a/06 UebgDiExceptions/obj/Debug/netcoreapp3.1/06 UebgDiExceptions.dll and b/06 UebgDiExceptions/obj/Debug/netcoreapp3.1/06 UebgDiExceptions.dll differ diff --git a/06 UebgDiExceptions/obj/Debug/netcoreapp3.1/06 UebgDiExceptions.pdb b/06 UebgDiExceptions/obj/Debug/netcoreapp3.1/06 UebgDiExceptions.pdb index c110f34e9e21b3d8d0e6c420ca493f46c50cc316..fba46e6611b0983845750958a4468cd122da961d 100644 Binary files a/06 UebgDiExceptions/obj/Debug/netcoreapp3.1/06 UebgDiExceptions.pdb and b/06 UebgDiExceptions/obj/Debug/netcoreapp3.1/06 UebgDiExceptions.pdb differ diff --git a/06Exceptions_Threads/Program.cs b/06Exceptions_Threads/Program.cs index 440d1d0d0bfb5579d8984f1ee2640814ee1e6a6b..bd862f07bdcfe0458ec80dd831f8f1f2d645bf29 100644 --- a/06Exceptions_Threads/Program.cs +++ b/06Exceptions_Threads/Program.cs @@ -10,14 +10,14 @@ namespace _06Exceptions_Threads // The method that will be called when the thread is started. public void InstanceMethod() { - int data = count++; + int processNr = count++; try { Console.WriteLine(" InstanceMethod läuft in einem eigenen Thread"); // Pause for a moment to provide a delay to make // threads more apparent. - if (data == 3) + if (processNr == 3) { Thread.Sleep(2000); throw new NullReferenceException("Null Referenz!!!"); @@ -27,11 +27,11 @@ namespace _06Exceptions_Threads } catch (Exception e) { - Console.WriteLine($"!!!Fehler {e.Message} in Instanz {data}"); + Console.WriteLine($"!!!Fehler {e.Message} in Instanz {processNr}"); } finally { - Console.WriteLine($" Thread {data} wurde beendet"); + Console.WriteLine($" Thread {processNr} wurde beendet"); } } } diff --git a/06Exceptions_Threads/bin/Debug/netcoreapp3.1/06Exceptions_Threads.dll b/06Exceptions_Threads/bin/Debug/netcoreapp3.1/06Exceptions_Threads.dll index f26342668538b477f50663f639ec1ffd56f777f2..909606b8a8ebcb4350b19252e5c4cc7feeec0161 100644 Binary files a/06Exceptions_Threads/bin/Debug/netcoreapp3.1/06Exceptions_Threads.dll and b/06Exceptions_Threads/bin/Debug/netcoreapp3.1/06Exceptions_Threads.dll differ diff --git a/06Exceptions_Threads/bin/Debug/netcoreapp3.1/06Exceptions_Threads.pdb b/06Exceptions_Threads/bin/Debug/netcoreapp3.1/06Exceptions_Threads.pdb index 9dcd57eb02304fcb23ddc75288bbf4a768bf6215..4c17c690751ad78bee4e4087acbf9d207183a6f5 100644 Binary files a/06Exceptions_Threads/bin/Debug/netcoreapp3.1/06Exceptions_Threads.pdb and b/06Exceptions_Threads/bin/Debug/netcoreapp3.1/06Exceptions_Threads.pdb differ diff --git a/06Exceptions_Threads/obj/Debug/netcoreapp3.1/06Exceptions_Threads.csproj.FileListAbsolute.txt b/06Exceptions_Threads/obj/Debug/netcoreapp3.1/06Exceptions_Threads.csproj.FileListAbsolute.txt index f9ac9157fb39fbf16f31e689e851c152403ad81f..dbee0b50ffb11bfc28972a793f2ad64783eaf8ec 100644 --- a/06Exceptions_Threads/obj/Debug/netcoreapp3.1/06Exceptions_Threads.csproj.FileListAbsolute.txt +++ b/06Exceptions_Threads/obj/Debug/netcoreapp3.1/06Exceptions_Threads.csproj.FileListAbsolute.txt @@ -10,3 +10,4 @@ C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\06Exceptions_Threads\obj\Debu C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\06Exceptions_Threads\obj\Debug\netcoreapp3.1\06Exceptions_Threads.dll C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\06Exceptions_Threads\obj\Debug\netcoreapp3.1\06Exceptions_Threads.pdb C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\06Exceptions_Threads\obj\Debug\netcoreapp3.1\06Exceptions_Threads.genruntimeconfig.cache +C:\Users\wienkop\source\repos\prog2-ss2020-wienkop\06Exceptions_Threads\obj\Debug\netcoreapp3.1\06Exceptions_Threads.csprojAssemblyReference.cache diff --git a/06Exceptions_Threads/obj/Debug/netcoreapp3.1/06Exceptions_Threads.csprojAssemblyReference.cache b/06Exceptions_Threads/obj/Debug/netcoreapp3.1/06Exceptions_Threads.csprojAssemblyReference.cache new file mode 100644 index 0000000000000000000000000000000000000000..74fe67b1ca671095970d4a7fbcae2417231e8f41 Binary files /dev/null and b/06Exceptions_Threads/obj/Debug/netcoreapp3.1/06Exceptions_Threads.csprojAssemblyReference.cache differ diff --git a/06Exceptions_Threads/obj/Debug/netcoreapp3.1/06Exceptions_Threads.dll b/06Exceptions_Threads/obj/Debug/netcoreapp3.1/06Exceptions_Threads.dll index f26342668538b477f50663f639ec1ffd56f777f2..909606b8a8ebcb4350b19252e5c4cc7feeec0161 100644 Binary files a/06Exceptions_Threads/obj/Debug/netcoreapp3.1/06Exceptions_Threads.dll and b/06Exceptions_Threads/obj/Debug/netcoreapp3.1/06Exceptions_Threads.dll differ diff --git a/06Exceptions_Threads/obj/Debug/netcoreapp3.1/06Exceptions_Threads.pdb b/06Exceptions_Threads/obj/Debug/netcoreapp3.1/06Exceptions_Threads.pdb index 9dcd57eb02304fcb23ddc75288bbf4a768bf6215..4c17c690751ad78bee4e4087acbf9d207183a6f5 100644 Binary files a/06Exceptions_Threads/obj/Debug/netcoreapp3.1/06Exceptions_Threads.pdb and b/06Exceptions_Threads/obj/Debug/netcoreapp3.1/06Exceptions_Threads.pdb differ diff --git a/06WPF_Ausnahmen/MainWindow.xaml.cs b/06WPF_Ausnahmen/MainWindow.xaml.cs index 965c8d056bbdc22d00a96a2c783e55caf822ffe5..cb21aeb5e0c68c67bf9d720b0c9a8602c4822df0 100644 --- a/06WPF_Ausnahmen/MainWindow.xaml.cs +++ b/06WPF_Ausnahmen/MainWindow.xaml.cs @@ -31,10 +31,16 @@ namespace _06WPF_Ausnahmen { int a = Convert.ToInt32(tb1.Text); int b = Convert.ToInt32(tb2.Text); + if (b > 1000) + throw new ArgumentException("Wert zu groß bei Eingabe 2"); int c = Convert.ToInt32(tb3.Text); int d = Convert.ToInt32(tb4.Text); ErgLbl.Content = a + b + c + d; } + catch (FormatException) + { + MessageBox.Show("Vermutlich eine falsche Eingabe. Bitte prüfen Sie die Textboxen"); + } catch (Exception ex) { MessageBox.Show("Fehler bei der Eingabe " + ex.Message); diff --git a/06WPF_Ausnahmen/bin/Debug/06WPF_Ausnahmen.exe b/06WPF_Ausnahmen/bin/Debug/06WPF_Ausnahmen.exe index 390848ce56e5cc3e5b61f84037715b377512bf5a..d8b14e281f511700e503cdfab14d66c1181e5bb4 100644 Binary files a/06WPF_Ausnahmen/bin/Debug/06WPF_Ausnahmen.exe and b/06WPF_Ausnahmen/bin/Debug/06WPF_Ausnahmen.exe differ diff --git a/06WPF_Ausnahmen/bin/Debug/06WPF_Ausnahmen.pdb b/06WPF_Ausnahmen/bin/Debug/06WPF_Ausnahmen.pdb index d3a79a8c2ec0b2b224c70a8725f89267bee2c68b..f3204050def129a76ba380cdd5871fb7ed5c0e71 100644 Binary files a/06WPF_Ausnahmen/bin/Debug/06WPF_Ausnahmen.pdb and b/06WPF_Ausnahmen/bin/Debug/06WPF_Ausnahmen.pdb differ diff --git a/06WPF_Ausnahmen/obj/Debug/06WPF_Ausnahmen.csprojAssemblyReference.cache b/06WPF_Ausnahmen/obj/Debug/06WPF_Ausnahmen.csprojAssemblyReference.cache index a2e1b3c981b518b371cbf28e2fa26d2ca39fdbdb..8fab01cc1c6c5dcf52040485c13a7c6d2f7d9e1f 100644 Binary files a/06WPF_Ausnahmen/obj/Debug/06WPF_Ausnahmen.csprojAssemblyReference.cache and b/06WPF_Ausnahmen/obj/Debug/06WPF_Ausnahmen.csprojAssemblyReference.cache differ diff --git a/06WPF_Ausnahmen/obj/Debug/06WPF_Ausnahmen.exe b/06WPF_Ausnahmen/obj/Debug/06WPF_Ausnahmen.exe index 390848ce56e5cc3e5b61f84037715b377512bf5a..d8b14e281f511700e503cdfab14d66c1181e5bb4 100644 Binary files a/06WPF_Ausnahmen/obj/Debug/06WPF_Ausnahmen.exe and b/06WPF_Ausnahmen/obj/Debug/06WPF_Ausnahmen.exe differ diff --git a/06WPF_Ausnahmen/obj/Debug/06WPF_Ausnahmen.pdb b/06WPF_Ausnahmen/obj/Debug/06WPF_Ausnahmen.pdb index d3a79a8c2ec0b2b224c70a8725f89267bee2c68b..f3204050def129a76ba380cdd5871fb7ed5c0e71 100644 Binary files a/06WPF_Ausnahmen/obj/Debug/06WPF_Ausnahmen.pdb and b/06WPF_Ausnahmen/obj/Debug/06WPF_Ausnahmen.pdb differ