Write() public static méthode

public static Write ( bool value ) : void
value bool
Résultat void
Exemple #1
0
using S = System.Console; class A { static void Main()
                                    {
                                        for (int d = 1, c;; d = c > 83?1:++d % 51 - c % 2 * 51)
                                        {
                                            c = S.Read(); S.Write("#\n "[d < 1?0:c % 3]);
                                        }
                                    }
Exemple #2
0
    public static void Error(string text)
    {
        var color = Console.ForegroundColor;

        Console.ForegroundColor = System.ConsoleColor.Red;
        Console.Write(text);
        Console.ForegroundColor = color;
    }
Exemple #3
0
    public static void Warning(string text)
    {
        var color = Console.ForegroundColor;

        Console.ForegroundColor = System.ConsoleColor.Yellow;
        Console.Write(text);
        Console.ForegroundColor = color;
    }
Exemple #4
0
 private static int Main2(string[] args)
 {
     ParseCommandLineArgs(args);
     hostIpAddr = Resolve(hostName);
     while (true)
     {
         ConnectAndTransfer();
         Console.Write("|");
     }
 }
Exemple #5
0
        static void checkUpdates(Version version)
        {
            var    client = new WebClient();
            string url    = "https://czgzz.space/gzzLoggerVersion.html";

            Console.Write("Avaible version = ...");
            string AvailVer = client.DownloadString(url);

            Console.WriteLine("\b\b\b" + AvailVer);
            if (version.ToString() != AvailVer)
            {
                Console.Write("New version available, would you like to update? (y/n): ");
            }
        }
Exemple #6
0
        public static void WriteListItemBullet(string bullet, int intentLevel)
        {
            if (intentLevel <= 1)
            {
                SysConsole.Write(' ');
            }
            else
            {
                SysConsole.Write(new string(' ', intentLevel * 2 - 1));
            }

            TexoConsole.WriteWithColor(bullet, ConsoleColor.Yellow, ConsoleColor.DarkGreen);
            SysConsole.Write(' ');
        }
Exemple #7
0
        static void AVLTreeShow()
        {
            AVLTree tree = new AVLTree();

            tree.Add(1);
            tree.Add(2);
            tree.Add(3);
            tree.Add(4);
            tree.Add(5);
            tree.Add(6);
            PrintAVLTree(tree.Root);


            string input;
            int    value;

            do
            {
                Console1.Write("Input Value:");
                input = Console1.ReadLine();
                if (input.Equals("exit", StringComparison.OrdinalIgnoreCase))
                {
                    break;
                }

                if (int.TryParse(input, out value))
                {
                    tree.Add(value);
                    PrintAVLTree(tree.Root);
                }
            }while (true);

            do
            {
                Console1.Write("Remove Value:");
                input = Console1.ReadLine();
                if (input.Equals("exit", StringComparison.OrdinalIgnoreCase))
                {
                    break;
                }

                if (int.TryParse(input, out value))
                {
                    tree.Remove(value);
                    PrintAVLTree(tree.Root);
                }
            }while (true);

            Console1.ReadKey();
        }
        private static Task ConfigEnvironmentAsync()
        {
            if (_usingArgs)
            {
                var parameters = ParseParameters();
                if (parameters.ContainsKey("debug"))
                {
                    SettingsService.Instance.ApiBaseUrl      = "http://localhost:4000";
                    SettingsService.Instance.IdentityBaseUrl = "http://localhost:33656";
                }
                else
                {
                    if (parameters.ContainsKey("api"))
                    {
                        SettingsService.Instance.ApiBaseUrl = parameters["api"];
                    }
                    if (parameters.ContainsKey("id"))
                    {
                        SettingsService.Instance.IdentityBaseUrl = parameters["id"];
                    }
                }
            }
            else
            {
                var input = string.Empty;

                Con.Write("API [{0}]: ", SettingsService.Instance.ApiBaseUrl);
                input = Con.ReadLine();
                if (input == "debug")
                {
                    SettingsService.Instance.ApiBaseUrl = "http://localhost:4000";
                }
                else if (!string.IsNullOrEmpty(input))
                {
                    SettingsService.Instance.ApiBaseUrl = input;
                }
                Con.Write("Identity [{0}]: ", SettingsService.Instance.IdentityBaseUrl);
                input = Con.ReadLine();
                if (input == "debug")
                {
                    SettingsService.Instance.IdentityBaseUrl = "http://localhost:33656";
                }
                else if (!string.IsNullOrEmpty(input))
                {
                    SettingsService.Instance.IdentityBaseUrl = input;
                }
            }

            return(Task.FromResult(0));
        }
Exemple #9
0
 private void Delete()
 {
     if (stringBuilder.Length > currentIndex)
     {
         stringBuilder.Remove(currentIndex, 1);
         Con.SetCursorPosition(previousLeft, previousTop);
         Con.Write(stringBuilder.ToString().Substring(currentIndex) + " ");
         Con.SetCursorPosition(previousLeft, previousTop);
     }
     else
     {
         Con.SetCursorPosition(previousLeft, previousTop);
     }
 }
Exemple #10
0
        private int GoRight()
        {
            if (currentIndex < stringBuilder.Length)
            {
                Con.SetCursorPosition(previousLeft, previousTop);
                Con.Write(stringBuilder[currentIndex]);
                currentIndex++;
            }
            else
            {
                Con.SetCursorPosition(previousLeft, previousTop);
            }

            return(currentIndex);
        }
Exemple #11
0
 public static void Log(string Message, ConsoleColor col)
 {
     Console.ForegroundColor = ConsoleColor.White;
     Console.Write("[");
     Console.ForegroundColor = ConsoleColor.Green;
     Console.Write(GetCurrentTime());
     Console.ForegroundColor = ConsoleColor.White;
     Console.Write("] [");
     Console.ForegroundColor = ConsoleColor.Magenta;
     Console.Write("BlazeLib");
     Console.ForegroundColor = ConsoleColor.White;
     Console.Write("] ");
     Console.ForegroundColor = col;
     Console.WriteLine(Message);
 }
Exemple #12
0
      public void Spotlight(string message)
      {
          string fullMessage = JsonConvert.SerializeObject(message, Formatting.Indented).ToUpper(CultureInfo.InvariantCulture);

          StackFrame frame      = new StackFrame(skipFrames: 1, fNeedFileInfo: true);
          int        lineNumber = frame.GetFileLineNumber();

          using (StringWriter writer = new StringWriter())
          {
              C.ForegroundColor = ConsoleColor.Magenta;
              C.WriteLine($"{fullMessage} @ Line#: {lineNumber}");
              C.Write(writer.ToString());
              C.ResetColor();
          }
      }
Exemple #13
0
        private static string InputPersonalInfo(string displayText)
        {
            Console.Write(displayText);
            string outputText = Console.ReadLine();

            if (string.IsNullOrEmpty(outputText))//if IsNullOrEmpty is True
            {
                Console.WriteLine("Name cannot be empty.");
                return("-");
            }
            else
            {
                return(outputText);
            }
        }
Exemple #14
0
        static void Main(string[] args)
        {
            ConsoleA.WriteLine("Assembly Info Editor v 0.01 | Powered by CAFFI \n");
            ConsoleA.Write("Write the path to file that needs to be changed: ");

            fileName = ConsoleA.ReadLine();
            Editor.ReadAssembly(fileName);

            FileAttributes fileAttributes = File.GetAttributes(fileName);
            bool           isDirectory    = fileAttributes.HasFlag(FileAttributes.Directory);

            Editor.ReadTime(fileName, isDirectory);
            Editor.SetTime(fileName, DateTime.Now, isDirectory);
            ConsoleA.ReadKey();
        }
Exemple #15
0
        private static void PrintTree(RBTreeNode treeNode, int deep = 0)
        {
            if (treeNode == null || treeNode is Nil)
            {
                return;
            }

            for (int i = 0; i < deep; i++)
            {
                Console1.Write("  ");
            }
            Console1.WriteLine(string.Format("|___{0}({1})", treeNode.Value, GetNodeColor(treeNode.Color)));
            PrintTree(treeNode.Left, 1 + deep);
            PrintTree(treeNode.Right, 1 + deep);
        }
Exemple #16
0
        private static void Main(string[] args)
        {
            //Con.InputEncoding = Encoding.UTF8;
            Con.OutputEncoding = Encoding.UTF8;


            RunTests();

            IDisposable locker = new Lib.Utils.AsyncLock(_locker);

            Con.Write("Press any key to exit:");
            Con.ReadKey(true);

            locker.Dispose();
        }
        public void Write(IItem item)
        {
            if (item.Format != TextFormatEnum.Markdown &&
                item.Format != TextFormatEnum.Model)
            {
                SysConsole.Write(item.Text);
            }
            else
            {
                MarkdownDocument doc = markdown.Parse(item.Text);
                WriteBlockContainer(doc);
            }

            SysConsole.WriteLine();
        }
 private static void DeletePerson()
 {
     try
     {
         ShowPeople();
         UI.Write("Id da pessoa a ser deletada: ");
         int personId = Convert.ToInt32(UI.ReadLine());
         ICrudRepository <Person, int> personRepository = _serviceProvider.GetService <ICrudRepository <Person, int> >();
         personRepository.DeletetById(personId);
     }
     catch (Exception ex)
     {
         UI.WriteLine($"Houve um erro ao deletar a pessoa: {ex.Message}");
     }
 }
Exemple #19
0
        private static void PrintAVLTree(AVLTreeNode treeNode, int deep = 0)
        {
            if (treeNode == null)
            {
                return;
            }

            for (int i = 0; i < deep; i++)
            {
                Console1.Write("  ");
            }
            Console1.WriteLine(string.Format("|___{0}({1})", treeNode.Value, treeNode.HighValue));
            PrintAVLTree(treeNode.Left, 1 + deep);
            PrintAVLTree(treeNode.Right, 1 + deep);
        }
Exemple #20
0
        //  Console.Horizontal("+12345-", "///START!!!", "\\\\\\END!!!");



        public static void HorizontalTitle
        (
            string title,
            int x_start,
            string fill        = HorizontalFill,
            string title_start = TitleDecorStart,
            string title_end   = TitleDecorEnd
        )
        {
            int max_size = BaseConsole.WindowWidth;

            const int MaxDecorSize = 8;

            if (title_start.Length > MaxDecorSize)
            {
                title_start = title_start.Substring(0, MaxDecorSize);
            }
            if (title_end.Length > MaxDecorSize)
            {
                title_end = title_end.Substring(0, MaxDecorSize);
            }

            int title_size = Math.Min(max_size - title_start.Length - title_end.Length, title.Length);

            if (title.Length > title_size)
            {
                title_size = title_size - 3;
                if (title_size > 0)
                {
                    title = title.Substring(0, title_size) + "...";
                }
                else
                {
                    title = title.Substring(0, 3);
                }
            }

            Console.Horizontal(fill);
            BaseConsole.CursorTop--;

            BaseConsole.CursorLeft += x_start;
            BaseConsole.Write(title_start);
            BaseConsole.Write(title);
            BaseConsole.Write(title_end);

            BaseConsole.CursorLeft = 0;
            BaseConsole.CursorTop++;
        }
Exemple #21
0
        static void Main(string[] args)
        {
            Version GZZLoggerVersion = new Version(1, 0, 0, 0);

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                Console.SetWindowSize(130, 33);
            }
            else
            {
                Console.WriteLine("\033[8;33;130t");
            }
            Console.WriteLine("GZZ Logger -- V " + GZZLoggerVersion.ToString());
            Console.WriteLine("Checking for updates...");
            checkUpdates(GZZLoggerVersion);
            Console.Write("Loading...");
            var SessionSettings  = new Settings();                                      //Load Settings from file
            var LocationRecords  = new CallsignLocationLookup();                        //Load location DB for use with callsign prefixes
            var startContestMode = SessionSettings.ContestMode;


            Application.Init();
            if (SessionSettings.Callsign == string.Empty || SessionSettings.CurrentDatabaseName == string.Empty)
            {
                var introGui = new GUI.introGui(SessionSettings, LocationRecords);
                Application.Run(introGui.introUITopLevel());
            }

            else
            {
                var SessionDatabase = new Database(SessionSettings.CurrentDatabaseName);    //Load DB from DB name in settings
                var MainGui         = new GUI.GUIClass(SessionSettings, SessionDatabase, LocationRecords);
                var top             = MainGui.MainUIToplevel();
                Application.Run(top);
            }

            while (startContestMode != SessionSettings.ContestMode) // REDRAW IF CHANGED MODE
            {
                startContestMode = SessionSettings.ContestMode;
                var SessionDatabase = new Database(SessionSettings.CurrentDatabaseName);
                var MainGui         = new GUI.GUIClass(SessionSettings, SessionDatabase, LocationRecords);
                var top             = MainGui.MainUIToplevel();
                Application.Run(top);
            }

            Console.WriteLine("Goodbye " + SessionSettings.Callsign);
            Thread.Sleep(1000);
        }
