/// <summary> /// Gets the implant name for the given slot and the provided set. /// </summary> /// <param name="set"></param> /// <param name="slot"></param> /// <returns></returns> private static Implant GetImplant(SerializableSettingsImplantSet set, ImplantSlots slot) { // Invoke the property getter with the matching name through reflection object implantName = typeof(SerializableSettingsImplantSet).GetProperty(slot.ToString()).GetValue(set, null); return(StaticItems.GetImplants(slot)[(string)implantName]); }
/// <summary> /// Sets the implant name for the given slot and the provided set. /// </summary> /// <param name="set"></param> /// <param name="slot"></param> /// <param name="implant"></param> /// <returns></returns> private static void SetImplant(SerializableSettingsImplantSet set, ImplantSlots slot, Implant implant) { // Set may be null when the user is editing the phantom line if (set == null) { return; } // Invoke the property setter with the matching name through reflection typeof(SerializableSettingsImplantSet).GetProperty(slot.ToString()).SetValue(set, implant.Name, null); }
/// <summary> /// Sets the implant name for the given slot and the provided set. /// </summary> /// <param name="set"></param> /// <param name="slot"></param> /// <param name="implantName"></param> /// <returns></returns> private void SetImplant(SerializableSettingsImplantSet set, ImplantSlots slot, Implant implant) { // Set may be null when the user is editing the phantom line if (set == null) return; // Invoke the property setter with the matching name through reflection typeof(SerializableSettingsImplantSet).GetProperty(slot.ToString()).SetValue(set, implant.Name, null); }
/// <summary> /// Gets the implant name for the given slot and the provided set. /// </summary> /// <param name="set"></param> /// <param name="slot"></param> /// <returns></returns> private Implant GetImplant(SerializableSettingsImplantSet set, ImplantSlots slot) { // Invoke the property getter with the matching name through reflection var implantName = typeof(SerializableSettingsImplantSet).GetProperty(slot.ToString()).GetValue(set, null); return StaticItems.GetImplants(slot)[(string)implantName] as Implant; }