Exemple #1
0
 private EscapeSequencer(TextWriter textWriter)
 {
     Instance = this;
     this.textWriter = textWriter;
     defaultForegroundColor = Console.ForegroundColor;
     defaultBackgroundColor = Console.BackgroundColor;
 }
 private static void DrawColoredSpace(ConsoleColor background)
 {
     System.Console.BackgroundColor = background;
     System.Console.ForegroundColor = ConsoleColor.White;
     System.Console.Write(" ");
     System.Console.ResetColor();
 }
Exemple #3
0
 public static void Write(ConsoleColor color, string text, params object[] args)
 {
     ConsoleColor currentColor = Console.ForegroundColor;
     Console.ForegroundColor = color;
     Console.Write(text, args);
     Console.ForegroundColor = currentColor;
 }
        public static void PrintCharOnPos(char ch, int y, int x, ConsoleColor color)
        {
            Console.ForegroundColor = color;

            Console.SetCursorPosition(x, y);
            Console.Write(ch);
        }
 static void Print(ConsoleColor color, string format, params object[] args)
 {
     var old = Console.ForegroundColor;
     Console.ForegroundColor = color;
     Console.WriteLine(format, args);
     Console.ForegroundColor = old;
 }
 private void WriteMessage(string message, ConsoleColor color)
 {
     var oldColor = Console.ForegroundColor;
     Console.ForegroundColor = color;
     Console.WriteLine(message);
     Console.ForegroundColor = oldColor;
 }
Exemple #7
0
 private void Write(string s, ConsoleColor c)
 {
     ConsoleColor temp = Console.ForegroundColor;
     Console.ForegroundColor = c;
     Write(s);
     Console.ForegroundColor = temp;
 }
 public static void WriteLine(ConsoleColor color, String format, params object[] args)
 {
     ConsoleColor tmp = Console.ForegroundColor;
     Console.ForegroundColor = color;
     Console.WriteLine(format, args);
     Console.ForegroundColor = tmp;
 }
Exemple #9
0
 public static void WriteLine(ConsoleColor color, object value)
 {
     var previousColor = Console.ForegroundColor;
     Console.ForegroundColor = color;
     Console.WriteLine(value);
     Console.ForegroundColor = previousColor;
 }
 public static void PrintEncolored(string text, ConsoleColor color, params object[] arguments)
 {
     var clr = Console.ForegroundColor;
     Console.ForegroundColor = color;
     Console.WriteLine(text, arguments);
     Console.ForegroundColor = clr;
 }
Exemple #11
0
 public static void Initialize(ConsoleColor defaultColor = ConsoleColor.Gray)
 {
     switches = new List<List<Switch>>();
     DefaultColor = defaultColor;
     _lock = new object();
     isInitialized = true;
 }
        public IDisposable UseColor(ConsoleColor consoleColor)
        {
            var old = Console.ForegroundColor;
            Console.ForegroundColor = consoleColor;

            return new DelegateDisposable(() => Console.ForegroundColor = old);
        }
 public static void VerboseWriteLine(ConsoleColor color, string output)
 {
     if (WriteVerboseOutput)
     {
         WriteLine(color, output);
     }
 }
 protected override void DoWrite(ConsoleColor white, params string[] s)
 {
     foreach (var message in s)
     {
         Debug.WriteLine(message);
     }
 }
Exemple #15
0
 public static void CPrint(string Text, ConsoleColor Color)
 {
     //Set The Colour Of The Font, Then Set It Back To White
     Console.ForegroundColor = Color;
     Console.Write(Text);
     Console.ForegroundColor = ConsoleColor.White;
 }
        public TerminalWindow()
        {
            _stdbackground = Console.BackgroundColor;
            _stdforeground = Console.ForegroundColor;

            Interfaces = new List<WindowInterface>();
        }
Exemple #17
0
 public static void WriteColor(ConsoleColor ForeGround, string var)
 {
     if (ForegroundColor != ForeGround)
         ForegroundColor = ForeGround;
     WriteLine(var.PadRight(var.Length % WindowWidth, ' '));
     LowerBoundOutput();
 }
