private string ScriptPropertyValuesToString(VirtualMachineAdapter.ScriptProperty prop) { if (!prop.IsSet) { return("(not assigned)"); } else if (!prop.IsArray) { return(SingleScriptPropertyValueToString(prop.GetValues().First())); } else { return(string.Format("[ {0} ]", string.Join(",", prop.GetValues().Select(v => SingleScriptPropertyValueToString(v))))); } }
public IScript AddProperty(string name, Types type) { EnsureWritable(); if (Field.Properties.Any(p => p.Name.Equals(name, StringComparison.OrdinalIgnoreCase))) { throw new InvalidOperationException("Property '" + name + "' has been already added."); } var prop = new VirtualMachineAdapter.ScriptProperty() { Name = name, Type = type.ToScriptPropertType() }; Field.Properties.Add(prop); return(this); }