//-------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------- public static FullPropertyDescription operator +(FullPropertyDescription fullPropertyDescription, ArkCmdArgumentsDescAttribute cmdArgs) { var args = fullPropertyDescription.Parameters.ToList(); args.Add(cmdArgs.Parameters.ToList()); var report = new FullPropertyDescription( fullName: fullPropertyDescription.FullName, shortName: fullPropertyDescription.ShortName, isRequire: fullPropertyDescription.IsRequire, propertyInfo: fullPropertyDescription.PropertyInfo, parameters: args); return(report); }
//-------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------- private ParserResult <TTargetClass> CreateTableContent(string[] arguments) { var instance = new TTargetClass(); var exceptions = new List <Exception>(); //TODO multi Exceptions not solely single. foreach (var property in typeof(TTargetClass).GetProperties()) { var cmdDescription = property.GetCustomAttributes <ArkCmdDescAttribute>().Single(); //TODO try { var propertyDescription = new FullPropertyDescription(cmdDescription, propertyInfo: property); _tableContent.Add(cmdDescription.FullName, propertyDescription); if (string.IsNullOrEmpty(cmdDescription.ShortName) == false) { _tableContent.Add(cmdDescription.ShortName, propertyDescription); } } catch (ArgumentException argumentException) { exceptions.Add(new PropertyNameDuplicationException("stam")); continue; } catch (Exception exception) { exceptions.Add(exception); continue; } foreach (var cmdArgs in property.GetCustomAttributes <ArkCmdArgumentsDescAttribute>()) { _tableContent[cmdDescription.FullName] += cmdArgs; } } return(new ParserResult <TTargetClass>(isSucceeded: !exceptions.Any(), exceptions: exceptions.ToArray(), targetClass: instance)); }