Skip to main content
Code Review

Return to Question

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

GetBootstrap v1.0.0.2 a console customizer update from this this

GetBootstrap v1.0.0.2 a console customizer update from this

GetBootstrap v1.0.0.2 a console customizer update from this

Change the title
Link

Console Application Customizer v1.0.0.2

Source Link

Console Application Customizer

GetBootstrap v1.0.0.2 a console customizer update from this

Please give me tips, request and suggestion for my future updates. (I update every 2 weeks)

Sample Preview enter image description here

The following code contains the Write(), WriteLine() and Typewriter effect of the console.

using System;
using System.Linq;
using System.Threading.Tasks;
namespace GetBootstrap.Styles
{
 /// <summary>
 /// Project: Console-Bootstrap v1.0.0.2 Beta
 /// Description: Use to provide a customize console application. 
 /// Developer: Leonel Sarmiento
 /// Contact: [email protected]
 /// </summary>
 public static class Bootstrap 
 {
 public static void Write(string value, BootstrapType bootstrapType, BootstrapStyle bootstrapStyle)
 {
 Styler.SetStyle(bootstrapType, bootstrapStyle);
 Console.Write(value);
 Console.ResetColor();
 }
 public static void Write(string value, BootstrapType bootstrapType, BootstrapStyle bootstrapStyle, int minDelay, int maxDelay)
 {
 Styler.SetStyle(bootstrapType, bootstrapStyle);
 Typewriter.Write(value, minDelay, maxDelay);
 Console.ResetColor();
 }
 public static void Write(string format, BootstrapType bootstrapType, BootstrapStyle bootstrapStyle, params object[] arg)
 {
 Styler.SetStyle(bootstrapType, bootstrapStyle);
 Console.Write(format, arg);
 Console.ResetColor();
 }
 public static void Write(string format, BootstrapType bootstrapType, BootstrapStyle bootstrapStyle, int minDelay, int maxDelay, params object[] arg)
 {
 Styler.SetStyle(bootstrapType, bootstrapStyle);
 Typewriter.Write(string.Format(format,arg), minDelay, maxDelay);
 Console.ResetColor();
 }
 public static void WriteLine(string value, BootstrapType bootstrapType, BootstrapStyle bootstrapStyle)
 {
 Write(value, bootstrapType, bootstrapStyle);
 Console.WriteLine("");
 }
 public static void WriteLine(string value, BootstrapType bootstrapType, BootstrapStyle bootstrapStyle, int minDelay, int maxDelay)
 {
 Write(value, bootstrapType, bootstrapStyle, minDelay, maxDelay);
 Console.WriteLine("");
 }
 public static void WriteLine(string format, BootstrapType bootstrapType, BootstrapStyle bootstrapStyle, params object[] arg)
 {
 Write(format, bootstrapType, bootstrapStyle, arg);
 Console.WriteLine("");
 }
 public static void WriteLine(string format, BootstrapType bootstrapType, BootstrapStyle bootstrapStyle, int minDelay, int maxDelay, params object[] arg)
 {
 Write(format, bootstrapType, bootstrapStyle, minDelay, maxDelay, arg);
 Console.WriteLine("");
 }
 }
 public static class Typewriter
 {
 public static void Write(string value, int minDelay, int maxDelay)
 {
 Random random = new Random();
 for (int c = 0; c < value.Count(); c++)
 {
 System.Threading.Thread.Sleep(random.Next(minDelay, maxDelay));
 Console.Write(value.Substring(c,1));
 }
 }
 public static void WriteLine(string value, int minDelay, int maxDelay)
 {
 Random random = new Random();
 for (int c = 0; c < value.Count(); c++)
 {
 System.Threading.Thread.Sleep(random.Next(minDelay, maxDelay));
 if (c != value.Count() - 1)
 {
 Console.Write(value.Substring(c, 1));
 }
 else
 {
 Console.WriteLine(value.Substring(c, 1));
 }
 }
 }
 }
 public static class Styler
 {
 public static void SetStyle(BootstrapType bootstrapType, BootstrapStyle bootstrapStyle)
 {
 switch (bootstrapType)
 {
 case BootstrapType.Success:
 if (bootstrapStyle == BootstrapStyle.Alert)
 {
 Console.ForegroundColor = ConsoleColor.Green;
 Console.BackgroundColor = ConsoleColor.DarkGreen;
 }
 else
 {
 Console.ForegroundColor = ConsoleColor.Green;
 }
 break;
 case BootstrapType.Info:
 if (bootstrapStyle == BootstrapStyle.Alert)
 {
 Console.ForegroundColor = ConsoleColor.Cyan;
 Console.BackgroundColor = ConsoleColor.DarkCyan;
 }
 else
 {
 Console.ForegroundColor = ConsoleColor.Cyan;
 }
 break;
 case BootstrapType.Warning:
 if (bootstrapStyle == BootstrapStyle.Alert)
 {
 Console.ForegroundColor = ConsoleColor.Yellow;
 Console.BackgroundColor = ConsoleColor.DarkYellow;
 }
 else
 {
 Console.ForegroundColor = ConsoleColor.Yellow;
 }
 break;
 case BootstrapType.Danger:
 if (bootstrapStyle == BootstrapStyle.Alert)
 {
 Console.ForegroundColor = ConsoleColor.Red;
 Console.BackgroundColor = ConsoleColor.DarkRed;
 }
 else
 {
 Console.ForegroundColor = ConsoleColor.Red;
 }
 break;
 default:
 if (bootstrapStyle == BootstrapStyle.Alert)
 {
 Console.ForegroundColor = ConsoleColor.Gray;
 Console.BackgroundColor = ConsoleColor.DarkGray;
 }
 else
 {
 Console.ForegroundColor = ConsoleColor.Gray;
 }
 break;
 }
 }
 }
 public enum BootstrapStyle
 {
 None = 0,
 Alert = 1
 }
 public enum BootstrapType
 {
 Default = 0,
 Success = 1,
 Info = 2,
 Warning = 3,
 Danger = 4
 }
}
lang-cs

AltStyle によって変換されたページ (->オリジナル) /