Exemple #18
0
        private ConsoleColor? GetColor(ConsoleColor color)
        {
            if (LogManager.UseConsoleColors)
                return color;

            return null;
        }
Exemple #19
0
 private static void Log(object message, ConsoleColor color)
 {
   ConsoleColor current = Console.ForegroundColor;
   Console.ForegroundColor = color;
   Console.WriteLine(message);
   Console.ForegroundColor = current;
 }
		static void ConsoleWriteLine(string message, ConsoleColor foregroundColor)
		{
			var oldForegroundColor = System.Console.ForegroundColor;
			System.Console.ForegroundColor = foregroundColor;
			System.Console.WriteLine(message);
			System.Console.ForegroundColor = oldForegroundColor;
		}
 private static void WriteColorMessage(string message, ConsoleColor messgeColor)
 {
     var color = Console.ForegroundColor;
       Console.ForegroundColor = messgeColor;
       Console.WriteLine(message);
       Console.ForegroundColor = color;
 }
Exemple #22
0
 public static void UseTextColour(ConsoleColor colour, Action action)
 {
     var prevForegroundColor = Console.ForegroundColor;
     Console.ForegroundColor = colour;
     action();
     Console.ForegroundColor = prevForegroundColor;
 }
Exemple #23
0
 private static void Log(string message, ConsoleColor color)
 {
     var keepColor = Console.ForegroundColor;
       Console.ForegroundColor = color;
       Console.WriteLine(message);
       Console.ForegroundColor = keepColor;
 }
Exemple #24
0
 public AbstractHero(Position position)
 {
     this.position = position;
     this.color = Constants.HeroColor;
     this.width = 1;
     this.height = 1;
 }
 static void WriteLine(ConsoleColor color, string text, params object[] args)
 {
     var oldColor = Console.ForegroundColor;
     Console.ForegroundColor = color;
     Console.WriteLine(text, args);
     Console.ForegroundColor = oldColor;
 }
Exemple #26
0
 /// <summary>
 /// Creates progress bar.
 /// </summary>
 /// <param name="name">Name of the widget.</param>
 /// <param name="pos">Position of the progress bar.</param>
 /// <param name="width">Width of the progress bar</param>
 /// <param name="maxValue">Maximum value.</param>
 /// <param name="value">Current value (default: 0).</param>
 /// <param name="fc">Foreground color (default gray).</param>
 /// <param name="bc">Background color (default black).</param>
 public ProgressBar(string name, Position pos, int width, int maxValue, float value = 0.0f,
     ConsoleColor fc = ConsoleColor.Gray, ConsoleColor bc = ConsoleColor.Black)
     : base(name, pos, width, 1, false, fc, bc)
 {
     this.Value = value;
     this.MaxValue = maxValue;
 }
Exemple #27
0
 private void ConsoleWriteLine(string text, ConsoleColor color)
 {
     ConsoleColor before = Console.ForegroundColor;
     Console.ForegroundColor = color;
     Console.WriteLine(text);
     Console.ForegroundColor = before;
 }
 public static void Write(ConsoleColor color, string content)
 {
     Console.ForegroundColor = color;
     BreakIntoLines(content)
         .Each(l=>Console.WriteLine(l));
     Console.ResetColor();
 }
Exemple #29
0
 public static void ColoredConsoleWrite(ConsoleColor color, string text)
 {
     ConsoleColor originalColor = System.Console.ForegroundColor;
     System.Console.ForegroundColor = color;
     System.Console.WriteLine($"[{DateTime.Now.ToString("HH:mm:ss")}] " + text);
     System.Console.ForegroundColor = originalColor;
 }
Exemple #30
0
 public GameObject(int x, int y, string sprite, ConsoleColor color = DefaultColor)
 {
     this.X = x;
     this.Y = y;
     this.Sprite = sprite;
     this.Color = color;
 }
