public void InitLogging(OutMode outMode = OutMode.OutConsole, string filePath = "") { _outMode = outMode; InstantiateStreamWriter(filePath); WriteLine("START logging configured for {0} ...", _outMode); _IsInitialized = true; }
/// <summary> /// Returns tag instance of <see cref="string"/> /// </summary> /// <param name="tag">The <see cref="TextTag"/> </param> /// <param name="mode">The <see cref="OutMode"/></param> /// <returns></returns> public static string ToString(this TextTag tag, OutMode mode) { switch (mode) { case OutMode.Auto: if ((tag.Previous == null || !tag.Previous.Out) && !string.IsNullOrEmpty(tag.Text)) { if (tag.Text.Length > 1 && tag.Text[0] == '\r' && tag.Text[1] == '\n') { return(tag.Text.Substring(2)); } if (tag.Text.Length > 0 && tag.Text[0] == '\n') { return(tag.Text.Substring(1)); } } return(tag.Text); case OutMode.StripWhiteSpace: return(tag.Text?.Trim()); default: return(tag.Text); } }
static void Main(string[] args) { if (Environment.GetCommandLineArgs().Contains <string>("/json")) { outModeStrean = OutMode.JSON; } if (Environment.GetCommandLineArgs().Contains <string>("/csv")) { outModeStrean = OutMode.CSV; } switch (outModeStrean) { case OutMode.TEXT: { Console.WriteLine("{0} v.{1}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() ); Console.WriteLine("Find VeraCrypt mounts and drive letters.\nVeraCrypt must be installed. Use /x for extended info, /json for json output, /csv for comma seperated values\n"); break; } case OutMode.JSON: { Console.WriteLine("{{\n\t\"version\": \"{0}\",\n\t\"mounts\": [", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() ); break; } case OutMode.CSV: { break; } } if (Environment.GetCommandLineArgs().Contains <string>("/x")) { GetMounts().Wait(); } else { GetMountsSimple().Wait(); } if (outModeStrean == OutMode.TEXT) { Console.WriteLine("\n"); } else if (outModeStrean == OutMode.JSON) { Console.WriteLine("\t]\n}"); } }
public static string ToString(OutMode outMode) { switch (outMode) { case OutMode.DoubleOut: return "Double Out"; case OutMode.MasterOut: return "Master Out"; case OutMode.StraightOut: return "Straight Out"; default: return "Straight Out"; } }