Example #1
0
		static int Main (string [] args) {
			PackOptions options = new PackOptions ();
			ArrayList resources = new ArrayList ();
			
			for (int i = 0; i < args.Length; i++){
				string s = args [i];
				string key, value;
				
				if (s.Length > 2){
					int p = s.IndexOf (':');
					if (p != -1){
						key = s.Substring (0, p);
						value = s.Substring (p + 1);
					} else {
						key = s;
						value = null;
					}
				} else {
					key = s;
					if (i+1 < args.Length)
						value = args [i+1];
					else
						value = null;
				}

				switch (key){
				case "-n": case "-appname":
					options.appname = value;
					break;
				case "-o": case "-output":
					options.output = value;
					break;
				case "-a": case "-assembly":
					options.assembly = value;
					break;
				case "-i": case "-icon":
					options.icon = value;
					break;
				case "-r": case "-resource":
					foreach (string ss in value.Split (new char [] {','}))
						resources.Add (ss);
					break;
				case "-about":
					Console.WriteLine ("MacPack 1.0 by Geoff Norton\n");
					break;
					
				case "-m": case "-mode":
					switch (value){
					case "winforms":
						options.mode = 1;
						break;
					case "x11":
						options.mode = 3;
						break;
					case "console":
						options.mode = 0;
						break;
					case "cocoa":
						options.mode = 2;
						break;
					default:
						try {
							options.mode = Int32.Parse (value);
						} catch {
							Console.Error.WriteLine ("Could not recognize option {0} as the mode", value);
						}
						break;
					}
					break;

				case "-h": case "-help":
					Usage ();
					break;
					
				default:
					options.assembly = key;
					break;
				}
			}
			
			options.resource = (string [])resources.ToArray (typeof (string));
			Pack pack = new Pack (options);
			if (pack.Generate ())
				return 0;
			return -1;
		}
Example #2
0
        static int Main(string [] args)
        {
            PackOptions options   = new PackOptions();
            ArrayList   resources = new ArrayList();

            for (int i = 0; i < args.Length; i++)
            {
                string s = args [i];
                string key, value;

                if (s.Length > 2)
                {
                    int p = s.IndexOf(':');
                    if (p != -1)
                    {
                        key   = s.Substring(0, p);
                        value = s.Substring(p + 1);
                    }
                    else
                    {
                        key   = s;
                        value = null;
                    }
                }
                else
                {
                    key = s;
                    if (i + 1 < args.Length)
                    {
                        value = args [i + 1];
                    }
                    else
                    {
                        value = null;
                    }
                }

                switch (key)
                {
                case "-n":
                case "-appname":
                    options.appname = value;
                    break;

                case "-o":
                case "-output":
                    options.output = value;
                    break;

                case "-a":
                case "-assembly":
                    options.assembly = value;
                    break;

                case "-i":
                case "-icon":
                    options.icon = value;
                    break;

                case "-r":
                case "-resource":
                    foreach (string ss in value.Split(new char [] { ',' }))
                    {
                        resources.Add(ss);
                    }
                    break;

                case "-about":
                    Console.WriteLine("MacPack 1.0 by Geoff Norton\n");
                    break;

                case "-m":
                case "-mode":
                    switch (value)
                    {
                    case "winforms":
                        options.mode = 1;
                        break;

                    case "x11":
                        options.mode = 3;
                        break;

                    case "console":
                        options.mode = 0;
                        break;

                    case "cocoa":
                        options.mode = 2;
                        break;

                    default:
                        try {
                            options.mode = Int32.Parse(value);
                        } catch {
                            Console.Error.WriteLine("Could not recognize option {0} as the mode", value);
                        }
                        break;
                    }
                    break;

                case "-h":
                case "-help":
                    Usage();
                    break;

                default:
                    options.assembly = key;
                    break;
                }
            }

            options.resource = (string [])resources.ToArray(typeof(string));
            Pack pack = new Pack(options);

            if (pack.Generate())
            {
                return(0);
            }
            return(-1);
        }