public static void WriteCommandInfo(this string combotype, string text) { var names = Enum.GetNames(typeof(Command)).ToList(); var vals = text.Split(','); List <string> Lines = new List <string>(); Lines.Add("Datatype Command"); Lines.Add(DateTime.Now.ToString("yyyyMMddhhmmss")); Lines.Add(vals[0]); var val = int.TryParse(vals[1], out int x) ? vals[1] : Enum.GetNames(typeof(Command)).Contains(vals[1]) ? Enum.GetNames(typeof(Command)).ToList().IndexOf(vals[1]).ToString() : "0"; if (val != null) { Lines.Add(val); var ID = Guid.NewGuid().ToString(); if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } string subfolder = folder + "\\Command"; if (!Directory.Exists(subfolder)) { Directory.CreateDirectory(subfolder); } string fn = subfolder + "\\" + ID + ".txt"; File.WriteAllLines(fn, Lines); CmdNetwork.Propogate(CMDLibrary.WriteNull); } }