Exemple #31
0
 /// <summary>
 /// Writes colored <paramref name="line"/> to console standard output
 /// </summary>
 /// <param name="line">Line to write to console</param>
 /// <param name="color">Text color to use</param>
 public static void WriteLine(string line, ConsoleColor color)
 {
     WriteLine(Console.Out, line, color);
 }
 /// <summary>
 /// Constructor parametrizado.
 /// </summary>
 /// <param name="marca">Marca de la Suv</param>
 /// <param name="chasis">Chasis de la Suv</param>
 /// <param name="color">Color de la Suv</param>
 public Suv(EMarca marca, string chasis, ConsoleColor color) : base(chasis, marca, color)
 {
 }
Exemple #33
0
 public override void Write(ConsoleColor foregroundColor, ConsoleColor backgroundColor, string value)
 {
 }
Exemple #34
0
 void IWrite.WriteLine(object value, ConsoleColor color) => WriteLine(value, color);
Exemple #35
0
 void IWrite.WriteLine(string text, ConsoleColor color) => WriteLine(text, color);
Exemple #36
0
 public ScriptOutputBlock WriteLine(object value, ConsoleColor color)
 {
     blockOutput.WriteLine(value, color);
     return(this);
 }
Exemple #37
0
 public ScriptOutputBlock WriteLine(string text, ConsoleColor color)
 {
     blockOutput.WriteLine(text, color);
     return(this);
 }
 /// <summary>
 /// Display the prompt in a loop until a valid int is entered at the console
 /// </summary>
 /// <param name="prompt">The prompt to display on the console</param>
 /// <param name="color">The color to display the prompt in</param>
 /// <returns>The int entered at the console</returns>
 public static int GetValidInt(string prompt, ConsoleColor color)
 {
     return(GetValidInt(prompt, int.MinValue, int.MaxValue, color));
 }
