Stetic.SteticMain.Main C# (CSharp) Method

Main() public static method

public static Main ( string args ) : int
args string
return int
        public static int Main(string[] args)
        {
            int n = 0;
            IsolationMode mode = IsolationMode.None;
            bool usePartial = false;
            bool useGettext = false;
            bool genEmpty = false;
            bool useMultifile = false;

            while (n < args.Length) {
                string arg = args[n];
                if (arg.StartsWith ("--language:"))
                    language = arg.Substring (11);
                else if (arg.StartsWith ("-l:"))
                    language = arg.Substring (3);
                else if (arg.StartsWith ("-lib:"))
                    libraries.Add (arg.Substring (5));
                else if (arg.StartsWith ("--library:"))
                    libraries.Add (arg.Substring (10));
                else if (arg == "--generate" || arg == "-g")
                    break;
                else if (arg == "--noisolation")
                    mode = IsolationMode.None;
                else if (arg == "--gen-partial")
                    usePartial = true;
                else if (arg == "--gen-gettext")
                    useGettext = true;
                else if (arg == "--gen-multifile")
                    useMultifile = true;
                else if (arg == "--gen-empty")
                    genEmpty = true;
                else
                    break;
                n++;
            }

            if (args.Length == 1 && args [0] == "--help") {
                Console.WriteLine (Catalog.GetString ("Stetic - A GTK User Interface Builder"));
                Console.WriteLine (Catalog.GetString ("Usage:"));
                Console.WriteLine ("\tstetic [<file>]");
                Console.WriteLine ("\tstetic [--language:<language>] [-lib:<library>...] --generate <sourceFile> <projectFile> ...");
                return 0;
            }

            Program = new Gnome.Program ("Stetic", "0.0", Gnome.Modules.UI, args);

            int ret;

            if (args.Length - n > 2 && ((args [n] == "--generate" || args [n] == "-g"))) {
                SteticApp = Stetic.ApplicationFactory.CreateApplication (IsolationMode.None);
                GenerationOptions ops = new GenerationOptions ();
                ops.UsePartialClasses = usePartial;
                ops.GenerateEmptyBuildMethod = genEmpty;
                ops.UseGettext = useGettext;
                ops.GenerateSingleFile = !useMultifile;
                ret = GenerateCode (args [n+1], args, n+2, ops);
            }
            else {
                SteticApp = Stetic.ApplicationFactory.CreateApplication (mode);
                SteticApp.AllowInProcLibraries = false;
                ret = RunApp (args, n);
            }

            SteticApp.Dispose ();
            return ret;
        }