// Spludlow Software // Copyright © Samuel P. Ludlow 2020 All Rights Reserved // Distributed under the terms of the GNU General Public License version 3 // Distributed WITHOUT ANY WARRANTY; without implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE // https://www.spludlow.co.uk/LICENCE.TXT // The Spludlow logo is a registered trademark of Samuel P. Ludlow and may not be used without permission // v1.14 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data; namespace Spludlow { [Flags] public enum CallFlags { None = 0x00000000, InProcess = 0x00000001, NonPersistent = 0x00000002, RemoveError = 0x00000004, // RE N/I - If Queued method fails delete it and continue running DontDuplicate = 0x00000008, QueueDirect = 0x00000010, // QD N/I Route to remote queue through Web Service, don't drop to local routing queue first. Drops to local queses as normal. May loose message if remote network not reachable QueueWeb = 0x00000020, // QW N/I - MSMQ not local so route to web service first always LargeParameters = 0x00000040, LargeResult = 0x00000080, StoreParameters = 0x00000100, StoreResult = 0x00000200, ConstructorIndex = 0x00000400, CheckTarget = 0x00000800, // CT N/I - need? Check using a Web Service call first if method is available on host ??? TraceRoute = 0x00001000, // TR semi N/I - Appends routing information to the CallSet at each route ReportResult = 0x00002000, EmailResult = 0x00004000, DumpResult = 0x00008000, // DR N/i? Result is dumped to current directory (DataSet or tables dumped as text tables) IgnoreResult = 0x00010000, } public class CallFlag { public static Dictionary Abbreviations; static CallFlag() { Abbreviations = new Dictionary(); foreach (string fullName in Enum.GetNames(typeof(CallFlags))) { string abbreviation = ""; foreach (char ch in fullName) { if (Char.IsUpper(ch) == true) abbreviation += ch; if (fullName == "None") abbreviation += "O"; if (abbreviation.Length == 2) { Abbreviations.Add(abbreviation, (CallFlags)Enum.Parse(typeof(CallFlags), fullName)); break; } } } } public static CallFlags Parse(string text) { CallFlags result = CallFlags.None; if (text == null || text.Length == 0) return result; return Parse(Spludlow.Text.Split(text, '|')); } public static CallFlags Parse(string[] texts) { CallFlags result = CallFlags.None; if (texts == null || texts.Length == 0) return result; foreach (string word in texts) { if (word.Length == 0) continue; if (word.Length == 2) result = result | Abbreviations[word]; else result = result | (CallFlags)Enum.Parse(typeof(CallFlags), word); } return result; } public static DataTable List() { DataTable table = Spludlow.Data.TextTable.ReadText(new string[] { "Abbreviation Call Flag", "String* String", }); foreach (string key in Abbreviations.Keys) table.Rows.Add(new object[] { key, Abbreviations[key].ToString() }); return table; } } }