Exemple #39
0
        // Main method - Takes input, processes, and provides output.
        static void Main(string[] args)
        {
            // This will be the main method's fully qualified name once it is found. The last step in the C++ code gen is to add the C++ main method which calls this.
            MainPath = "";

            // This ensures the command has admin. There's a helpful command you can call anywhere called cmd4 which autocalls cmd with admin.
            if (!HasAdministratorPrivileges())
            {
                Console.WriteLine("Please only use this command in cmd4! To open cmd4, open cmd and run cmd4, or press win+r and enter cmd4.");
                return;
            }

            // This is a test user's can do to check if C4 was installed, AKA if the app is running, which we know it is.
            if (args.Length >= 1 && args[0] == "detonate")
            {
                ConsoleColor color = Console.ForegroundColor;
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("KABOOM!!! C4 is now installed on your machine!");
                Console.ForegroundColor = color;
            }

            // Give help.
            if (args.Length <= 0 || (args.Length >= 1 &&
                                     args[0].ToLower().StartsWith("help") ||
                                     args[0].StartsWith(@"/?") || args[0].StartsWith(@"\?") || args[0].StartsWith(@"?")))
            {
                Console.WriteLine("Build and run: C4 run filename.C4");
                Console.WriteLine("Build only: C4 build filename.C4");
            }
            else if (args.Length >= 1)
            {
                // Run a C4 source file (Build and run) (TODO)
                if (args[0] == "run")
                {
                    if (args.Length >= 2)
                    {
                        string fn = args[1];
                        //TODO
                        Console.WriteLine("//TODO");
                    }
                    else
                    {
                        ConsoleColor color = Console.ForegroundColor;
                        Console.Write("Build and run: C4 run ");
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.Write("-->");
                        Console.ForegroundColor = color;
                        Console.WriteLine("filename.C4");
                    }
                }
                // Build a C4 source file. (Should eventually build the whole program, using just the main file.)
                if (args[0] == "build")
                {
                    if (args.Length >= 2)
                    {
                        string fn = args[1];
                        if (args.Length >= 3)
                        {
                            // This option only transpiles to C++
                            if (args[2] == "-CPP")
                            {
                                // Read C4 file.
                                string C4_SRC = File.ReadAllText(fn);

                                // This is the code without using C#'s unsafe option. Eventually, there will be a step to convert the methods to unsafe so we can use pointers.
                                string CS_SRC_SAFE = "";

                                // Allow C++ preprocessor directives to be parsed. This allows us to convert them back later. Right now, they are seen as global function statements.
                                foreach (string ln in C4_SRC.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries))
                                {
                                    if (ln.StartsWith(@"#"))
                                    {
                                        CS_SRC_SAFE += "CPP_SPECIAL_CHAR(\"HASH\", " + ToLiteral(ln) + ");" + Environment.NewLine;
                                    }
                                    else
                                    {
                                        CS_SRC_SAFE += ln + Environment.NewLine;
                                    }
                                }

                                // Now the C# can be parsed even if it's invalid, so we get the abstract syntax tree.
                                var AST = CSharpSyntaxTree.ParseText(CS_SRC_SAFE);
                                CSharpSyntaxNode ROOT = (CSharpSyntaxNode)AST.GetRoot();

                                // C++ Code gen
                                string CPP_SRC = "";

                                // Generate actual C++ (debug = false)
                                debug = false;
                                AST2CPP(ROOT, ref CPP_SRC);
                                CPP_SRC += Environment.NewLine + Environment.NewLine +
                                           "int main() {" + Environment.NewLine + MainPath.Replace(".", "::") +
                                           "();" + Environment.NewLine + "}" + Environment.NewLine;
                                File.WriteAllText("output.cpp", CPP_SRC);

                                // Generate AST file for debugging (debug = true)
                                CPP_SRC = "";
                                debug   = true;
                                AST2CPP(ROOT, ref CPP_SRC);
                                File.WriteAllText("output.ast", CPP_SRC);
                            }
                            else
                            {
                                Console.WriteLine("Invalid argument: " + args[2]);
                            }
                        }
                        else
                        {
                            //TODO
                            Console.WriteLine("//TODO");
                        }
                    }
                    else
                    {
                        // Error no filename
                        ConsoleColor color = Console.ForegroundColor;
                        Console.Write("Build and run: C4 build ");
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.Write("-->");
                        Console.ForegroundColor = color;
                        Console.WriteLine("filename.C4");
                    }
                }
            }
        }
 /// <summary>
 /// Out put a message and newline to the console in color.
 /// </summary>
 /// <param name="color">The color to output</param>
 /// <param name="message">The Message to output</param>
 public static void ColorWriteLine(ConsoleColor color, string message)
 {
     ColorWrite(color, $"{message}{ System.Environment.NewLine }");
 }
Exemple #41
0
 public Color(Canvas grid, ConsoleColor color)
     : this(grid, color, (int)color % 10, (int)color > 9)
 {
 }
Exemple #42
0
        private static void ShowCompareResults(List <CompareResultItem> resultsList)
        {
            ConsoleColor currentForegroundColor = Console.ForegroundColor;

            Console.WriteLine("The following differences have been found:\n");
            foreach (CompareResultItem diffItem in resultsList)
            {
                if (diffItem.parentObjectName.Length > 0)
                {
                    // Write Parent property name
                    Console.Write("[{0}] ==> ", diffItem.parentObjectName);
                }

                if (diffItem.itemNameLeft == diffItem.itemNameRight)
                {
                    // Looks like types are different
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.Write("'{0}'", diffItem.itemNameLeft);
                    Console.ForegroundColor = currentForegroundColor;
                    Console.Write(" : ");
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.Write("different types: ");
                    Console.ForegroundColor = currentForegroundColor;
                    Console.Write("'{0}' <-> '{1}'", diffItem.itemTypeLeft, diffItem.itemTypeRight);
                }
                else
                {
                    // item is missed in right schema
                    Console.ForegroundColor = ConsoleColor.Cyan;

                    if (diffItem.itemNameRight.Length == 0)
                    {
                        Console.Write("'{0}'", diffItem.itemNameLeft);
                    }
                    else
                    {
                        Console.Write("'{0}'", diffItem.itemNameRight);
                    }

                    Console.ForegroundColor = currentForegroundColor;
                    if (diffItem.itemNameRight.Length == 0)
                    {
                        Console.Write(" : '{0}' ", diffItem.itemTypeLeft);
                    }
                    else
                    {
                        Console.Write(" : '{0}' ", diffItem.itemTypeRight);
                    }

                    Console.Write("is ");
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.Write("missed ");
                    Console.ForegroundColor = currentForegroundColor;
                    Console.Write("in the ");
                    if (diffItem.itemNameRight.Length == 0)
                    {
                        Console.Write("right ");
                    }
                    else
                    {
                        Console.Write("left ");
                    }
                    Console.Write("file");
                }

                Console.WriteLine();
            }
        }