Exemple #22
0
 /// <summary>
 /// Writes the specified value with the specified color
 /// </summary>
 /// <param name="value">The value to write</param>
 /// <param name="color">The color to use</param>
 public IConsole Write(string value, Color color)
 {
     lock (_innerWriteLock) {
         Color prevColor = new Color(SysConsole.ForegroundColor, SysConsole.BackgroundColor);
         SysConsole.ForegroundColor = color.Foreground;
         SysConsole.BackgroundColor = color.Background;
         SysConsole.Write(value);
         SysConsole.ForegroundColor = prevColor.Foreground;
         SysConsole.BackgroundColor = prevColor.Background;
     }
     if (addToBuffer)
     {
         questionBuffer.Add(new ColorTokenItem(value, color));
     }
     return(this);
 }
Exemple #23
0
        static void Main(string[] args)
        {
            const string hihi = "Hello love baby cute kul! khikhi";


            X.WriteLine("Gio thu may do di ve:" + Class1.tentoi);
            X.WriteLine("Tan cay xoa bong biet ve noi mo:" + Class1.lienket);

            X.WriteLine(hihi);
            X.Write("Duong xua nga bong hoa vang:");
            int    hoa  = Convert.ToInt32(X.ReadLine());
            double canh = hoa + hoa + hoa + Class1.pi;

            X.WriteLine("Nhin theo bong mat trang ngan o dau:{0}", nhanh + Class1.lienket2);
            X.ReadLine();
        }
