Esempio n. 1
0
 public static bool HandleFileOptions(BFInterpreter.Options opts, string file)
 {
     if (file.StartsWith("[options:"))
     {
         HandleOptions(opts, file.Substring(1, file.IndexOf("]")).Split(" ", StringSplitOptions.RemoveEmptyEntries));
     }
     return(false);
 }
Esempio n. 2
0
        public static bool HandleOptions(BFInterpreter.Options opts, string[] args)
        {
            bool interpret = false;

            foreach (var arg in args)
            {
                if (arg.StartsWith("-"))
                {
                    interpret = SetOption(opts, arg.Replace("--", "").Replace("-", "")) ?? interpret;
                }
            }
            return(interpret);
        }
Esempio n. 3
0
        private static bool?SetOption(BFInterpreter.Options opts, string arg)
        {
            var split = arg.Split("=");

            switch (split[0])
            {
            case "r":
            case "realtime":
                opts.ToggleRealTimeMode();
                break;

            case "b":
            case "binaryInput":
                opts.ToggleBinaryInput();
                break;

            case "w":
            case "wrapBuffer":
                opts.ToggleWrapBuffer();
                break;

            case "s":
            case "bufferSize":
                opts.SetBufferSize(int.Parse(split[1]));
                break;

            case "raw":
                opts.ToggleOptimizeInput();
                break;

            case "i":
            case "interpret":
                return(true);

            case "h":
            case "help":
                Program.PrintHelp();
                break;
            }

            return(null);
        }