public static string Combine(string folder, string format, params object[] args) { var relative = TextTools.Format(format, args); var root = Path.GetFullPath(folder); return(Path.GetFullPath(Path.Combine(root, relative))); }
public void WriteLine(string format, params object[] args) { var text = TextTools.Format(format, args); foreach (var writer in writers) { try { writer.WriteLine(text); } catch (Exception) { /* IGNORE */ } } }
public void WriteLine(string format, params object[] args) { var text = TextTools.Format(format, args); lock (write) { Console.Error.Write(text); Console.Error.Write(Environ.NewLine); Console.Error.Flush(); } }
public static void SetStatus(string format, params object[] args) { var text = TextTools.Format(format, args); lock (write) { Console.Out.Write(text); Console.Out.Write(Environ.NewLine); Console.Out.Flush(); } Logger.Trace(text); }
public static void Trace(string format, params object[] args) { if (TRACE != null) { var pid = Process.GetCurrentProcess().Id; var text = TextTools.Format(format, args); var thread = Thread.CurrentThread; TRACE.WriteLine("TRACE Pid:{0} Thread:{1}:{2} {3}" , pid , thread.ManagedThreadId , thread.Name , text ); } }
private void Log(string format, params object[] args) { var writer = Logger.TRACE; if (writer != null) { var text = TextTools.Format(format, args); var thread = Thread.CurrentThread; writer.WriteLine("Thread:{0}:{1} Disposable:{2}:{3} DC:{4} {5}" , thread.ManagedThreadId , thread.Name , GetType() , GetHashCode() , Undisposed , text ); } }
public static void SetProperty(object target, string line) { var parts = line.Split(new char[] { '=' }); if (parts.Length != 2) { throw ExceptionTools.Make("Expected 2 parts in {0}", TextTools.Readable(line)); } var propertyName = parts[0]; var propertyValue = parts[1]; var property = target.GetType().GetProperty(propertyName); if (property == null) { throw ExceptionTools.Make("Property not found {0}", TextTools.Readable(propertyName)); } var value = Convert.ChangeType(propertyValue, property.PropertyType); property.SetValue(target, value, null); }
public static string Relative(string format, params object[] args) { var child = TextTools.Format(format, args); return(Path.Combine(Directory(), child)); }
public static Exception Make(string format, params object[] args) { return(new Exception(TextTools.Format(format, args))); }