public static void ParseArgs(ref string[] argv) { GLib.Argv a = new GLib.Argv(argv, true); IntPtr buf = a.Handle; int argc = argv.Length + 1; gdk_parse_args(ref argc, ref buf); argv = a.GetArgs(argc); }
public static bool InitCheck(ref string[] argv) { GLib.Argv a = new GLib.Argv (argv, true); IntPtr buf = a.Handle; int argc = argv.Length + 1; bool result = gdk_init_check (ref argc, ref buf); argv = a.GetArgs (argc); return result; }
public static bool InitCheck(ref string[] argv) { GLib.Argv a = new GLib.Argv(argv, true); IntPtr buf = a.Handle; int argc = argv.Length + 1; bool result = gdk_init_check(ref argc, ref buf); argv = a.GetArgs(argc); return(result); }
private static void FullInit(string progname, ref string [] args, bool check) { string [] progargs = new string[args.Length + 1]; progargs[0] = progname; args.CopyTo(progargs, 1); GLib.Argv argv = new GLib.Argv(progargs); IntPtr argv_ptr = argv.Handle; int argc = progargs.Length; if (check) { IntPtr error_ptr; bool result = gst_init_check(ref argc, ref argv_ptr, out error_ptr); if (error_ptr != IntPtr.Zero) { throw new GLib.GException(error_ptr); } else if (!result) { throw new ApplicationException("gst_init_check() failed: Reason unknown"); } } else { gst_init(ref argc, ref argv_ptr); } if (argv_ptr != argv.Handle) { string init_call = check ? "gst_init_check()" : "gst_init()"; throw new ApplicationException(init_call + " returned a new argv handle"); } gst_controller_init(ref argc, ref argv_ptr); gst_pb_utils_init(); if (argc <= 1) { args = new string[0]; } else { progargs = argv.GetArgs(argc); args = new string[argc - 1]; System.Array.Copy(progargs, 1, args, 0, argc - 1); } RegisterManagedTypes(); }
private static void FullInit(string progname, ref string [] args, bool check) { string [] progargs = new string[args.Length + 1]; progargs[0] = progname; args.CopyTo(progargs, 1); GLib.Argv argv = new GLib.Argv(progargs); IntPtr argv_ptr = argv.Handle; int argc = progargs.Length; if (check) { IntPtr error_ptr; bool result = gst_init_check(ref argc, ref argv_ptr, out error_ptr); if (error_ptr != IntPtr.Zero) { throw new ApplicationException("gst_init_check set error"); } else if (!result) { throw new ApplicationException("gst_init_check failed, error not set"); } } else { gst_init(ref argc, ref argv_ptr); } if (argv_ptr != argv.Handle) { string init_call = check ? "gst_init_check" : "gst_init"; throw new ApplicationException(init_call + " returned a new argv handle"); } if (argc <= 1) { args = new string[0]; } else { progargs = argv.GetArgs(argc); args = new string[argc - 1]; Array.Copy(progargs, 1, args, 0, argc - 1); } }
static bool do_init(string progname, ref string[] args, bool check) { SetPrgname(); bool res = false; string[] progargs = new string[args.Length + 1]; progargs[0] = progname; args.CopyTo(progargs, 1); GLib.Argv argv = new GLib.Argv(progargs); IntPtr buf = argv.Handle; int argc = progargs.Length; if (check) { res = gtk_init_check(ref argc, ref buf); } else { gtk_init(ref argc, ref buf); } if (buf != argv.Handle) { throw new Exception("init returned new argv handle"); } // copy back the resulting argv, minus argv[0], which we're // not interested in. if (argc <= 1) { args = new string[0]; } else { progargs = argv.GetArgs(argc); args = new string[argc - 1]; Array.Copy(progargs, 1, args, 0, argc - 1); } return(res); }
static bool do_init (string progname, ref string[] args, bool check) { SetPrgname (); bool res = false; string[] progargs = new string[args.Length + 1]; progargs[0] = progname; args.CopyTo (progargs, 1); GLib.Argv argv = new GLib.Argv (progargs); IntPtr buf = argv.Handle; int argc = progargs.Length; if (check) res = gtk_init_check (ref argc, ref buf); else gtk_init (ref argc, ref buf); if (buf != argv.Handle) throw new Exception ("init returned new argv handle"); // copy back the resulting argv, minus argv[0], which we're // not interested in. if (argc <= 1) args = new string[0]; else { progargs = argv.GetArgs (argc); args = new string[argc - 1]; Array.Copy (progargs, 1, args, 0, argc - 1); } return res; }
public static void ParseArgs(ref string[] argv) { GLib.Argv a = new GLib.Argv (argv, true); IntPtr buf = a.Handle; int argc = argv.Length + 1; gdk_parse_args (ref argc, ref buf); argv = a.GetArgs (argc); }
public Program(string app_id, string app_version, ModuleInfo module, string[] argv, params object[] props) : base(IntPtr.Zero) { if (app_id.IndexOf(" ") > 0) { throw new ArgumentException("app_id argument can't contain spaces."); } int nargs = props.Length / 2; PropertyArg[] args = new PropertyArg[nargs]; GLib.Value[] vals = new GLib.Value[nargs]; string[] new_argv = new string[argv.Length + 1]; g_type_init(); for (int i = 0; i < nargs; i++) { args[i].name = (string)props[i * 2]; GLib.Value value; // FIXME: handle more types object prop = props[i * 2 + 1]; Type type = prop.GetType(); if (type == "hello".GetType()) { value = new GLib.Value((string)prop); } else if (type == true.GetType()) { value = new GLib.Value((bool)prop); } else { value = GLib.Value.Empty; } vals[i] = value; args[i].value = value; } /* FIXME: Is there a way to access this in .NET? */ new_argv[0] = app_id; Array.Copy(argv, 0, new_argv, 1, argv.Length); GLib.Argv gargv = new GLib.Argv(new_argv, false); Raw = gtksharp_gnome_program_init(app_id, app_version, module.Handle, new_argv.Length, gargv.Handle, nargs, args); PersistentData["glib_argv"] = gargv; // // Dynamically reset the signal handlers, because Gnome overwrites them // Type mono_runtime_type = Type.GetType("Mono.Runtime"); if (mono_runtime_type != null) { object [] iargs = new object [0]; System.Reflection.MethodInfo mi = mono_runtime_type.GetMethod("InstallSignalHandlers", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static); mi.Invoke(null, iargs); } HardenRef(); }