diff --git a/Program.cs b/Program.cs index 9f0dbe7..36e0b70 100644 --- a/Program.cs +++ b/Program.cs @@ -2,56 +2,72 @@ class Program { static void Main(string[] args) { - - - string[][] userEnteredValues = new string[][] - { + string[][] userEnteredValues = new string[][] + { new string[] { "1", "2", "3"}, new string[] { "1", "two", "3"}, new string[] { "0", "1", "2"} - }; + }; - string overallStatusMessage = ""; + //string overallStatusMessage = ""; - overallStatusMessage = Workflow1(userEnteredValues); + //overallStatusMessage = Workflow1(userEnteredValues); - if (overallStatusMessage == "operating procedure complete") { - Console.WriteLine("'Workflow1' completed successfully."); + try { + Workflow1(userEnteredValues); } - else { + catch (DivideByZeroException e) { Console.WriteLine("An error occurred during 'Workflow1'."); - Console.WriteLine(overallStatusMessage); + Console.WriteLine(e.Message); + Console.WriteLine(); } - static string Workflow1(string[][] userEnteredValues) { - string operationStatusMessage = "good"; - string processStatusMessage = ""; + //if (overallStatusMessage == "operating procedure complete") { + // Console.WriteLine("'Workflow1' completed successfully."); + //} + //else { + // Console.WriteLine("An error occurred during 'Workflow1'."); + // Console.WriteLine(overallStatusMessage); + //} + + static void Workflow1(string[][] userEnteredValues) { + //string operationStatusMessage = "good"; + //string processStatusMessage = ""; foreach (string[] userEntries in userEnteredValues) { - processStatusMessage = Process1(userEntries); - - if (processStatusMessage == "process complete") { + //processStatusMessage = Process1(userEntries); + try { + Process1(userEntries); Console.WriteLine("'Process1' completed successfully."); Console.WriteLine(); } - else { + //if (processStatusMessage == "process complete") { + // Console.WriteLine("'Process1' completed successfully."); + // Console.WriteLine(); + //} + catch (FormatException e) { Console.WriteLine("'Process1' encountered an issue, process aborted."); - Console.WriteLine(processStatusMessage); + Console.WriteLine(e.Message); Console.WriteLine(); - operationStatusMessage = processStatusMessage; } + //else { + // Console.WriteLine("'Process1' encountered an issue, process aborted."); + // Console.WriteLine(processStatusMessage); + // Console.WriteLine(); + // operationStatusMessage = processStatusMessage; + //} } - if (operationStatusMessage == "good") { - operationStatusMessage = "operating procedure complete"; - } + //if (operationStatusMessage == "good") { + // operationStatusMessage = "operating procedure complete"; + //} - return operationStatusMessage; + //return operationStatusMessage; } - static string Process1(String[] userEntries) { - string processStatus = "clean"; - string returnMessage = ""; + static void Process1(String[] userEntries) { + //string processStatus = "clean"; + //string returnMessage = ""; int valueEntered; foreach (string userValue in userEntries) { @@ -64,21 +80,23 @@ class Program { } } else { - returnMessage = "Invalid data. User input values must be non-zero values."; - processStatus = "error"; + //returnMessage = "Invalid data. User input values must be non-zero values."; + throw new DivideByZeroException("Invalid data. User input values must be non-zero values."); + //processStatus = "error"; } } else { - returnMessage = "Invalid data. User input values must be valid integers."; - processStatus = "error"; + //returnMessage = "Invalid data. User input values must be valid integers."; + throw new FormatException("Invalid data. User input values must be valid integers."); + //processStatus = "error"; } } - if (processStatus == "clean") { - returnMessage = "process complete"; - } + //if (processStatus == "clean") { + // returnMessage = "process complete"; + //} - return returnMessage; + //return returnMessage; } } } diff --git a/bin/Debug/net9.0/es_microsoft.dll b/bin/Debug/net9.0/es_microsoft.dll index ccd810d..bb9604a 100644 Binary files a/bin/Debug/net9.0/es_microsoft.dll and b/bin/Debug/net9.0/es_microsoft.dll differ diff --git a/bin/Debug/net9.0/es_microsoft.pdb b/bin/Debug/net9.0/es_microsoft.pdb index 5b08c3b..0259220 100644 Binary files a/bin/Debug/net9.0/es_microsoft.pdb and b/bin/Debug/net9.0/es_microsoft.pdb differ diff --git a/obj/Debug/net9.0/es_microsoft.AssemblyInfo.cs b/obj/Debug/net9.0/es_microsoft.AssemblyInfo.cs index f149490..0a6d691 100644 --- a/obj/Debug/net9.0/es_microsoft.AssemblyInfo.cs +++ b/obj/Debug/net9.0/es_microsoft.AssemblyInfo.cs @@ -13,10 +13,10 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("es_microsoft")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f7de842578b3a781c70401e9cda7d4a76775c93f")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+edf9e69a0ce18bcf901ab061a8edcf43c82db844")] [assembly: System.Reflection.AssemblyProductAttribute("es_microsoft")] [assembly: System.Reflection.AssemblyTitleAttribute("es_microsoft")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] -// Generated by the MSBuild WriteCodeFragment class. +// Generato dalla classe WriteCodeFragment di MSBuild. diff --git a/obj/Debug/net9.0/es_microsoft.AssemblyInfoInputs.cache b/obj/Debug/net9.0/es_microsoft.AssemblyInfoInputs.cache index f8712db..a53596f 100644 --- a/obj/Debug/net9.0/es_microsoft.AssemblyInfoInputs.cache +++ b/obj/Debug/net9.0/es_microsoft.AssemblyInfoInputs.cache @@ -1 +1 @@ -56ed7301782671e005aca5beb135364494d106475fc78ab1890b2ca1c798aa82 +48c28f31449a3787660df4ade160598cddc1e8aa7552882538a2c0ab6772a2ee diff --git a/obj/Debug/net9.0/es_microsoft.dll b/obj/Debug/net9.0/es_microsoft.dll index ccd810d..bb9604a 100644 Binary files a/obj/Debug/net9.0/es_microsoft.dll and b/obj/Debug/net9.0/es_microsoft.dll differ diff --git a/obj/Debug/net9.0/es_microsoft.pdb b/obj/Debug/net9.0/es_microsoft.pdb index 5b08c3b..0259220 100644 Binary files a/obj/Debug/net9.0/es_microsoft.pdb and b/obj/Debug/net9.0/es_microsoft.pdb differ diff --git a/obj/Debug/net9.0/ref/es_microsoft.dll b/obj/Debug/net9.0/ref/es_microsoft.dll index ccd8df6..11cd863 100644 Binary files a/obj/Debug/net9.0/ref/es_microsoft.dll and b/obj/Debug/net9.0/ref/es_microsoft.dll differ diff --git a/obj/Debug/net9.0/refint/es_microsoft.dll b/obj/Debug/net9.0/refint/es_microsoft.dll index ccd8df6..11cd863 100644 Binary files a/obj/Debug/net9.0/refint/es_microsoft.dll and b/obj/Debug/net9.0/refint/es_microsoft.dll differ