Exemple #24
0
        static void Main(string[] args)
        {
            var table = new Table();

            table.Reset();

            for (var c = 0; c < Table.Columns; c++)
            {
                for (var r = 0; r < Table.Rows; r++)
                {
                    var cell = table.GetCell(r, c);
                    Console.Write(CellStateToChar(cell.State));
                }
                Console.WriteLine();
            }
        }
Exemple #25
0
        public static void Write(ConsoleColor color, object value, bool beautify = false)
        {
            ForegroundColor = color;

            if (!beautify)
            {
                SysConsole.Write(value);
            }
            else
            {
                var array = value.ToString().Split("\\n").ToList();
                array.ForEach(l => WriteLine(ConsoleColor.Green, l));
            }

            SysConsole.ResetColor();
        }
 public void Readdata()
 {
     Console.WriteLine("Enter the Student_Details: \n");
     A.Write("UID: ");
     uid = Convert.ToDouble(A.ReadLine());
     A.Write("Name: ");
     name = A.ReadLine();
     A.Write("Semester: ");
     sem = Convert.ToInt32(A.ReadLine());
     if (sem < 1 || sem > 8)
     {
         throw new Myexception();
     }
     A.Write("Email: ");
     email = A.ReadLine();
 }
            private static void PrintNumbers()
            {
                Console.Clear();
                Console.WriteLine("Print Numberz Game!");
                Console.Write("Type a number: ");
                int result  = int.Parse(Console.ReadLine());
                int counter = 1;

                while (counter <= result)
                {
                    Console.Write(counter);
                    Console.Write("-");
                    counter++;
                }
                Console.ReadLine();
            }
