public override string ToString() { var sb = new StringBuilder(); sb.Append("ќб¤з¤тельные параметры: "); RequiredParameters.ForEach(x => sb.Append($"{x.ToString().ToLower()}; ")); return(sb.ToString()); }
/// <summary> /// Function to initialize the effect. /// </summary> /// <param name="parameters">The parameters used to initialize the effect.</param> internal void InitializeEffect(GorgonEffectParameter[] parameters) { // Check its required parameters. if ((RequiredParameters.Count > 0) && ((parameters == null) || (parameters.Length == 0))) { throw new ArgumentException(string.Format(Resources.GORGFX_EFFECT_MISSING_REQUIRED_PARAMS, RequiredParameters[0]), "parameters"); } if ((parameters != null) && (parameters.Length > 0)) { // Only get parameters where the key name has a value. var validParameters = parameters.Where(item => !string.IsNullOrWhiteSpace(item.Name)).ToArray(); // Check for predefined required parameters from the effect. var missingParams = RequiredParameters.Where( effectParam => (!validParameters.Any( item => string.Equals(item.Name, effectParam, StringComparison.OrdinalIgnoreCase)))); StringBuilder missingList = null; foreach (var effectParam in missingParams) { if (missingList == null) { missingList = new StringBuilder(128); } if (missingList.Length > 0) { missingList.Append("\n"); } missingList.AppendFormat("'{0}'", effectParam); } if ((missingList != null) && (missingList.Length > 0)) { throw new ArgumentException(string.Format(Resources.GORGFX_EFFECT_MISSING_REQUIRED_PARAMS, missingList), "parameters"); } // Add/update the parameters. foreach (var param in validParameters) { Parameters[param.Name] = param.Value; } } OnInitialize(); }
private TreeNode CreateTreeNode(ContractParameter param, RequiredParameters requiredField) { if (param.Type.Equals(ContractParameterType.Array)) { return(new TreeNode(Strings.InvokeContractParamArray, new TreeNode[] { AddParamNodeToTreeView() }) { Name = Strings.InvokeContractParamArray, Tag = new object[] { requiredField, param } }); } return(new TreeNode($"{param.Type.ToString()}={GetValueString(GetParameterValueDisplayValue(param.Type, param.Value))}") { Tag = new object[] { requiredField, param }, Name = param.Type.ToString() }); }
/// <summary> /// Initializes a new instance of the <see cref="Gorgon2DEffect"/> class. /// </summary> /// <param name="graphics">The graphics interface that owns this effect.</param> /// <param name="name">The name of the effect.</param> /// <param name="passCount">The number of passes..</param> protected Gorgon2DEffect(GorgonGraphics graphics, string name, int passCount) : base(graphics, name, passCount) { RequiredParameters.Add("Gorgon2D"); }