using System.Collections.Generic; using System.Linq; using InABox.Core; using PRSClasses; namespace PRSServer { public abstract class ServerProperties : BaseObject { [TextBoxEditor] [Caption("Service Account Username")] public string Username { get; set; } public ServerProperties() { Name = CoreUtils.Neatify(Type().ToString()); } [TextBoxEditor] [EditorSequence(-1)] public string Name { get; set; } public abstract ServerType Type(); public List CommandLineOptions(params string[] extras) { var options = new List(); var props = CoreUtils.PropertyList( GetType(), x => x.GetEditor() != null && (x.DeclaringType == typeof(ServerProperties) || x.DeclaringType.IsSubclassOf(typeof(ServerProperties)) ) ).OrderBy(x => x.GetSequence()); foreach (var prop in props) options.Add( string.Format( "/{0}={1}{2}{1}", prop.Name, prop.PropertyType == typeof(string) ? "\"" : "", prop.GetValue(this) ) ); foreach (var extra in extras) options.Add(extra); return options; } } }