示例#1
0
        public void WriteIndividualHelpToConsole(ArgumentKey k)
        {
            ConsoleColorState colorState = RugConsole.ColorState;
            IArgumentValue    value2     = this.m_Switches[k];

            RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.SubText, new string('-', RugConsole.BufferWidth) + "[");
            RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.TitleText, k.Prefix + k.Symbol.ToUpper());
            RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.Text, value2.ArgumentString());
            RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.SubText, "] ");
            RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.TitleText, "  " + k.Prefix + k.Symbol.ToUpper());
            if (k.Name.ToUpper().StartsWith(k.Symbol.ToUpper()))
            {
                RugConsole.WriteLine(ConsoleVerbosity.Silent, ConsoleThemeColor.Text, k.Name.Substring(k.Symbol.Length).PadRight(15 - k.Symbol.Length));
            }
            else
            {
                RugConsole.WriteLine(ConsoleVerbosity.Silent, ConsoleThemeColor.Text, (" (" + k.Name + ")").PadRight(15 - k.Symbol.Length));
            }
            RugConsole.WriteLine(ConsoleVerbosity.Silent, ConsoleThemeColor.Text1, "  " + value2.ShortHelp);
            RugConsole.WriteLine(ConsoleVerbosity.Silent, ConsoleThemeColor.TitleText, "");
            if (Helper.IsNotNullOrEmpty(value2.Help))
            {
                RugConsole.WriteInterpreted(ConsoleThemeColor.TitleText, value2.Help, 2, 2);
                RugConsole.WriteLine(ConsoleVerbosity.Silent, "");
            }
            RugConsole.ColorState = colorState;
        }
示例#2
0
        public static void WriteSimpleBanner(string str, char fill, int paddingRight, ConsoleColorExt ForeColour, ConsoleColorExt BackColour)
        {
            ConsoleColorState colorState = RugConsole.ColorState;
            int num   = RugConsole.BufferWidth - paddingRight;
            int count = (num - str.Length) / 2;

            if (ForeColour != ConsoleColorExt.Inhreit)
            {
                RugConsole.ForegroundColor = ForeColour;
            }
            if (BackColour != ConsoleColorExt.Inhreit)
            {
                RugConsole.BackgroundColor = BackColour;
            }
            if (paddingRight > 0)
            {
                RugConsole.Write(ConsoleVerbosity.Silent, new string(fill, count) + str + new string(fill, num - (count + str.Length)));
                RugConsole.ColorState = colorState;
                RugConsole.WriteLine(ConsoleVerbosity.Silent);
            }
            else
            {
                RugConsole.Write(ConsoleVerbosity.Silent, new string(fill, count) + str + new string(fill, num - (count + str.Length)));
                RugConsole.ColorState = colorState;
                RugConsole.Write(ConsoleVerbosity.Silent, new string(' ', RugConsole.BufferWidth));
                if (RugConsole.CanManipulateBuffer)
                {
                    RugConsole.CursorTop--;
                }
            }
        }
示例#3
0
 public static void WriteLogo(int x, int y, int pixWidth, int pixHeight, ConsoleShade fillShade, ConsoleShade endShade, ConsoleShade shadowShade, bool makeSpace, bool replaceCursor, string[] lines)
 {
     if (RugConsole.CanManipulateBuffer)
     {
         int cursorLeft = RugConsole.CursorLeft;
         int cursorTop  = RugConsole.CursorTop;
         if (makeSpace)
         {
             RugConsole.CursorLeft = x;
             RugConsole.CursorTop  = y;
             int num3 = 0;
             int num4 = pixHeight * lines.Length;
             while (num3 < num4)
             {
                 RugConsole.WriteLine();
                 num3++;
             }
             if (!replaceCursor)
             {
                 cursorLeft = RugConsole.CursorLeft;
                 cursorTop  = RugConsole.CursorTop;
             }
         }
         WriteLogo(x, y, pixWidth, pixHeight, fillShade, endShade, shadowShade, lines);
         RugConsole.CursorTop  = cursorTop;
         RugConsole.CursorLeft = cursorLeft;
     }
 }
