public static void CheckAllowedType(QuestType questType) { if (!AllowedTypes.Contains(questType)) { AllowedTypes.Add(questType); // if (AllowedTypes.Count == 1) { // foreach (NetworkUser networkUser in NetworkUser.readOnlyInstancesList) { // Questing.Announcement announcement = new Questing.Announcement(""); // Networking.SendAnnouncement(announcement, networkUser.connectionToClient.connectionId); // } // } timeoutStart = Run.instance.GetRunStopwatch(); } }
public bool CanHaveStatefulFields(Control control) { if (control is LiteralControl) //quickly removed the LiteralControls { return(false); } if (control is UserControl || control is Page) { if (control is IStatefulFieldsControl) { if (((IStatefulFieldsControl)control).IgnoreStatefulFields) { return(false); } } return(Attribute.GetCustomAttribute(control.GetType(), typeof(IgnoreStatefulFields)) == null); } Type t = control.GetType(); LogFactory.Log.Debug("inspecting " + t + control.ID + "(" + control.UniqueID + ")"); if (AllowedTypes.Contains(t)) { return(true); } if (FilteredTypes.Contains(t)) { return(false); } foreach (Type ft in FilteredBaseTypes) { if (t.IsSubclassOf(ft)) { FilteredTypes.Add(t); return(false); } } //this line took too much resources: //return Attribute.GetCustomAttribute(control.GetType(), typeof (HasStatefulField)) != null; return(true); }
public void SetValue <T>(T value) { object objValue = value; if (objValue != null && AllowedTypes != null) { Type type = typeof(T); if (type == typeof(BoostVariant)) { BoostVariant boostVariant = (BoostVariant)objValue; type = boostVariant.Type; objValue = boostVariant.Value; } if (type != null && !AllowedTypes.Contains(type)) { throw new ArgumentException(String.Format("This type is not allowed: {0}", type)); } } data = objValue; }
private static bool IsAllowedType(this Type t) { return(AllowedTypes.Contains(t)); }