Exemple #28
0
        /// <summary>
        /// Authorize with the Spotify Web API to retrieve a Refresh Token.
        /// This token is then to be used for any subsequent calls to <see cref="RunStatus(Status)"/>
        /// </summary>
        /// <param name="opts_">CLI arguments</param>
        /// <returns>1 for errors, 0 otherwise</returns>
        static int RunAuthorize(Authorize opts_)
        {
            SysConsole.WriteLine("Authorizing with SpotifyWebAPI");

            Token token = null;
            var   auth  = new AuthorizationCodeAuth(opts_.ClientId, opts_.ClientSecret, "http://localhost:" + opts_.Port, "http://localhost:" + opts_.Port, Scope.UserReadPrivate);

            auth.AuthReceived += (object sender_, AuthorizationCode payload_) =>
            {
                auth.Stop();
                var exchange = auth.ExchangeCode(payload_.Code);
                exchange.Wait(10000);

                if (!exchange.IsCompleted)
                {
                    throw new Exception("Timeout during authorization process!");
                }

                token = exchange.Result;
            };

            SysConsole.WriteLine("Starting authorization process");
            auth.Start();
            auth.OpenBrowser();

            SysConsole.Write("Waiting for authorzation to complete...");
            while (token == null)
            {
                SysConsole.Write(".");
                Task.Delay(500).Wait();
            }

            string settings = "ClientId=" + opts_.ClientId + "\r\n";

            settings += "ClientSecret=" + opts_.ClientSecret + "\r\n";
            settings += "RefreshToken=" + token.RefreshToken + "\r\n";
            Clipboard.SetText(settings);

            SysConsole.WriteLine("");
            SysConsole.WriteLine("Token received. Set the following settings in your web parser parent measure:");
            SysConsole.WriteLine("---");
            SysConsole.WriteLine(settings);
            SysConsole.WriteLine("---");
            SysConsole.WriteLine("(the settings have been copied to your clipboard as well)");

            return(0);
        }
