Beispiel #1
0
        static void Main(string[] args)
        {
            ArgumentCollection argumentCollection = null;

            Calculator.Heap.Add(Program.LastResultKey, "0");
            Calculator.Heap.Add(Program.ModeKey, "rad");
            Calculator.Heap.Add(Program.PromptKey, ">>>");

            string arguments = args.Join();

            if (!arguments.IsNullOrEmpty())
            {
                argumentCollection = ArgumentCollection.Parse(args, __argumentMap);
                arguments          = RemoveKnownArguments(arguments, argumentCollection);
            }

            if (!argumentCollection.IsNull())
            {
                if (argumentCollection.ContainsKey(HelpArg))
                {
                    DisplayUsage();
                    DisplayHelp();
                }
                else if (argumentCollection.ContainsKey(VersionArg))
                {
                    DisplayVersion();
                }
                else if (argumentCollection.ContainsKey(LicenseArg))
                {
                    DisplayLicense();
                }
                else
                {
                    if (argumentCollection.ContainsKey(ModeDegreesArg))
                    {
                        Calculator.Heap["mode"] = "deg";
                    }
                    else if (argumentCollection.ContainsKey(ModeRadiansArg))
                    {
                        Calculator.Heap["mode"] = "rad";
                    }

                    Run(arguments.Trim().Replace(" ", String.Empty));
                }
            }
            else
            {
                string title = Console.Title;

                Console.Title = Messages.BpcConsoleTitle;

                Run(String.Empty);

                Console.Title = title;
            }
        }