示例#4
0
 public static void WriteLogo(int x, int y, int pixWidth, int pixHeight, ConsoleShade fillShade, ConsoleShade endShade, ConsoleShade shadowShade, string[] lines)
 {
     if (RugConsole.CanManipulateBuffer)
     {
         ConsoleColorState colorState = RugConsole.ColorState;
         int    cursorLeft            = RugConsole.CursorLeft;
         int    cursorTop             = RugConsole.CursorTop;
         string str  = new string(ConsoleChars.GetShade(fillShade), pixWidth);
         string str2 = "";
         if (pixWidth > 1)
         {
             str2 = new string(ConsoleChars.GetShade(fillShade), pixWidth - 1) + ConsoleChars.GetShade(endShade);
         }
         else
         {
             str2 = new string(ConsoleChars.GetShade(endShade), 1);
         }
         string str3 = new string(ConsoleChars.GetShade(ConsoleShade.Clear), pixWidth);
         string str4 = new string(ConsoleChars.GetShade(shadowShade), pixWidth);
         string str5 = "";
         if (pixWidth > 1)
         {
             str5 = new string(ConsoleChars.GetShade(shadowShade), 1) + new string(ConsoleChars.GetShade(ConsoleShade.Clear), pixWidth - 1);
         }
         else
         {
             str5 = new string(ConsoleChars.GetShade(shadowShade), 1);
         }
         int num3 = y;
         RugConsole.CursorLeft           = x;
         RugConsole.CursorTop            = num3++;
         RugConsole.ForegroundThemeColor = ConsoleThemeColor.TitleText;
         for (int i = 0; i < lines.Length; i++)
         {
             for (int j = 0; j < pixHeight; j++)
             {
                 RugConsole.Write(string.Format(lines[i], new object[] { str, str2, str3, str4, str5 }));
                 RugConsole.CursorLeft = x;
                 RugConsole.CursorTop  = num3++;
             }
         }
         RugConsole.ColorState = colorState;
         RugConsole.CursorTop  = cursorTop;
         RugConsole.CursorLeft = cursorLeft;
     }
 }
示例#5
0
 public static void WriteInfoToConsole(string label, string value, ConsoleColorExt valueColor, bool extended)
 {
     RugConsole.Write(ConsoleThemeColor.TitleText, " " + label.PadRight(0x12) + ":");
     if (extended)
     {
         RugConsole.WriteLine(valueColor, value);
     }
     else if (value.Length < 0x16)
     {
         RugConsole.Write(ConsoleThemeColor.SubText, new string('.', 0x16 - value.Length));
         RugConsole.WriteLine(valueColor, value);
     }
     else
     {
         RugConsole.WriteLine(valueColor, value.Substring(value.Length - 0x16));
     }
 }
示例#6
0
        public void WriteLongArgumentsUsage()
        {
            ConsoleColorState colorState = RugConsole.ColorState;

            this.WriteShortArgumentsUsage();
            if ((this.m_FirstArgument != null) && Helper.IsNotNullOrEmpty(this.m_FirstArgument.Help))
            {
                RugConsole.WriteLine(ConsoleVerbosity.Silent, ConsoleThemeColor.SubText2, "  <" + this.m_FirstArgument.ArgumentString().Trim() + ">");
                RugConsole.WriteWrapped(ConsoleThemeColor.Text1, this.m_FirstArgument.Help, 4, 4);
                RugConsole.WriteLine(ConsoleVerbosity.Silent, "");
            }
            if ((this.m_DefaultArgument != null) && Helper.IsNotNullOrEmpty(this.m_DefaultArgument.Help))
            {
                RugConsole.WriteLine(ConsoleVerbosity.Silent, ConsoleThemeColor.SubText3, "  <" + this.m_DefaultArgument.ArgumentString().Trim() + ">");
                RugConsole.WriteWrapped(ConsoleThemeColor.Text1, this.m_DefaultArgument.Help, 4, 2);
                RugConsole.WriteLine(ConsoleVerbosity.Silent, "");
            }
            foreach (ArgumentKey key in this.m_Switches.Keys)
            {
                IArgumentValue value2 = this.m_Switches[key];
                string         str    = key.Prefix + key.Symbol.ToUpper();
                RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.TitleText, "  " + str);
                if (key.Name.ToUpper().StartsWith(key.Symbol.ToUpper()))
                {
                    RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.Text, key.Name.Substring(key.Symbol.Length).PadRight(0x12 - str.Length));
                }
                else
                {
                    RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.Text, (" (" + key.Name + ")").PadRight(0x12 - str.Length));
                }
                RugConsole.WriteLine(ConsoleVerbosity.Silent, ConsoleThemeColor.Text1, " " + value2.ShortHelp);
            }
            if (this.HasApplicationAbout)
            {
                RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.WarningColor2, "  " + "/?? ".PadRight(0x12));
                RugConsole.WriteLine(ConsoleVerbosity.Silent, ConsoleThemeColor.Text1, " " + Strings.ArgumentParser_AboutScreen_Title);
            }
            if (this.HasApplicationDocument)
            {
                RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.WarningColor2, "  " + "/?D ".PadRight(0x12));
                RugConsole.WriteLine(ConsoleVerbosity.Silent, ConsoleThemeColor.Text1, " " + Strings.ArgumentParser_DocumentGenerator_Title);
            }
            RugConsole.ColorState = colorState;
        }
