From: Michael Wagner Date: Wed, 11 Oct 2023 13:11:14 +0000 (+0200) Subject: Squashed commit of the following: X-Git-Tag: mdoku_0.3-0~3 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=bc02e26749d7b41fa7095c626d35694a9651fe3f;p=mDoc.git Squashed commit of the following: commit 5968bc04a73fc57ddea666df2fd30fd7228645cc Author: Michael Wagner Date: Wed Oct 11 15:07:49 2023 +0200 csharp-s6g --- diff --git a/csharp/mutil/MessageTool.cs b/csharp/mutil/MessageTool.cs new file mode 100644 index 0000000..d4fa406 --- /dev/null +++ b/csharp/mutil/MessageTool.cs @@ -0,0 +1,32 @@ +using System; + +namespace mutil { + +public interface MessageToolImpl{ + void send(string message); +} +public class MessageTool : MessageToolImpl { + // strategy pattern + //private messageToolImpl MessageToolImpl = null; + public MessageToolImpl MessageToolImpl {private get; set;} + + public void send(string message) { + if (MessageToolImpl == null) throw new System.Exception("set MessageToolImpl before sending a message."); + MessageToolImpl.send(message); + } + // singleton + static private MessageTool theInstance = null; + + static public MessageTool getInstance() { + if (theInstance == null) theInstance = new MessageTool(); + return theInstance; + } +} + +public class ConsoleMessageTool : MessageToolImpl { + public void send(string message) { + Console.WriteLine(message); + } +} + +} // namespace \ No newline at end of file diff --git a/csharp/mutil/ReturnCode.cs b/csharp/mutil/ReturnCode.cs new file mode 100644 index 0000000..7702231 --- /dev/null +++ b/csharp/mutil/ReturnCode.cs @@ -0,0 +1,21 @@ +using System; + +namespace mutil { + + public class ReturnCode { + public const int OK = 0; + public const int FileNotFound = 1; + + int RC; + public ReturnCode(int RC) { + this.RC = RC; + } + override public string ToString() { + switch (this.RC) { + case OK : return "OK"; + case FileNotFound: return "FileNotFound"; + default: throw new System.Exception("Unknown RC: " + Convert.ToString(this.RC)); + } + } + } +} \ No newline at end of file diff --git a/debian/mdoc-tools.changelog b/debian/mdoc-tools.changelog index 983c899..8393b7e 100644 --- a/debian/mdoc-tools.changelog +++ b/debian/mdoc-tools.changelog @@ -1,7 +1,8 @@ -mdoc (0.2-%BUILD%) unstable; urgency=medium +mdoc (0.2) unstable; urgency=medium * better error messages + * new features in mutil.dll: Configuration -- Michael Wagner Fri, 26 May 2023 16:54:48 +0100 -mdoc (0.1-%BUILD%) unstable; urgency=medium +mdoc (0.1) unstable; urgency=medium * C# port for mmailc -- Michael Wagner Fri, 30 Dec 2022 16:54:48 +0100 diff --git a/debian/mdoc-tools.prebuild b/debian/mdoc-tools.prebuild index a20ea2c..9980f66 100755 --- a/debian/mdoc-tools.prebuild +++ b/debian/mdoc-tools.prebuild @@ -2,7 +2,7 @@ set -e pushd csharp/mDoc >/dev/null - ln -s /usr/share/mbuild/makefile . + ln -sf /usr/share/mbuild/makefile . echo "SOURCES=\\" >> make.pre find . -name "*.cs" -exec echo " "{}" \\" >> make.pre \; echo >> make.pre @@ -10,14 +10,14 @@ pushd csharp/mDoc >/dev/null popd >/dev/null pushd csharp/mutil >/dev/null - ln -s /usr/share/mbuild/makefile . + ln -sf /usr/share/mbuild/makefile . echo "SOURCES=\\" >> make.pre find . -name "*.cs" -exec echo " "{}" \\" >> make.pre \; echo >> make.pre popd >/dev/null pushd csharp/mDocLib >/dev/null - ln -s /usr/share/mbuild/makefile . + ln -sf /usr/share/mbuild/makefile . echo "SOURCES=\\" >> make.pre find . -name "*.cs" -exec echo " "{}" \\" >> make.pre \; echo >> make.pre