예제 #1
0
 public override void Init()
 {
     if (Registered)
     {
         return;
     }
     AnsiSequencer.RegisterAction('m', HandleSelectGraphicsRendering);
 }
예제 #2
0
 public override void DeInit()
 {
     if (!Registered)
     {
         return;
     }
     AnsiSequencer.UnregisterAction('m');
 }
예제 #3
0
        private void HandleSelectGraphicsRendering(AnsiSequencer s, params byte[] b)
        {
            foreach (var param in b)
            {
                // Foreground
                if (param >= 30 && param <= 37)
                {
                    SetForeColor((byte)(param - 30), false);
                }
                else if (param >= 90 && param <= 97)
                {
                    SetForeColor((byte)(param - 90), true);
                }
                // Foreground
                else if (param >= 40 && param <= 47)
                {
                    SetBackColor((byte)(param - 40), false);
                }
                else if (param >= 100 && param <= 107)
                {
                    SetBackColor((byte)(param - 100), true);
                }
                else
                {
                    switch (param)
                    {
                    // Reset
                    case 0:
                        SetBold(false);
                        SetInverse(false);
                        ResetForeColor();
                        ResetBackColor();
                        break;

                    case 2:
                    case 22:
                        SetBold(false);
                        break;

                    case 39:
                        ResetForeColor();
                        break;

                    case 49:
                        ResetBackColor();
                        break;

                    // Intensity
                    case 1:
                        SetBold(true);
                        break;

                    //  Inverse Video
                    case 7:
                        SetInverse(true);
                        break;

                    case 27:
                        SetInverse(false);
                        break;
                    }
                }
            }
        }
예제 #4
0
        static void Main(string[] args)
        {
#if !ANSI
            if (!IsAnsiCompilant())
            {
                AnsiSequencer.Enable();
                AnsiSequencer.EnableModule <SGRModule>();
            }
#else
            AnsiSequencer.Enable();
            AnsiSequencer.EnableModule <SGRModule>();
#endif

            PrintHeader();

            var unparsed = new List <string>();
            var opts     = new OptionSet();
            var argsObj  = new ProgramArguments();

            opts.Add("<>",
                     arg =>
            {
                var m = OptionSet.ValueOptionRegex.Match(arg);
                if (m.Success)
                {
                    PrintInvalid(m.Groups["name"].Value);
                    Environment.Exit(1);
                }
                else if (File.Exists(arg))
                {
                    argsObj.RgssArchive = arg;
                }
                else
                {
                    unparsed.Add(arg);
                }
            }
                     );

            opts.Add("?|help",
                     "Displays this help message",
                     arg =>
            {
                PrintHelp(opts);
                Environment.Exit(0);
            });

            opts.Add("d|dump",
                     $"Only Dumps Archive Information\n(Default: {argsObj.InfoDump})",
                     arg => argsObj.InfoDump = true);

            opts.Add("o|output=",
                     $"Output Directory, Relative to RGSS Archive.\n(Default: {argsObj.OutputDir})",
                     arg => argsObj.OutputDir = arg);

            opts.Add("p|proj",
                     $"Creates Project File.\n(Default: {argsObj.CreateProjectFile})",
                     arg => argsObj.CreateProjectFile = true);

            opts.Add("q|quiet",
                     $"Supresses Output. \n(Default: {argsObj.SupressOutput})",
                     arg => argsObj.SupressOutput = true);

            opts.Add("r|register",
                     "Registers Context Menu Handler",
                     arg => argsObj.RegisterContext = true);

            opts.Add("u|unregister",
                     "Unregisters Context Menu Handler",
                     arg => argsObj.UnregisterContext = true);

            if (args.Length == 0)
            {
                PrintHelp(opts);
                Environment.Exit(1);
            }

            var ext = opts.Parse(args);
            SubMain(argsObj);
        }