示例#7
0
 private void WriteApplicationAboutToConsole(bool colourise)
 {
     if (this.m_AboutTitleText != null)
     {
         CmdHelper.WriteSimpleBanner(this.m_AboutTitleText, ' ', RugConsole.Theme[ConsoleThemeColor.AppBackground], RugConsole.Theme[ConsoleThemeColor.TitleText]);
         RugConsole.WriteLine(ConsoleVerbosity.Silent);
     }
     if (this.m_AboutText != null)
     {
         RugConsole.WriteInterpreted(ConsoleThemeColor.TitleText, this.m_AboutText, 3, 3);
         RugConsole.WriteLine(ConsoleVerbosity.Silent);
         RugConsole.WriteLine(ConsoleVerbosity.Silent);
     }
     if (this.m_AboutTextLong != null)
     {
         RugConsole.WriteInterpreted(ConsoleThemeColor.Text, this.m_AboutTextLong, 3, 3);
         RugConsole.WriteLine(ConsoleVerbosity.Silent);
         RugConsole.WriteLine(ConsoleVerbosity.Silent);
     }
     if (this.m_CreditsText != null)
     {
         RugConsole.WriteInterpreted(ConsoleThemeColor.Text, this.m_CreditsText, 3, 3);
         RugConsole.WriteLine(ConsoleVerbosity.Silent);
         RugConsole.WriteLine(ConsoleVerbosity.Silent);
     }
     if (this.m_LegalText != null)
     {
         RugConsole.WriteInterpreted(ConsoleThemeColor.SubText2, this.m_LegalText, 3, 3);
         RugConsole.WriteLine(ConsoleVerbosity.Silent);
         RugConsole.WriteLine(ConsoleVerbosity.Silent);
     }
     if (this.m_UsageText != null)
     {
         RugConsole.WriteLine(ConsoleVerbosity.Silent, ConsoleThemeColor.TitleText, string.Format(" {0}:", Strings.ArgumentParser_AboutScreen_Usage));
         RugConsole.WriteInterpreted(ConsoleThemeColor.Text1, this.m_UsageText, 3, 3);
         RugConsole.WriteLine(ConsoleVerbosity.Silent);
     }
 }
示例#8
0
        public void WriteShortArgumentsUsage()
        {
            ConsoleColorState colorState = RugConsole.ColorState;

            RugConsole.ForegroundThemeColor = ConsoleThemeColor.TitleText;
            RugConsole.WriteLine(ConsoleVerbosity.Silent, this.m_Description);
            RugConsole.WriteLine(ConsoleVerbosity.Silent);
            int count = this.m_AppName.Length + 1;
            int num2  = count;

            RugConsole.Write(ConsoleVerbosity.Silent, this.m_AppName.ToUpper() + " ");
            if (this.m_FirstArgument != null)
            {
                string str = "<" + this.m_FirstArgument.ArgumentString().Trim() + "> ";
                num2 += str.Length + str.Length;
                if (num2 > RugConsole.BufferWidth)
                {
                    num2 = count;
                    RugConsole.WriteLine();
                    RugConsole.Write(new string(' ', count));
                }
                RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.SubText2, str);
            }
            if (this.m_DefaultArgument != null)
            {
                string str2 = "<" + this.m_DefaultArgument.ArgumentString().Trim() + "> ";
                num2 += str2.Length;
                if (num2 > RugConsole.BufferWidth)
                {
                    num2 = count + str2.Length;
                    RugConsole.WriteLine();
                    RugConsole.Write(new string(' ', count));
                }
                RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.SubText3, str2);
            }
            foreach (ArgumentKey key in this.m_Switches.Keys)
            {
                IArgumentValue value2 = this.m_Switches[key];
                int            num3   = ((key.Prefix.Length + key.Symbol.Length) + value2.ArgumentString().Length) + 3;
                num2 += num3;
                if (num2 > RugConsole.BufferWidth)
                {
                    num2 = count + num3;
                    RugConsole.WriteLine();
                    RugConsole.Write(new string(' ', count));
                }
                RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.SubText, "[");
                RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.TitleText, key.Prefix + key.Symbol.ToUpper());
                RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.Text, value2.ArgumentString());
                RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.SubText, "] ");
            }
            if (this.HasApplicationAbout)
            {
                int num4 = 4;
                num2 += num4;
                if (num2 > RugConsole.BufferWidth)
                {
                    num2 = count + num4;
                    RugConsole.WriteLine();
                    RugConsole.Write(new string(' ', count));
                }
                RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.WarningColor2, "/?? ");
            }
            if (this.HasApplicationDocument)
            {
                int num5 = 11;
                num2 += num5;
                if (num2 > RugConsole.BufferWidth)
                {
                    num2 = count + num5;
                    RugConsole.WriteLine();
                    RugConsole.Write(new string(' ', count));
                }
                RugConsole.Write(ConsoleVerbosity.Silent, ConsoleThemeColor.WarningColor2, "/?D <path> ");
            }
            RugConsole.ColorState = colorState;
            RugConsole.WriteLine(ConsoleVerbosity.Silent);
            RugConsole.WriteLine(ConsoleVerbosity.Silent);
        }
