public static IIocWrapper Bootstrap(BootstrapType type) { var container = new Container(); container.Configure(cfg => cfg.For <IIocWrapper>().Use(IocWrapper.Instance)); switch (type) { case BootstrapType.Web: ConfigureWebRegistries(container); break; case BootstrapType.Api: ConfigureApiRegistries(container); break; case BootstrapType.IntegrationTest: ConfigureIntegrationTestRegistries(container); break; } IocWrapper.Instance = new IocWrapper(container); return(IocWrapper.Instance); }
internal static BootstrapType ConsoleWriter(string format, BootstrapType type, BootstrapStyle style, bool fillLineBackground) { Customize.SetBufferAppearance(BootstrapTheme, type, style, fillLineBackground); char[] chars = format.ToCharArray(); lock (Threads) { Console.Write(chars); Console.ResetColor(); } return(type); }
internal new static BootstrapType ConsoleWriter(string format, BootstrapType type, BootstrapStyle style, bool fillLineBackground) { Customize.SetBufferAppearance(BootstrapTheme, type, style, fillLineBackground); char[] chars = format.ToCharArray(); lock (Threads) { for (int i = 0; i < chars.Length; i++) { Console.Write(chars[i]); Thread.Sleep(_random.Next(_minDelay, _maxDelay)); } Console.ResetColor(); } return(type); }
static void Writer(string format, BootstrapType type = BootstrapType.Default, BootsrapStyle style = BootsrapStyle.Text, bool fill = false, bool beep = false) { Bootstrap.PerformBeep(beep); Bootstrap.SetConsoleAppearance(Bootstrap.Theme, type, style); Bootstrap.FillLine(fill); char[] chars = format.ToCharArray(); lock (Bootstrap._threads) { for (int i = 0; i < chars.Length; i++) { Thread.Sleep(_random.Next(_minDelay, _maxDelay)); Console.Write(chars[i]); } } Console.ResetColor(); }
internal static void SetBufferAppearance(BootstrapTheme theme, BootstrapType type, BootstrapStyle style, bool fillLineBackground) { lock (Bootstrap.Threads) { string descTheme = EnumExtension.GetDescription(theme); string descType = EnumExtension.GetDescription(type); string fgColor = (theme != BootstrapTheme.LigthColor ? descType : $"Dark{descType}"); string bgColor = (theme != BootstrapTheme.LigthColor ? $"Dark{descType}" : descType); if (style == BootstrapStyle.Text) { fgColor = (theme != BootstrapTheme.LigthColor ? $"Dark{descType}" : descType); } Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), fgColor, true); Console.BackgroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), (style != BootstrapStyle.Text ? bgColor : "Black"), true); } FillLineBackground(fillLineBackground); }
private static void WriteLog(BootstrapType type, string format) { if (_logger == null) { return; } switch (type) { case BootstrapType.Success: _logger.Pass(format); break; case BootstrapType.Info: _logger.Info(format); break; case BootstrapType.Warning: _logger.Warn(format); break; case BootstrapType.Danger: _logger.Fatal(format); break; case BootstrapType.Magenta: _logger.Magenta(format); break; case BootstrapType.Cobalt: _logger.Cobalt(format); break; case BootstrapType.Default: default: _logger.Debug(format); break; } }
private static void Writer(string format, BootstrapType type = BootstrapType.Default, BootsrapStyle style = BootsrapStyle.Text, bool fill = false, bool beep = false) { PerformBeep(beep); SetConsoleAppearance(Theme, type, style); FillLine(fill); char[] chars = format.ToCharArray(); lock (_threads) { WriteLog(type, format); for (int i = 0; i < chars.Length; i++) { Console.Write(chars[i]); } } Console.ResetColor(); }
public static void WriteLine(string format = "", BootstrapType type = BootstrapType.Default, BootstrapStyle style = BootstrapStyle.Text, bool fillLineBackground = false) { ConsoleWriter(format, type, style, fillLineBackground); Console.WriteLine(); }
public static void WriteLine(string format, BootstrapType type = BootstrapType.Default, BootsrapStyle style = BootsrapStyle.Text, bool fill = false, bool beep = false) { Writer(format, type, style, fill, beep); Console.WriteLine(); }
public BootstrapType Log(string format, BootstrapType type) { _loggerXmlFile.XmlWrite(DateTime.Now, EnumExtension.GetDescription(type), format); return(type); }
internal static void SetConsoleAppearance(BootstrapTheme theme = BootstrapTheme.LigthColor, BootstrapType type = BootstrapType.Default, BootsrapStyle style = BootsrapStyle.Text) { string descTheme = GetDescription(theme); string descType = GetDescription(type); string fgColor = (theme != BootstrapTheme.LigthColor ? descType : $"Dark{descType}"); string bgColor = (theme != BootstrapTheme.LigthColor ? $"Dark{descType}" : descType); if (style == BootsrapStyle.Text) { fgColor = (theme != BootstrapTheme.LigthColor ? $"Dark{descType}" : descType); } Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), fgColor, true); Console.BackgroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), (style != BootsrapStyle.Text ? bgColor : "Black"), true); }