private static FieldInfo[] GetSaveableFields <T>(T Input) where T : Panel { List <FieldInfo> WorkingTable = new List <FieldInfo>(); FieldInfo[] fields = Input.GetType().GetFields(); foreach (FieldInfo FInfo in fields) { object[] FInfoAttribs = FInfo.GetCustomAttributes(typeof(PackerAttrib), true); // Add if PackerAttrib is assigned bool ShouldContinue = false; foreach (PackerAttrib a in FInfoAttribs) { if (a.ShouldIgnore) { ShouldContinue = true; } } if (ShouldContinue) { continue; } object[] FInfoAttribs_CA = FInfo.GetCustomAttributes(typeof(CategoryAttribute), true); // Add if CategoryAttribute is assigned if (!FInfoAttribs.Any() && !FInfoAttribs_CA.Any()) { continue; } WorkingTable.Add(FInfo); } return(WorkingTable.ToArray()); }
private static PropertyInfo[] GetSaveableProperties <T>(T Input) where T : Panel { List <PropertyInfo> WorkingTable = new List <PropertyInfo>(); PropertyInfo[] fields = Input.GetType().GetProperties(); foreach (PropertyInfo FInfo in fields) { if (FInfo.GetSetMethod() == null) { continue; } if (FInfo.Name == "X" || FInfo.Name == "Y") { continue; } object[] FInfoAttribs = FInfo.GetCustomAttributes(typeof(PackerAttrib), true); // Add if PackerAttrib is assigned bool ShouldContinue = false; foreach (PackerAttrib a in FInfoAttribs) { if (a.ShouldIgnore == true) { ShouldContinue = true; } } if (ShouldContinue) { continue; } object[] FInfoAttribs_CA = FInfo.GetCustomAttributes(typeof(CategoryAttribute), true); // Add if CategoryAttribute is assigned object[] FInfoAttribs_ED = FInfo.GetCustomAttributes(typeof(EditorAttribute), true); if (!FInfoAttribs.Any() && !FInfoAttribs_CA.Any() && !FInfoAttribs_ED.Any()) { continue; } WorkingTable.Add(FInfo); } return(WorkingTable.ToArray()); }