Exemple #43
0
 internal ColoredConsoleScope(ConsoleColor background, ConsoleColor foreground)
 {
     Console.BackgroundColor = background;
     Console.ForegroundColor = foreground;
 }
Exemple #44
0
 public Vehiculo(string chasis, EMarca marca, ConsoleColor color)
 {
     this.chasis = chasis;
     this.marca  = marca;
     this.color  = color;
 }
Exemple #45
0
 public Producto(string patente, EMarca marca, ConsoleColor color)
 {
     this._marca = marca;
     this._colorPrimarioEmpaque = color;
     this._codigoDeBarras       = patente;
 }
Exemple #46
0
 /// <summary>
 /// Tisk textu do konzole na přesně zadanou pozici vybranou barvou.
 /// </summary>
 /// <param name="TextForPrint">Text který bude tisknut. Musí se do konzole vejít.</param>
 /// <param name="PositionY">Řádek na který se umístí první písmeno.</param>
 /// <param name="PositionX">Sloupec na který se umístí text.</param>
 /// <param name="Color">Barva kterou se text vytiskne.</param>
 public static void TextPrint(char TextForPrint, int PositionY, int PositionX, ConsoleColor Color)
 {
     //ošetření proti tisku mimo povolenou oblast
     if ((1 + PositionX < 90) && (PositionY < 30) && (PositionX > 0) && (PositionY > 0))
     {
         ConsoleColor BackUp = Console.ForegroundColor;
         Console.ForegroundColor = Color;
         Console.SetCursorPosition(PositionX, PositionY);
         Console.Write(TextForPrint);
         Console.ForegroundColor = BackUp;
     }
 }
Exemple #47
0
        static void Main(string[] args)
        {
            try
            {
                Maximize();

                _defaultForegroundColor = Console.ForegroundColor;
                _directoryColor         = ConsoleColor.Green;
                _fileColor   = ConsoleColor.White;
                _deleteColor = ConsoleColor.Red;

                string        executingDirectory = GetExecutingDirectory();
                List <string> directoryFilters   = GetDirectoryFilters();
                List <string> fileFilters        = GetFileFilters();

                Console.WriteLine("*** Visual Studio Artifact Cleaner ***");
                Console.WriteLine();

                Console.WriteLine("Searching for directory names:");
                Console.WriteLine();
                Console.ForegroundColor = _directoryColor;
                directoryFilters.ForEach(p => Console.WriteLine(p));
                List <string> directories = Directory.GetDirectories(executingDirectory, "*", SearchOption.AllDirectories)
                                            .Where(p => directoryFilters.Contains(Path.GetFileName(p))).ToList();
                Console.WriteLine();
                Console.ForegroundColor = _defaultForegroundColor;

                Console.WriteLine("Searching for files with extensions:");
                Console.WriteLine();
                Console.ForegroundColor = _fileColor;
                fileFilters.ForEach(p => Console.WriteLine(p));
                List <string> files = Directory.GetFiles(executingDirectory, "*.*", SearchOption.AllDirectories)
                                      .Where(p => fileFilters.Contains(Path.GetExtension(p))).ToList();
                Console.WriteLine();
                Console.ForegroundColor = _defaultForegroundColor;

                Console.WriteLine("Directories to be deleted:");
                Console.WriteLine();
                Console.ForegroundColor = _directoryColor;
                directories.ForEach(p => Console.WriteLine(p));
                Console.WriteLine();
                Console.ForegroundColor = _defaultForegroundColor;

                Console.WriteLine("Files to be deleted:");
                Console.WriteLine();
                Console.ForegroundColor = _fileColor;
                files.ForEach(p => Console.WriteLine(p));
                Console.WriteLine();
                Console.ForegroundColor = _defaultForegroundColor;

                if (directories.Count == 0 && files.Count == 0)
                {
                    Console.WriteLine("No files or directories to be deleted.");
                    Console.WriteLine("Press any key to continue ...");
                    Console.ReadLine();
                    return;
                }

                Console.Write("Delete directories and files? (Y/N)  ");
                string response = Console.ReadLine();
                if (response.ToLower() != "y")
                {
                    Console.WriteLine("Operation canceled.");
                    Console.WriteLine("Press any key to continue ...");
                    Console.ReadLine();
                    return;
                }
                Console.WriteLine();
                directories.ForEach(p => DeleteDirectoryRecursive(new DirectoryInfo(p)));
                files.ForEach(p => DeleteFileForce(new FileInfo(p)));
                Console.ForegroundColor = _defaultForegroundColor;
                Console.WriteLine();
                Console.WriteLine("Successfully deleted all files.");
                Console.WriteLine("Press any key to continue ...");
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
            }
        }
