protected internal static GType LookupGType(System.Type t) { GType gtype = (GType)t; if (gtype.ToString() != "GtkSharpValue") { return(gtype); } return(RegisterGType(t)); }
void InitForProperty (GType gtype, string name) { IntPtr p_name = Marshaller.StringToPtrGStrdup (name); IntPtr spec_ptr = g_object_class_find_property (gtype.GetClassPtr (), p_name); Marshaller.Free (p_name); if (spec_ptr == IntPtr.Zero) throw new Exception (String.Format ("No property with name '{0}' in type '{1}'", name, gtype.ToString())); ParamSpec spec = new ParamSpec (spec_ptr); g_value_init (ref this, spec.ValueType.Val); }
protected override bool ExecuteParent(ArraySegment <string> arguments, ICommandSender sender, out string response) { EventHandlers.LogCommandUsed((CommandSender)sender, EventHandlers.FormatArguments(arguments, 0)); if (!((CommandSender)sender).CheckPermission("at.grenade")) { response = "You do not have permission to use this command"; return(false); } if (arguments.Count < 2 || arguments.Count > 3) { response = "Usage: grenade ((player id / name) or (all / *)) (GrenadeType) (grenade time)"; return(false); } switch (arguments.At(0)) { case "*": case "all": if (!Enum.TryParse(arguments.At(1), true, out GrenadeType GType)) { response = $"Invalid value for grenade name: {arguments.At(1)}"; return(false); } if (GType == GrenadeType.Scp018) { Cassie.Message("pitch_1.5 xmas_bouncyballs", true, false); foreach (Player Pl in Player.List) { if (Pl.Role == RoleType.Spectator || Pl.Role == RoleType.None) { continue; } EventHandlers.SpawnGrenadeOnPlayer(Pl, GType, 0); } } else { if (arguments.Count != 3) { response = "Usage: grenade ((player id / name) or (all / *)) (GrenadeType) (grenade time)"; return(false); } if (!float.TryParse(arguments.At(2), out float Time)) { response = $"Invalid value for grenade timer: {arguments.At(2)}"; return(false); } foreach (Player Pl in Player.List) { if (Pl.Role == RoleType.Spectator || Pl.Role == RoleType.None) { continue; } EventHandlers.SpawnGrenadeOnPlayer(Pl, GType, Time); } } response = $"You spawned a {GType.ToString().ToLower()} on everyone"; return(true); default: Player Ply = Player.Get(arguments.At(0)); if (Ply == null) { response = $"Player not found: {arguments.At(0)}"; return(false); } else if (Ply.Role == RoleType.Spectator || Ply.Role == RoleType.None) { response = $"Player {Ply.Nickname} is not a valid class to spawn a grenade on"; return(false); } if (!Enum.TryParse(arguments.At(1), true, out GrenadeType Type)) { response = $"Invalid value for grenade name: {arguments.At(1)}"; return(false); } if (Type == GrenadeType.Scp018) { EventHandlers.SpawnGrenadeOnPlayer(Ply, Type, 0); } else { if (arguments.Count != 3) { response = "Usage: grenade ((player id / name) or (all / *)) (GrenadeType) (grenade time)"; return(false); } if (!float.TryParse(arguments.At(2), out float Time)) { response = $"Invalid value for grenade timer: {arguments.At(2)}"; return(false); } EventHandlers.SpawnGrenadeOnPlayer(Ply, Type, Time); } response = $"You spawned a {Type.ToString().ToLower()} on {Ply.Nickname}"; return(true); } }