Exemple #29
0
        public static void ShowOneLine(int startIndex, CellContent[] board)
        {
            var lineNo = 1 + startIndex / 3;

            Console.Write(lineNo + "│");
            for (var i = startIndex; i < startIndex + 3; i++)
            {
                if (i > startIndex)
                {
                    Console.Write(' ');
                }
                var isBlank = board[i] == CellContent.None;
                var isCross = board[i] == CellContent.Cross;
                Console.Write(isBlank ? ' ' : isCross ? 'x' : 'o');
            }
            Console.WriteLine("│");
        }
Exemple #30
0
 private static void UpdateStatusBars()
 {
     lock (_lock)
     {
         var posX      = SysConsole.CursorLeft;
         var posY      = SysConsole.CursorTop;
         var consumedX = 0;
         foreach (var bar in StatusBars)
         {
             SysConsole.CursorLeft = SysConsole.BufferWidth - bar.Text.Length - consumedX;
             SysConsole.Write(bar.Text);
             consumedX += bar.Text.Length;
         }
         SysConsole.CursorLeft = posX;
         SysConsole.CursorTop  = posY;
     }
 }
Exemple #31
0
        public static void Main()
        {
            BasicConsole.Clear();
            Console.InitDefault();

            // Wait for other system startup to occur
            Processes.SystemCalls.SleepThread(1000);
            
            MainConsole = new Consoles.AdvancedConsole();
            MainConsole.ScreenHeight = 7;
            MainConsole.LineLength = 55;
            MainConsole.ScreenStartLineOffset = 0;
            MainConsole.UpdateScreenCursor = false;

            StatusConsole = new Consoles.AdvancedConsole();
            StatusConsole.ScreenHeight = 7;
            StatusConsole.LineLength = 24;
            StatusConsole.ScreenStartLineOffset = 56;
            StatusConsole.UpdateScreenCursor = false;

            MainConsole.Clear();
            StatusConsole.Clear();

            bool StatusLine1 = true;

            Hardware.DeviceManager.AddDeviceAddedListener(DeviceManager_DeviceAdded, null);

            Processes.SystemCalls.SleepThread(500);
            Console.Default.ScreenHeight = 25 - 8;
            Console.Default.ScreenStartLine = 8;

            while (!Terminating)
            {
                try
                {
                    ((Consoles.AdvancedConsole)StatusConsole).DrawBottomBorder();
                    ((Consoles.AdvancedConsole)StatusConsole).DrawLeftBorder();
                    ((Consoles.AdvancedConsole)MainConsole).DrawBottomBorder();
            
                    StatusConsole.Clear();
                    if (StatusLine1)
                    {
                        StatusConsole.WriteLine("State: 1");
                    }
                    else
                    {
                        StatusConsole.WriteLine("State: 2");
                    }
                    StatusLine1 = !StatusLine1;

                    StatusConsole.Write("Processes: ");
                    StatusConsole.WriteLine_AsDecimal(ProcessManager.Processes.Count);

                    int ThreadCount = 0;
                    int SleptThreads = 0;
                    int IndefiniteSleptThreads = 0;
                    for (int i = 0; i < ProcessManager.Processes.Count; i++)
                    {
                        List threads = ((Process)ProcessManager.Processes[i]).Threads;
                        ThreadCount += threads.Count;
                        for (int j = 0; j < threads.Count; j++)
                        {
                            Thread thread = (Thread)threads[j];
                            if (thread.TimeToSleep == Thread.IndefiniteSleep)
                            {
                                IndefiniteSleptThreads++;
                                SleptThreads++;
                            }
                            else if (thread.TimeToSleep > 0)
                            {
                                SleptThreads++;
                            }
                        }
                    }
                    StatusConsole.Write("Threads: ");
                    StatusConsole.Write_AsDecimal(ThreadCount);
                    StatusConsole.Write(" / ");
                    StatusConsole.Write_AsDecimal(SleptThreads);
                    StatusConsole.Write(" / ");
                    StatusConsole.WriteLine_AsDecimal(IndefiniteSleptThreads);

                    StatusConsole.Write("Devices: ");
                    StatusConsole.WriteLine_AsDecimal(Hardware.DeviceManager.Devices.Count);
                    StatusConsole.Write("File Sys:");
                    for(int i = 0; i < FileSystemManager.FileSystemMappings.Count; i++)
                    {
                        FileSystemMapping mapping = (FileSystemMapping)FileSystemManager.FileSystemMappings[i];
                        StatusConsole.Write(" ");
                        StatusConsole.Write(mapping.Prefix);
                    }
                    StatusConsole.WriteLine();
                    StatusConsole.Write("USB Devices: ");
                    StatusConsole.WriteLine_AsDecimal(Hardware.USB.USBManager.Devices.Count);

                    unsafe
                    {
                        StatusConsole.Write("Heap: ");
                        //StatusConsole.Write_AsDecimal(Heap.GetTotalUsedMem());
                        //StatusConsole.Write(" / ");
                        //StatusConsole.Write_AsDecimal(Heap.GetTotalMem());
                        uint totalMem = Heap.GetTotalMem();
                        StatusConsole.Write_AsDecimal(Heap.GetTotalUsedMem() / (totalMem / 100));
                        StatusConsole.Write("% / ");
                        StatusConsole.Write_AsDecimal(totalMem / 1024);
                        StatusConsole.Write(" KiB");
                    }
                }
                catch
                {
                    MainConsole.ErrorColour();
                    MainConsole.WriteLine("Error updating the status console:");
                    if (ExceptionMethods.CurrentException != null)
                    {
                        MainConsole.WriteLine(ExceptionMethods.CurrentException.Message);
                    }
                    MainConsole.DefaultColour();
                }

                MainConsole.Update();
                StatusConsole.Update();

                Processes.SystemCalls.SleepThread(500);
            }
        }