Exemple #48
0
 private static void WriteLine(string text, ConsoleColor color)
 {
     cons.ForegroundColor = color;
     cons.WriteLine(text);
     cons.ResetColor();
 }
 public static void ColorWriteLines(string text, ConsoleColor color)
 {
     Console.ForegroundColor = color;
     Console.WriteLine(text);
     Console.ResetColor();
 }
Exemple #50
0
 /// <summary>
 /// 直接在控制台打印内容
 /// </summary>
 /// <param name="message"></param>
 /// <param name="color"></param>
 public static void Console(String message, ConsoleColor color = ConsoleColor.White)
 {
     System.Console.ForegroundColor = color;
     System.Console.Write(" => " + message + "\n");
     System.Console.ForegroundColor = ConsoleColor.White;
 }
Exemple #51
0
 public static void UpdateCheck(bool wait = false, Player p = null)
 {
     CurrentUpdate = true;
     Thread updateThread = new Thread(new ThreadStart(delegate
     {
         using (WebClient Client = new WebClient())
         {
             if (wait)
             {
                 if (!Server.checkUpdates)
                 {
                     return;
                 }
                 Thread.Sleep(10000);
             }
             try
             {
                 Server.DownloadBeta = true; //forced beta use (beta is the only thing being released right now)
                 string raw          = Client.DownloadString(Program.CurrentVersionFile);
                 if (raw.EndsWith("b") && !Server.DownloadBeta)
                 {
                     Player.SendMessage(p, "Beta version found!");
                     Player.SendMessage(p, "But server set to use release build!");
                     return;
                 }
                 else if (raw.EndsWith("b") && Server.DownloadBeta)
                 {
                     raw = raw.Substring(0, raw.Length - 1);
                 }
                 Version availableUpdateVersion = new Version(raw);
                 if (availableUpdateVersion > Server.Version || availableUpdateVersion > AssemblyName.GetAssemblyName(parent).Version)
                 {
                     if (Server.autoupdate == true || p != null)
                     {
                         if (Server.autonotify == true || p != null)
                         {
                             //if (p != null) Server.restartcountdown = "20";  This is set by the user.  Why change it?
                             Player.GlobalMessage("Update found. Prepare for restart in &f" + Server.restartcountdown + Server.DefaultColor + " seconds.");
                             Server.s.Log("Update found. Prepare for restart in " + Server.restartcountdown + " seconds.");
                             double nxtTime                = Convert.ToDouble(Server.restartcountdown);
                             DateTime nextupdate           = DateTime.Now.AddMinutes(nxtTime);
                             int timeLeft                  = Convert.ToInt32(Server.restartcountdown);
                             System.Timers.Timer countDown = new System.Timers.Timer();
                             countDown.Interval            = 1000;
                             countDown.Start();
                             countDown.Elapsed += delegate
                             {
                                 if (Server.autoupdate == true || p != null)
                                 {
                                     Player.GlobalMessage("Updating in &f" + timeLeft + Server.DefaultColor + " seconds.");
                                     Server.s.Log("Updating in " + timeLeft + " seconds.");
                                     timeLeft = timeLeft - 1;
                                     if (timeLeft < 0)
                                     {
                                         Player.GlobalMessage("---UPDATING SERVER---");
                                         Server.s.Log("---UPDATING SERVER---");
                                         countDown.Stop();
                                         countDown.Dispose();
                                         PerformUpdate();
                                     }
                                 }
                                 else
                                 {
                                     Player.GlobalMessage("Stopping auto restart.");
                                     Server.s.Log("Stopping auto restart.");
                                     countDown.Stop();
                                     countDown.Dispose();
                                 }
                             };
                         }
                         else
                         {
                             PerformUpdate();
                         }
                     }
                     else
                     {
                         if (!msgOpen && !usingConsole)
                         {
                             if (Server.autonotify)
                             {
                                 msgOpen = true;
                                 if (MessageBox.Show("New version found. Would you like to update?", "Update?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                                 {
                                     PerformUpdate();
                                 }
                                 msgOpen = false;
                             }
                         }
                         else
                         {
                             ConsoleColor prevColor  = Console.ForegroundColor;
                             Console.ForegroundColor = ConsoleColor.Red;
                             Console.WriteLine("An update was found!");
                             Console.WriteLine("Update using the file at " + DLLLocation + " and placing it over the top of your current SinCraft_.dll!");
                             Console.WriteLine("Also update using the file at " + EXELocation + " and placing it over the top of your current SinCraft.exe");
                             Console.ForegroundColor = prevColor;
                         }
                     }
                 }
                 else
                 {
                     Player.SendMessage(p, "No update found!");
                 }
             }
             catch { try { Server.s.Log("No web server found to update on."); } catch { } }
             Client.Dispose();
         }
         CurrentUpdate = false;
     })); updateThread.Start();
 }
Exemple #52
0
 static void WriteLine(string text, ConsoleColor color)
 {
     Console.ForegroundColor = color;
     Console.WriteLine(text);
 }
Exemple #53
0
 public ColorBlock(ConsoleColor foreground)
 {
     _previousColor = Console.ForegroundColor;
     Console.ForegroundColor = foreground;
 }
 public static void InputError(string text, ConsoleColor color)
 {
     Console.Beep();
     ColorWriteLines(text, color);
 }
Exemple #55
0
 public Boligrafo(int unidades, ConsoleColor color)
 {
     this.tinta      = unidades;
     this.colorTinta = color;
 }
Exemple #56
0
 public static IDisposable BeginColorBlock(ConsoleColor color)
 {
     return new ColorBlock(color);
 }
Exemple #57
0
 static public void SetColor(ConsoleColor foregroundColor)
 {
     Console.ForegroundColor = foregroundColor;
 }
 public static void DisplayMessage(string message, ConsoleColor color = ConsoleColor.White)
 {
     Console.ForegroundColor = color;
     Console.WriteLine(message);
     Console.ResetColor();
 }
Exemple #59
0
 static public void write(int x, int y, char sign, ConsoleColor c = ConsoleColor.White) // in position x and y print sign with color c
 {
     Console.ForegroundColor = c;
     Console.SetCursorPosition(x, y);
     Console.Write(sign);
 }
Exemple #60
0
 static public void SetColor(ConsoleColor foregroundColor, ConsoleColor backgroundColor)
 {
     Console.ForegroundColor = foregroundColor;
     Console.BackgroundColor = backgroundColor;
 }