示例#9
0
        public void WriteApplicationDocumentationToPath(string path)
        {
            StringBuilder builder = new StringBuilder();

            if (this.m_AboutTitleText != null)
            {
                builder.AppendLine(ConsoleFormatter.StripFormat(this.m_AboutTitleText));
                builder.AppendLine();
            }
            if (this.m_CreditsText != null)
            {
                builder.AppendLine(ConsoleFormatter.StripFormat(this.m_CreditsText));
                builder.AppendLine();
            }
            if (this.m_AboutText != null)
            {
                builder.AppendLine(ConsoleFormatter.StripFormat(this.m_AboutText));
                builder.AppendLine();
            }
            if (this.m_AboutTextLong != null)
            {
                builder.AppendLine(ConsoleFormatter.StripFormat(this.m_AboutTextLong));
                builder.AppendLine();
            }
            builder.AppendLine();
            builder.AppendLine();
            builder.AppendLine(new string('=', RugConsole.BufferWidth));
            builder.AppendLine();
            builder.AppendLine(ConsoleFormatter.StripFormat(string.Format("{0}:", Strings.ArgumentParser_AboutScreen_Usage)));
            if (this.m_UsageText != null)
            {
                builder.AppendLine(ConsoleFormatter.StripFormat(this.m_UsageText));
                builder.AppendLine();
                builder.AppendLine();
            }
            builder.AppendLine(this.GetLongArgumentsUsage());
            builder.AppendLine();
            if ((this.m_FirstArgument != null) && Helper.IsNotNullOrEmpty(this.m_FirstArgument.Help))
            {
                builder.AppendLine(new string('-', RugConsole.BufferWidth));
                builder.AppendLine("<" + this.m_FirstArgument.ArgumentString().Trim() + ">");
                builder.AppendLine(ConsoleFormatter.StripFormat(this.m_FirstArgument.Help));
                builder.AppendLine();
            }
            if ((this.m_DefaultArgument != null) && Helper.IsNotNullOrEmpty(this.m_DefaultArgument.Help))
            {
                builder.AppendLine(new string('-', RugConsole.BufferWidth));
                builder.AppendLine("<" + this.m_DefaultArgument.ArgumentString().Trim() + ">");
                builder.AppendLine(ConsoleFormatter.StripFormat(this.m_DefaultArgument.Help));
                builder.AppendLine();
            }
            foreach (ArgumentKey key in this.m_Switches.Keys)
            {
                builder.AppendLine(new string('-', RugConsole.BufferWidth));
                builder.Append(this.GetIndividualHelpString(key));
            }
            if (this.m_LegalText != null)
            {
                builder.AppendLine();
                builder.AppendLine();
                builder.AppendLine(new string('=', RugConsole.BufferWidth));
                builder.AppendLine(ConsoleFormatter.StripFormat(this.m_LegalText));
                builder.AppendLine();
            }
            try
            {
                File.WriteAllText(path, builder.ToString());
                RugConsole.Write(ConsoleVerbosity.Normal, ConsoleThemeColor.Text1, string.Format(Strings.ArgumentParser_DocumentationWrittenToPath, path));
            }
            catch (Exception exception)
            {
                RugConsole.WriteException(10, string.Format(Strings.Error_0010, path), exception);
            }
        }
示例#10
0
 public static void WriteInfoToConsole(string label, string value, ConsoleColorExt valueColor)
 {
     RugConsole.Write(ConsoleThemeColor.TitleText, " " + label.PadRight(0x12) + ":");
     RugConsole.Write(ConsoleThemeColor.SubText, new string('.', 0x16 - value.Length));
     RugConsole.WriteLine(valueColor, value);
 }